From eb3a201d39d5c6a4a8bc178cff8ac7d578717a9e Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 14 May 2019 11:51:24 +0100 Subject: [PATCH] Move some PCBNew and GerbView actions to their COMMON equivalents. --- gerbview/tools/gerbview_actions.h | 30 ----------------------- gerbview/tools/gerbview_control.cpp | 5 ---- pcbnew/tools/edit_tool.cpp | 2 +- pcbnew/tools/pcb_actions.h | 2 -- pcbnew/tools/pcbnew_control.cpp | 37 ----------------------------- pcbnew/tools/pcbnew_control.h | 2 -- 6 files changed, 1 insertion(+), 77 deletions(-) diff --git a/gerbview/tools/gerbview_actions.h b/gerbview/tools/gerbview_actions.h index dca51e69b8..e53b39fe54 100644 --- a/gerbview/tools/gerbview_actions.h +++ b/gerbview/tools/gerbview_actions.h @@ -58,24 +58,12 @@ public: static TOOL_ACTION measureTool; - // View controls - static TOOL_ACTION zoomIn; - static TOOL_ACTION zoomOut; - static TOOL_ACTION zoomInCenter; - static TOOL_ACTION zoomOutCenter; - static TOOL_ACTION zoomCenter; - static TOOL_ACTION zoomFitScreen; - static TOOL_ACTION zoomPreset; - // Display modes static TOOL_ACTION linesDisplayOutlines; static TOOL_ACTION flashedDisplayOutlines; static TOOL_ACTION polygonsDisplayOutlines; static TOOL_ACTION negativeObjectDisplay; static TOOL_ACTION dcodeDisplay; - static TOOL_ACTION highContrastMode; - static TOOL_ACTION highContrastInc; - static TOOL_ACTION highContrastDec; // Layer control static TOOL_ACTION layerPrev; @@ -86,29 +74,11 @@ public: static TOOL_ACTION layerChanged; // notification - // Grid control - static TOOL_ACTION gridFast1; - static TOOL_ACTION gridFast2; - static TOOL_ACTION gridNext; - static TOOL_ACTION gridPrev; - static TOOL_ACTION gridSetOrigin; - static TOOL_ACTION gridResetOrigin; - static TOOL_ACTION gridPreset; - - /// Cursor control - static TOOL_ACTION cursorClick; - static TOOL_ACTION cursorDblClick; - // Miscellaneous static TOOL_ACTION selectionTool; static TOOL_ACTION zoomTool; - static TOOL_ACTION panTool; - static TOOL_ACTION pickerTool; static TOOL_ACTION resetCoords; - static TOOL_ACTION switchCursor; - static TOOL_ACTION switchUnits; static TOOL_ACTION showHelp; - static TOOL_ACTION toBeDone; // Highlighting static TOOL_ACTION highlightClear; diff --git a/gerbview/tools/gerbview_control.cpp b/gerbview/tools/gerbview_control.cpp index 3e8519f8fb..cf2e9327b6 100644 --- a/gerbview/tools/gerbview_control.cpp +++ b/gerbview/tools/gerbview_control.cpp @@ -81,10 +81,6 @@ TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( "gerbview.Control.dcodeDisplay", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_DCODE_DISPLAY_ONOFF ), "", "" ); -TOOL_ACTION GERBVIEW_ACTIONS::switchUnits( "gerbview.Control.switchUnits", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ), - "", "" ); - TOOL_ACTION GERBVIEW_ACTIONS::resetCoords( "gerbview.Control.resetCoords", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ), "", "" ); @@ -265,6 +261,5 @@ void GERBVIEW_CONTROL::setTransitions() Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::dcodeDisplay.MakeEvent() ); Go( &GERBVIEW_CONTROL::ResetCoords, GERBVIEW_ACTIONS::resetCoords.MakeEvent() ); - Go( &GERBVIEW_CONTROL::SwitchUnits, GERBVIEW_ACTIONS::switchUnits.MakeEvent() ); Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() ); } diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 7e04e8d534..e210d5b6df 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -1348,7 +1348,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) view.Update( &ruler, KIGFX::GEOMETRY ); } - else if( evt->IsAction( &PCB_ACTIONS::switchUnits ) + else if( evt->IsAction( &ACTIONS::toggleUnits ) || evt->IsAction( &PCB_ACTIONS::updateUnits ) ) { if( frame()->GetUserUnits() != units ) diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index f0da291a92..f8180bea63 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -311,8 +311,6 @@ public: static TOOL_ACTION pickerTool; static TOOL_ACTION resetCoords; static TOOL_ACTION measureTool; - static TOOL_ACTION switchCursor; - static TOOL_ACTION switchUnits; static TOOL_ACTION updateUnits; static TOOL_ACTION deleteItemCursor; static TOOL_ACTION clearHighlight; diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 44b933f63c..d66e530097 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -187,14 +187,6 @@ TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ), "", "" ); -TOOL_ACTION PCB_ACTIONS::switchCursor( "pcbnew.Control.switchCursor", - AS_GLOBAL, 0, - "", "" ); - -TOOL_ACTION PCB_ACTIONS::switchUnits( "pcbnew.Control.switchUnits", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ), - "", "" ); - TOOL_ACTION PCB_ACTIONS::deleteItemCursor( "pcbnew.Control.deleteItemCursor", AS_GLOBAL, 0, "", "" ); @@ -642,33 +634,6 @@ int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent ) } -int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent ) -{ - auto& galOpts = m_frame->GetGalDisplayOptions(); - - galOpts.m_fullscreenCursor = !galOpts.m_fullscreenCursor; - galOpts.NotifyChanged(); - - return 0; -} - - -int PCBNEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent ) -{ - // TODO should not it be refactored to pcb_frame member function? - wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED ); - - if( m_frame->GetUserUnits() == INCHES ) - evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_MM ); - else - evt.SetId( ID_TB_OPTIONS_SELECT_UNIT_INCH ); - - m_frame->ProcessEvent( evt ); - - return 0; -} - - static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) { SELECTION_TOOL* selectionTool = aToolMgr->GetTool(); @@ -1047,8 +1012,6 @@ void PCBNEW_CONTROL::setTransitions() // Miscellaneous Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() ); - Go( &PCBNEW_CONTROL::SwitchCursor, PCB_ACTIONS::switchCursor.MakeEvent() ); - Go( &PCBNEW_CONTROL::SwitchUnits, PCB_ACTIONS::switchUnits.MakeEvent() ); Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteItemCursor.MakeEvent() ); Go( &PCBNEW_CONTROL::ShowHelp, PCB_ACTIONS::showHelp.MakeEvent() ); Go( &PCBNEW_CONTROL::ToBeDone, PCB_ACTIONS::toBeDone.MakeEvent() ); diff --git a/pcbnew/tools/pcbnew_control.h b/pcbnew/tools/pcbnew_control.h index e02ea8c3f8..a5f392c6d7 100644 --- a/pcbnew/tools/pcbnew_control.h +++ b/pcbnew/tools/pcbnew_control.h @@ -87,8 +87,6 @@ public: // Miscellaneous int ResetCoords( const TOOL_EVENT& aEvent ); - int SwitchCursor( const TOOL_EVENT& aEvent ); - int SwitchUnits( const TOOL_EVENT& aEvent ); int DeleteItemCursor( const TOOL_EVENT& aEvent ); int PasteItemsFromClipboard( const TOOL_EVENT& aEvent ); int AppendBoardFromFile( const TOOL_EVENT& aEvent );