diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index dc173428d6..07a36572c8 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -312,6 +312,10 @@ TOOL_ACTION ACTIONS::togglePolarCoords( "common.Control.togglePolarCoords", _( "Polar Coordinates" ), _( "Switch between polar and cartesian coordinate systems" ), polar_coord_xpm ); +TOOL_ACTION ACTIONS::resetLocalCoords( "common.Control.resetLocalCoords", + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ), + "", "" ); + TOOL_ACTION ACTIONS::toggleCursor( "common.Control.toggleCursor", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_TOGGLE_CURSOR ), _( "Always Show Cursor" ), _( "Display crosshairs even in selection tool" ), diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 35e81b6079..57753382be 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -462,6 +462,21 @@ int COMMON_TOOLS::TogglePolarCoords( const TOOL_EVENT& aEvent ) } +int COMMON_TOOLS::ResetLocalCoords( const TOOL_EVENT& aEvent ) +{ + auto vcSettings = m_toolMgr->GetCurrentToolVC(); + + // Use either the active tool forced cursor position or the general settings + VECTOR2I cursorPos = vcSettings.m_forceCursorPosition ? vcSettings.m_forcedPosition : + getViewControls()->GetCursorPosition(); + + m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y ); + m_frame->UpdateStatusBar(); + + return 0; +} + + int COMMON_TOOLS::ToggleCursor( const TOOL_EVENT& aEvent ) { auto& galOpts = m_frame->GetGalDisplayOptions(); @@ -540,6 +555,7 @@ void COMMON_TOOLS::setTransitions() Go( &COMMON_TOOLS::MetricUnits, ACTIONS::metricUnits.MakeEvent() ); Go( &COMMON_TOOLS::ToggleUnits, ACTIONS::toggleUnits.MakeEvent() ); Go( &COMMON_TOOLS::TogglePolarCoords, ACTIONS::togglePolarCoords.MakeEvent() ); + Go( &COMMON_TOOLS::ResetLocalCoords, ACTIONS::resetLocalCoords.MakeEvent() ); Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() ); Go( &COMMON_TOOLS::ToggleCursorStyle, ACTIONS::toggleCursorStyle.MakeEvent() ); diff --git a/cvpcb/tools/cvpcb_actions.h b/cvpcb/tools/cvpcb_actions.h index a6df7ae1c9..267eb4650f 100644 --- a/cvpcb/tools/cvpcb_actions.h +++ b/cvpcb/tools/cvpcb_actions.h @@ -52,7 +52,6 @@ public: // Miscellaneous static TOOL_ACTION zoomTool; - static TOOL_ACTION resetCoords; static TOOL_ACTION switchCursor; static TOOL_ACTION switchUnits; static TOOL_ACTION showHelp; diff --git a/cvpcb/tools/cvpcb_control.cpp b/cvpcb/tools/cvpcb_control.cpp index 73b5d8a32c..f2642281a3 100644 --- a/cvpcb/tools/cvpcb_control.cpp +++ b/cvpcb/tools/cvpcb_control.cpp @@ -44,10 +44,6 @@ using namespace std::placeholders; // Miscellaneous -TOOL_ACTION CVPCB_ACTIONS::resetCoords( "cvpcb.Control.resetCoords", - AS_GLOBAL, ' ',//TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ), - "", "" ); - TOOL_ACTION CVPCB_ACTIONS::switchCursor( "cvpcb.Control.switchCursor", AS_GLOBAL, 0, "", "" ); @@ -80,21 +76,6 @@ void CVPCB_CONTROL::Reset( RESET_REASON aReason ) // Miscellaneous -int CVPCB_CONTROL::ResetCoords( const TOOL_EVENT& aEvent ) -{ - auto vcSettings = m_toolMgr->GetCurrentToolVC(); - - // Use either the active tool forced cursor position or the general settings - VECTOR2I cursorPos = vcSettings.m_forceCursorPosition ? vcSettings.m_forcedPosition : - getViewControls()->GetCursorPosition(); - - m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y ); - m_frame->UpdateStatusBar(); - - return 0; -} - - int CVPCB_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent ) { auto& galOpts = m_frame->GetGalDisplayOptions(); @@ -116,7 +97,6 @@ int CVPCB_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent ) void CVPCB_CONTROL::setTransitions() { // Miscellaneous - Go( &CVPCB_CONTROL::ResetCoords, CVPCB_ACTIONS::resetCoords.MakeEvent() ); Go( &CVPCB_CONTROL::SwitchCursor, CVPCB_ACTIONS::switchCursor.MakeEvent() ); Go( &CVPCB_CONTROL::SwitchUnits, CVPCB_ACTIONS::switchUnits.MakeEvent() ); } diff --git a/cvpcb/tools/cvpcb_control.h b/cvpcb/tools/cvpcb_control.h index 2143b1ceaa..ec72b2440a 100644 --- a/cvpcb/tools/cvpcb_control.h +++ b/cvpcb/tools/cvpcb_control.h @@ -49,7 +49,6 @@ public: void Reset( RESET_REASON aReason ) override; // Miscellaneous - int ResetCoords( const TOOL_EVENT& aEvent ); int SwitchCursor( const TOOL_EVENT& aEvent ); int SwitchUnits( const TOOL_EVENT& aEvent ); diff --git a/cvpcb/tools/cvpcb_selection_tool.cpp b/cvpcb/tools/cvpcb_selection_tool.cpp index 9ccab4470b..5f05fcf1ef 100644 --- a/cvpcb/tools/cvpcb_selection_tool.cpp +++ b/cvpcb/tools/cvpcb_selection_tool.cpp @@ -115,6 +115,9 @@ int CVPCB_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { m_menu.CloseContextMenu( evt ); } + + else + m_toolMgr->PassEvent(); } // This tool is supposed to be active forever diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 34355d73d1..84a724acb5 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -453,6 +453,9 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { m_menu.CloseContextMenu( evt ); } + + else + m_toolMgr->PassEvent(); } // This tool is supposed to be active forever diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index 4f44400ce8..d2cc5ca66b 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -58,37 +58,36 @@ // local variables // Hotkey list: -static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); -static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); -static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); -static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); -static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); -static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), - HK_ZOOM_SELECTION, GR_KB_CTRL + WXK_F5 ); -static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), - HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES ); -static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 ); -static EDA_HOTKEY HkSwitchUnits( _HKI( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); -static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), - HK_RESET_LOCAL_COORD, ' ' ); -static EDA_HOTKEY HkSwitchHighContrastMode( _HKI( "Toggle High Contrast Mode" ), - HK_SWITCH_HIGHCONTRAST_MODE, 'H' + GR_KB_CTRL ); +static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); +static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); +static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); +static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); +static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); +static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), + HK_ZOOM_SELECTION, GR_KB_CTRL + WXK_F5 ); +static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), + HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES ); +static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 ); +static EDA_HOTKEY HkSwitchUnits( _HKI( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); +static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); +static EDA_HOTKEY HkSwitchHighContrastMode( _HKI( "Toggle High Contrast Mode" ), + HK_SWITCH_HIGHCONTRAST_MODE, 'H' + GR_KB_CTRL ); -static EDA_HOTKEY HkLinesDisplayMode( _HKI( "Gbr Lines Display Mode" ), - HK_GBR_LINES_DISPLAY_MODE, 'L' ); -static EDA_HOTKEY HkFlashedDisplayMode( _HKI( "Gbr Flashed Display Mode" ), +static EDA_HOTKEY HkLinesDisplayMode( _HKI( "Gbr Lines Display Mode" ), + HK_GBR_LINES_DISPLAY_MODE, 'L' ); +static EDA_HOTKEY HkFlashedDisplayMode( _HKI( "Gbr Flashed Display Mode" ), HK_GBR_FLASHED_DISPLAY_MODE, 'F' ); -static EDA_HOTKEY HkPolygonDisplayMode( _HKI( "Gbr Polygons Display Mode" ), - HK_GBR_POLYGON_DISPLAY_MODE, 'P' ); -static EDA_HOTKEY HkNegativeObjDisplayMode( _HKI( "Gbr Negative Obj Display Mode" ), - HK_GBR_NEGATIVE_DISPLAY_ONOFF, 'N' ); -static EDA_HOTKEY HkDCodesDisplayMode( _HKI( "DCodes Display Mode" ), - HK_GBR_DCODE_DISPLAY_ONOFF, 'D' ); +static EDA_HOTKEY HkPolygonDisplayMode( _HKI( "Gbr Polygons Display Mode" ), + HK_GBR_POLYGON_DISPLAY_MODE, 'P' ); +static EDA_HOTKEY HkNegativeObjDisplayMode( _HKI( "Gbr Negative Obj Display Mode" ), + HK_GBR_NEGATIVE_DISPLAY_ONOFF, 'N' ); +static EDA_HOTKEY HkDCodesDisplayMode( _HKI( "DCodes Display Mode" ), + HK_GBR_DCODE_DISPLAY_ONOFF, 'D' ); -static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ), - HK_SWITCH_LAYER_TO_NEXT, '+' ); -static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ), - HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); +static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ), + HK_SWITCH_LAYER_TO_NEXT, '+' ); +static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ), + HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); static EDA_HOTKEY HkCanvasDefault( _HKI( "Switch to Legacy Toolset" ), HK_CANVAS_LEGACY, diff --git a/gerbview/tools/gerbview_actions.h b/gerbview/tools/gerbview_actions.h index e53b39fe54..889cc415b1 100644 --- a/gerbview/tools/gerbview_actions.h +++ b/gerbview/tools/gerbview_actions.h @@ -77,7 +77,6 @@ public: // Miscellaneous static TOOL_ACTION selectionTool; static TOOL_ACTION zoomTool; - static TOOL_ACTION resetCoords; static TOOL_ACTION showHelp; // Highlighting diff --git a/gerbview/tools/gerbview_control.cpp b/gerbview/tools/gerbview_control.cpp index d72b8596c4..e6364e5dd8 100644 --- a/gerbview/tools/gerbview_control.cpp +++ b/gerbview/tools/gerbview_control.cpp @@ -92,10 +92,6 @@ TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( "gerbview.Control.dcodeDisplay", _( "Show DCodes" ), _( "Show dcode number" ), show_dcodenumber_xpm ); -TOOL_ACTION GERBVIEW_ACTIONS::resetCoords( "gerbview.Control.resetCoords", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ), - "", "" ); - TOOL_ACTION GERBVIEW_ACTIONS::showHelp( "gerbview.Control.showHelp", AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ), "", "" ); @@ -229,17 +225,6 @@ int GERBVIEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent ) } -int GERBVIEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent ) -{ - VECTOR2I cursorPos = getViewControls()->GetCursorPosition(); - - m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y ); - m_frame->UpdateStatusBar(); - - return 0; -} - - int GERBVIEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent ) { m_frame->ChangeUserUnits( m_frame->GetUserUnits() == INCHES ? MILLIMETRES : INCHES ); @@ -271,6 +256,5 @@ void GERBVIEW_CONTROL::setTransitions() Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::negativeObjectDisplay.MakeEvent() ); Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::dcodeDisplay.MakeEvent() ); - Go( &GERBVIEW_CONTROL::ResetCoords, GERBVIEW_ACTIONS::resetCoords.MakeEvent() ); Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() ); } diff --git a/gerbview/tools/gerbview_control.h b/gerbview/tools/gerbview_control.h index a34e65168a..697654d6e6 100644 --- a/gerbview/tools/gerbview_control.h +++ b/gerbview/tools/gerbview_control.h @@ -57,7 +57,6 @@ public: int HighlightControl( const TOOL_EVENT& aEvent ); // Miscellaneous - int ResetCoords( const TOOL_EVENT& aEvent ); int SwitchUnits( const TOOL_EVENT& aEvent ); int ShowHelp( const TOOL_EVENT& aEvent ); diff --git a/gerbview/tools/gerbview_selection_tool.cpp b/gerbview/tools/gerbview_selection_tool.cpp index e490617ec8..e018f23c54 100644 --- a/gerbview/tools/gerbview_selection_tool.cpp +++ b/gerbview/tools/gerbview_selection_tool.cpp @@ -261,6 +261,9 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { m_menu.CloseContextMenu( evt ); } + + else + m_toolMgr->PassEvent(); } // This tool is supposed to be active forever diff --git a/include/tool/actions.h b/include/tool/actions.h index 0aec26e642..e5c061d2e5 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -129,6 +129,7 @@ public: static TOOL_ACTION metricUnits; static TOOL_ACTION toggleUnits; static TOOL_ACTION togglePolarCoords; + static TOOL_ACTION resetLocalCoords; // Misc static TOOL_ACTION acceleratedGraphics; diff --git a/include/tool/common_tools.h b/include/tool/common_tools.h index 750e23adca..5d863ee366 100644 --- a/include/tool/common_tools.h +++ b/include/tool/common_tools.h @@ -70,6 +70,7 @@ public: int MetricUnits( const TOOL_EVENT& aEvent ); int ToggleUnits( const TOOL_EVENT& aEvent ); int TogglePolarCoords( const TOOL_EVENT& aEvent ); + int ResetLocalCoords( const TOOL_EVENT& aEvent ); // Grid control int GridNext( const TOOL_EVENT& aEvent ); diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h index 84cbbc1ba6..48f7e089b8 100644 --- a/include/tool/tool_event.h +++ b/include/tool/tool_event.h @@ -636,9 +636,8 @@ namespace TOOL_EVT_UTILS /** * Function IsCancelInteractive() * - * @return true if this event should restart/end an ongoing interactive - * tool's event loop (eg esc key, click cancel, start different - * tool) + * Indicates the event should restart/end an ongoing interactive tool's + * event loop (eg esc key, click cancel, start different tool) */ bool IsCancelInteractive( const TOOL_EVENT& aEvt ); diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp index d300c8a302..be98ce9bec 100644 --- a/pagelayout_editor/tools/pl_selection_tool.cpp +++ b/pagelayout_editor/tools/pl_selection_tool.cpp @@ -220,6 +220,9 @@ int PL_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { m_menu.CloseContextMenu( evt ); } + + else + m_toolMgr->PassEvent(); } // This tool is supposed to be active forever diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index e311891360..64f8aa67e6 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1144,7 +1144,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, OPTUpdate( &preview ); frame()->SetMsgPanel( aGraphic ); } - else if( evt->IsAction( &PCB_ACTIONS::resetCoords ) ) + else if( evt->IsAction( &ACTIONS::resetLocalCoords ) ) { IsOCurseurSet = true; } diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index b6984b1dc9..b694c5c639 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -302,7 +302,6 @@ public: // Miscellaneous static TOOL_ACTION selectionTool; static TOOL_ACTION pickerTool; - static TOOL_ACTION resetCoords; static TOOL_ACTION measureTool; static TOOL_ACTION updateUnits; static TOOL_ACTION deleteTool; diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 50c475aca3..c33110caf7 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -197,10 +197,6 @@ TOOL_ACTION PCB_ACTIONS::selectionTool( "pcbnew.Control.selectionTool", _( "Select item(s)" ), "", cursor_xpm, AF_ACTIVATE ); -TOOL_ACTION PCB_ACTIONS::resetCoords( "pcbnew.Control.resetCoords", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ), - "", "" ); - TOOL_ACTION PCB_ACTIONS::deleteTool( "pcbnew.Control.deleteTool", AS_GLOBAL, 0, _( "Delete Items Tool" ), _( "Click on items to delete them" ), @@ -627,21 +623,6 @@ int PCBNEW_CONTROL::GridResetOrigin( const TOOL_EVENT& aEvent ) // Miscellaneous -int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent ) -{ - auto vcSettings = m_toolMgr->GetCurrentToolVC(); - - // Use either the active tool forced cursor position or the general settings - VECTOR2I cursorPos = vcSettings.m_forceCursorPosition ? vcSettings.m_forcedPosition : - getViewControls()->GetCursorPosition(); - - m_frame->GetScreen()->m_O_Curseur = wxPoint( cursorPos.x, cursorPos.y ); - m_frame->UpdateStatusBar(); - - return 0; -} - - static bool deleteItem( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) { SELECTION_TOOL* selectionTool = aToolMgr->GetTool(); @@ -1057,7 +1038,6 @@ void PCBNEW_CONTROL::setTransitions() Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() ); // Miscellaneous - Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() ); Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteTool.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 20d2a7dd82..41404280be 100644 --- a/pcbnew/tools/pcbnew_control.h +++ b/pcbnew/tools/pcbnew_control.h @@ -91,7 +91,6 @@ public: int Redo( const TOOL_EVENT& aEvent ); // Miscellaneous - int ResetCoords( const TOOL_EVENT& aEvent ); int DeleteItemCursor( const TOOL_EVENT& aEvent ); int Paste( const TOOL_EVENT& aEvent ); int AppendBoardFromFile( const TOOL_EVENT& aEvent ); diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index b65ecfa24c..151261ceac 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -370,6 +370,9 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { m_menu.CloseContextMenu( evt ); } + + else + m_toolMgr->PassEvent(); } // This tool is supposed to be active forever