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 <sch_draw_panel.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 HkShowComponentDatasheet( _HKI( "Show Symbol Datasheet" ),
175 static EDA_HOTKEY HkEditComponentWithLibedit( _HKI( "Edit with Symbol Editor" ),
178 
179 static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ),
182 
183 static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate Symbol or Label" ),
184  HK_DUPLICATE_ITEM, 'C',
186 
187 static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
188 static EDA_HOTKEY HkMove2Drag( _HKI( "Move Block -> Drag Block" ),
190 static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
191 static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
192 static EDA_HOTKEY HkDeleteNode( _HKI( "Delete Node" ), HK_DELETE_NODE, WXK_BACK,
194 
195 static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL, ID_FIND_ITEMS );
196 static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
197  wxEVT_COMMAND_FIND );
198 static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE,
199  'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
200 static EDA_HOTKEY HkFindNextDrcMarker( _HKI( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
201  WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
202 static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION,
203  GR_KB_CTRL + WXK_F5, ID_ZOOM_SELECTION );
204 
205 // Special keys for library editor:
206 static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
207 static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
208 static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
209 static EDA_HOTKEY HkViewDoc( _HKI( "Show Datasheet" ), HK_LIBEDIT_VIEW_DOC, 'D' + GR_KB_CTRL,
211 
212 // Autoplace fields
213 static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
215 
216 static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UPDATE_PCB_FROM_SCH,
217  WXK_F8 );
218 
219 // Higtlight connection
220 static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
221  'B' + GR_KB_CTRL );
222 
223 // Common: hotkeys_basic.h
224 static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N', (int) wxID_NEW );
225 static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O', (int) wxID_OPEN );
226 static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', (int) wxID_SAVE );
227 static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFT + GR_KB_CTRL + 'S',
228  (int) wxID_SAVEAS );
229 static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', (int) wxID_PRINT );
230 
231 static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
232 
233 #if !defined( __WXMAC__ )
234 static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
235 #else
236 static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO,
237  GR_KB_SHIFT + GR_KB_CTRL + 'Z',
238  (int) wxID_REDO );
239 #endif
240 
241 static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X', (int) wxID_CUT );
242 static EDA_HOTKEY HkEditCopy( _HKI( "Copy" ), HK_EDIT_COPY, GR_KB_CTRL + 'C', (int) wxID_COPY );
243 static EDA_HOTKEY HkEditPaste( _HKI( "Paste" ), HK_EDIT_PASTE, GR_KB_CTRL + 'V', (int) wxID_PASTE );
244 
245 static EDA_HOTKEY HkCanvasOpenGL( _HKI( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
247 #ifdef __WXMAC__
248  GR_KB_ALT +
249 #endif
250  WXK_F11, ID_MENU_CANVAS_OPENGL );
251 static EDA_HOTKEY HkCanvasCairo( _HKI( "Switch to Modern Toolset with software graphics (fall-back)" ),
253 #ifdef __WXMAC__
254  GR_KB_ALT +
255 #endif
256  WXK_F12, ID_MENU_CANVAS_CAIRO );
257 
258 // List of common hotkey descriptors
260 {
262  &HkUndo, &HkRedo,
264  &HkHelp,
265  &HkZoomIn,
266  &HkZoomOut,
267  &HkZoomRedraw,
268  &HkZoomCenter,
269  &HkZoomAuto,
272  &HkEdit,
273  &HkDelete,
274  &HkRotate,
275  &HkDrag,
278  NULL
279 };
280 
281 // List of common hotkey descriptors, for the library vierwer
283 {
284  &HkHelp,
285  &HkZoomIn,
286  &HkZoomOut,
287  &HkZoomRedraw,
288  &HkZoomCenter,
289  &HkZoomAuto,
293  NULL
294 };
295 
296 // List of hotkey descriptors for schematic
298 {
299  &HkFindItem,
302  &HkFindReplace,
303  &HkInsert,
304  &HkMove2Drag,
305  &HkMove,
308  &HkAddPower,
309  &HkMirrorX,
310  &HkMirrorY,
317  &HkBeginWire,
318  &HkBeginBus,
320  &HkAddLabel,
323  &HkAddJunction,
324  &HkAddNoConn,
327  &HkAddBusEntry,
332  &HkLeaveSheet,
333  &HkDeleteNode,
335  &HkCanvasCairo,
337  NULL
338 };
339 
340 // List of hotkey descriptors for library editor
342 {
343  &HkCreatePin,
344  &HkInsertPin,
345  &HkMoveLibItem,
346  &HkMirrorX,
347  &HkMirrorY,
348  &HkViewDoc,
349  NULL
350 };
351 
352 // List of hotkey descriptors for library viewer (currently empty
354 {
355  NULL
356 };
357 
358 // Keyword Identifiers (tags) in key code configuration file (section names)
359 // (.m_SectionTag member of a EDA_HOTKEY_CONFIG)
360 static wxString schematicSectionTag( wxT( "[eeschema]" ) );
361 static wxString libEditSectionTag( wxT( "[libedit]" ) );
362 
363 // Titles for hotkey editor and hotkey display
364 static wxString commonSectionTitle( _HKI( "Common" ) );
365 static wxString schematicSectionTitle( _HKI( "Schematic Editor" ) );
366 static wxString libEditSectionTitle( _HKI( "Library Editor" ) );
367 
368 // list of sections and corresponding hotkey list for Eeschema (used to create
369 // an hotkey config file)
371 {
372  { &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
373  { &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
374  { &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
375  { NULL, NULL, NULL }
376 };
377 
378 // list of sections and corresponding hotkey list for the schematic editor
379 // (used to list current hotkeys)
381 {
382  { &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
383  { &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
384  { NULL, NULL, NULL }
385 };
386 
387 // list of sections and corresponding hotkey list for the component editor
388 // (used to list current hotkeys)
390 {
391  { &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
392  { &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
393  { NULL, NULL, NULL }
394 };
395 
396 // list of sections and corresponding hotkey list for the component browser
397 // (used to list current hotkeys)
399 {
400  { &g_CommonSectionTag, common_basic_Hotkey_List, &commonSectionTitle },
401  { NULL, NULL, NULL }
402 };
403 
404 
406 {
407  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
408 
409  if( HK_Descr == NULL )
410  HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
411 
412  return HK_Descr;
413 }
414 
415 
416 /*
417  * Hot keys. Some commands are relative to the item under the mouse cursor
418  * Commands are case insensitive
419  */
420 bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
421 {
422  if( aHotKey == 0 )
423  return false;
424 
425  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
426 
427  SCH_SCREEN* screen = GetScreen();
428 
429  // itemInEdit == false means no item currently edited. We can ask for editing a new item
430  bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetFlags();
431 
432  // blocInProgress == false means no block in progress.
433  // Because a drag command uses a drag block, false means also no drag in progress
434  // If false, we can ask for editing a new item
435  bool blocInProgress = screen->m_BlockLocate.GetState() != STATE_NO_BLOCK;
436 
437  // notBusy == true means no item currently edited and no other command in progress
438  // We can change active tool and ask for editing a new item
439  bool notBusy = (!itemInEdit) && (!blocInProgress);
440 
441  /* Convert lower to upper case (the usual toupper function has problem
442  * with non ascii codes like function keys */
443  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
444  aHotKey += 'A' - 'a';
445 
446  // Search command from key :
447  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
448 
449  if( hotKey == NULL )
450  hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List );
451 
452  if( hotKey == NULL )
453  return false;
454 
455  switch( hotKey->m_Idcommand )
456  {
457  default:
458  case HK_NOT_FOUND:
459  return false;
460 
461  case HK_HELP: // Display Current hotkey list
462  DisplayHotkeyList( this, g_Schematic_Hokeys_Descr );
463  break;
464 
465  case HK_RESET_LOCAL_COORD: // Reset the relative coord
467  break;
468 
469  case ID_HOTKEY_HIGHLIGHT:
470  if( notBusy )
472  break;
473 
474  case HK_LEFT_CLICK:
475  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
476  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
477  {
478  GetCanvas()->SetAutoPanRequest( false );
479  HandleBlockPlace( aDC );
480  }
481  else if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
482  {
483  auto pos = GetCrossHairPosition();
484  OnLeftClick( aDC, pos );
485 
486  if( hotKey->m_Idcommand == HK_LEFT_DCLICK )
487  OnLeftDClick( aDC, pos );
488  }
489  break;
490 
491  case HK_ZOOM_IN:
492  case HK_ZOOM_OUT:
493  case HK_ZOOM_REDRAW:
494  case HK_ZOOM_CENTER:
495  case HK_ZOOM_AUTO:
496  case HK_ZOOM_SELECTION:
497  case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
498  case HK_EDIT_PASTE:
499  case HK_EDIT_COPY: // Copy block to paste buffer.
500  case HK_EDIT_CUT:
501  cmd.SetId( hotKey->m_IdMenuEvent );
502  GetEventHandler()->ProcessEvent( cmd );
503  break;
504 
505  case HK_DELETE:
506  if( blocInProgress )
507  {
508  cmd.SetId( ID_POPUP_DELETE_BLOCK );
509  GetEventHandler()->ProcessEvent( cmd );
510  }
511  else if( notBusy )
513  break;
514 
515  case HK_REPEAT_LAST:
516  if( notBusy )
517  RepeatDrawItem();
518  break;
519 
521  // this key terminates a new line/bus/wire in progress
522  if( aItem && aItem->IsNew() &&
523  aItem->Type() == SCH_LINE_T )
524  {
525  cmd.SetId( hotKey->m_IdMenuEvent );
526  GetEventHandler()->ProcessEvent( cmd );
527  }
528  break;
529 
530  case HK_UNDO: // Hot keys that map to command IDs that cannot be called
531  case HK_REDO: // while busy performing another command.
532  case HK_FIND_ITEM:
533  case HK_FIND_REPLACE:
534  case HK_DELETE_NODE:
535  case HK_LEAVE_SHEET:
536  if( notBusy )
537  {
538  cmd.SetId( hotKey->m_IdMenuEvent );
539  GetEventHandler()->ProcessEvent( cmd );
540  }
541  break;
542 
543  case HK_FIND_NEXT_ITEM:
545  if( notBusy )
546  {
547  wxFindDialogEvent event( hotKey->m_IdMenuEvent, GetId() );
548  event.SetEventObject( this );
549  event.SetFlags( m_findReplaceData->GetFlags() );
550  event.SetFindString( m_findReplaceData->GetFindString() );
551  GetEventHandler()->ProcessEvent( event );
552  }
553  break;
554 
555  case HK_ADD_NEW_COMPONENT: // Add component
556  case HK_ADD_NEW_POWER: // Add power component
557  case HK_ADD_LABEL:
558  case HK_ADD_HLABEL:
559  case HK_ADD_GLABEL:
560  case HK_ADD_JUNCTION:
561  case HK_ADD_WIRE_ENTRY:
562  case HK_ADD_BUS_ENTRY:
563  case HK_ADD_HIER_SHEET:
564  case HK_ADD_GRAPHIC_TEXT:
566  case HK_ADD_NOCONN_FLAG: // Add a no connected flag
567  case HK_BEGIN_BUS:
568  case HK_BEGIN_WIRE:
569  if( notBusy )
570  {
571  EDA_HOTKEY_CLIENT_DATA data( aPosition );
572  cmd.SetInt( aHotKey );
573  cmd.SetClientObject( &data );
574  cmd.SetId( hotKey->m_IdMenuEvent );
575  GetEventHandler()->ProcessEvent( cmd );
576  }
577  else if( aItem && aItem->IsNew() )
578  {
579  // If the item is a bus or a wire, a begin command is not possible.
580  if( (GetToolId() == ID_BUS_BUTT) && (aItem->Type() == SCH_LINE_T) )
581  {
582  SCH_LINE* segment = (SCH_LINE*) aItem;
583 
584  if( segment->GetLayer() != LAYER_BUS )
585  break;
586 
587  // Bus in progress:
588  OnLeftClick( aDC, aPosition );
589  }
590  else if( (GetToolId() == ID_WIRE_BUTT ) && (aItem->Type() == SCH_LINE_T) )
591  {
592  SCH_LINE* segment = (SCH_LINE*) aItem;
593 
594  if( segment->GetLayer() != LAYER_WIRE )
595  break;
596 
597  // Wire in progress:
598  OnLeftClick( aDC, aPosition );
599  }
600  }
601  break;
602 
603  case HK_DUPLICATE_ITEM: // Duplicate component or text/label
604  if( itemInEdit )
605  break;
606 
607  if( aItem == NULL )
608  {
609  aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::CopyableItems );
610 
611  if( aItem == NULL )
612  break;
613  }
614 
615  cmd.SetId( hotKey->m_IdMenuEvent );
616  wxPostEvent( this, cmd );
617  break;
618 
619  case HK_DRAG: // Start drag
620  case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
621  if( ! notBusy )
622  break;
623 
624  // Fall through
625  case HK_EDIT:
626  // Edit schematic item. Do not allow sheet editing when mowing because sheet editing
627  // can be complex.
628  if( itemInEdit && screen->GetCurItem()->Type() == SCH_SHEET_T )
629  break;
630 
631  // Fall through
632  case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
633  case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
634  case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
635  case HK_SHOW_COMPONENT_DATASHEET: // Show component datasheet in browser.
636  case HK_MIRROR_Y: // Mirror Y
637  case HK_MIRROR_X: // Mirror X
638  case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
639  case HK_ROTATE: // Rotate schematic item.
640  case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
641  case HK_AUTOPLACE_FIELDS: // Autoplace all fields around component
642  case HK_CANVAS_CAIRO:
643  case HK_CANVAS_OPENGL:
644  {
645  // force a new item search on hot keys at current position,
646  // if there is no currently edited item,
647  // to avoid using a previously selected item
648  if( ! itemInEdit )
649  screen->SetCurItem( NULL );
650 
651  EDA_HOTKEY_CLIENT_DATA data( aPosition );
652  cmd.SetInt( hotKey->m_Idcommand );
653  cmd.SetClientObject( &data );
654  cmd.SetId( hotKey->m_IdMenuEvent );
655  GetEventHandler()->ProcessEvent( cmd );
656  }
657  break;
658  }
659 
660  // Hot key handled.
661  return true;
662 }
663 
664 
666 {
667  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
668 
669  if( HK_Descr == NULL )
670  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
671 
672  return HK_Descr;
673 }
674 
675 
676 bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
677 {
678  if( aHotKey == 0 )
679  return false;
680 
681  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
682 
683  cmd.SetEventObject( this );
684 
685  /* Convert lower to upper case (the usual toupper function has problem
686  * with non ascii codes like function keys */
687  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
688  aHotKey += 'A' - 'a';
689 
690  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
691 
692  if( hotKey == NULL )
693  hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List );
694 
695  if( hotKey == NULL )
696  return false;
697 
698  // itemInEdit == false means no item currently edited. We can ask for editing a new item
699  bool itemInEdit = IsEditingDrawItem();
700 
701  bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
702 
703  switch( hotKey->m_Idcommand )
704  {
705  default:
706  case HK_NOT_FOUND:
707  return false;
708 
709  case HK_HELP: // Display Current hotkey list
710  DisplayHotkeyList( this, g_Libedit_Hokeys_Descr );
711  break;
712 
713  case HK_RESET_LOCAL_COORD: // Reset the relative coord
715  break;
716 
717  case HK_LEFT_CLICK:
718  OnLeftClick( aDC, aPosition );
719  break;
720 
721  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
722  OnLeftClick( aDC, aPosition );
723  OnLeftDClick( aDC, aPosition );
724  break;
725 
726  case HK_ZOOM_IN:
727  case HK_ZOOM_OUT:
728  case HK_ZOOM_REDRAW:
729  case HK_ZOOM_CENTER:
730  case HK_ZOOM_AUTO:
731  case HK_EDIT_PASTE:
732  case HK_EDIT_COPY:
733  case HK_EDIT_CUT:
734  cmd.SetId( hotKey->m_IdMenuEvent );
735  GetEventHandler()->ProcessEvent( cmd );
736  break;
737 
738  case HK_UNDO:
739  case HK_REDO:
740  if( !itemInEdit )
741  {
742  cmd.SetId( hotKey->m_IdMenuEvent );
743  GetEventHandler()->ProcessEvent( cmd );
744  }
745  break;
746 
747  case HK_REPEAT_LAST:
748  if( ! itemInEdit )
749  {
750  if( m_lastDrawItem && !m_lastDrawItem->InEditMode() &&
751  ( m_lastDrawItem->Type() == LIB_PIN_T ) )
752  RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem );
753  }
754  break;
755 
756  case HK_EDIT:
757  if ( !itemInEdit )
758  SetDrawItem( LocateItemUsingCursor( aPosition ) );
759 
760  if( GetDrawItem() )
761  {
762  switch( GetDrawItem()->Type() )
763  {
764  case LIB_PIN_T:
765  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
766  GetEventHandler()->ProcessEvent( cmd );
767  break;
768 
769  case LIB_ARC_T:
770  case LIB_CIRCLE_T:
771  case LIB_RECTANGLE_T:
772  case LIB_POLYLINE_T:
773  case LIB_TEXT_T:
774  cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
775  GetEventHandler()->ProcessEvent( cmd );
776  break;
777 
778  case LIB_FIELD_T:
780  GetEventHandler()->ProcessEvent( cmd );
781  break;
782 
783  default:
784  break;
785  }
786  }
787  break;
788 
789  case HK_ROTATE:
790  if ( !itemInEdit && !blocInProgress )
791  SetDrawItem( LocateItemUsingCursor( aPosition ) );
792 
793  if( blocInProgress || GetDrawItem() )
794  {
795  cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
796  OnRotate( cmd );
797  }
798  break;
799 
801  if( ! itemInEdit )
802  {
803  SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
804  OnLeftClick( aDC, aPosition );
805  }
806  break;
807 
808  case HK_DELETE:
809  if( blocInProgress )
810  {
811  cmd.SetId( ID_POPUP_DELETE_BLOCK );
813  }
814  else
815  {
816  if( !itemInEdit )
817  SetDrawItem( LocateItemUsingCursor( aPosition ) );
818 
819  if( GetDrawItem() )
820  {
821  cmd.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
823  }
824  }
825  break;
826 
828  if( !itemInEdit && !blocInProgress )
829  {
830  SetDrawItem( LocateItemUsingCursor( aPosition ) );
831 
832  if( GetDrawItem() )
833  {
836  }
837  }
838  break;
839 
840  case HK_DRAG:
841  if( !itemInEdit && !blocInProgress )
842  {
843  SetDrawItem( LocateItemUsingCursor( aPosition ) );
844 
845  if( GetDrawItem() )
846  {
847  cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
849  }
850  }
851  break;
852 
853  case HK_MIRROR_Y: // Mirror Y
854  if( !itemInEdit && !blocInProgress )
855  SetDrawItem( LocateItemUsingCursor( aPosition ) );
856 
857  if( blocInProgress || GetDrawItem() )
858  {
859  cmd.SetId( ID_LIBEDIT_MIRROR_Y );
860  OnOrient( cmd );
861  }
862  break;
863 
864  case HK_MIRROR_X: // Mirror X
865  if( !itemInEdit && !blocInProgress )
866  SetDrawItem( LocateItemUsingCursor( aPosition ) );
867 
868  if( blocInProgress || GetDrawItem() )
869  {
870  cmd.SetId( ID_LIBEDIT_MIRROR_X );
871  OnOrient( cmd );
872  }
873  break;
874  }
875 
876  // Hot key handled.
877  return true;
878 }
879 
880 
882 {
883  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
884 
885  if( HK_Descr == NULL )
886  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
887 
888  return HK_Descr;
889 }
890 
891 
892 bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
893 {
894  if( aHotKey == 0 )
895  return false;
896 
897  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
898  cmd.SetEventObject( this );
899 
900  /* Convert lower to upper case (the usual toupper function has problem with non ascii
901  * codes like function keys */
902  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
903  aHotKey += 'A' - 'a';
904 
905  EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
906 
907  if( HK_Descr == NULL )
908  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
909 
910  if( HK_Descr == NULL )
911  return false;
912 
913  switch( HK_Descr->m_Idcommand )
914  {
915  default:
916  case HK_NOT_FOUND:
917  return false;
918 
919  case HK_HELP: // Display Current hotkey list
920  DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr );
921  break;
922 
923  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
925  break;
926 
927  case HK_LEFT_CLICK:
928  OnLeftClick( aDC, aPosition );
929  break;
930 
931  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
932  OnLeftClick( aDC, aPosition );
933  OnLeftDClick( aDC, aPosition );
934  break;
935 
936  case HK_ZOOM_IN:
937  cmd.SetId( ID_KEY_ZOOM_IN );
938  GetEventHandler()->ProcessEvent( cmd );
939  break;
940 
941  case HK_ZOOM_OUT:
942  cmd.SetId( ID_KEY_ZOOM_OUT );
943  GetEventHandler()->ProcessEvent( cmd );
944  break;
945 
946  case HK_ZOOM_REDRAW:
947  cmd.SetId( ID_ZOOM_REDRAW );
948  GetEventHandler()->ProcessEvent( cmd );
949  break;
950 
951  case HK_ZOOM_CENTER:
952  cmd.SetId( ID_POPUP_ZOOM_CENTER );
953  GetEventHandler()->ProcessEvent( cmd );
954  break;
955 
956  case HK_ZOOM_AUTO:
957  cmd.SetId( ID_ZOOM_PAGE );
958  GetEventHandler()->ProcessEvent( cmd );
959  break;
960  }
961 
962  return true;
963 }
Definition of the SCH_SHEET class for Eeschema.
bool DeleteItemAtCrossHair()
Delete the item found under the cross hair.
Definition: schedit.cpp:653
#define GR_KB_ALT
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:201
void RepeatDrawItem()
Repeat the last item placement if the last item was a bus, bus entry, label, or component.
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:258
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:94
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 HkCanvasCairo(_HKI("Switch to Modern Toolset with software graphics (fall-back)"), HK_CANVAS_CAIRO, WXK_F12, ID_MENU_CANVAS_CAIRO)
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:219
EDA_HOTKEY * GetHotKeyDescription(int aCommand) const override
>
static EDA_HOTKEY HkAddLabel(_HKI("Add Label"), HK_ADD_LABEL, 'L', ID_LABEL_BUTT)
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem) override
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)
static EDA_HOTKEY HkViewDoc(_HKI("Show Datasheet"), HK_LIBEDIT_VIEW_DOC, 'D'+GR_KB_CTRL, ID_LIBEDIT_VIEW_DOC)
#define GR_KB_CTRL
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)
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
Return 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.
static EDA_HOTKEY HkBeginWire(_HKI("Begin Wire"), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT)
bool HighlightConnectionAtPosition(wxPoint aPosition)
Highlight the connection found at aPosition.
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)
void OnRotate(wxCommandEvent &aEvent)
Handle the ID_SCH_ROTATE_CLOCKWISE and ID_SCH_ROTATE_COUNTERCLOCKWISE events used to rotate schematic...
Definition: schedit.cpp:850
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:196
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)
SCH_DRAW_PANEL * GetCanvas() const override
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)
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem) override
Handle hot key events.
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 HkCanvasOpenGL(_HKI("Switch to Modern Toolset with hardware-accelerated graphics (recommended)"), HK_CANVAS_OPENGL, WXK_F11, ID_MENU_CANVAS_OPENGL)
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)
Set the tool command ID to aId and sets the cursor to aCursor.
#define GR_KB_SHIFT
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 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:519
void SetCurItem(SCH_ITEM *aItem)
Sets the currently selected object, m_CurrentItem.
Definition: sch_screen.h:204
static EDA_HOTKEY HkShowComponentDatasheet(_HKI("Show Symbol Datasheet"), HK_SHOW_COMPONENT_DATASHEET, 'D'+GR_KB_CTRL, ID_POPUP_SCH_DISPLAYDOC_CMP)
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:154
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)
void OnOrient(wxCommandEvent &aEvent)
Handle the ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, and ID_SCH_ORIENT_NORMAL events used to orient schematic...
Definition: schedit.cpp:1207
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 _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
Return the current cross hair position in logical (drawing) coordinates.
void Process_Special_Functions(wxCommandEvent &event)
Definition: schedit.cpp:55
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)
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[]