From be8bb2439060107186a0c70e3c1a8c54c348f57a Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 25 Feb 2018 13:30:59 -0500 Subject: [PATCH] Make all new hotkeys editable; label some GAL-only hotkeys Fixes: lp:1751183 * https://bugs.launchpad.net/kicad/+bug/1751183 --- common/tool/common_tools.cpp | 5 ++-- gerbview/hotkeys.cpp | 4 +++ gerbview/tools/selection_tool.cpp | 2 +- include/hotkeys_basic.h | 2 ++ pcbnew/hotkeys.cpp | 41 +++++++++++++++++++++++++---- pcbnew/hotkeys.h | 11 ++++++-- pcbnew/menubar_footprint_editor.cpp | 4 +-- pcbnew/menubar_pcb_editor.cpp | 4 +-- pcbnew/router/router_tool.cpp | 8 +++--- pcbnew/tools/edit_tool.cpp | 8 +++--- pcbnew/tools/pcbnew_control.cpp | 8 +++--- 11 files changed, 71 insertions(+), 26 deletions(-) diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index 366f321077..a20c4a6674 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -29,14 +29,15 @@ #include #include #include +#include #include static TOOL_ACTION ACT_toggleCursor( "common.Control.toggleCursor", - AS_GLOBAL, MD_CTRL + MD_SHIFT + 'X', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_TOGGLE_CURSOR ), _( "Toggle Always Show Cursor" ), - _( "Toogle display of the cursor, even when not in an interactive tool" ) ); + _( "Toogle display of the cursor, even when not in an interactive tool" ) ); COMMON_TOOLS::COMMON_TOOLS() : diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index 5bb4bcb14d..73dad9e447 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -105,6 +105,9 @@ static EDA_HOTKEY HkCanvasCairo( _HKI( "Switch to Modern Toolset with software g #endif WXK_F12 ); +static EDA_HOTKEY HkMeasureTool( _HKI( "Measure Distance (Modern Toolset only)" ), + HK_MEASURE_TOOL, 'M' + GR_KB_SHIFTCTRL ); + // List of common hotkey descriptors EDA_HOTKEY* gerbviewHotkeyList[] = { &HkHelp, @@ -117,6 +120,7 @@ EDA_HOTKEY* gerbviewHotkeyList[] = { &HkCanvasDefault, &HkCanvasOpenGL, &HkCanvasCairo, + &HkMeasureTool, NULL }; diff --git a/gerbview/tools/selection_tool.cpp b/gerbview/tools/selection_tool.cpp index bc3f0f6121..9a26387a68 100644 --- a/gerbview/tools/selection_tool.cpp +++ b/gerbview/tools/selection_tool.cpp @@ -70,7 +70,7 @@ TOOL_ACTION GERBVIEW_ACTIONS::selectionClear( "gerbview.InteractiveSelection.Cle "", "" ); // No description, it is not supposed to be shown anywhere TOOL_ACTION GERBVIEW_ACTIONS::measureTool( "gerbview.InteractiveSelection.measureTool", - AS_GLOBAL, MD_CTRL + MD_SHIFT + 'M', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MEASURE_TOOL ), _( "Measure Tool" ), _( "Interactively measure distance between points" ), nullptr, AF_ACTIVATE ); diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index c395643a7c..8f15960341 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -254,6 +254,8 @@ enum common_hotkey_id_commnand { HK_ZOOM_CENTER, HK_ZOOM_AUTO, HK_ZOOM_SELECTION, + HK_TOGGLE_CURSOR, + HK_MEASURE_TOOL, HK_COMMON_END }; diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 1913c76401..b97f0805de 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -96,6 +96,16 @@ static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); static EDA_HOTKEY HkBackspace( _HKI( "Delete Track Segment" ), HK_BACK_SPACE, WXK_BACK ); static EDA_HOTKEY HkAddNewTrack( _HKI( "Add New Track" ), HK_ADD_NEW_TRACK, 'X' ); + +static EDA_HOTKEY HkRouteDiffPair( _HKI( "Route Differential Pair (Modern Toolset only)" ), + HK_ROUTE_DIFF_PAIR, '6' ); +static EDA_HOTKEY HkRouteTuneSingle( _HKI( "Tune Single Track (Modern Toolset only)" ), + HK_ROUTE_TUNE_SINGLE, '7' ); +static EDA_HOTKEY HkRouteTuneDiffPair( _HKI( "Tune Differential Pair Length (Modern Toolset only)" ), + HK_ROUTE_TUNE_DIFF_PAIR, '8' ); +static EDA_HOTKEY HkRouteTuneSkew( _HKI( "Tune Differential Pair Skew (Modern Toolset only)" ), + HK_ROUTE_TUNE_SKEW, '9' ); + static EDA_HOTKEY HkAddThroughVia( _HKI( "Add Through Via" ), HK_ADD_THROUGH_VIA, 'V' ); static EDA_HOTKEY HkSelLayerAndAddThroughVia( _HKI( "Select Layer and Add Through Via" ), HK_SEL_LAYER_AND_ADD_THROUGH_VIA, '<' ); @@ -110,6 +120,8 @@ static EDA_HOTKEY HkEditBoardItem( _HKI( "Edit Item" ), HK_EDIT_ITEM, 'E' ); static EDA_HOTKEY HkEditWithModedit( _HKI( "Edit with Footprint Editor" ), HK_EDIT_MODULE_WITH_MODEDIT, 'E' + GR_KB_CTRL ); static EDA_HOTKEY HkFlipItem( _HKI( "Flip Item" ), HK_FLIP_ITEM, 'F' ); static EDA_HOTKEY HkRotateItem( _HKI( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); +static EDA_HOTKEY HkRotateItemClockwise( _HKI( "Rotate Item Clockwise (Modern Toolset only)" ), + HK_ROTATE_ITEM_CLOCKWISE, GR_KB_SHIFT + 'R' ); static EDA_HOTKEY HkMoveItem( _HKI( "Move Item" ), HK_MOVE_ITEM, 'M' ); static EDA_HOTKEY HkMoveItemExact( _HKI( "Move Item Exactly" ), HK_MOVE_ITEM_EXACT, 'M' + GR_KB_CTRL ); static EDA_HOTKEY HkPositionItemRelative( _HKI( "Position Item Relative" ), HK_POSITION_RELATIVE, 'R' + GR_KB_CTRL ); @@ -216,9 +228,15 @@ static EDA_HOTKEY HkAddModule( _HKI( "Add Footprint" ), HK_ADD_MODULE, 'O' ); // These hotkeys work only in GAL canvas, because the legacy canvas using wxDC does not know // the transparency (alpha channel) -static EDA_HOTKEY HkIncLayerAlhpa( _HKI( "Increment Layer Transparency" ), HK_INC_LAYER_ALHPA, '}' ); +static EDA_HOTKEY HkIncLayerAlpha( _HKI( "Increment Layer Transparency (Modern Toolset only)" ), + HK_INC_LAYER_ALPHA, '}' ); -static EDA_HOTKEY HkDecLayerAlhpa( _HKI( "Decrement Layer Transparency" ), HK_DEC_LAYER_ALHPA, '{' ); +static EDA_HOTKEY HkDecLayerAlpha( _HKI( "Decrement Layer Transparency (Modern Toolset only)" ), + HK_DEC_LAYER_ALPHA, '{' ); + +// These two are currently unused, and are intentionally not added to a list below. +static EDA_HOTKEY HkIncHighContrast( _HKI( "Increment High Contrast" ), HK_HIGHCONTRAST_INC, '>' ); +static EDA_HOTKEY HkDecHighContrast( _HKI( "Decrement High Contrast" ), HK_HIGHCONTRAST_DEC, '<' ); static EDA_HOTKEY HkSelectConnection( _HKI( "Select Trivial Connection" ), HK_SEL_TRIVIAL_CONNECTION, 'U' ); @@ -255,6 +273,11 @@ static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X', (int) 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 HkToggleCursor( _HKI( "Toggle Cursor Display (Modern Toolset only)" ), + HK_TOGGLE_CURSOR, 'X' + GR_KB_SHIFTCTRL ); +static EDA_HOTKEY HkMeasureTool( _HKI( "Measure Distance (Modern Toolset only)" ), + HK_MEASURE_TOOL, 'M' + GR_KB_SHIFTCTRL ); + // List of common hotkey descriptors EDA_HOTKEY* common_Hotkey_List[] = { @@ -266,7 +289,9 @@ EDA_HOTKEY* common_Hotkey_List[] = &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin, &HkMouseLeftClick, &HkMouseLeftDClick, - &HkIncLayerAlhpa, &HkDecLayerAlhpa, + &HkIncLayerAlpha, &HkDecLayerAlpha, + &HkToggleCursor, + &HkMeasureTool, NULL }; @@ -286,7 +311,12 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = { &HkTrackDisplayMode, &HkDelete, &HkBackspace, - &HkAddNewTrack, &HkAddThroughVia, &HkAddBlindBuriedVia, + &HkAddNewTrack, + &HkRouteDiffPair, + &HkRouteTuneSingle, + &HkRouteTuneDiffPair, + &HkRouteTuneSkew, + &HkAddThroughVia, &HkAddBlindBuriedVia, &HkAddMicroVia, &HkSelLayerAndAddThroughVia, &HkSelLayerAndAddBlindBuriedVia, &HkSwitchTrackPosture, @@ -294,7 +324,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = &HkPlaceItem, &HkCopyItem, &HkMoveItem, &HkFlipItem, - &HkRotateItem, &HkMoveItemExact, &HkPositionItemRelative, + &HkRotateItem, &HkRotateItemClockwise, + &HkMoveItemExact, &HkPositionItemRelative, &HkDuplicateItem, &HkDuplicateItemAndIncrement, &HkCreateArray, &HkDragFootprint, &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index 5ccca9c3fa..8fada5d72f 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -38,6 +38,7 @@ enum hotkey_id_commnand { HK_DELETE = HK_COMMON_END, HK_BACK_SPACE, HK_ROTATE_ITEM, + HK_ROTATE_ITEM_CLOCKWISE, HK_FLIP_ITEM, HK_COPY_ITEM, HK_MOVE_ITEM, @@ -47,6 +48,10 @@ enum hotkey_id_commnand { HK_GET_AND_MOVE_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT, HK_ADD_NEW_TRACK, + HK_ROUTE_DIFF_PAIR, + HK_ROUTE_TUNE_SINGLE, + HK_ROUTE_TUNE_DIFF_PAIR, + HK_ROUTE_TUNE_SKEW, HK_ADD_THROUGH_VIA, HK_SEL_LAYER_AND_ADD_THROUGH_VIA, HK_ADD_BLIND_BURIED_VIA, @@ -91,6 +96,8 @@ enum hotkey_id_commnand { HK_ADD_MODULE, HK_SLIDE_TRACK, HK_SWITCH_HIGHCONTRAST_MODE, + HK_HIGHCONTRAST_INC, + HK_HIGHCONTRAST_DEC, HK_CANVAS_LEGACY, HK_CANVAS_OPENGL, HK_CANVAS_CAIRO, @@ -98,8 +105,8 @@ enum hotkey_id_commnand { HK_LEFT_DCLICK, HK_ZONE_FILL_OR_REFILL, HK_ZONE_REMOVE_FILLED, - HK_INC_LAYER_ALHPA, - HK_DEC_LAYER_ALHPA, + HK_INC_LAYER_ALPHA, + HK_DEC_LAYER_ALPHA, HK_SEL_TRIVIAL_CONNECTION, HK_SEL_COPPER_CONNECTION, HK_ROUTING_OPTIONS, diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 6bcdc0c980..eba2abe091 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -314,13 +314,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() contrastModeSubMenu->AppendSeparator(); text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_DEC_LAYER_ALHPA ); + HK_DEC_LAYER_ALPHA ); AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA, text, _( "Make the current layer more transparent" ), KiBitmap( contrast_mode_xpm ) ); text = AddHotkeyName( _( "&Increase Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_INC_LAYER_ALHPA ); + HK_INC_LAYER_ALPHA ); AddMenuItem( contrastModeSubMenu, ID_INC_LAYER_ALPHA, text, _( "Make the current layer less transparent" ), KiBitmap( contrast_mode_xpm ) ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 2bdc626fb2..88d81dab50 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -756,13 +756,13 @@ void prepareViewMenu( wxMenu* aParentMenu, bool aUseGal ) contrastModeSubMenu->AppendSeparator(); text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_DEC_LAYER_ALHPA ); + HK_DEC_LAYER_ALPHA ); AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA, text, _( "Make the current layer more transparent" ), KiBitmap( contrast_mode_xpm ) ); text = AddHotkeyName( _( "&Increase Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr, - HK_INC_LAYER_ALHPA ); + HK_INC_LAYER_ALPHA ); AddMenuItem( contrastModeSubMenu, ID_INC_LAYER_ALPHA, text, _( "Make the current layer less transparent" ), KiBitmap( contrast_mode_xpm ) ); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 35085de6f3..6e94f39d2a 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -84,7 +84,7 @@ TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleT _( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair", - AS_GLOBAL, '6', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_DIFF_PAIR ), _( "Interactive Router (Differential Pairs)" ), _( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE ); @@ -99,15 +99,15 @@ TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRo _( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack", - AS_GLOBAL, '7', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SINGLE ), _( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair", - AS_GLOBAL, '8', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_DIFF_PAIR ), _( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew", - AS_GLOBAL, '9', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SKEW ), _( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag", diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 35cb02da3a..804103402d 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -120,7 +120,7 @@ TOOL_ACTION PCB_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray", _( "Create Array..." ), _( "Create array" ), array_xpm, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::rotateCw( "pcbnew.InteractiveEdit.rotateCw", - AS_GLOBAL, MD_SHIFT + 'R', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE_ITEM_CLOCKWISE ), _( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ), rotate_cw_xpm, AF_NONE, (void*) -1 ); @@ -166,17 +166,17 @@ TOOL_ACTION PCB_ACTIONS::selectionModified( "pcbnew.InteractiveEdit.ModifiedSele "", "", nullptr, AF_NOTIFY ); TOOL_ACTION PCB_ACTIONS::measureTool( "pcbnew.InteractiveEdit.measureTool", - AS_GLOBAL, MD_CTRL + MD_SHIFT + 'M', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MEASURE_TOOL ), _( "Measuring Tool" ), _( "Interactively measure distance between points" ), nullptr, AF_ACTIVATE ); TOOL_ACTION PCB_ACTIONS::copyToClipboard( "pcbnew.InteractiveEdit.CopyToClipboard", - AS_GLOBAL, MD_CTRL + int( 'C' ), + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COPY ), _( "Copy" ), _( "Copy selected content to clipboard" ), copy_xpm ); TOOL_ACTION PCB_ACTIONS::cutToClipboard( "pcbnew.InteractiveEdit.CutToClipboard", - AS_GLOBAL, MD_CTRL + int( 'X' ), + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_CUT ), _( "Cut" ), _( "Cut selected content to clipboard" ), cut_xpm ); diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 632c14179e..1e55f4c0e5 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -109,11 +109,11 @@ TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode", "", "" ); TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc", - AS_GLOBAL, '>', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_INC ), "", "" ); TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec", - AS_GLOBAL, '<', + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_DEC ), "", "" ); @@ -163,11 +163,11 @@ TOOL_ACTION PCB_ACTIONS::layerToggle( "pcbnew.Control.layerToggle", "", "" ); TOOL_ACTION PCB_ACTIONS::layerAlphaInc( "pcbnew.Control.layerAlphaInc", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_INC_LAYER_ALHPA ), + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_INC_LAYER_ALPHA ), "", "" ); TOOL_ACTION PCB_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec", - AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DEC_LAYER_ALHPA ), + AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DEC_LAYER_ALPHA ), "", "" ); TOOL_ACTION PCB_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",