← Back to team overview

kicad-developers team mailing list archive

[PATCH] Hotkey for editing module with module editor (Ctrl-E)

 

Hi all,

Here is a little patch for adding a hotkey to edit a module with the
module editor. It defaults to "Ctrl-E".

At least this makes it a little easier to develop for modedit, as you
now don't need to click into the menu to get there!

Thanks,

John
diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp
index 4e7447d..c7c475c 100644
--- a/pcbnew/hotkeys.cpp
+++ b/pcbnew/hotkeys.cpp
@@ -105,6 +105,7 @@ static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ),  HK_SWITC
 static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag Track Keep Slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
 static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
 static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
+static EDA_HOTKEY HkEditWithModedit( wxT( "Edit with Footprint Editor" ), HK_EDIT_MODULE_WITH_MODEDIT, 'E' + GR_KB_CTRL );
 static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' );
 static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
 static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
@@ -278,6 +279,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
     &HkRotateItem,             &HkDragFootprint,
     &HkGetAndMoveFootprint,    &HkLock_Unlock_Footprint,     &HkSavefile, &HkSavefileAs,
     &HkLoadfile,               &HkFindItem,                  &HkEditBoardItem,
+    &HkEditWithModedit,
     &HkSwitch2CopperLayer,     &HkSwitch2InnerLayer1,
     &HkSwitch2InnerLayer2,     &HkSwitch2InnerLayer3,        &HkSwitch2InnerLayer4,
     &HkSwitch2InnerLayer5,     &HkSwitch2InnerLayer6,        &HkSwitch2ComponentLayer,
diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h
index 50f00de..27635a4 100644
--- a/pcbnew/hotkeys.h
+++ b/pcbnew/hotkeys.h
@@ -88,6 +88,7 @@ enum hotkey_id_commnand {
     HK_SWITCH_LAYER_TO_INNER13,
     HK_SWITCH_LAYER_TO_INNER14,
     HK_ADD_MODULE,
+    HK_EDIT_MODULE_WITH_MODEDIT,
     HK_SLIDE_TRACK,
     HK_MACRO_ID_BEGIN,
     HK_RECORD_MACROS_0,     // keep these id ordered from 0 to 9
diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp
index 9ac2940..6136c30 100644
--- a/pcbnew/hotkeys_board_editor.cpp
+++ b/pcbnew/hotkeys_board_editor.cpp
@@ -508,6 +508,10 @@ bool PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
         OnHotkeyEditItem( HK_EDIT_ITEM );
         break;
 
+    case HK_EDIT_MODULE_WITH_MODEDIT:      // Edit module with module editor
+        evt_type = ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT;
+        break;
+
     // Footprint edition:
     case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status:
         // get any module, locked or not locked and toggle its locked status
diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp
index bafbffe..6f125a1 100644
--- a/pcbnew/onrightclick.cpp
+++ b/pcbnew/onrightclick.cpp
@@ -757,9 +757,11 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
                              g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM );
         AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE_PRMS, msg,
                      KiBitmap( edit_module_xpm ) );
+
+        msg = AddHotkeyName( _( "Edit with Footprint Editor" ),
+                             g_Board_Editor_Hokeys_Descr, HK_EDIT_MODULE_WITH_MODEDIT );
         AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT,
-                     _( "Edit with Footprint Editor" ),
-                     KiBitmap( module_editor_xpm ) );
+                     msg, KiBitmap( module_editor_xpm ) );
         sub_menu_footprint->AppendSeparator();
         msg = AddHotkeyName( _( "Delete Footprint" ),
                              g_Board_Editor_Hokeys_Descr, HK_DELETE );

Follow ups