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-2017 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 <schframe.h>
34 #include <class_drawpanel.h>
35 
36 #include <general.h>
37 #include <libeditframe.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_POPUP_ZOOM_IN );
107 #else
108 static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_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_POPUP_ZOOM_OUT );
114 #else
115 static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', ID_POPUP_ZOOM_OUT );
116 #endif
117 
118 static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
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 // Undo
124 static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
125 
126 // Redo
127 #if !defined( __WXMAC__ )
128 static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
129 #else
130 static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z',
131  (int) wxID_REDO );
132 #endif
133 
134 // mouse click command:
135 static EDA_HOTKEY HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 );
136 static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK, WXK_END, 0 );
137 
138 // Schematic editor
139 static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
140 static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
141 static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K',
143 
144 static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L', ID_LABEL_BUTT );
145 static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
147 static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H',
148  ID_GLABEL_BUTT );
149 static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J', ID_JUNCTION_BUTT );
150 static EDA_HOTKEY HkAddComponent( _HKI( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A',
152 static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P',
154 static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q',
155  ID_NOCONN_BUTT );
156 static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S',
158 static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/',
160 static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z',
162 static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE,
163  'I', ID_LINE_COMMENT_BUTT );
164 static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
166 static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y',
167  ID_SCH_MIRROR_Y );
168 static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
169  ID_SCH_MIRROR_X );
170 static EDA_HOTKEY HkOrientNormalComponent( _HKI( "Orient Normal Component" ),
172 static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE );
173 static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E', ID_SCH_EDIT_ITEM );
174 static EDA_HOTKEY HkEditComponentValue( _HKI( "Edit Component Value" ),
177 static EDA_HOTKEY HkEditComponentReference( _HKI( "Edit Component Reference" ),
180 static EDA_HOTKEY HkEditComponentFootprint( _HKI( "Edit Component Footprint" ),
183 static EDA_HOTKEY HkEditComponentWithLibedit( _HKI( "Edit with Component Editor" ),
185  'E' + GR_KB_CTRL,
187 static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ),
190 
191 static EDA_HOTKEY HkCopyComponentOrText( _HKI( "Copy Component or Label" ),
194 
195 static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
196 static EDA_HOTKEY HkSaveBlock( _HKI( "Save Block" ), HK_SAVE_BLOCK, 'C' + GR_KB_CTRL, wxID_COPY );
197 static EDA_HOTKEY HkMove2Drag( _HKI( "Move Block -> Drag Block" ),
199 static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
200 static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
201 static EDA_HOTKEY HkDeleteNode( _HKI( "Delete Node" ), HK_DELETE_NODE, WXK_BACK,
203 
204 static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL, ID_FIND_ITEMS );
205 static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
206  wxEVT_COMMAND_FIND );
207 static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE,
208  'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
209 static EDA_HOTKEY HkFindNextDrcMarker( _HKI( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
210  WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
211 static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION );
212 
213 // Special keys for library editor:
214 static EDA_HOTKEY HkLoadPart( _HKI( "Load Component" ), HK_LIBEDIT_LOAD_PART, 'L' + GR_KB_CTRL );
215 static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
216 static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
217 static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
218 
219 // Load/save files
220 static EDA_HOTKEY HkSaveLib( _HKI( "Save Library" ), HK_SAVE_LIB, 'S' + GR_KB_CTRL );
221 static EDA_HOTKEY HkSaveSchematic( _HKI( "Save Schematic" ), HK_SAVE_SCH, 'S' + GR_KB_CTRL );
222 static EDA_HOTKEY HkLoadSchematic( _HKI( "Load Schematic" ), HK_LOAD_SCH, 'L' + GR_KB_CTRL );
223 
224 // Autoplace fields
225 static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
227 
228 static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematics" ), HK_UPDATE_PCB_FROM_SCH,
229  WXK_F8 );
230 
231 // Higtlight connection
232 static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
233  'X' + GR_KB_CTRL );
234 
235 // List of common hotkey descriptors
237 {
238  &HkHelp,
239  &HkZoomIn,
240  &HkZoomOut,
241  &HkZoomRedraw,
242  &HkZoomCenter,
243  &HkZoomAuto,
246  &HkEdit,
247  &HkDelete,
248  &HkRotate,
249  &HkDrag,
250  &HkUndo,
251  &HkRedo,
254  NULL
255 };
256 
257 // List of common hotkey descriptors, for the library vierwer
259 {
260  &HkHelp,
261  &HkZoomIn,
262  &HkZoomOut,
263  &HkZoomRedraw,
264  &HkZoomCenter,
265  &HkZoomAuto,
269  NULL
270 };
271 
272 // List of hotkey descriptors for schematic
274 {
277  &HkFindItem,
280  &HkFindReplace,
281  &HkInsert,
282  &HkMove2Drag,
283  &HkSaveBlock,
284  &HkMove,
287  &HkAddPower,
288  &HkMirrorX,
289  &HkMirrorY,
295  &HkBeginWire,
296  &HkBeginBus,
298  &HkAddLabel,
301  &HkAddJunction,
302  &HkAddNoConn,
305  &HkAddBusEntry,
310  &HkLeaveSheet,
311  &HkDeleteNode,
313  NULL
314 };
315 
316 // List of hotkey descriptors for library editor
318 {
319  &HkSaveLib,
320  &HkLoadPart,
321  &HkCreatePin,
322  &HkInsertPin,
323  &HkMoveLibItem,
324  &HkMirrorX,
325  &HkMirrorY,
326  NULL
327 };
328 
329 // List of hotkey descriptors for library viewer (currently empty
331 {
332  NULL
333 };
334 
335 // Keyword Identifiers (tags) in key code configuration file (section names)
336 // (.m_SectionTag member of a EDA_HOTKEY_CONFIG)
337 static wxString schematicSectionTag( wxT( "[eeschema]" ) );
338 static wxString libEditSectionTag( wxT( "[libedit]" ) );
339 
340 // Titles for hotkey editor and hotkey display
341 static wxString commonSectionTitle( _HKI( "Common" ) );
342 static wxString schematicSectionTitle( _HKI( "Schematic Editor" ) );
343 static wxString libEditSectionTitle( _HKI( "Library Editor" ) );
344 
345 // list of sections and corresponding hotkey list for Eeschema (used to create
346 // an hotkey config file)
348 {
352  { NULL, NULL, NULL }
353 };
354 
355 // list of sections and corresponding hotkey list for the schematic editor
356 // (used to list current hotkeys)
358 {
361  { NULL, NULL, NULL }
362 };
363 
364 // list of sections and corresponding hotkey list for the component editor
365 // (used to list current hotkeys)
367 {
370  { NULL, NULL, NULL }
371 };
372 
373 // list of sections and corresponding hotkey list for the component browser
374 // (used to list current hotkeys)
376 {
378  { NULL, NULL, NULL }
379 };
380 
381 
383 {
384  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
385 
386  if( HK_Descr == NULL )
387  HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
388 
389  return HK_Descr;
390 }
391 
392 
393 /*
394  * Hot keys. Some commands are relative to the item under the mouse cursor
395  * Commands are case insensitive
396  */
397 bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
398 {
399  if( aHotKey == 0 )
400  return false;
401 
402  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
403 
404  SCH_SCREEN* screen = GetScreen();
405 
406  // itemInEdit == false means no item currently edited. We can ask for editing a new item
407  bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetFlags();
408 
409  // blocInProgress == false means no block in progress.
410  // Because a drag command uses a drag block, false means also no drag in progress
411  // If false, we can ask for editing a new item
412  bool blocInProgress = screen->m_BlockLocate.GetState() != STATE_NO_BLOCK;
413 
414  // notBusy == true means no item currently edited and no other command in progress
415  // We can change active tool and ask for editing a new item
416  bool notBusy = (!itemInEdit) && (!blocInProgress);
417 
418  /* Convert lower to upper case (the usual toupper function has problem
419  * with non ascii codes like function keys */
420  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
421  aHotKey += 'A' - 'a';
422 
423  // Search command from key :
424  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
425 
426  if( hotKey == NULL )
427  hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List );
428 
429  if( hotKey == NULL )
430  return false;
431 
432  switch( hotKey->m_Idcommand )
433  {
434  default:
435  case HK_NOT_FOUND:
436  return false;
437 
438  case HK_HELP: // Display Current hotkey list
439  DisplayHotkeyList( this, g_Schematic_Hokeys_Descr );
440  break;
441 
442  case HK_RESET_LOCAL_COORD: // Reset the relative coord
444  break;
445 
446  case ID_HOTKEY_HIGHLIGHT:
447  if( notBusy )
449  break;
450 
451  case HK_LEFT_CLICK:
452  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
453  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
454  {
455  GetCanvas()->SetAutoPanRequest( false );
456  HandleBlockPlace( aDC );
457  }
458  else if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
459  {
460  OnLeftClick( aDC, aPosition );
461 
462  if( hotKey->m_Idcommand == HK_LEFT_DCLICK )
463  OnLeftDClick( aDC, aPosition );
464  }
465  break;
466 
467  case HK_ZOOM_IN:
468  case HK_ZOOM_OUT:
469  case HK_ZOOM_REDRAW:
470  case HK_ZOOM_CENTER:
471  case HK_ZOOM_AUTO:
472  case HK_ZOOM_SELECTION:
473  case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
474  case HK_SAVE_BLOCK: // Copy block to paste buffer.
475  cmd.SetId( hotKey->m_IdMenuEvent );
476  GetEventHandler()->ProcessEvent( cmd );
477  break;
478 
479  case HK_DELETE:
480  if( notBusy )
481  DeleteItemAtCrossHair( aDC );
482  break;
483 
484  case HK_REPEAT_LAST:
485  if( notBusy )
486  RepeatDrawItem( aDC );
487  break;
488 
490  // this key terminates a new line/bus/wire in progress
491  if( aItem && aItem->IsNew() &&
492  aItem->Type() == SCH_LINE_T )
493  {
494  cmd.SetId( hotKey->m_IdMenuEvent );
495  GetEventHandler()->ProcessEvent( cmd );
496  }
497  break;
498 
499  case HK_UNDO: // Hot keys that map to command IDs that cannot be called
500  case HK_REDO: // while busy performing another command.
501  case HK_FIND_ITEM:
502  case HK_FIND_REPLACE:
503  case HK_DELETE_NODE:
504  case HK_LEAVE_SHEET:
505  if( notBusy )
506  {
507  cmd.SetId( hotKey->m_IdMenuEvent );
508  GetEventHandler()->ProcessEvent( cmd );
509  }
510  break;
511 
512  case HK_FIND_NEXT_ITEM:
514  if( notBusy )
515  {
516  wxFindDialogEvent event( hotKey->m_IdMenuEvent, GetId() );
517  event.SetEventObject( this );
518  event.SetFlags( m_findReplaceData->GetFlags() );
519  event.SetFindString( m_findReplaceData->GetFindString() );
520  GetEventHandler()->ProcessEvent( event );
521  }
522  break;
523 
524  case HK_ADD_NEW_COMPONENT: // Add component
525  case HK_ADD_NEW_POWER: // Add power component
526  case HK_ADD_LABEL:
527  case HK_ADD_HLABEL:
528  case HK_ADD_GLABEL:
529  case HK_ADD_JUNCTION:
530  case HK_ADD_WIRE_ENTRY:
531  case HK_ADD_BUS_ENTRY:
532  case HK_ADD_HIER_SHEET:
533  case HK_ADD_GRAPHIC_TEXT:
535  case HK_ADD_NOCONN_FLAG: // Add a no connected flag
536  case HK_BEGIN_BUS:
537  case HK_BEGIN_WIRE:
538  if( notBusy )
539  {
540  EDA_HOTKEY_CLIENT_DATA data( aPosition );
541  cmd.SetInt( aHotKey );
542  cmd.SetClientObject( &data );
543  cmd.SetId( hotKey->m_IdMenuEvent );
544  GetEventHandler()->ProcessEvent( cmd );
545  }
546  else if( aItem && aItem->IsNew() )
547  {
548  // If the item is a bus or a wire, a begin command is not possible.
549  if( (GetToolId() == ID_BUS_BUTT) && (aItem->Type() == SCH_LINE_T) )
550  {
551  SCH_LINE* segment = (SCH_LINE*) aItem;
552 
553  if( segment->GetLayer() != LAYER_BUS )
554  break;
555 
556  // Bus in progress:
557  OnLeftClick( aDC, aPosition );
558  }
559  else if( (GetToolId() == ID_WIRE_BUTT ) && (aItem->Type() == SCH_LINE_T) )
560  {
561  SCH_LINE* segment = (SCH_LINE*) aItem;
562 
563  if( segment->GetLayer() != LAYER_WIRE )
564  break;
565 
566  // Wire in progress:
567  OnLeftClick( aDC, aPosition );
568  }
569  }
570  break;
571 
572  case HK_COPY_COMPONENT_OR_LABEL: // Duplicate component or text/label
573  if( itemInEdit )
574  break;
575 
576  if( aItem == NULL )
577  {
578  aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::CopyableItems );
579 
580  if( aItem == NULL )
581  break;
582  }
583 
584  cmd.SetId( hotKey->m_IdMenuEvent );
585  wxPostEvent( this, cmd );
586  break;
587 
588  case HK_DRAG: // Start drag
589  case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
590  if( ! notBusy )
591  break;
592 
593  // Fall through
594  case HK_EDIT:
595  // Edit schematic item. Do not allow sheet edition when mowing
596  // Because a sheet edition can be complex.
597  if( itemInEdit && screen->GetCurItem()->Type() == SCH_SHEET_T )
598  break;
599 
600  // Fall through
601  case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
602  case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
603  case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
604  case HK_MIRROR_Y: // Mirror Y
605  case HK_MIRROR_X: // Mirror X
606  case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
607  case HK_ROTATE: // Rotate schematic item.
608  case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
609  case HK_AUTOPLACE_FIELDS: // Autoplace all fields around component
610  {
611  // force a new item search on hot keys at current position,
612  // if there is no currently edited item,
613  // to avoid using a previously selected item
614  if( ! itemInEdit )
615  screen->SetCurItem( NULL );
616  EDA_HOTKEY_CLIENT_DATA data( aPosition );
617  cmd.SetInt( hotKey->m_Idcommand );
618  cmd.SetClientObject( &data );
619  cmd.SetId( hotKey->m_IdMenuEvent );
620  GetEventHandler()->ProcessEvent( cmd );
621  }
622  break;
623  }
624 
625  // Hot key handled.
626  return true;
627 }
628 
629 
631 {
632  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
633 
634  if( HK_Descr == NULL )
635  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
636 
637  return HK_Descr;
638 }
639 
640 
641 bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
642 {
643  if( aHotKey == 0 )
644  return false;
645 
646  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
647 
648  cmd.SetEventObject( this );
649 
650  /* Convert lower to upper case (the usual toupper function has problem
651  * with non ascii codes like function keys */
652  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
653  aHotKey += 'A' - 'a';
654 
655  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
656 
657  if( hotKey == NULL )
658  hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List );
659 
660  if( hotKey == NULL )
661  return false;
662 
663  bool itemInEdit = m_drawItem && m_drawItem->InEditMode();
664 
665  bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
666 
667  switch( hotKey->m_Idcommand )
668  {
669  default:
670  case HK_NOT_FOUND:
671  return false;
672 
673  case HK_HELP: // Display Current hotkey list
674  DisplayHotkeyList( this, g_Libedit_Hokeys_Descr );
675  break;
676 
677  case HK_RESET_LOCAL_COORD: // Reset the relative coord
679  break;
680 
681  case HK_LEFT_CLICK:
682  OnLeftClick( aDC, aPosition );
683  break;
684 
685  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
686  OnLeftClick( aDC, aPosition );
687  OnLeftDClick( aDC, aPosition );
688  break;
689 
690  case HK_ZOOM_IN:
691  case HK_ZOOM_OUT:
692  case HK_ZOOM_REDRAW:
693  case HK_ZOOM_CENTER:
694  case HK_ZOOM_AUTO:
695  cmd.SetId( hotKey->m_IdMenuEvent );
696  GetEventHandler()->ProcessEvent( cmd );
697  break;
698 
699  case HK_UNDO:
700  case HK_REDO:
701  if( !itemInEdit )
702  {
703  cmd.SetId( hotKey->m_IdMenuEvent );
704  GetEventHandler()->ProcessEvent( cmd );
705  }
706  break;
707 
708  case HK_REPEAT_LAST:
709  if( ! itemInEdit )
710  {
712  ( m_lastDrawItem->Type() == LIB_PIN_T ) )
714  }
715  break;
716 
717  case HK_EDIT:
718  if( !itemInEdit )
719  m_drawItem = LocateItemUsingCursor( aPosition );
720 
721  if( m_drawItem )
722  {
723  switch( m_drawItem->Type() )
724  {
725  case LIB_PIN_T:
726  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
727  GetEventHandler()->ProcessEvent( cmd );
728  break;
729 
730  case LIB_ARC_T:
731  case LIB_CIRCLE_T:
732  case LIB_RECTANGLE_T:
733  case LIB_POLYLINE_T:
734  case LIB_TEXT_T:
735  cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
736  GetEventHandler()->ProcessEvent( cmd );
737  break;
738 
739  case LIB_FIELD_T:
741  GetEventHandler()->ProcessEvent( cmd );
742  break;
743 
744  default:
745  break;
746  }
747  }
748  break;
749 
750  case HK_ROTATE:
751  if( blocInProgress )
752  {
754  HandleBlockPlace( aDC );
755  }
756  else
757  {
758  if ( !itemInEdit )
759  m_drawItem = LocateItemUsingCursor( aPosition );
760 
761  if( m_drawItem )
762  {
763  cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
764  GetEventHandler()->ProcessEvent( cmd );
765  }
766  }
767  break;
768 
770  LoadOneLibraryPart( cmd );
771  break;
772 
774  if( ! itemInEdit )
775  {
776  SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
777  OnLeftClick( aDC, aPosition );
778  }
779  break;
780 
781  case HK_DELETE:
782  if( !itemInEdit )
783  m_drawItem = LocateItemUsingCursor( aPosition );
784 
785  if( m_drawItem && !m_drawItem->InEditMode() )
786  {
787  cmd.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
789  }
790  break;
791 
793  if( !itemInEdit )
794  {
795  m_drawItem = LocateItemUsingCursor( aPosition );
796 
797  if( m_drawItem )
798  {
801  }
802  }
803  break;
804 
805  case HK_DRAG:
806  if( !itemInEdit )
807  {
808  m_drawItem = LocateItemUsingCursor( aPosition );
809 
810  if( m_drawItem && !m_drawItem->InEditMode() )
811  {
812  cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
814  }
815  }
816  break;
817 
818  case HK_MIRROR_Y: // Mirror Y
819  if( !itemInEdit )
820  m_drawItem = LocateItemUsingCursor( aPosition );
821 
822  cmd.SetId( ID_LIBEDIT_MIRROR_Y );
823  GetEventHandler()->ProcessEvent( cmd );
824  break;
825 
826  case HK_MIRROR_X: // Mirror X
827  if( !itemInEdit )
828  m_drawItem = LocateItemUsingCursor( aPosition );
829 
830  cmd.SetId( ID_LIBEDIT_MIRROR_X );
831  GetEventHandler()->ProcessEvent( cmd );
832  break;
833  }
834 
835  // Hot key handled.
836  return true;
837 }
838 
839 
841 {
842  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
843 
844  if( HK_Descr == NULL )
845  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
846 
847  return HK_Descr;
848 }
849 
850 
851 bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
852 {
853  if( aHotKey == 0 )
854  return false;
855 
856  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
857  cmd.SetEventObject( this );
858 
859  /* Convert lower to upper case (the usual toupper function has problem with non ascii
860  * codes like function keys */
861  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
862  aHotKey += 'A' - 'a';
863 
864  EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
865 
866  if( HK_Descr == NULL )
867  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
868 
869  if( HK_Descr == NULL )
870  return false;
871 
872  switch( HK_Descr->m_Idcommand )
873  {
874  default:
875  case HK_NOT_FOUND:
876  return false;
877 
878  case HK_HELP: // Display Current hotkey list
879  DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr );
880  break;
881 
882  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
884  break;
885 
886  case HK_LEFT_CLICK:
887  OnLeftClick( aDC, aPosition );
888  break;
889 
890  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
891  OnLeftClick( aDC, aPosition );
892  OnLeftDClick( aDC, aPosition );
893  break;
894 
895  case HK_ZOOM_IN:
896  cmd.SetId( ID_POPUP_ZOOM_IN );
897  GetEventHandler()->ProcessEvent( cmd );
898  break;
899 
900  case HK_ZOOM_OUT:
901  cmd.SetId( ID_POPUP_ZOOM_OUT );
902  GetEventHandler()->ProcessEvent( cmd );
903  break;
904 
905  case HK_ZOOM_REDRAW:
906  cmd.SetId( ID_ZOOM_REDRAW );
907  GetEventHandler()->ProcessEvent( cmd );
908  break;
909 
910  case HK_ZOOM_CENTER:
911  cmd.SetId( ID_POPUP_ZOOM_CENTER );
912  GetEventHandler()->ProcessEvent( cmd );
913  break;
914 
915  case HK_ZOOM_AUTO:
916  cmd.SetId( ID_ZOOM_PAGE );
917  GetEventHandler()->ProcessEvent( cmd );
918  break;
919  }
920 
921  return true;
922 }
Definition of the SCH_SHEET class for Eeschema.
void RepeatDrawItem(wxDC *DC)
Function RepeatDrawItem repeats 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:198
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:255
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.
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:87
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 * schematic_Hotkey_List[]
bool IsNew() const
Definition: base_struct.h:216
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:299
static EDA_HOTKEY HkSaveSchematic(_HKI("Save Schematic"), HK_SAVE_SCH, 'S'+GR_KB_CTRL)
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:91
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
static EDA_HOTKEY HkAddLabel(_HKI("Add Label"), HK_ADD_LABEL, 'L', ID_LABEL_BUTT)
static EDA_HOTKEY HkMoveLibItem(_HKI("Move Library Item"), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M')
static EDA_HOTKEY HkHelp(_HKI("Help (this window)"), HK_HELP, '?')
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
Definition: viewlibs.cpp:161
static EDA_HOTKEY HkLoadPart(_HKI("Load Component"), HK_LIBEDIT_LOAD_PART, 'L'+GR_KB_CTRL)
bool InEditMode() const
Return the draw item editing mode status.
wxFindReplaceData * m_findReplaceData
Definition: schframe.h:127
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
virtual void HandleBlockPlace(wxDC *DC) override
Function HandleBlockPlace Called after HandleBlockEnd, when a block command needs to be executed afte...
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.
#define GR_KB_ALT
Definition: common.h:65
static EDA_HOTKEY HkResetLocalCoord(_HKI("Reset Local Coordinates"), HK_RESET_LOCAL_COORD, ' ')
static EDA_HOTKEY HkZoomIn(_HKI("Zoom In"), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN)
void RepeatPinItem(wxDC *DC, LIB_PIN *Pin)
Definition: pinedit.cpp:607
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.
Definition: schframe.cpp:521
Class EDA_HOTKEY_CLIENT_DATA provides client data member for hotkeys to include in command events gen...
SCH_ITEM * LocateAndShowItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0)
Function LocateAndShowItem checks the schematic at aPosition in logical (drawing) units for a item ma...
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
static EDA_HOTKEY HkEditComponentWithLibedit(_HKI("Edit with Component Editor"), HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E'+GR_KB_CTRL, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP)
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey handle hot key events.
static EDA_HOTKEY HkBeginWire(_HKI("Begin Wire"), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT)
bool HighlightConnectionAtPosition(wxPoint aPosition)
Function HighlightConnectionAtPosition Highlight the connection found at aPosition.
bool DeleteItemAtCrossHair(wxDC *aDC)
Function DeleteItemAtCrossHair delete the item found under the cross hair.
Definition: schedit.cpp:666
static EDA_HOTKEY HkOrientNormalComponent(_HKI("Orient Normal Component"), HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL)
SCH_ITEM * GetCurItem() const
Function GetCurItem returns the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
void LoadOneLibraryPart(wxCommandEvent &event)
Function LoadOneLibraryPart loads a library component from the currently selected library...
Definition: libedit.cpp:106
#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 HkEditComponentReference(_HKI("Edit Component Reference"), HK_EDIT_COMPONENT_REFERENCE, 'U', ID_SCH_EDIT_COMPONENT_REFERENCE)
static EDA_HOTKEY HkFindItem(_HKI("Find Item"), HK_FIND_ITEM, 'F'+GR_KB_CTRL, ID_FIND_ITEMS)
static EDA_HOTKEY HkSaveBlock(_HKI("Save Block"), HK_SAVE_BLOCK, 'C'+GR_KB_CTRL, wxID_COPY)
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 HkAddComponent(_HKI("Add Component"), HK_ADD_NEW_COMPONENT, 'A', ID_SCH_PLACE_COMPONENT)
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:90
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:535
static EDA_HOTKEY HkAddGraphicPolyLine(_HKI("Add Graphic PolyLine"), HK_ADD_GRAPHIC_POLYLINE, 'I', ID_LINE_COMMENT_BUTT)
void Process_Special_Functions(wxCommandEvent &event)
static EDA_HOTKEY HkZoomSelection(_HKI("Zoom to Selection"), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION)
static EDA_HOTKEY HkAddHierarchicalLabel(_HKI("Add Hierarchical Label"), HK_ADD_HLABEL, 'H', ID_HIERLABEL_BUTT)
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 HkDelete(_HKI("Delete Item"), HK_DELETE, WXK_DELETE)
static EDA_HOTKEY HkZoomOut(_HKI("Zoom Out"), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT)
static EDA_HOTKEY HkCopyComponentOrText(_HKI("Copy Component or Label"), HK_COPY_COMPONENT_OR_LABEL, 'C', ID_POPUP_SCH_COPY_ITEM)
static EDA_HOTKEY HkLoadSchematic(_HKI("Load Schematic"), HK_LOAD_SCH, 'L'+GR_KB_CTRL)
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
Definition the SCH_COMPONENT class for Eeschema.
LIB_ITEM * LocateItemUsingCursor(const wxPoint &aPosition, const KICAD_T aFilterList[]=LIB_COLLECTOR::AllItems)
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:57
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 ...
Class SCH_LINE is a segment description base class to describe items which have 2 end points (track...
Definition: sch_line.h:42
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[]
static EDA_HOTKEY HkSaveLib(_HKI("Save Library"), HK_SAVE_LIB, 'S'+GR_KB_CTRL)
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)
virtual void HandleBlockPlace(wxDC *DC) override
Function HandleBlockPlace handles the block place command.
static EDA_HOTKEY HkMirrorY(_HKI("Mirror Y"), HK_MIRROR_Y, 'Y', ID_SCH_MIRROR_Y)
int GetToolId() const
Definition: draw_frame.h:406
void SetCurItem(SCH_ITEM *aItem)
Function SetCurItem sets the currently selected object, m_CurrentItem.
void OnLeftDClick(wxDC *DC, const wxPoint &MousePos) override
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:151
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)
static EDA_HOTKEY HkHighlightConnection(_HKI("Highlight Connection"), ID_HOTKEY_HIGHLIGHT, 'X'+GR_KB_CTRL)
static wxString libEditSectionTag(wxT("[libedit]"))
static EDA_HOTKEY HkEditComponentFootprint(_HKI("Edit Component Footprint"), HK_EDIT_COMPONENT_FOOTPRINT, 'F', ID_SCH_EDIT_COMPONENT_FOOTPRINT)
wxString g_CommonSectionTag
static EDA_HOTKEY HkEditComponentValue(_HKI("Edit Component Value"), HK_EDIT_COMPONENT_VALUE, 'V', ID_SCH_EDIT_COMPONENT_VALUE)
static EDA_HOTKEY HkUpdatePcbFromSch(_HKI("Update PCB from Schematics"), HK_UPDATE_PCB_FROM_SCH, WXK_F8)
static EDA_HOTKEY HkRotate(_HKI("Rotate Item"), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE)
virtual void OnLeftDClick(wxDC *DC, const wxPoint &MousePos)
Definition: draw_frame.cpp:492
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 wxString commonSectionTitle(_HKI("Common"))
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Definition of class LIB_EDIT_FRAME.
int m_IdMenuEvent
Definition: hotkeys_basic.h:66
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.
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[]