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 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 HkLoadPart( _HKI( "Load Component" ), HK_LIBEDIT_LOAD_PART, 'L' + GR_KB_CTRL );
217 static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
218 static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
219 static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
220 
221 // Load/save files
222 static EDA_HOTKEY HkSaveLib( _HKI( "Save Library" ), HK_SAVE_LIB, 'S' + GR_KB_CTRL );
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  &HkLoadPart,
325  &HkCreatePin,
326  &HkInsertPin,
327  &HkMoveLibItem,
328  &HkMirrorX,
329  &HkMirrorY,
330  NULL
331 };
332 
333 // List of hotkey descriptors for library viewer (currently empty
335 {
336  NULL
337 };
338 
339 // Keyword Identifiers (tags) in key code configuration file (section names)
340 // (.m_SectionTag member of a EDA_HOTKEY_CONFIG)
341 static wxString schematicSectionTag( wxT( "[eeschema]" ) );
342 static wxString libEditSectionTag( wxT( "[libedit]" ) );
343 
344 // Titles for hotkey editor and hotkey display
345 static wxString commonSectionTitle( _HKI( "Common" ) );
346 static wxString schematicSectionTitle( _HKI( "Schematic Editor" ) );
347 static wxString libEditSectionTitle( _HKI( "Library Editor" ) );
348 
349 // list of sections and corresponding hotkey list for Eeschema (used to create
350 // an hotkey config file)
352 {
356  { NULL, NULL, NULL }
357 };
358 
359 // list of sections and corresponding hotkey list for the schematic editor
360 // (used to list current hotkeys)
362 {
365  { NULL, NULL, NULL }
366 };
367 
368 // list of sections and corresponding hotkey list for the component editor
369 // (used to list current hotkeys)
371 {
374  { NULL, NULL, NULL }
375 };
376 
377 // list of sections and corresponding hotkey list for the component browser
378 // (used to list current hotkeys)
380 {
382  { NULL, NULL, NULL }
383 };
384 
385 
387 {
388  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
389 
390  if( HK_Descr == NULL )
391  HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
392 
393  return HK_Descr;
394 }
395 
396 
397 /*
398  * Hot keys. Some commands are relative to the item under the mouse cursor
399  * Commands are case insensitive
400  */
401 bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
402 {
403  if( aHotKey == 0 )
404  return false;
405 
406  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
407 
408  SCH_SCREEN* screen = GetScreen();
409 
410  // itemInEdit == false means no item currently edited. We can ask for editing a new item
411  bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetFlags();
412 
413  // blocInProgress == false means no block in progress.
414  // Because a drag command uses a drag block, false means also no drag in progress
415  // If false, we can ask for editing a new item
416  bool blocInProgress = screen->m_BlockLocate.GetState() != STATE_NO_BLOCK;
417 
418  // notBusy == true means no item currently edited and no other command in progress
419  // We can change active tool and ask for editing a new item
420  bool notBusy = (!itemInEdit) && (!blocInProgress);
421 
422  /* Convert lower to upper case (the usual toupper function has problem
423  * with non ascii codes like function keys */
424  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
425  aHotKey += 'A' - 'a';
426 
427  // Search command from key :
428  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
429 
430  if( hotKey == NULL )
431  hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List );
432 
433  if( hotKey == NULL )
434  return false;
435 
436  switch( hotKey->m_Idcommand )
437  {
438  default:
439  case HK_NOT_FOUND:
440  return false;
441 
442  case HK_HELP: // Display Current hotkey list
443  DisplayHotkeyList( this, g_Schematic_Hokeys_Descr );
444  break;
445 
446  case HK_RESET_LOCAL_COORD: // Reset the relative coord
448  break;
449 
450  case ID_HOTKEY_HIGHLIGHT:
451  if( notBusy )
453  break;
454 
455  case HK_LEFT_CLICK:
456  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
457  if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
458  {
459  GetCanvas()->SetAutoPanRequest( false );
460  HandleBlockPlace( aDC );
461  }
462  else if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
463  {
464  OnLeftClick( aDC, aPosition );
465 
466  if( hotKey->m_Idcommand == HK_LEFT_DCLICK )
467  OnLeftDClick( aDC, aPosition );
468  }
469  break;
470 
471  case HK_ZOOM_IN:
472  case HK_ZOOM_OUT:
473  case HK_ZOOM_REDRAW:
474  case HK_ZOOM_CENTER:
475  case HK_ZOOM_AUTO:
476  case HK_ZOOM_SELECTION:
477  case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
478  case HK_PASTE_BLOCK:
479  case HK_COPY_BLOCK: // Copy block to paste buffer.
480  case HK_CUT_BLOCK:
481  cmd.SetId( hotKey->m_IdMenuEvent );
482  GetEventHandler()->ProcessEvent( cmd );
483  break;
484 
485  case HK_DELETE:
486  if( notBusy )
487  DeleteItemAtCrossHair( aDC );
488  break;
489 
490  case HK_REPEAT_LAST:
491  if( notBusy )
492  RepeatDrawItem( aDC );
493  break;
494 
496  // this key terminates a new line/bus/wire in progress
497  if( aItem && aItem->IsNew() &&
498  aItem->Type() == SCH_LINE_T )
499  {
500  cmd.SetId( hotKey->m_IdMenuEvent );
501  GetEventHandler()->ProcessEvent( cmd );
502  }
503  break;
504 
505  case HK_UNDO: // Hot keys that map to command IDs that cannot be called
506  case HK_REDO: // while busy performing another command.
507  case HK_FIND_ITEM:
508  case HK_FIND_REPLACE:
509  case HK_DELETE_NODE:
510  case HK_LEAVE_SHEET:
511  if( notBusy )
512  {
513  cmd.SetId( hotKey->m_IdMenuEvent );
514  GetEventHandler()->ProcessEvent( cmd );
515  }
516  break;
517 
518  case HK_FIND_NEXT_ITEM:
520  if( notBusy )
521  {
522  wxFindDialogEvent event( hotKey->m_IdMenuEvent, GetId() );
523  event.SetEventObject( this );
524  event.SetFlags( m_findReplaceData->GetFlags() );
525  event.SetFindString( m_findReplaceData->GetFindString() );
526  GetEventHandler()->ProcessEvent( event );
527  }
528  break;
529 
530  case HK_ADD_NEW_COMPONENT: // Add component
531  case HK_ADD_NEW_POWER: // Add power component
532  case HK_ADD_LABEL:
533  case HK_ADD_HLABEL:
534  case HK_ADD_GLABEL:
535  case HK_ADD_JUNCTION:
536  case HK_ADD_WIRE_ENTRY:
537  case HK_ADD_BUS_ENTRY:
538  case HK_ADD_HIER_SHEET:
539  case HK_ADD_GRAPHIC_TEXT:
541  case HK_ADD_NOCONN_FLAG: // Add a no connected flag
542  case HK_BEGIN_BUS:
543  case HK_BEGIN_WIRE:
544  if( notBusy )
545  {
546  EDA_HOTKEY_CLIENT_DATA data( aPosition );
547  cmd.SetInt( aHotKey );
548  cmd.SetClientObject( &data );
549  cmd.SetId( hotKey->m_IdMenuEvent );
550  GetEventHandler()->ProcessEvent( cmd );
551  }
552  else if( aItem && aItem->IsNew() )
553  {
554  // If the item is a bus or a wire, a begin command is not possible.
555  if( (GetToolId() == ID_BUS_BUTT) && (aItem->Type() == SCH_LINE_T) )
556  {
557  SCH_LINE* segment = (SCH_LINE*) aItem;
558 
559  if( segment->GetLayer() != LAYER_BUS )
560  break;
561 
562  // Bus in progress:
563  OnLeftClick( aDC, aPosition );
564  }
565  else if( (GetToolId() == ID_WIRE_BUTT ) && (aItem->Type() == SCH_LINE_T) )
566  {
567  SCH_LINE* segment = (SCH_LINE*) aItem;
568 
569  if( segment->GetLayer() != LAYER_WIRE )
570  break;
571 
572  // Wire in progress:
573  OnLeftClick( aDC, aPosition );
574  }
575  }
576  break;
577 
578  case HK_DUPLICATE_ITEM: // Duplicate component or text/label
579  if( itemInEdit )
580  break;
581 
582  if( aItem == NULL )
583  {
584  aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::CopyableItems );
585 
586  if( aItem == NULL )
587  break;
588  }
589 
590  cmd.SetId( hotKey->m_IdMenuEvent );
591  wxPostEvent( this, cmd );
592  break;
593 
594  case HK_DRAG: // Start drag
595  case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
596  if( ! notBusy )
597  break;
598 
599  // Fall through
600  case HK_EDIT:
601  // Edit schematic item. Do not allow sheet edition when mowing
602  // Because a sheet edition can be complex.
603  if( itemInEdit && screen->GetCurItem()->Type() == SCH_SHEET_T )
604  break;
605 
606  // Fall through
607  case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
608  case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
609  case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
610  case HK_MIRROR_Y: // Mirror Y
611  case HK_MIRROR_X: // Mirror X
612  case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
613  case HK_ROTATE: // Rotate schematic item.
614  case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
615  case HK_AUTOPLACE_FIELDS: // Autoplace all fields around component
616  {
617  // force a new item search on hot keys at current position,
618  // if there is no currently edited item,
619  // to avoid using a previously selected item
620  if( ! itemInEdit )
621  screen->SetCurItem( NULL );
622  EDA_HOTKEY_CLIENT_DATA data( aPosition );
623  cmd.SetInt( hotKey->m_Idcommand );
624  cmd.SetClientObject( &data );
625  cmd.SetId( hotKey->m_IdMenuEvent );
626  GetEventHandler()->ProcessEvent( cmd );
627  }
628  break;
629  }
630 
631  // Hot key handled.
632  return true;
633 }
634 
635 
637 {
638  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
639 
640  if( HK_Descr == NULL )
641  HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
642 
643  return HK_Descr;
644 }
645 
646 
647 bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
648 {
649  if( aHotKey == 0 )
650  return false;
651 
652  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
653 
654  cmd.SetEventObject( this );
655 
656  /* Convert lower to upper case (the usual toupper function has problem
657  * with non ascii codes like function keys */
658  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
659  aHotKey += 'A' - 'a';
660 
661  EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
662 
663  if( hotKey == NULL )
664  hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List );
665 
666  if( hotKey == NULL )
667  return false;
668 
669  bool itemInEdit = m_drawItem && m_drawItem->InEditMode();
670 
671  bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
672 
673  switch( hotKey->m_Idcommand )
674  {
675  default:
676  case HK_NOT_FOUND:
677  return false;
678 
679  case HK_HELP: // Display Current hotkey list
680  DisplayHotkeyList( this, g_Libedit_Hokeys_Descr );
681  break;
682 
683  case HK_RESET_LOCAL_COORD: // Reset the relative coord
685  break;
686 
687  case HK_LEFT_CLICK:
688  OnLeftClick( aDC, aPosition );
689  break;
690 
691  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
692  OnLeftClick( aDC, aPosition );
693  OnLeftDClick( aDC, aPosition );
694  break;
695 
696  case HK_ZOOM_IN:
697  case HK_ZOOM_OUT:
698  case HK_ZOOM_REDRAW:
699  case HK_ZOOM_CENTER:
700  case HK_ZOOM_AUTO:
701  cmd.SetId( hotKey->m_IdMenuEvent );
702  GetEventHandler()->ProcessEvent( cmd );
703  break;
704 
705  case HK_UNDO:
706  case HK_REDO:
707  if( !itemInEdit )
708  {
709  cmd.SetId( hotKey->m_IdMenuEvent );
710  GetEventHandler()->ProcessEvent( cmd );
711  }
712  break;
713 
714  case HK_REPEAT_LAST:
715  if( ! itemInEdit )
716  {
718  ( m_lastDrawItem->Type() == LIB_PIN_T ) )
720  }
721  break;
722 
723  case HK_EDIT:
724  if( !itemInEdit )
725  m_drawItem = LocateItemUsingCursor( aPosition );
726 
727  if( m_drawItem )
728  {
729  switch( m_drawItem->Type() )
730  {
731  case LIB_PIN_T:
732  cmd.SetId( ID_LIBEDIT_EDIT_PIN );
733  GetEventHandler()->ProcessEvent( cmd );
734  break;
735 
736  case LIB_ARC_T:
737  case LIB_CIRCLE_T:
738  case LIB_RECTANGLE_T:
739  case LIB_POLYLINE_T:
740  case LIB_TEXT_T:
741  cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
742  GetEventHandler()->ProcessEvent( cmd );
743  break;
744 
745  case LIB_FIELD_T:
747  GetEventHandler()->ProcessEvent( cmd );
748  break;
749 
750  default:
751  break;
752  }
753  }
754  break;
755 
756  case HK_ROTATE:
757  if( blocInProgress )
758  {
760  HandleBlockPlace( aDC );
761  }
762  else
763  {
764  if ( !itemInEdit )
765  m_drawItem = LocateItemUsingCursor( aPosition );
766 
767  if( m_drawItem )
768  {
769  cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
770  GetEventHandler()->ProcessEvent( cmd );
771  }
772  }
773  break;
774 
776  LoadOneLibraryPart( cmd );
777  break;
778 
780  if( ! itemInEdit )
781  {
782  SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
783  OnLeftClick( aDC, aPosition );
784  }
785  break;
786 
787  case HK_DELETE:
788  if( !itemInEdit )
789  m_drawItem = LocateItemUsingCursor( aPosition );
790 
791  if( m_drawItem && !m_drawItem->InEditMode() )
792  {
793  cmd.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
795  }
796  break;
797 
799  if( !itemInEdit )
800  {
801  m_drawItem = LocateItemUsingCursor( aPosition );
802 
803  if( m_drawItem )
804  {
807  }
808  }
809  break;
810 
811  case HK_DRAG:
812  if( !itemInEdit )
813  {
814  m_drawItem = LocateItemUsingCursor( aPosition );
815 
816  if( m_drawItem && !m_drawItem->InEditMode() )
817  {
818  cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
820  }
821  }
822  break;
823 
824  case HK_MIRROR_Y: // Mirror Y
825  if( !itemInEdit )
826  m_drawItem = LocateItemUsingCursor( aPosition );
827 
828  cmd.SetId( ID_LIBEDIT_MIRROR_Y );
829  GetEventHandler()->ProcessEvent( cmd );
830  break;
831 
832  case HK_MIRROR_X: // Mirror X
833  if( !itemInEdit )
834  m_drawItem = LocateItemUsingCursor( aPosition );
835 
836  cmd.SetId( ID_LIBEDIT_MIRROR_X );
837  GetEventHandler()->ProcessEvent( cmd );
838  break;
839  }
840 
841  // Hot key handled.
842  return true;
843 }
844 
845 
847 {
848  EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
849 
850  if( HK_Descr == NULL )
851  HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
852 
853  return HK_Descr;
854 }
855 
856 
857 bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
858 {
859  if( aHotKey == 0 )
860  return false;
861 
862  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
863  cmd.SetEventObject( this );
864 
865  /* Convert lower to upper case (the usual toupper function has problem with non ascii
866  * codes like function keys */
867  if( (aHotKey >= 'a') && (aHotKey <= 'z') )
868  aHotKey += 'A' - 'a';
869 
870  EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
871 
872  if( HK_Descr == NULL )
873  HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
874 
875  if( HK_Descr == NULL )
876  return false;
877 
878  switch( HK_Descr->m_Idcommand )
879  {
880  default:
881  case HK_NOT_FOUND:
882  return false;
883 
884  case HK_HELP: // Display Current hotkey list
885  DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr );
886  break;
887 
888  case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
890  break;
891 
892  case HK_LEFT_CLICK:
893  OnLeftClick( aDC, aPosition );
894  break;
895 
896  case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
897  OnLeftClick( aDC, aPosition );
898  OnLeftDClick( aDC, aPosition );
899  break;
900 
901  case HK_ZOOM_IN:
902  cmd.SetId( ID_POPUP_ZOOM_IN );
903  GetEventHandler()->ProcessEvent( cmd );
904  break;
905 
906  case HK_ZOOM_OUT:
907  cmd.SetId( ID_POPUP_ZOOM_OUT );
908  GetEventHandler()->ProcessEvent( cmd );
909  break;
910 
911  case HK_ZOOM_REDRAW:
912  cmd.SetId( ID_ZOOM_REDRAW );
913  GetEventHandler()->ProcessEvent( cmd );
914  break;
915 
916  case HK_ZOOM_CENTER:
917  cmd.SetId( ID_POPUP_ZOOM_CENTER );
918  GetEventHandler()->ProcessEvent( cmd );
919  break;
920 
921  case HK_ZOOM_AUTO:
922  cmd.SetId( ID_ZOOM_PAGE );
923  GetEventHandler()->ProcessEvent( cmd );
924  break;
925  }
926 
927  return true;
928 }
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:665
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
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:115
#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)
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 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 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 ...
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:419
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 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: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"))
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[]