kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #04972
eeschema patch to add hotkey shortcut for "add label"
Hello everyone,
One of the most common things I do with eeschema that doesn't have a
hotkey is adding a label to a wire. I have prepared a patch to add
support for a hotkey shortcut for this functionality. I hope that it is
in the proper patch file format, and that I have not overlooked any
coding issues or forgotten to update some variable. I based my few
changes on the instructions in the files' headers and the code for
similar features. Please feel free to adjust/fix this patch as you see
fit. I welcome any feedback you all may have.
Thanks in advance,
Matthew Beckler
matthew@xxxxxxxxxxxx
--- eeschema/hotkeys.cpp (revision 2518)
+++ eeschema/hotkeys.cpp (working copy)
@@ -102,6 +102,7 @@
#endif
// Schematic editor
+static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' );
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ),
HK_ADD_NEW_COMPONENT, 'A' );
@@ -188,6 +189,7 @@
&HkEditComponentValue,
&HkEditComponentFootprint,
&HkBeginWire,
+ &HkAddLabel,
NULL
};
@@ -383,6 +385,13 @@
}
break;
+ case HK_ADD_LABEL:
+ // switch to m_ID_current_state = ID_LABEL_BUTT;
+ if( m_ID_current_state != ID_LABEL_BUTT )
+ SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) );
+ OnLeftClick( DC, MousePos );
+ break;
+
case HK_BEGIN_WIRE:
/* An item is selected. If edited and not a wire, a new command is not
--- eeschema/hotkeys.h (revision 2518)
+++ eeschema/hotkeys.h (working copy)
@@ -31,7 +31,8 @@
HK_COPY_COMPONENT_OR_LABEL,
HK_DRAG,
HK_ADD_NEW_COMPONENT,
- HK_BEGIN_WIRE
+ HK_BEGIN_WIRE,
+ HK_ADD_LABEL
};
// List of hotkey descriptors for eeschema
Attachment:
signature.asc
Description: OpenPGP digital signature
Follow ups