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 <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 HkDuplicateItem( _HKI( "Duplicate Component or Label" ),
192  HK_DUPLICATE_ITEM, 'C',
194 
195 static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
196 static EDA_HOTKEY HkCopyBlock( _HKI( "Copy Block" ), HK_COPY_BLOCK, 'C' + GR_KB_CTRL, wxID_COPY );
197 static EDA_HOTKEY HkPasteBlock( _HKI( "Paste Block" ), HK_PASTE_BLOCK, 'V' + GR_KB_CTRL, wxID_PASTE );
198 static EDA_HOTKEY HkCutBlock( _HKI( "Cut Block" ), HK_CUT_BLOCK, 'X' + GR_KB_CTRL, wxID_CUT );
199 static EDA_HOTKEY HkMove2Drag( _HKI( "Move Block -> Drag Block" ),
201 static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
202 static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
203 static EDA_HOTKEY HkDeleteNode( _HKI( "Delete Node" ), HK_DELETE_NODE, WXK_BACK,
205 
206 static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL, ID_FIND_ITEMS );
207 static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
208  wxEVT_COMMAND_FIND );
209 static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE,
210  'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
211 static EDA_HOTKEY HkFindNextDrcMarker( _HKI( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
212  WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
213 static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION );
214 
215 // Special keys for library editor:
216 static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
217 static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
218 static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
219 
220 // Load/save files
221 static EDA_HOTKEY HkSaveLib( _HKI( "Save Library" ), HK_SAVE_LIB, 'S' + GR_KB_CTRL + GR_KB_ALT, ID_LIBEDIT_SAVE_LIBRARY );
222 static EDA_HOTKEY HkSavePart( _HKI( "Save Part" ), HK_SAVE_PART, 'S' + GR_KB_CTRL, ID_LIBEDIT_SAVE_PART );
223 static EDA_HOTKEY HkSaveSchematic( _HKI( "Save Schematic" ), HK_SAVE_SCH, 'S' + GR_KB_CTRL );
224 static EDA_HOTKEY HkLoadSchematic( _HKI( "Load Schematic" ), HK_LOAD_SCH, 'L' + GR_KB_CTRL );
225 
226 // Autoplace fields
227 static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
229 
230 static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UPDATE_PCB_FROM_SCH,
231  WXK_F8 );
232 
233 // Higtlight connection
234 static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
235  'B' + GR_KB_CTRL );
236 
237 // List of common hotkey descriptors
239 {
240  &HkHelp,
241  &HkZoomIn,
242  &HkZoomOut,
243  &HkZoomRedraw,
244  &HkZoomCenter,
245  &HkZoomAuto,
248  &HkEdit,
249  &HkDelete,
250  &HkRotate,
251  &HkDrag,
252  &HkUndo,
253  &HkRedo,
256  NULL
257 };
258 
259 // List of common hotkey descriptors, for the library vierwer
261 {
262  &HkHelp,
263  &HkZoomIn,
264  &HkZoomOut,
265  &HkZoomRedraw,
266  &HkZoomCenter,
267  &HkZoomAuto,
271  NULL
272 };
273 
274 // List of hotkey descriptors for schematic
276 {
279  &HkFindItem,
282  &HkFindReplace,
283  &HkInsert,
284  &HkMove2Drag,
285  &HkCopyBlock,
286  &HkPasteBlock,
287  &HkCutBlock,
288  &HkMove,
291  &HkAddPower,
292  &HkMirrorX,
293  &HkMirrorY,
299  &HkBeginWire,
300  &HkBeginBus,
302  &HkAddLabel,
305  &HkAddJunction,
306  &HkAddNoConn,
309  &HkAddBusEntry,
314  &HkLeaveSheet,
315  &HkDeleteNode,
317  NULL
318 };
319 
320 // List of hotkey descriptors for library editor
322 {
323  &HkSaveLib,
324  &HkSavePart,
325  &HkCreatePin,
326  &HkInsertPin,
327  &HkMoveLibItem,
328  &HkMirrorX,
329  &HkMirrorY,
330  &HkCopyBlock,
331  &HkPasteBlock,
332  &HkCutBlock,
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 {
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 {
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 {
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 {
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_PASTE_BLOCK:
482  case HK_COPY_BLOCK: // Copy block to paste buffer.
483  case HK_CUT_BLOCK:
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  bool itemInEdit = m_drawItem && m_drawItem->InEditMode();
678 
679  bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
680 
681  switch( hotKey->m_Idcommand )
682  {
683  default:
684  case HK_NOT_FOUND:
685  return false;
686 
687  case HK_HELP: // Display Current hotkey list
688  DisplayHotkeyList( this, g_Libedit_Hokeys_Descr );
689  break;
690 
691  case HK_RESET_LOCAL_COORD: // Reset the relative coord
693  break;
694 
695  case HK_LEFT_CLICK:
696  OnLeftClick( aDC, aPosition );
697  break;
698 
699  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
700  OnLeftClick( aDC, aPosition );
701  OnLeftDClick( aDC, aPosition );
702  break;
703 
704  case HK_ZOOM_IN:
705  case HK_ZOOM_OUT:
706  case HK_ZOOM_REDRAW:
707  case HK_ZOOM_CENTER:
708  case HK_ZOOM_AUTO:
709  case HK_PASTE_BLOCK:
710  case HK_COPY_BLOCK:
711  case HK_CUT_BLOCK:
712  cmd.SetId( hotKey->m_IdMenuEvent );
713  GetEventHandler()->ProcessEvent( cmd );
714  break;
715 
716  case HK_UNDO:
717  case HK_REDO:
718  if( !itemInEdit )
719  {
720  cmd.SetId( hotKey->m_IdMenuEvent );
721  GetEventHandler()->ProcessEvent( cmd );
722  }
723  break;
724 
725  case HK_REPEAT_LAST:
726  if( ! itemInEdit )
727  {
729  ( m_lastDrawItem->Type() == LIB_PIN_T ) )
731  }
732  break;
733 
734  case HK_EDIT:
735  if( !itemInEdit )
736  m_drawItem = LocateItemUsingCursor( aPosition );
737 
738  if( m_drawItem )
739  {
740  switch( m_drawItem->Type() )
741  {
742  case LIB_PIN_T:
743  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
744  GetEventHandler()->ProcessEvent( cmd );
745  break;
746 
747  case LIB_ARC_T:
748  case LIB_CIRCLE_T:
749  case LIB_RECTANGLE_T:
750  case LIB_POLYLINE_T:
751  case LIB_TEXT_T:
752  cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
753  GetEventHandler()->ProcessEvent( cmd );
754  break;
755 
756  case LIB_FIELD_T:
758  GetEventHandler()->ProcessEvent( cmd );
759  break;
760 
761  default:
762  break;
763  }
764  }
765  break;
766 
767  case HK_ROTATE:
768  if( blocInProgress )
769  {
771  HandleBlockPlace( aDC );
772  }
773  else
774  {
775  if ( !itemInEdit )
776  m_drawItem = LocateItemUsingCursor( aPosition );
777 
778  if( m_drawItem )
779  {
780  cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
781  GetEventHandler()->ProcessEvent( cmd );
782  }
783  }
784  break;
785 
787  if( ! itemInEdit )
788  {
789  SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
790  OnLeftClick( aDC, aPosition );
791  }
792  break;
793 
794  case HK_DELETE:
795  if( !itemInEdit )
796  m_drawItem = LocateItemUsingCursor( aPosition );
797 
798  if( m_drawItem && !m_drawItem->InEditMode() )
799  {
800  cmd.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
802  }
803  break;
804 
806  if( !itemInEdit )
807  {
808  m_drawItem = LocateItemUsingCursor( aPosition );
809 
810  if( m_drawItem )
811  {
814  }
815  }
816  break;
817 
818  case HK_DRAG:
819  if( !itemInEdit )
820  {
821  m_drawItem = LocateItemUsingCursor( aPosition );
822 
823  if( m_drawItem && !m_drawItem->InEditMode() )
824  {
825  cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
827  }
828  }
829  break;
830 
831  case HK_MIRROR_Y: // Mirror Y
832  if( !itemInEdit )
833  m_drawItem = LocateItemUsingCursor( aPosition );
834 
835  cmd.SetId( ID_LIBEDIT_MIRROR_Y );
836  GetEventHandler()->ProcessEvent( cmd );
837  break;
838 
839  case HK_MIRROR_X: // Mirror X
840  if( !itemInEdit )
841  m_drawItem = LocateItemUsingCursor( aPosition );
842 
843  cmd.SetId( ID_LIBEDIT_MIRROR_X );
844  GetEventHandler()->ProcessEvent( cmd );
845  break;
846  }
847 
848  // Hot key handled.
849  return true;
850 }
851 
852 
854 {
855  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
856 
857  if( HK_Descr == NULL )
858  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
859 
860  return HK_Descr;
861 }
862 
863 
864 bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
865 {
866  if( aHotKey == 0 )
867  return false;
868 
869  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
870  cmd.SetEventObject( this );
871 
872  /* Convert lower to upper case (the usual toupper function has problem with non ascii
873  * codes like function keys */
874  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
875  aHotKey += 'A' - 'a';
876 
877  EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
878 
879  if( HK_Descr == NULL )
880  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
881 
882  if( HK_Descr == NULL )
883  return false;
884 
885  switch( HK_Descr->m_Idcommand )
886  {
887  default:
888  case HK_NOT_FOUND:
889  return false;
890 
891  case HK_HELP: // Display Current hotkey list
892  DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr );
893  break;
894 
895  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
897  break;
898 
899  case HK_LEFT_CLICK:
900  OnLeftClick( aDC, aPosition );
901  break;
902 
903  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
904  OnLeftClick( aDC, aPosition );
905  OnLeftDClick( aDC, aPosition );
906  break;
907 
908  case HK_ZOOM_IN:
909  cmd.SetId( ID_POPUP_ZOOM_IN );
910  GetEventHandler()->ProcessEvent( cmd );
911  break;
912 
913  case HK_ZOOM_OUT:
914  cmd.SetId( ID_POPUP_ZOOM_OUT );
915  GetEventHandler()->ProcessEvent( cmd );
916  break;
917 
918  case HK_ZOOM_REDRAW:
919  cmd.SetId( ID_ZOOM_REDRAW );
920  GetEventHandler()->ProcessEvent( cmd );
921  break;
922 
923  case HK_ZOOM_CENTER:
924  cmd.SetId( ID_POPUP_ZOOM_CENTER );
925  GetEventHandler()->ProcessEvent( cmd );
926  break;
927 
928  case HK_ZOOM_AUTO:
929  cmd.SetId( ID_ZOOM_PAGE );
930  GetEventHandler()->ProcessEvent( cmd );
931  break;
932  }
933 
934  return true;
935 }
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:212
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:269
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 HkSaveLib(_HKI("Save Library"), HK_SAVE_LIB, 'S'+GR_KB_CTRL+GR_KB_ALT, ID_LIBEDIT_SAVE_LIBRARY)
static EDA_HOTKEY * schematic_Hotkey_List[]
bool IsNew() const
Definition: base_struct.h:230
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:337
static EDA_HOTKEY HkSaveSchematic(_HKI("Save Schematic"), HK_SAVE_SCH, 'S'+GR_KB_CTRL)
static LIB_ITEM * m_drawItem
Definition: libeditframe.h:100
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:163
bool InEditMode() const
Return the draw item editing mode status.
wxFindReplaceData * m_findReplaceData
Definition: schframe.h:128
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 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:64
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:532
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)
Check the schematic at aPosition in logical (drawing) units for a item matching the types in aFilterL...
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
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:657
static EDA_HOTKEY HkOrientNormalComponent(_HKI("Orient Normal Component"), HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL)
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().
#define GR_KB_SHIFT
Definition: common.h:65
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)
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 HkCopyBlock(_HKI("Copy Block"), HK_COPY_BLOCK, 'C'+GR_KB_CTRL, wxID_COPY)
static EDA_HOTKEY HkSavePart(_HKI("Save Part"), HK_SAVE_PART, 'S'+GR_KB_CTRL, ID_LIBEDIT_SAVE_PART)
static EDA_HOTKEY HkAddComponent(_HKI("Add Component"), HK_ADD_NEW_COMPONENT, 'A', ID_SCH_PLACE_COMPONENT)
static LIB_ITEM * m_lastDrawItem
Definition: libeditframe.h:99
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:546
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 HkLoadSchematic(_HKI("Load Schematic"), HK_LOAD_SCH, 'L'+GR_KB_CTRL)
static EDA_HOTKEY HkPasteBlock(_HKI("Paste Block"), HK_PASTE_BLOCK, 'V'+GR_KB_CTRL, wxID_PASTE)
static EDA_HOTKEY HkHighlightConnection(_HKI("Highlight Connection"), ID_HOTKEY_HIGHLIGHT, 'B'+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 ...
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)
virtual void HandleBlockPlace(wxDC *DC) override
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:471
void SetCurItem(SCH_ITEM *aItem)
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:165
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 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 HkDuplicateItem(_HKI("Duplicate Component or Label"), HK_DUPLICATE_ITEM, 'C', ID_POPUP_SCH_DUPLICATE_ITEM)
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:503
static EDA_HOTKEY HkZoomAuto(_HKI("Fit on Screen"), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE)
#define GR_KB_CTRL
Definition: common.h:63
#define _HKI(x)
static wxString commonSectionTitle(_HKI("Common"))
static EDA_HOTKEY HkCutBlock(_HKI("Cut Block"), HK_CUT_BLOCK, 'X'+GR_KB_CTRL, wxID_CUT)
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[]