Move some PCBNew and GerbView actions to their COMMON equivalents.

This commit is contained in:
Jeff Young 2019-05-14 11:51:24 +01:00
parent 06d64c7883
commit eb3a201d39
6 changed files with 1 additions and 77 deletions

View File

@ -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;

View File

@ -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() );
}

View File

@ -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 )

View File

@ -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;

View File

@ -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<SELECTION_TOOL>();
@ -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() );

View File

@ -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 );