diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index ad332b06f8..fb110eca47 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -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 ) diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index b2c50f989c..8dcba36518 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -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(); } diff --git a/include/draw_frame.h b/include/draw_frame.h index 33560c390b..d787a4f52e 100644 --- a/include/draw_frame.h +++ b/include/draw_frame.h @@ -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; } diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 6d540dd9f7..7e1ac35cc2 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -340,7 +340,10 @@ public: * Function SetGridColor() , virtual * @param aColor = the new color of the grid */ - virtual void SetGridColor(EDA_COLOR_T aColor); + virtual void SetGridColor( EDA_COLOR_T aColor ); + + ///> @copydoc EDA_DRAW_FRAME::SetCursorShape() + virtual void SetCursorShape( int aCursorShape ); // Configurations: void Process_Config( wxCommandEvent& event ); diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 2406a9ee13..239f09e3d9 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -40,12 +40,7 @@ #include #include #include - #include -#include -#include -#include -#include 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 ); - } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 7c3d6e558e..8107d30c9b 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -77,6 +77,7 @@ #endif #include +#include #include // Keys used in read/write config @@ -820,12 +821,25 @@ EDA_COLOR_T PCB_EDIT_FRAME::GetGridColor() const } -void PCB_EDIT_FRAME::SetGridColor(EDA_COLOR_T aColor) +void PCB_EDIT_FRAME::SetGridColor( EDA_COLOR_T aColor ) { GetBoard()->SetVisibleElementColor( GRID_VISIBLE, 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( );