Fixed VIEW_CONTROLS too frequent reset.

This commit is contained in:
Maciej Suminski 2015-07-28 10:30:06 +02:00
parent e9921d8eea
commit c9837595ef
6 changed files with 25 additions and 15 deletions

View File

@ -285,7 +285,7 @@ void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc );
m_cursorShape = !m_cursorShape;
SetCursorShape( !GetCursorShape() );
m_canvas->CrossHairOn( &dc );
}
@ -327,9 +327,6 @@ void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
void EDA_DRAW_FRAME::OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent )
{
if( aEvent.IsChecked() != m_cursorShape && IsGalCanvasActive() )
GetToolManager()->RunAction( "pcbnew.Control.switchCursor" );
aEvent.Check( m_cursorShape );
}
@ -1064,7 +1061,6 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
// Transfer EDA_DRAW_PANEL settings
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
GetToolManager()->RunAction( "pcbnew.Control.switchCursor" );
}
else if( m_galCanvasActive )

View File

@ -637,6 +637,10 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
{
// Reset VIEW_CONTROLS only if the most recent tool is finished
if( m_activeTools.front() == aState->theTool->GetId() )
m_viewControls->Reset();
if( !aState->Pop() ) // if there are no other contexts saved on the stack
{
// find the tool and deactivate it
@ -648,7 +652,6 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
}
aState->theTool->SetTransitions();
m_viewControls->Reset();
}

View File

@ -277,7 +277,7 @@ public:
int GetCursorShape() const { return m_cursorShape; }
void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; }
virtual void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; }
bool GetShowBorderAndTitleBlock() const { return m_showBorderAndTitleBlock; }

View File

@ -342,6 +342,9 @@ public:
*/
virtual void SetGridColor( EDA_COLOR_T aColor );
///> @copydoc EDA_DRAW_FRAME::SetCursorShape()
virtual void SetCursorShape( int aCursorShape );
// Configurations:
void Process_Config( wxCommandEvent& event );

View File

@ -40,12 +40,7 @@
#include <pcbnew_id.h>
#include <class_board.h>
#include <collectors.h>
#include <dialog_general_options.h>
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <pcb_painter.h>
#include <base_units.h>
DIALOG_GENERALOPTIONS::DIALOG_GENERALOPTIONS( PCB_EDIT_FRAME* parent ) :
DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( parent )
@ -98,7 +93,6 @@ void DIALOG_GENERALOPTIONS::init()
m_UseOldZoneFillingAlgo->SetValue ( g_UseOldZoneFillingAlgo );
m_DumpZonesWhenFilling->SetValue ( g_DumpZonesWhenFilling );
}

View File

@ -77,6 +77,7 @@
#endif
#include <pcb_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <boost/bind.hpp>
// Keys used in read/write config
@ -826,6 +827,19 @@ void PCB_EDIT_FRAME::SetGridColor(EDA_COLOR_T aColor)
}
void PCB_EDIT_FRAME::SetCursorShape( int aCursorShape )
{
const unsigned int BIG_CURSOR = 8000;
const unsigned int SMALL_CURSOR = 80;
EDA_DRAW_FRAME::SetCursorShape( aCursorShape );
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
if( gal )
gal->SetCursorSize( aCursorShape ? BIG_CURSOR : SMALL_CURSOR );
}
bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
{
int copperlayercnt = GetBoard()->GetCopperLayerCount( );