← Back to team overview

kicad-developers team mailing list archive

[PATCH] Remove hardcoded hotkeys that have a context menu to fall back on.

 

Fixed blocked Lock/Unlock hotkey.
Add hotkeys for Select Trivial Connection and Select Copper Connection
---
 pcbnew/hotkeys.cpp                  | 7 ++++++-
 pcbnew/hotkeys.h                    | 4 +++-
 pcbnew/router/pns_tool_base.cpp     | 2 +-
 pcbnew/router/router_tool.cpp       | 4 ++--
 pcbnew/tools/pcb_editor_control.cpp | 6 +++---
 pcbnew/tools/selection_tool.cpp     | 4 ++--
 6 files changed, 17 insertions(+), 10 deletions(-)


This was the minimum hotkey fix that I needed to get up and running. If
there are no issues I will create hotkey descriptors for the remaining
hardcoded keys.
diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp
index e4239518b..54cd922e3 100644
--- a/pcbnew/hotkeys.cpp
+++ b/pcbnew/hotkeys.cpp
@@ -237,6 +237,10 @@ static EDA_HOTKEY HkIncLayerAlhpa( _HKI( "Increment Layer Transparency" ), HK_IN
 
 static EDA_HOTKEY HkDecLayerAlhpa( _HKI( "Decrement Layer Transparency" ), HK_DEC_LAYER_ALHPA, '{' );
 
+static EDA_HOTKEY HkSelectConnection( _HKI( "Select Trivial Connection" ), HK_SEL_TRIVIAL_CONNECTION, 'U' );
+
+static EDA_HOTKEY HkSelectCopper( _HKI( "Select Copper Connection" ), HK_SEL_COPPER_CONNECTION, 'I' );
+
 // List of common hotkey descriptors
 EDA_HOTKEY* common_Hotkey_List[] =
 {
@@ -288,7 +292,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
     &HkSwitchGridToFastGrid2,  &HkSwitchGridToNext,          &HkSwitchGridToPrevious,
     &HkSwitchHighContrastMode,
     &HkCanvasDefault,          &HkCanvasCairo,               &HkCanvasOpenGL,
-    &HkZoneFillOrRefill,       &HkZoneRemoveFilled,
+    &HkZoneFillOrRefill,       &HkZoneRemoveFilled,          &HkSelectConnection,
+    &HkSelectCopper,
     NULL
 };
 
diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h
index 36b91e944..6ddd6c764 100644
--- a/pcbnew/hotkeys.h
+++ b/pcbnew/hotkeys.h
@@ -103,7 +103,9 @@ enum hotkey_id_commnand {
     HK_ZONE_FILL_OR_REFILL,
     HK_ZONE_REMOVE_FILLED,
     HK_INC_LAYER_ALHPA,
-    HK_DEC_LAYER_ALHPA
+    HK_DEC_LAYER_ALHPA,
+    HK_SEL_TRIVIAL_CONNECTION,
+    HK_SEL_COPPER_CONNECTION
 };
 
 // Full list of hotkey descriptors for board editor and footprint editor
diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp
index f8b484991..49f9d0369 100644
--- a/pcbnew/router/pns_tool_base.cpp
+++ b/pcbnew/router/pns_tool_base.cpp
@@ -61,7 +61,7 @@ using namespace KIGFX;
 namespace PNS {
 
 TOOL_ACTION TOOL_BASE::ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
-                                            AS_CONTEXT, 'E',
+                                            AS_CONTEXT, 0,
                                             _( "Routing Options..." ),
                                             _( "Shows a dialog containing router options." ), tools_xpm );
 
diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp
index 61f34d361..d25100202 100644
--- a/pcbnew/router/router_tool.cpp
+++ b/pcbnew/router/router_tool.cpp
@@ -163,7 +163,7 @@ static const TOOL_ACTION ACT_SelLayerAndPlaceBlindVia(
     (void*) ( VIA_ACTION_FLAGS::BLIND_VIA | VIA_ACTION_FLAGS::SELECT_LAYER ) );
 
 static const TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackViaSize",
-    AS_CONTEXT, 'Q',
+    AS_CONTEXT, 0,
     _( "Custom Track/Via Size" ),
     _( "Shows a dialog for changing the track width and via size." ),
     width_track_xpm );
@@ -175,7 +175,7 @@ static const TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPost
     change_entry_orient_xpm );
 
 static const TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions",
-    AS_CONTEXT, 'P',
+    AS_CONTEXT, 0,
     _( "Differential Pair Dimensions..." ),
     _( "Sets the width and gap of the currently routed differential pair." ),
     ps_diff_pair_tune_length_xpm );
diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp
index 163cca5c5..7ab80f147 100644
--- a/pcbnew/tools/pcb_editor_control.cpp
+++ b/pcbnew/tools/pcb_editor_control.cpp
@@ -70,11 +70,11 @@ TOOL_ACTION PCB_ACTIONS::trackWidthDec( "pcbnew.EditorControl.trackWidthDec",
         "", "" );
 
 TOOL_ACTION PCB_ACTIONS::viaSizeInc( "pcbnew.EditorControl.viaSizeInc",
-        AS_GLOBAL, '\'',
+        AS_GLOBAL,0,
         "", "" );
 
 TOOL_ACTION PCB_ACTIONS::viaSizeDec( "pcbnew.EditorControl.viaSizeDec",
-        AS_GLOBAL, '\\',
+        AS_GLOBAL, 0,
         "", "" );
 
 TOOL_ACTION PCB_ACTIONS::trackViaSizeChanged( "pcbnew.EditorControl.trackViaSizeChanged",
@@ -126,7 +126,7 @@ TOOL_ACTION PCB_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchT
         "", "" );
 
 TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock",
-        AS_GLOBAL, 'L',
+        AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LOCK_UNLOCK_FOOTPRINT ),
         "Toggle Lock", "" );
 
 TOOL_ACTION PCB_ACTIONS::lock( "pcbnew.EditorControl.lock",
diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp
index f05424670..f024b8ead 100644
--- a/pcbnew/tools/selection_tool.cpp
+++ b/pcbnew/tools/selection_tool.cpp
@@ -87,11 +87,11 @@ TOOL_ACTION PCB_ACTIONS::selectionClear( "pcbnew.InteractiveSelection.Clear",
         "", "" );    // No description, it is not supposed to be shown anywhere
 
 TOOL_ACTION PCB_ACTIONS::selectConnection( "pcbnew.InteractiveSelection.SelectConnection",
-        AS_GLOBAL, 'U',
+        AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SEL_TRIVIAL_CONNECTION ),
         _( "Trivial Connection" ), _( "Selects a connection between two junctions." ) );
 
 TOOL_ACTION PCB_ACTIONS::selectCopper( "pcbnew.InteractiveSelection.SelectCopper",
-        AS_GLOBAL, 'I',
+        AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SEL_COPPER_CONNECTION ),
         _( "Copper Connection" ), _( "Selects whole copper connection." ) );
 
 TOOL_ACTION PCB_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet",


Follow ups