From b0674b880296b2b681c1983a159149f056cd0afb Mon Sep 17 00:00:00 2001 From: Michael Kavanagh Date: Mon, 1 Apr 2019 18:18:29 +0100 Subject: [PATCH] Add Ctrl+, hotkey to preferences dialog Also change interactive router settings from Ctrl+, to Ctrl+Shift+, --- eeschema/hotkeys.cpp | 12 ++++++++++++ eeschema/libedit/menubar_libedit.cpp | 5 ++--- eeschema/menubar.cpp | 5 +++-- gerbview/hotkeys.cpp | 9 ++++++++- gerbview/menubar.cpp | 6 +++--- include/hotkeys_basic.h | 1 + kicad/menubar.cpp | 9 +++++---- pagelayout_editor/hotkeys.cpp | 8 +++++++- pagelayout_editor/menubar.cpp | 3 ++- pcbnew/hotkeys.cpp | 10 +++++++--- pcbnew/hotkeys_board_editor.cpp | 4 ++++ pcbnew/hotkeys_footprint_editor.cpp | 5 +++++ pcbnew/menubar_footprint_editor.cpp | 5 +++-- pcbnew/menubar_pcb_editor.cpp | 5 +++-- 14 files changed, 65 insertions(+), 22 deletions(-) diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index cbb2a3d5c4..725781cc87 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -116,6 +116,7 @@ static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', #endif static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 ); +static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES ); static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK, ID_POPUP_SCH_LEAVE_SHEET ); @@ -265,6 +266,7 @@ static EDA_HOTKEY* common_Hotkey_List[] = &HkUndo, &HkRedo, &HkEditCut, &HkEditCopy, &HkEditPaste, &HkHelp, + &HkPreferences, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, @@ -466,6 +468,11 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, DisplayHotkeyList( this, g_Schematic_Hotkeys_Descr ); break; + case HK_PREFERENCES: + cmd.SetId( wxID_PREFERENCES ); + GetEventHandler()->ProcessEvent( cmd ); + break; + case HK_RESET_LOCAL_COORD: // Reset the relative coord GetScreen()->m_O_Curseur = GetCrossHairPosition(); break; @@ -715,6 +722,11 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, DisplayHotkeyList( this, g_Libedit_Hotkeys_Descr ); break; + case HK_PREFERENCES: + cmd.SetId( wxID_PREFERENCES ); + GetEventHandler()->ProcessEvent( cmd ); + break; + case HK_RESET_LOCAL_COORD: // Reset the relative coord GetScreen()->m_O_Curseur = GetCrossHairPosition(); break; diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/libedit/menubar_libedit.cpp index 9de220b9eb..1a5fc2bf95 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/libedit/menubar_libedit.cpp @@ -329,9 +329,8 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() preferencesMenu->AppendSeparator(); // Default values and options - AddMenuItem( preferencesMenu, - wxID_PREFERENCES, - _( "&Preferences..." ), + text = AddHotkeyName( _( "&Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES ); + AddMenuItem( preferencesMenu, wxID_PREFERENCES, text, _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index bf75263356..7529542521 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -634,7 +634,8 @@ static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu KiBitmap( library_table_xpm ) ); // Options (Preferences on WXMAC) - AddMenuItem( aParentMenu, wxID_PREFERENCES, _( "Preferences..." ), + wxString text = AddHotkeyName( _( "&Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ); + AddMenuItem( aParentMenu, wxID_PREFERENCES, text, _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); @@ -645,7 +646,7 @@ static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu aParentMenu->AppendSeparator(); - wxString text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Eeschema_Hotkeys_Descr, + text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Eeschema_Hotkeys_Descr, HK_CANVAS_OPENGL ); AddMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL, text, _( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ), diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index 9a8ef0b0e6..dfcdf19dcc 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -65,6 +65,8 @@ 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" ), @@ -112,7 +114,7 @@ static EDA_HOTKEY HkMeasureTool( _HKI( "Measure Distance (Modern Toolset only)" // List of common hotkey descriptors EDA_HOTKEY* gerbviewHotkeyList[] = { - &HkHelp, + &HkHelp, &HkPreferences, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomSelection, &HkSwitchUnits, &HkResetLocalCoord, &HkLinesDisplayMode, &HkFlashedDisplayMode, &HkPolygonDisplayMode, @@ -175,6 +177,11 @@ bool GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit DisplayHotkeyList( this, GerbviewHotkeysDescr ); break; + case HK_PREFERENCES: + cmd.SetId( wxID_PREFERENCES ); + GetEventHandler()->ProcessEvent( cmd ); + break; + case HK_ZOOM_IN: cmd.SetId( ID_KEY_ZOOM_IN ); GetEventHandler()->ProcessEvent( cmd ); diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index a3f471598d..2c76bc3166 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -299,9 +299,9 @@ void GERBVIEW_FRAME::ReCreateMenuBar() wxMenu* configMenu = new wxMenu; // Options (Preferences on WXMAC) - AddMenuItem( configMenu, wxID_PREFERENCES, - _( "&Preferences..." ), - wxEmptyString, + text = AddHotkeyName( _( "&Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES ); + AddMenuItem( configMenu, wxID_PREFERENCES, text, + _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); // Canvas selection diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index 21e0dc5a8c..f990827cf8 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -280,6 +280,7 @@ enum common_hotkey_id_commnand { HK_ZOOM_CENTER, HK_ZOOM_AUTO, HK_ZOOM_SELECTION, + HK_PREFERENCES, HK_TOGGLE_CURSOR, HK_MEASURE_TOOL, HK_COMMON_END diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index ccb0a1c5f2..049781d317 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -151,6 +151,8 @@ static EDA_HOTKEY HkNewProject( _HKI( "New Project" ), HK_NEW, GR_KB_CTRL + 'N' static EDA_HOTKEY HkOpenProject( _HKI( "Open Project" ), HK_OPEN, GR_KB_CTRL + 'O' ); static EDA_HOTKEY HkSaveProject( _HKI( "Save Project" ), HK_SAVE, GR_KB_CTRL + 'S' ); static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 ); +static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), + HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES ); // List of hotkey descriptors EDA_HOTKEY* common_Hotkey_List[] = @@ -161,7 +163,7 @@ EDA_HOTKEY* common_Hotkey_List[] = #if 0 &HkSaveProject, #endif - &HkRefresh, &HkHelp, + &HkRefresh, &HkHelp, &HkPreferences, &HkRunEeschema, &HkRunLibedit, &HkRunPcbnew, &HkRunModedit, &HkRunGerbview, &HkRunBm2Cmp, &HkRunPcbCalc, &HkRunPleditor, @@ -350,9 +352,8 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() _( "Configure footprint library table" ), KiBitmap( library_table_xpm ) ); - AddMenuItem( preferencesMenu, - wxID_PREFERENCES, - _( "&Preferences..." ), + msg = AddHotkeyName( _( "&Preferences..." ), kicad_Manager_Hotkeys_Descr, HK_PREFERENCES ); + AddMenuItem( preferencesMenu, wxID_PREFERENCES, msg, _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp index d72221062b..81e626a9fc 100644 --- a/pagelayout_editor/hotkeys.cpp +++ b/pagelayout_editor/hotkeys.cpp @@ -99,6 +99,7 @@ static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', (int) wxID_ static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_CTRL + GR_KB_SHIFT + 'S', (int) wxID_SAVEAS ); static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', (int) wxID_PRINT ); +static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES ); // List of common hotkey descriptors EDA_HOTKEY* s_Common_Hotkey_List[] = @@ -107,7 +108,7 @@ EDA_HOTKEY* s_Common_Hotkey_List[] = &HkUndo, &HkRedo, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomSelection, &HkResetLocalCoord, - &HkHelp, + &HkHelp, &HkPreferences, &HkMouseLeftClick, &HkMouseLeftDClick, NULL @@ -256,6 +257,11 @@ bool PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, DisplayHotkeyList( this, PlEditorHotkeysDescr ); break; + case HK_PREFERENCES: + cmd.SetId( wxID_PREFERENCES ); + GetEventHandler()->ProcessEvent( cmd ); + break; + case HK_SET_GRID_ORIGIN: SetGridOrigin( GetCrossHairPosition() ); break; diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index df4f7bf278..5ca1835338 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -172,7 +172,8 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() // Menu for preferences wxMenu* preferencesMenu = new wxMenu; - AddMenuItem( preferencesMenu, wxID_PREFERENCES, _( "&Preferences..." ), + msg = AddHotkeyName( _( "&Preferences..." ), PlEditorHotkeysDescr, HK_PREFERENCES ); + AddMenuItem( preferencesMenu, wxID_PREFERENCES, msg, _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index b8d0678a59..c1c5f0ac78 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -292,7 +292,7 @@ static EDA_HOTKEY HkSelectCopper( _HKI( "Select Connected Tracks" ), HK_SEL_COPP 'I' ); static EDA_HOTKEY HkRoutingOptions( _HKI( "Routing Options" ), HK_ROUTING_OPTIONS, - ',' + GR_KB_CTRL ); + ',' + GR_KB_CTRL + GR_KB_SHIFT ); static EDA_HOTKEY HkCustomTrackWidth( _HKI( "Custom Track/Via Size" ), HK_CUSTOM_TRACK_WIDTH, 'Q' ); @@ -327,6 +327,8 @@ static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X', (int) wxID_CUT ); static EDA_HOTKEY HkEditCopy( _HKI( "Copy" ), HK_EDIT_COPY, GR_KB_CTRL + 'C', (int) wxID_COPY ); static EDA_HOTKEY HkEditPaste( _HKI( "Paste" ), HK_EDIT_PASTE, GR_KB_CTRL + 'V', (int) wxID_PASTE ); +static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), + HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES ); static EDA_HOTKEY HkToggleCursor( _HKI( "Toggle Cursor Display (Modern Toolset only)" ), HK_TOGGLE_CURSOR, 'X' + GR_KB_SHIFTCTRL ); @@ -342,8 +344,10 @@ EDA_HOTKEY* common_Hotkey_List[] = &HkNew, &HkOpen, &HkSave, &HkSaveAs, &HkPrint, &HkUndo, &HkRedo, &HkEditCut, &HkEditCopy, &HkEditPaste, - &HkHelp, &HkZoomIn, &HkZoomOut, - &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomSelection, &Hk3DViewer, + &HkHelp, &HkPreferences, + &HkZoomIn, &HkZoomOut, + &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomSelection, + &Hk3DViewer, &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin, &HkMouseLeftClick, &HkMouseLeftDClick, diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index dbda9f1ca1..7a343a43fd 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -221,6 +221,10 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit DisplayHotkeyList( this, g_Board_Editor_Hotkeys_Descr ); break; + case HK_PREFERENCES: + evt_type = wxID_PREFERENCES; + break; + case HK_ZOOM_IN: evt_type = ID_KEY_ZOOM_IN; break; diff --git a/pcbnew/hotkeys_footprint_editor.cpp b/pcbnew/hotkeys_footprint_editor.cpp index bca1de3360..65964ef2d3 100644 --- a/pcbnew/hotkeys_footprint_editor.cpp +++ b/pcbnew/hotkeys_footprint_editor.cpp @@ -88,6 +88,11 @@ bool FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos DisplayHotkeyList( this, g_Module_Editor_Hotkeys_Descr ); break; + case HK_PREFERENCES: + cmd.SetId( wxID_PREFERENCES ); + GetEventHandler()->ProcessEvent( cmd ); + break; + case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin GetScreen()->m_O_Curseur = GetCrossHairPosition(); break; diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 45d27dcd92..95bdfaf188 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -426,8 +426,9 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() KiBitmap( library_table_xpm ) ); // Settings - AddMenuItem( prefs_menu, wxID_PREFERENCES, - _( "&Preferences..." ), _( "Show preferences for all open tools" ), + text = AddHotkeyName( _( "&Preferences..." ), m_hotkeysDescrList, HK_PREFERENCES ); + AddMenuItem( prefs_menu, wxID_PREFERENCES, text, + _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); prefs_menu->AppendSeparator(); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 0d1b3d1d71..422456245e 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -153,8 +153,9 @@ void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu ) wxString text; - AddMenuItem( aParentMenu, wxID_PREFERENCES, - _( "&Preferences..." ), _( "Show preferences for all open tools" ), + text = AddHotkeyName( _( "&Preferences..." ), g_Board_Editor_Hotkeys_Descr, HK_PREFERENCES ); + AddMenuItem( aParentMenu, wxID_PREFERENCES, text, + _( "Show preferences for all open tools" ), KiBitmap( preference_xpm ) ); if( ADVANCED_CFG::GetCfg().AllowLegacyCanvas() )