KiCad PCB EDA Suite
eeschema/hotkeys.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
30 #include <fctsys.h>
31 #include <eeschema_id.h>
32 #include <hotkeys.h>
33 #include <sch_edit_frame.h>
34 #include <class_drawpanel.h>
35 
36 #include <general.h>
37 #include <lib_edit_frame.h>
38 #include <viewlib_frame.h>
39 #include <class_libentry.h>
40 #include <sch_junction.h>
41 #include <sch_line.h>
42 #include <sch_component.h>
43 #include <sch_sheet.h>
44 
46 
47 // Remark: the hotkey message info is used as keyword in hotkey config files and
48 // as comments in help windows, therefore translated only when displayed
49 // they are marked _HKI to be extracted by translation tools
50 // See hotkeys_basic.h for more info
51 
52 
53 /* How to add a new hotkey:
54  * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see
55  * hotkeys.h).
56  * add a new EDA_HOTKEY entry like:
57  * static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION,
58  * default key value);
59  * _HKI("Command Label") is the name used in hotkey list display, and the
60  * identifier in the hotkey list file
61  * MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in
62  * OnHotKey() function.
63  * default key value is the default hotkey for this command. Can be overridden
64  * by the user hotkey list file
65  * add the HkMyNewEntry pointer in the schematic_Hotkey_List list or the
66  * libEdit_Hotkey_List list or common_Hotkey_List if the same command is
67  * added both in Eeschema and libedit)
68  * Add the new code in the switch in OnHotKey() function.
69  * when the variable itemInEdit is true, an item is currently edited.
70  * This can be useful if the new function cannot be executed while an item is
71  * currently being edited
72  * ( For example, one cannot start a new wire when a component is moving.)
73  *
74  * Note: If an hotkey is a special key be sure the corresponding wxWidget
75  * keycode (WXK_XXXX) is handled in the hotkey_name_descr
76  * s_Hotkey_Name_List list (see hotkeys_basic.cpp) and see this list
77  * for some ascii keys (space ...)
78  *
79  * Key modifier are: GR_KB_CTRL GR_KB_ALT
80  */
81 
82 
83 // Common commands
84 
85 // Fit on Screen
86 #if !defined( __WXMAC__ )
87 static EDA_HOTKEY HkZoomAuto( _HKI( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
88 #else
89 static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0',
90  ID_ZOOM_PAGE );
91 #endif
92 
93 static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
95 
96 // Refresh Screen
97 #if !defined( __WXMAC__ )
98 static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
99 #else
100 static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R',
101  ID_ZOOM_REDRAW );
102 #endif
103 
104 // Zoom In
105 #if !defined( __WXMAC__ )
106 static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_KEY_ZOOM_IN );
107 #else
108 static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_KEY_ZOOM_IN );
109 #endif
110 
111 // Zoom Out
112 #if !defined( __WXMAC__ )
113 static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_KEY_ZOOM_OUT );
114 #else
115 static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', ID_KEY_ZOOM_OUT );
116 #endif
117 
118 static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
119 static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
120 static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK,
122 
123 // mouse click command:
124 static EDA_HOTKEY HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 );
125 static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK, WXK_END, 0 );
126 
127 // Schematic editor
128 static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
129 static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
130 static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K',
132 
133 static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L', ID_LABEL_BUTT );
134 static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
136 static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H',
137  ID_GLABEL_BUTT );
138 static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J', ID_JUNCTION_BUTT );
139 static EDA_HOTKEY HkAddComponent( _HKI( "Add Symbol" ), HK_ADD_NEW_COMPONENT, 'A',
141 static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P',
143 static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q',
144  ID_NOCONN_BUTT );
145 static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S',
147 static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/',
149 static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z',
151 static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE,
152  'I', ID_LINE_COMMENT_BUTT );
153 static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
155 static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y',
156  ID_SCH_MIRROR_Y );
157 static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
158  ID_SCH_MIRROR_X );
159 static EDA_HOTKEY HkOrientNormalComponent( _HKI( "Orient Normal Component" ),
161 static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE );
162 static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E', ID_SCH_EDIT_ITEM );
163 static EDA_HOTKEY HkEditComponentValue( _HKI( "Edit Symbol Value" ),
166 static EDA_HOTKEY HkEditComponentReference( _HKI( "Edit Symbol Reference" ),
169 static EDA_HOTKEY HkEditComponentFootprint( _HKI( "Edit Symbol Footprint" ),
172 static EDA_HOTKEY HkEditComponentWithLibedit( _HKI( "Edit with Symbol Editor" ),
174  'E' + GR_KB_CTRL,
176 static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ),
179 
180 static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate Symbol or Label" ),
181  HK_DUPLICATE_ITEM, 'C',
183 
184 static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
185 static EDA_HOTKEY HkMove2Drag( _HKI( "Move Block -> Drag Block" ),
187 static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
188 static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
189 static EDA_HOTKEY HkDeleteNode( _HKI( "Delete Node" ), HK_DELETE_NODE, WXK_BACK,
191 
192 static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL, ID_FIND_ITEMS );
193 static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
194  wxEVT_COMMAND_FIND );
195 static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE,
196  'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
197 static EDA_HOTKEY HkFindNextDrcMarker( _HKI( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
198  WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
199 static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION,
200  GR_KB_CTRL + WXK_F5, ID_ZOOM_SELECTION );
201 
202 // Special keys for library editor:
203 static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
204 static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
205 static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
206 
207 // Load/save files
208 static EDA_HOTKEY HkSaveAllLib( _HKI( "Save All Libraries" ), HK_SAVE_ALL_LIBS, 'S' + GR_KB_CTRL,
210 
211 // Autoplace fields
212 static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
214 
215 static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UPDATE_PCB_FROM_SCH,
216  WXK_F8 );
217 
218 // Higtlight connection
219 static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
220  'B' + GR_KB_CTRL );
221 
222 // Common: hotkeys_basic.h
223 static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N', (int) wxID_NEW );
224 static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O', (int) wxID_OPEN );
225 static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', (int) wxID_SAVE );
226 static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFT + GR_KB_CTRL + 'S',
227  (int) wxID_SAVEAS );
228 static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', (int) wxID_PRINT );
229 
230 static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
231 
232 #if !defined( __WXMAC__ )
233 static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
234 #else
235 static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO,
236  GR_KB_SHIFT + GR_KB_CTRL + 'Z',
237  (int) wxID_REDO );
238 #endif
239 
240 static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X', (int) wxID_CUT );
241 static EDA_HOTKEY HkEditCopy( _HKI( "Copy" ), HK_EDIT_COPY, GR_KB_CTRL + 'C', (int) wxID_COPY );
242 static EDA_HOTKEY HkEditPaste( _HKI( "Paste" ), HK_EDIT_PASTE, GR_KB_CTRL + 'V', (int) wxID_PASTE );
243 
244 
245 // List of common hotkey descriptors
247 {
249  &HkUndo, &HkRedo,
251  &HkHelp,
252  &HkZoomIn,
253  &HkZoomOut,
254  &HkZoomRedraw,
255  &HkZoomCenter,
256  &HkZoomAuto,
259  &HkEdit,
260  &HkDelete,
261  &HkRotate,
262  &HkDrag,
265  NULL
266 };
267 
268 // List of common hotkey descriptors, for the library vierwer
270 {
271  &HkHelp,
272  &HkZoomIn,
273  &HkZoomOut,
274  &HkZoomRedraw,
275  &HkZoomCenter,
276  &HkZoomAuto,
280  NULL
281 };
282 
283 // List of hotkey descriptors for schematic
285 {
286  &HkFindItem,
289  &HkFindReplace,
290  &HkInsert,
291  &HkMove2Drag,
292  &HkMove,
295  &HkAddPower,
296  &HkMirrorX,
297  &HkMirrorY,
303  &HkBeginWire,
304  &HkBeginBus,
306  &HkAddLabel,
309  &HkAddJunction,
310  &HkAddNoConn,
313  &HkAddBusEntry,
318  &HkLeaveSheet,
319  &HkDeleteNode,
321  NULL
322 };
323 
324 // List of hotkey descriptors for library editor
326 {
327  &HkSaveAllLib,
328  &HkCreatePin,
329  &HkInsertPin,
330  &HkMoveLibItem,
331  &HkMirrorX,
332  &HkMirrorY,
333  NULL
334 };
335 
336 // List of hotkey descriptors for library viewer (currently empty
338 {
339  NULL
340 };
341 
342 // Keyword Identifiers (tags) in key code configuration file (section names)
343 // (.m_SectionTag member of a EDA_HOTKEY_CONFIG)
344 static wxString schematicSectionTag( wxT( "[eeschema]" ) );
345 static wxString libEditSectionTag( wxT( "[libedit]" ) );
346 
347 // Titles for hotkey editor and hotkey display
348 static wxString commonSectionTitle( _HKI( "Common" ) );
349 static wxString schematicSectionTitle( _HKI( "Schematic Editor" ) );
350 static wxString libEditSectionTitle( _HKI( "Library Editor" ) );
351 
352 // list of sections and corresponding hotkey list for Eeschema (used to create
353 // an hotkey config file)
355 {
356  { &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
357  { &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
358  { &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
359  { NULL, NULL, NULL }
360 };
361 
362 // list of sections and corresponding hotkey list for the schematic editor
363 // (used to list current hotkeys)
365 {
366  { &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
367  { &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
368  { NULL, NULL, NULL }
369 };
370 
371 // list of sections and corresponding hotkey list for the component editor
372 // (used to list current hotkeys)
374 {
375  { &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
376  { &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
377  { NULL, NULL, NULL }
378 };
379 
380 // list of sections and corresponding hotkey list for the component browser
381 // (used to list current hotkeys)
383 {
384  { &g_CommonSectionTag, common_basic_Hotkey_List, &commonSectionTitle },
385  { NULL, NULL, NULL }
386 };
387 
388 
390 {
391  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
392 
393  if( HK_Descr == NULL )
394  HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
395 
396  return HK_Descr;
397 }
398 
399 
400 /*
401  * Hot keys. Some commands are relative to the item under the mouse cursor
402  * Commands are case insensitive
403  */
404 bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
405 {
406  if( aHotKey == 0 )
407  return false;
408 
409  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
410 
411  SCH_SCREEN* screen = GetScreen();
412 
413  // itemInEdit == false means no item currently edited. We can ask for editing a new item
414  bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetFlags();
415 
416  // blocInProgress == false means no block in progress.
417  // Because a drag command uses a drag block, false means also no drag in progress
418  // If false, we can ask for editing a new item
419  bool blocInProgress = screen->m_BlockLocate.GetState() != STATE_NO_BLOCK;
420 
421  // notBusy == true means no item currently edited and no other command in progress
422  // We can change active tool and ask for editing a new item
423  bool notBusy = (!itemInEdit) && (!blocInProgress);
424 
425  /* Convert lower to upper case (the usual toupper function has problem
426  * with non ascii codes like function keys */
427  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
428  aHotKey += 'A' - 'a';
429 
430  // Search command from key :
431  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
432 
433  if( hotKey == NULL )
434  hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List );
435 
436  if( hotKey == NULL )
437  return false;
438 
439  switch( hotKey->m_Idcommand )
440  {
441  default:
442  case HK_NOT_FOUND:
443  return false;
444 
445  case HK_HELP: // Display Current hotkey list
446  DisplayHotkeyList( this, g_Schematic_Hokeys_Descr );
447  break;
448 
449  case HK_RESET_LOCAL_COORD: // Reset the relative coord
451  break;
452 
453  case ID_HOTKEY_HIGHLIGHT:
454  if( notBusy )
456  break;
457 
458  case HK_LEFT_CLICK:
459  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
460  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
461  {
462  GetCanvas()->SetAutoPanRequest( false );
463  HandleBlockPlace( aDC );
464  }
465  else if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
466  {
467  OnLeftClick( aDC, aPosition );
468 
469  if( hotKey->m_Idcommand == HK_LEFT_DCLICK )
470  OnLeftDClick( aDC, aPosition );
471  }
472  break;
473 
474  case HK_ZOOM_IN:
475  case HK_ZOOM_OUT:
476  case HK_ZOOM_REDRAW:
477  case HK_ZOOM_CENTER:
478  case HK_ZOOM_AUTO:
479  case HK_ZOOM_SELECTION:
480  case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
481  case HK_EDIT_PASTE:
482  case HK_EDIT_COPY: // Copy block to paste buffer.
483  case HK_EDIT_CUT:
484  cmd.SetId( hotKey->m_IdMenuEvent );
485  GetEventHandler()->ProcessEvent( cmd );
486  break;
487 
488  case HK_DELETE:
489  if( blocInProgress )
490  {
491  cmd.SetId( ID_POPUP_DELETE_BLOCK );
492  GetEventHandler()->ProcessEvent( cmd );
493  }
494  else if( notBusy )
495  DeleteItemAtCrossHair( aDC );
496  break;
497 
498  case HK_REPEAT_LAST:
499  if( notBusy )
500  RepeatDrawItem( aDC );
501  break;
502 
504  // this key terminates a new line/bus/wire in progress
505  if( aItem && aItem->IsNew() &&
506  aItem->Type() == SCH_LINE_T )
507  {
508  cmd.SetId( hotKey->m_IdMenuEvent );
509  GetEventHandler()->ProcessEvent( cmd );
510  }
511  break;
512 
513  case HK_UNDO: // Hot keys that map to command IDs that cannot be called
514  case HK_REDO: // while busy performing another command.
515  case HK_FIND_ITEM:
516  case HK_FIND_REPLACE:
517  case HK_DELETE_NODE:
518  case HK_LEAVE_SHEET:
519  if( notBusy )
520  {
521  cmd.SetId( hotKey->m_IdMenuEvent );
522  GetEventHandler()->ProcessEvent( cmd );
523  }
524  break;
525 
526  case HK_FIND_NEXT_ITEM:
528  if( notBusy )
529  {
530  wxFindDialogEvent event( hotKey->m_IdMenuEvent, GetId() );
531  event.SetEventObject( this );
532  event.SetFlags( m_findReplaceData->GetFlags() );
533  event.SetFindString( m_findReplaceData->GetFindString() );
534  GetEventHandler()->ProcessEvent( event );
535  }
536  break;
537 
538  case HK_ADD_NEW_COMPONENT: // Add component
539  case HK_ADD_NEW_POWER: // Add power component
540  case HK_ADD_LABEL:
541  case HK_ADD_HLABEL:
542  case HK_ADD_GLABEL:
543  case HK_ADD_JUNCTION:
544  case HK_ADD_WIRE_ENTRY:
545  case HK_ADD_BUS_ENTRY:
546  case HK_ADD_HIER_SHEET:
547  case HK_ADD_GRAPHIC_TEXT:
549  case HK_ADD_NOCONN_FLAG: // Add a no connected flag
550  case HK_BEGIN_BUS:
551  case HK_BEGIN_WIRE:
552  if( notBusy )
553  {
554  EDA_HOTKEY_CLIENT_DATA data( aPosition );
555  cmd.SetInt( aHotKey );
556  cmd.SetClientObject( &data );
557  cmd.SetId( hotKey->m_IdMenuEvent );
558  GetEventHandler()->ProcessEvent( cmd );
559  }
560  else if( aItem && aItem->IsNew() )
561  {
562  // If the item is a bus or a wire, a begin command is not possible.
563  if( (GetToolId() == ID_BUS_BUTT) && (aItem->Type() == SCH_LINE_T) )
564  {
565  SCH_LINE* segment = (SCH_LINE*) aItem;
566 
567  if( segment->GetLayer() != LAYER_BUS )
568  break;
569 
570  // Bus in progress:
571  OnLeftClick( aDC, aPosition );
572  }
573  else if( (GetToolId() == ID_WIRE_BUTT ) && (aItem->Type() == SCH_LINE_T) )
574  {
575  SCH_LINE* segment = (SCH_LINE*) aItem;
576 
577  if( segment->GetLayer() != LAYER_WIRE )
578  break;
579 
580  // Wire in progress:
581  OnLeftClick( aDC, aPosition );
582  }
583  }
584  break;
585 
586  case HK_DUPLICATE_ITEM: // Duplicate component or text/label
587  if( itemInEdit )
588  break;
589 
590  if( aItem == NULL )
591  {
592  aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::CopyableItems );
593 
594  if( aItem == NULL )
595  break;
596  }
597 
598  cmd.SetId( hotKey->m_IdMenuEvent );
599  wxPostEvent( this, cmd );
600  break;
601 
602  case HK_DRAG: // Start drag
603  case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
604  if( ! notBusy )
605  break;
606 
607  // Fall through
608  case HK_EDIT:
609  // Edit schematic item. Do not allow sheet edition when mowing
610  // Because a sheet edition can be complex.
611  if( itemInEdit && screen->GetCurItem()->Type() == SCH_SHEET_T )
612  break;
613 
614  // Fall through
615  case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
616  case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
617  case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
618  case HK_MIRROR_Y: // Mirror Y
619  case HK_MIRROR_X: // Mirror X
620  case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
621  case HK_ROTATE: // Rotate schematic item.
622  case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
623  case HK_AUTOPLACE_FIELDS: // Autoplace all fields around component
624  {
625  // force a new item search on hot keys at current position,
626  // if there is no currently edited item,
627  // to avoid using a previously selected item
628  if( ! itemInEdit )
629  screen->SetCurItem( NULL );
630  EDA_HOTKEY_CLIENT_DATA data( aPosition );
631  cmd.SetInt( hotKey->m_Idcommand );
632  cmd.SetClientObject( &data );
633  cmd.SetId( hotKey->m_IdMenuEvent );
634  GetEventHandler()->ProcessEvent( cmd );
635  }
636  break;
637  }
638 
639  // Hot key handled.
640  return true;
641 }
642 
643 
645 {
646  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
647 
648  if( HK_Descr == NULL )
649  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
650 
651  return HK_Descr;
652 }
653 
654 
655 bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
656 {
657  if( aHotKey == 0 )
658  return false;
659 
660  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
661 
662  cmd.SetEventObject( this );
663 
664  /* Convert lower to upper case (the usual toupper function has problem
665  * with non ascii codes like function keys */
666  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
667  aHotKey += 'A' - 'a';
668 
669  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
670 
671  if( hotKey == NULL )
672  hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List );
673 
674  if( hotKey == NULL )
675  return false;
676 
677  // itemInEdit == false means no item currently edited. We can ask for editing a new item
678  bool itemInEdit = IsEditingDrawItem();
679 
680  bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
681 
682  switch( hotKey->m_Idcommand )
683  {
684  default:
685  case HK_NOT_FOUND:
686  return false;
687 
688  case HK_HELP: // Display Current hotkey list
689  DisplayHotkeyList( this, g_Libedit_Hokeys_Descr );
690  break;
691 
692  case HK_RESET_LOCAL_COORD: // Reset the relative coord
694  break;
695 
696  case HK_LEFT_CLICK:
697  OnLeftClick( aDC, aPosition );
698  break;
699 
700  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
701  OnLeftClick( aDC, aPosition );
702  OnLeftDClick( aDC, aPosition );
703  break;
704 
705  case HK_ZOOM_IN:
706  case HK_ZOOM_OUT:
707  case HK_ZOOM_REDRAW:
708  case HK_ZOOM_CENTER:
709  case HK_ZOOM_AUTO:
710  case HK_EDIT_PASTE:
711  case HK_EDIT_COPY:
712  case HK_EDIT_CUT:
713  cmd.SetId( hotKey->m_IdMenuEvent );
714  GetEventHandler()->ProcessEvent( cmd );
715  break;
716 
717  case HK_UNDO:
718  case HK_REDO:
719  if( !itemInEdit )
720  {
721  cmd.SetId( hotKey->m_IdMenuEvent );
722  GetEventHandler()->ProcessEvent( cmd );
723  }
724  break;
725 
726  case HK_REPEAT_LAST:
727  if( ! itemInEdit )
728  {
729  if( m_lastDrawItem && !m_lastDrawItem->InEditMode() &&
730  ( m_lastDrawItem->Type() == LIB_PIN_T ) )
731  RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem );
732  }
733  break;
734 
735  case HK_EDIT:
736  if ( !itemInEdit )
737  SetDrawItem( LocateItemUsingCursor( aPosition ) );
738 
739  if( GetDrawItem() )
740  {
741  switch( GetDrawItem()->Type() )
742  {
743  case LIB_PIN_T:
744  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
745  GetEventHandler()->ProcessEvent( cmd );
746  break;
747 
748  case LIB_ARC_T:
749  case LIB_CIRCLE_T:
750  case LIB_RECTANGLE_T:
751  case LIB_POLYLINE_T:
752  case LIB_TEXT_T:
753  cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
754  GetEventHandler()->ProcessEvent( cmd );
755  break;
756 
757  case LIB_FIELD_T:
759  GetEventHandler()->ProcessEvent( cmd );
760  break;
761 
762  default:
763  break;
764  }
765  }
766  break;
767 
768  case HK_ROTATE:
769  if( blocInProgress )
770  {
772  HandleBlockPlace( aDC );
773  }
774  else
775  {
776  if ( !itemInEdit )
777  SetDrawItem( LocateItemUsingCursor( aPosition ) );
778 
779  if( GetDrawItem() )
780  {
781  cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
782  GetEventHandler()->ProcessEvent( cmd );
783  }
784  }
785  break;
786 
788  if( ! itemInEdit )
789  {
790  SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
791  OnLeftClick( aDC, aPosition );
792  }
793  break;
794 
795  case HK_DELETE:
796  if( blocInProgress )
797  {
798  cmd.SetId( ID_POPUP_DELETE_BLOCK );
800  }
801  else
802  {
803  if( !itemInEdit )
804  SetDrawItem( LocateItemUsingCursor( aPosition ) );
805 
806  if( GetDrawItem() )
807  {
808  cmd.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
810  }
811  }
812  break;
813 
815  if( !itemInEdit && !blocInProgress )
816  {
817  SetDrawItem( LocateItemUsingCursor( aPosition ) );
818 
819  if( GetDrawItem() )
820  {
823  }
824  }
825  break;
826 
827  case HK_DRAG:
828  if( !itemInEdit && !blocInProgress )
829  {
830  SetDrawItem( LocateItemUsingCursor( aPosition ) );
831 
832  if( GetDrawItem() )
833  {
834  cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
836  }
837  }
838  break;
839 
840  case HK_MIRROR_Y: // Mirror Y
841  if( !itemInEdit && !blocInProgress )
842  SetDrawItem( LocateItemUsingCursor( aPosition ) );
843 
844  if( blocInProgress || GetDrawItem() )
845  {
846  cmd.SetId( ID_LIBEDIT_MIRROR_Y );
847  GetEventHandler()->ProcessEvent( cmd );
848  }
849  break;
850 
851  case HK_MIRROR_X: // Mirror X
852  if( !itemInEdit && !blocInProgress )
853  SetDrawItem( LocateItemUsingCursor( aPosition ) );
854 
855  if( blocInProgress || GetDrawItem() )
856  {
857  cmd.SetId( ID_LIBEDIT_MIRROR_X );
858  GetEventHandler()->ProcessEvent( cmd );
859  }
860  break;
861  }
862 
863  // Hot key handled.
864  return true;
865 }
866 
867 
869 {
870  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
871 
872  if( HK_Descr == NULL )
873  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
874 
875  return HK_Descr;
876 }
877 
878 
879 bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
880 {
881  if( aHotKey == 0 )
882  return false;
883 
884  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
885  cmd.SetEventObject( this );
886 
887  /* Convert lower to upper case (the usual toupper function has problem with non ascii
888  * codes like function keys */
889  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
890  aHotKey += 'A' - 'a';
891 
892  EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
893 
894  if( HK_Descr == NULL )
895  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
896 
897  if( HK_Descr == NULL )
898  return false;
899 
900  switch( HK_Descr->m_Idcommand )
901  {
902  default:
903  case HK_NOT_FOUND:
904  return false;
905 
906  case HK_HELP: // Display Current hotkey list
907  DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr );
908  break;
909 
910  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
912  break;
913 
914  case HK_LEFT_CLICK:
915  OnLeftClick( aDC, aPosition );
916  break;
917 
918  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
919  OnLeftClick( aDC, aPosition );
920  OnLeftDClick( aDC, aPosition );
921  break;
922 
923  case HK_ZOOM_IN:
924  cmd.SetId( ID_KEY_ZOOM_IN );
925  GetEventHandler()->ProcessEvent( cmd );
926  break;
927 
928  case HK_ZOOM_OUT:
929  cmd.SetId( ID_KEY_ZOOM_OUT );
930  GetEventHandler()->ProcessEvent( cmd );
931  break;
932 
933  case HK_ZOOM_REDRAW:
934  cmd.SetId( ID_ZOOM_REDRAW );
935  GetEventHandler()->ProcessEvent( cmd );
936  break;
937 
938  case HK_ZOOM_CENTER:
939  cmd.SetId( ID_POPUP_ZOOM_CENTER );
940  GetEventHandler()->ProcessEvent( cmd );
941  break;
942 
943  case HK_ZOOM_AUTO:
944  cmd.SetId( ID_ZOOM_PAGE );
945  GetEventHandler()->ProcessEvent( cmd );
946  break;
947  }
948 
949  return true;
950 }
Definition of the SCH_SHEET class for Eeschema.
void RepeatDrawItem(wxDC *DC)
Repeat the last item placement if the last item was a bus, bus entry, label, or component.
static EDA_HOTKEY HkEndLineWireBus(_HKI("End Line Wire Bus"), HK_END_CURR_LINEWIREBUS, 'K', ID_POPUP_END_LINE)
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
static EDA_HOTKEY HkAddGraphicText(_HKI("Add Graphic Text"), HK_ADD_GRAPHIC_TEXT, 'T', ID_TEXT_COMMENT_BUTT)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
static EDA_HOTKEY HkFindReplace(_HKI("Find and Replace"), HK_FIND_REPLACE, 'F'+GR_KB_CTRL+GR_KB_ALT, wxID_REPLACE)
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:89
static EDA_HOTKEY HkAddWireEntry(_HKI("Add Wire Entry"), HK_ADD_WIRE_ENTRY, 'Z', ID_WIRETOBUS_ENTRY_BUTT)
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
static wxString schematicSectionTag(wxT("[eeschema]"))
static EDA_HOTKEY HkEditComponentFootprint(_HKI("Edit Symbol Footprint"), HK_EDIT_COMPONENT_FOOTPRINT, 'F', ID_SCH_EDIT_COMPONENT_FOOTPRINT)
static EDA_HOTKEY * schematic_Hotkey_List[]
bool IsNew() const
Definition: base_struct.h:227
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:359
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
static EDA_HOTKEY HkAddLabel(_HKI("Add Label"), HK_ADD_LABEL, 'L', ID_LABEL_BUTT)
static EDA_HOTKEY HkZoomIn(_HKI("Zoom In"), HK_ZOOM_IN, WXK_F1, ID_KEY_ZOOM_IN)
static EDA_HOTKEY HkMoveLibItem(_HKI("Move Library Item"), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M')
static EDA_HOTKEY HkEditCopy(_HKI("Copy"), HK_EDIT_COPY, GR_KB_CTRL+ 'C',(int) wxID_COPY)
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
static EDA_HOTKEY HkHelp(_HKI("Help (this window)"), HK_HELP, GR_KB_CTRL+WXK_F1)
wxFindReplaceData * m_findReplaceData
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
virtual void HandleBlockPlace(wxDC *DC) override
Call after HandleBlockEnd, when a block command needs to be executed after the block is moved to its ...
static EDA_HOTKEY HkDuplicateItem(_HKI("Duplicate Symbol or Label"), HK_DUPLICATE_ITEM, 'C', ID_POPUP_SCH_DUPLICATE_ITEM)
static EDA_HOTKEY HkEdit(_HKI("Edit Item"), HK_EDIT, 'E', ID_SCH_EDIT_ITEM)
static EDA_HOTKEY HkFindNextDrcMarker(_HKI("Find Next DRC Marker"), HK_FIND_NEXT_DRC_MARKER, WXK_F5+GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER)
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
static EDA_HOTKEY HkEditPaste(_HKI("Paste"), HK_EDIT_PASTE, GR_KB_CTRL+ 'V',(int) wxID_PASTE)
#define GR_KB_ALT
Definition: common.h:65
static EDA_HOTKEY HkResetLocalCoord(_HKI("Reset Local Coordinates"), HK_RESET_LOCAL_COORD, ' ')
static EDA_HOTKEY HkAddPower(_HKI("Add Power"), HK_ADD_NEW_POWER, 'P', ID_PLACE_POWER_BUTT)
static EDA_HOTKEY HkMove2Drag(_HKI("Move Block -> Drag Block"), HK_MOVEBLOCK_TO_DRAGBLOCK, '\t', ID_POPUP_DRAG_BLOCK)
EDA_HOTKEY * GetDescriptorFromHotkey(int aKey, EDA_HOTKEY **aList)
Function GetDescriptorFromHotkey Return a EDA_HOTKEY * pointer from a key code for OnHotKey() functio...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Class EDA_HOTKEY_CLIENT_DATA provides client data member for hotkeys to include in command events gen...
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Handle hot key events.
static EDA_HOTKEY HkBeginWire(_HKI("Begin Wire"), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT)
bool HighlightConnectionAtPosition(wxPoint aPosition)
Highlight the connection found at aPosition.
bool DeleteItemAtCrossHair(wxDC *aDC)
Delete the item found under the cross hair.
Definition: schedit.cpp:663
static EDA_HOTKEY HkOrientNormalComponent(_HKI("Orient Normal Component"), HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL)
static EDA_HOTKEY HkAddComponent(_HKI("Add Symbol"), HK_ADD_NEW_COMPONENT, 'A', ID_SCH_PLACE_COMPONENT)
static EDA_HOTKEY HkUpdatePcbFromSch(_HKI("Update PCB from Schematic"), HK_UPDATE_PCB_FROM_SCH, WXK_F8)
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:174
#define GR_KB_SHIFT
Definition: common.h:66
static EDA_HOTKEY HkAddNoConn(_HKI("Add No Connect Flag"), HK_ADD_NOCONN_FLAG, 'Q', ID_NOCONN_BUTT)
static EDA_HOTKEY HkDrag(_HKI("Drag Item"), HK_DRAG, 'G', ID_SCH_DRAG_ITEM)
Subclass of DIALOG_SCH_FIND_BASE, which is generated by wxFormBuilder.
Class LIB_ITEM definition.
static EDA_HOTKEY HkRedo(_HKI("Redo"), HK_REDO, GR_KB_CTRL+ 'Y',(int) wxID_REDO)
static EDA_HOTKEY HkUndo(_HKI("Undo"), HK_UNDO, GR_KB_CTRL+ 'Z',(int) wxID_UNDO)
static EDA_HOTKEY HkMirrorX(_HKI("Mirror X"), HK_MIRROR_X, 'X', ID_SCH_MIRROR_X)
static EDA_HOTKEY HkFindItem(_HKI("Find Item"), HK_FIND_ITEM, 'F'+GR_KB_CTRL, ID_FIND_ITEMS)
struct EDA_HOTKEY_CONFIG g_Eeschema_Hokeys_Descr[]
static EDA_HOTKEY * common_Hotkey_List[]
static EDA_HOTKEY HkZoomRedraw(_HKI("Zoom Redraw"), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW)
static EDA_HOTKEY HkDeleteNode(_HKI("Delete Node"), HK_DELETE_NODE, WXK_BACK, ID_POPUP_SCH_DELETE_NODE)
static EDA_HOTKEY HkMove(_HKI("Move Schematic Item"), HK_MOVE_COMPONENT_OR_ITEM, 'M', ID_SCH_MOVE_ITEM)
static EDA_HOTKEY * common_basic_Hotkey_List[]
static EDA_HOTKEY HkAutoplaceFields(_HKI("Autoplace Fields"), HK_AUTOPLACE_FIELDS, 'O', ID_AUTOPLACE_FIELDS)
static EDA_HOTKEY HkInsertPin(_HKI("Repeat Pin"), HK_REPEAT_LAST, WXK_INSERT)
void SetAutoPanRequest(bool aEnable)
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg)
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
Definition: draw_frame.cpp:590
static EDA_HOTKEY HkAddGraphicPolyLine(_HKI("Add Graphic PolyLine"), HK_ADD_GRAPHIC_POLYLINE, 'I', ID_LINE_COMMENT_BUTT)
SCH_ITEM * LocateAndShowItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0, bool *aClarifySelectionMenuCancelled=nullptr)
Check the schematic at aPosition in logical (drawing) units for a item matching the types in aFilterL...
static EDA_HOTKEY HkZoomOut(_HKI("Zoom Out"), HK_ZOOM_OUT, WXK_F2, ID_KEY_ZOOM_OUT)
static EDA_HOTKEY HkSaveAs(_HKI("Save As"), HK_SAVEAS, GR_KB_SHIFT+GR_KB_CTRL+ 'S',(int) wxID_SAVEAS)
static EDA_HOTKEY HkAddHierarchicalLabel(_HKI("Add Hierarchical Label"), HK_ADD_HLABEL, 'H', ID_HIERLABEL_BUTT)
static EDA_HOTKEY HkEditComponentValue(_HKI("Edit Symbol Value"), HK_EDIT_COMPONENT_VALUE, 'V', ID_SCH_EDIT_COMPONENT_VALUE)
static EDA_HOTKEY * viewlib_Hotkey_List[]
static EDA_HOTKEY HkBeginBus(_HKI("Begin Bus"), HK_BEGIN_BUS, 'B', ID_BUS_BUTT)
static EDA_HOTKEY HkAddBusEntry(_HKI("Add Bus Entry"), HK_ADD_BUS_ENTRY, '/', ID_BUSTOBUS_ENTRY_BUTT)
static EDA_HOTKEY HkSaveAllLib(_HKI("Save All Libraries"), HK_SAVE_ALL_LIBS, 'S'+GR_KB_CTRL, ID_LIBEDIT_SAVE_ALL_LIBS)
static EDA_HOTKEY HkDelete(_HKI("Delete Item"), HK_DELETE, WXK_DELETE)
static EDA_HOTKEY HkHighlightConnection(_HKI("Highlight Connection"), ID_HOTKEY_HIGHLIGHT, 'B'+GR_KB_CTRL)
static EDA_HOTKEY HkEditCut(_HKI("Cut"), HK_EDIT_CUT, GR_KB_CTRL+ 'X',(int) wxID_CUT)
Definition the SCH_COMPONENT class for Eeschema.
static EDA_HOTKEY HkCreatePin(_HKI("Create Pin"), HK_LIBEDIT_CREATE_PIN, 'P')
class EDA_HOTKEY is a class to handle hot key commands.
Definition: hotkeys_basic.h:59
static wxString schematicSectionTitle(_HKI("Schematic Editor"))
static EDA_HOTKEY * libEdit_Hotkey_List[]
void OnLeftDClick(wxDC *aDC, const wxPoint &aPosition) override
Function OnLeftDClick called on a double click event from the drawpanel mouse handler if an editable ...
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
BLOCK_STATE_T GetState() const
static wxString libEditSectionTitle(_HKI("Library Editor"))
static EDA_HOTKEY HkMouseLeftDClick(_HKI("Mouse Left Double Click"), HK_LEFT_DCLICK, WXK_END, 0)
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[]
void OnLeftClick(wxDC *aDC, const wxPoint &aPosition) override
static EDA_HOTKEY HkFindNextItem(_HKI("Find Next Item"), HK_FIND_NEXT_ITEM, WXK_F5, wxEVT_COMMAND_FIND)
static EDA_HOTKEY HkMirrorY(_HKI("Mirror Y"), HK_MIRROR_Y, 'Y', ID_SCH_MIRROR_Y)
int GetToolId() const
Definition: draw_frame.h:496
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:182
static const KICAD_T CopyableItems[]
A scan list for schematic items that can be copied/duplicated.
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
static EDA_HOTKEY HkNew(_HKI("New"), HK_NEW, GR_KB_CTRL+ 'N',(int) wxID_NEW)
static EDA_HOTKEY HkZoomCenter(_HKI("Zoom Center"), HK_ZOOM_CENTER, WXK_F4, ID_POPUP_ZOOM_CENTER)
static EDA_HOTKEY HkInsert(_HKI("Repeat Last Item"), HK_REPEAT_LAST, WXK_INSERT)
static EDA_HOTKEY HkAddJunction(_HKI("Add Junction"), HK_ADD_JUNCTION, 'J', ID_JUNCTION_BUTT)
static EDA_HOTKEY HkLeaveSheet(_HKI("Leave Sheet"), HK_LEAVE_SHEET, GR_KB_ALT+WXK_BACK, ID_POPUP_SCH_LEAVE_SHEET)
Definition of class LIB_EDIT_FRAME.
static EDA_HOTKEY HkZoomSelection(_HKI("Zoom to Selection"), HK_ZOOM_SELECTION, GR_KB_CTRL+WXK_F5, ID_ZOOM_SELECTION)
static EDA_HOTKEY HkOpen(_HKI("Open"), HK_OPEN, GR_KB_CTRL+ 'O',(int) wxID_OPEN)
static wxString libEditSectionTag(wxT("[libedit]"))
wxString g_CommonSectionTag
static EDA_HOTKEY HkEditComponentWithLibedit(_HKI("Edit with Symbol Editor"), HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E'+GR_KB_CTRL, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP)
static EDA_HOTKEY HkRotate(_HKI("Rotate Item"), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE)
static EDA_HOTKEY HkZoomAuto(_HKI("Fit on Screen"), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE)
#define GR_KB_CTRL
Definition: common.h:64
#define _HKI(x)
static EDA_HOTKEY HkSave(_HKI("Save"), HK_SAVE, GR_KB_CTRL+ 'S',(int) wxID_SAVE)
static wxString commonSectionTitle(_HKI("Common"))
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
void Process_Special_Functions(wxCommandEvent &event)
Definition: schedit.cpp:54
static EDA_HOTKEY HkPrint(_HKI("Print"), HK_PRINT, GR_KB_CTRL+ 'P',(int) wxID_PRINT)
int m_IdMenuEvent
Definition: hotkeys_basic.h:68
static EDA_HOTKEY HkMouseLeftClick(_HKI("Mouse Left Click"), HK_LEFT_CLICK, WXK_RETURN, 0)
EDA_HOTKEY * GetDescriptorFromCommand(int aCommand, EDA_HOTKEY **aList)
Function GetDescriptorFromCommand Returns a EDA_HOTKEY* pointer from a hot key identifier.
static EDA_HOTKEY HkEditComponentReference(_HKI("Edit Symbol Reference"), HK_EDIT_COMPONENT_REFERENCE, 'U', ID_SCH_EDIT_COMPONENT_REFERENCE)
void SetCommand(BLOCK_COMMAND_T aCommand)
static EDA_HOTKEY HkAddHierSheet(_HKI("Add Sheet"), HK_ADD_HIER_SHEET, 'S', ID_SHEET_SYMBOL_BUTT)
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
static EDA_HOTKEY HkAddGlobalLabel(_HKI("Add Global Label"), HK_ADD_GLABEL, GR_KB_CTRL+ 'H', ID_GLABEL_BUTT)
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]