KiCad PCB EDA Suite
eeschema/onrightclick.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) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2004-2017 KiCad Developers, see change_log.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 <class_drawpanel.h>
33 #include <confirm.h>
34 #include <schframe.h>
35 #include <menus_helpers.h>
36 
37 #include <general.h>
38 #include <hotkeys.h>
39 #include <class_library.h>
40 #include <sch_bus_entry.h>
41 #include <sch_marker.h>
42 #include <sch_text.h>
43 #include <sch_junction.h>
44 #include <sch_component.h>
45 #include <sch_line.h>
46 #include <sch_no_connect.h>
47 #include <sch_sheet.h>
48 #include <sch_sheet_path.h>
49 #include <sch_bitmap.h>
50 #include <symbol_lib_table.h>
51 
52 #include <iostream>
53 
54 static void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame );
55 static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame );
56 static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame );
57 static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
58 static void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
59 static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
60 static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
61 static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
62 static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
63 static void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component,
64  SYMBOL_LIB_TABLE* aLibs );
65 static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component,
66  SYMBOL_LIB_TABLE* aLibs );
67 static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field );
68 static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame );
69 static void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap );
70 static void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE * aBusEntry );
71 
72 
73 bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
74 {
75  SCH_ITEM* item = GetScreen()->GetCurItem();
76  bool blockActive = GetScreen()->IsBlockActive();
77  wxString msg;
78  bool actionCancelled = false;
79 
80  // Do not start a block command on context menu.
82 
83  if( blockActive )
84  {
85  AddMenusForBlock( PopMenu, this );
86  PopMenu->AppendSeparator();
87 
88  // If we have a block containing only one main element
89  // we append its edition submenu
90  if( item != NULL )
91  {
92  switch( item->Type() )
93  {
94  case SCH_COMPONENT_T:
95  AddMenusForEditComponent( PopMenu, (SCH_COMPONENT *) item,
96  Prj().SchSymbolLibTable() );
97  PopMenu->AppendSeparator();
98  break;
99 
100  case SCH_TEXT_T:
101  msg = AddHotkeyName( _( "Edit Text" ), g_Schematic_Hokeys_Descr, HK_EDIT );
102  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
103  PopMenu->AppendSeparator();
104  break;
105 
106  case SCH_LABEL_T:
107  msg = AddHotkeyName( _( "Edit Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
108  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
109  PopMenu->AppendSeparator();
110  break;
111 
112  case SCH_GLOBAL_LABEL_T:
113  msg = AddHotkeyName( _( "Edit Global Label" ), g_Schematic_Hokeys_Descr,
114  HK_EDIT );
115  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
116  PopMenu->AppendSeparator();
117  break;
118 
120  msg = AddHotkeyName( _( "Edit Hierarchical Label" ), g_Schematic_Hokeys_Descr,
121  HK_EDIT );
122  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
123  PopMenu->AppendSeparator();
124  break;
125 
126  case SCH_BITMAP_T:
127  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
128  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
129  PopMenu->AppendSeparator();
130  break;
131 
132  default:
133  break;
134  }
135  }
136  return true;
137  }
138 
139  // Try to locate items at cursor position.
140  if( (item == NULL) || (item->GetFlags() == 0) )
141  {
142  item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins, 0, &actionCancelled );
143 
144  // If the clarify item selection context menu is aborted, don't show the context menu.
145  if( item == NULL && actionCancelled )
146  return false;
147  }
148 
149  // If a command is in progress: add "cancel" and "end tool" menu
150  if( GetToolId() != ID_NO_TOOL_SELECTED )
151  {
152  if( item && item->GetFlags() )
153  {
154  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
155  KiBitmap( cancel_xpm ) );
156  }
157  else
158  {
159  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ),
160  KiBitmap( cursor_xpm ) );
161  }
162 
163  PopMenu->AppendSeparator();
164 
165  switch( GetToolId() )
166  {
167  case ID_WIRE_BUTT:
168  AddMenusForWire( PopMenu, NULL, this );
169  if( item == NULL )
170  PopMenu->AppendSeparator();
171  break;
172 
173  case ID_BUS_BUTT:
174  AddMenusForBus( PopMenu, NULL, this );
175  if( item == NULL )
176  PopMenu->AppendSeparator();
177  break;
178 
179  default:
180  break;
181  }
182  }
183  else
184  {
185  if( item && item->GetFlags() )
186  {
187  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
188  KiBitmap( cancel_xpm ) );
189  PopMenu->AppendSeparator();
190  }
191  }
192 
193  if( item == NULL )
194  {
195  if( m_CurrentSheet->Last() != g_RootSheet )
196  {
197  msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
198  AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, msg,
199  KiBitmap( leave_sheet_xpm ) );
200  PopMenu->AppendSeparator();
201  }
202  return true;
203  }
204 
205  bool is_new = item->IsNew();
206 
207  switch( item->Type() )
208  {
209  case SCH_NO_CONNECT_T:
210  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ),
211  KiBitmap( delete_xpm ) );
212  break;
213 
214  case SCH_JUNCTION_T:
215  addJunctionMenuEntries( PopMenu, (SCH_JUNCTION*) item );
216  break;
217 
218  case SCH_BUS_BUS_ENTRY_T:
220  AddMenusForBusEntry( PopMenu, static_cast<SCH_BUS_ENTRY_BASE*>( item ) );
221  break;
222 
223  case SCH_MARKER_T:
224  AddMenusForMarkers( PopMenu, (SCH_MARKER*) item, this );
225  break;
226 
227  case SCH_TEXT_T:
228  AddMenusForText( PopMenu, (SCH_TEXT*) item );
229  break;
230 
231  case SCH_LABEL_T:
232  AddMenusForLabel( PopMenu, (SCH_LABEL*) item );
233  break;
234 
235  case SCH_GLOBAL_LABEL_T:
236  AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) item );
237  break;
238 
240  AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) item );
241  break;
242 
243  case SCH_FIELD_T:
244  AddMenusForComponentField( PopMenu, (SCH_FIELD*) item );
245  break;
246 
247  case SCH_COMPONENT_T:
248  AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item, Prj().SchSymbolLibTable() );
249  break;
250 
251  case SCH_BITMAP_T:
252  AddMenusForBitmap( PopMenu, (SCH_BITMAP*) item );
253  break;
254 
255  case SCH_LINE_T:
256  switch( item->GetLayer() )
257  {
258  case LAYER_WIRE:
259  AddMenusForWire( PopMenu, (SCH_LINE*) item, this );
260  break;
261 
262  case LAYER_BUS:
263  AddMenusForBus( PopMenu, (SCH_LINE*) item, this );
264  break;
265 
266  default:
267  if( is_new )
268  AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
269  KiBitmap( checked_ok_xpm ) );
270 
271  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
272  KiBitmap( delete_xpm ) );
273  break;
274  }
275  break;
276 
277  case SCH_SHEET_T:
278  AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
279  break;
280 
281  case SCH_SHEET_PIN_T:
282  AddMenusForSheetPin( PopMenu, (SCH_SHEET_PIN*) item );
283  break;
284 
285  default:
286  wxFAIL_MSG( wxString::Format( wxT( "Cannot create context menu for unknown type %d" ),
287  item->Type() ) );
288  break;
289  }
290 
291  PopMenu->AppendSeparator();
292  return true;
293 }
294 
295 
296 void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
297 {
298  wxString msg, name;
299 
300  if( !Field->GetFlags() )
301  {
302  switch( Field->GetId() )
303  {
304  case REFERENCE: name = _( "Move Reference" ); break;
305  case VALUE: name = _( "Move Value" ); break;
306  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
307  default: name = _( "Move Field" ); break;
308  }
309 
312  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
313  }
314 
315  switch( Field->GetId() )
316  {
317  case REFERENCE: name = _( "Rotate Reference" ); break;
318  case VALUE: name = _( "Rotate Value" ); break;
319  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
320  default: name = _( "Rotate Field" ); break;
321  }
322 
324  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
325 
326  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
328  switch( Field->GetId() )
329  {
330  case REFERENCE:
332  name = _( "Edit Reference" );
333  break;
334  case VALUE:
336  name = _( "Edit Value" );
337  break;
338  case FOOTPRINT:
340  name = _( "Edit Footprint Field" );
341  break;
342  default:
343  id = HK_EDIT;
344  name = _( "Edit Field" );
345  break;
346  }
347  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
348  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
349 }
350 
351 
352 void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
353 {
354  if( Component->Type() != SCH_COMPONENT_T )
355  {
356  wxASSERT( 0 );
357  return;
358  }
359 
360  wxString msg;
361 
362  if( !Component->GetFlags() )
363  {
364  msg.Printf( _( "Move %s" ),
365  GetChars( Component->GetField( REFERENCE )->GetText() ) );
367  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
368  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
369  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
370  }
371 
372  wxMenu* orientmenu = new wxMenu;
373  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
374  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
375  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
376  KiBitmap( rotate_ccw_xpm ) );
377  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
378  HK_MIRROR_X );
379  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
380  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
381  HK_MIRROR_Y );
382  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
383  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
385  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
386  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
387  _( "Orientation" ), KiBitmap( orient_xpm ) );
388 
389  AddMenusForEditComponent( PopMenu, Component, aLibs );
390 
391  if( !Component->GetFlags() )
392  {
393  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
395  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
396  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
397  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
398  }
399 
400  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
401  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
402 
403  if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
404  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
405  KiBitmap( datasheet_xpm ) );
406 }
407 
408 
409 void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
410 {
411  if( Component->Type() != SCH_COMPONENT_T )
412  {
413  wxASSERT( 0 );
414  return;
415  }
416 
417  wxString msg;
418  LIB_PART* part = NULL;
419  LIB_ALIAS* alias = NULL;
420 
421  try
422  {
423  alias = aLibs->LoadSymbol( Component->GetLibId() );
424  }
425  catch( ... )
426  {
427  }
428 
429  if( alias )
430  part = alias->GetPart();
431 
432  wxMenu* editmenu = new wxMenu;
433  msg = AddHotkeyName( _( "Edit Properties" ), g_Schematic_Hokeys_Descr, HK_EDIT );
434  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
435 
436  if( part && part->IsNormal() )
437  {
438  msg = AddHotkeyName( _( "Edit Value" ), g_Schematic_Hokeys_Descr,
441  KiBitmap( edit_comp_value_xpm ) );
442 
443  msg = AddHotkeyName( _( "Edit Reference" ), g_Schematic_Hokeys_Descr,
446  KiBitmap( edit_comp_ref_xpm ) );
447 
448  msg = AddHotkeyName( _( "Edit Footprint" ), g_Schematic_Hokeys_Descr,
451  KiBitmap( edit_comp_footprint_xpm ) );
452  }
453 
454  if( part && part->HasConversion() )
455  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
456  KiBitmap( component_select_alternate_shape_xpm ) );
457 
458  if( part && part->GetUnitCount() >= 2 )
459  {
460  wxMenu* sel_unit_menu = new wxMenu; int ii;
461 
462  for( ii = 0; ii < part->GetUnitCount(); ii++ )
463  {
464  wxString num_unit;
465  int unit = Component->GetUnit();
466  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
467  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
468  num_unit, wxEmptyString,
469  wxITEM_CHECK );
470  if( unit == ii + 1 )
471  item->Check(true);
472 
473  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
474  // See eeschema_id to modify this value.
476  break; // We have used all IDs for these submenus
477  }
478 
479  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
480  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
481  }
482 
483  if( !Component->GetFlags() )
484  {
485  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
488  msg, KiBitmap( libedit_xpm ) );
489  }
490 
491  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
492  _( "Properties" ), KiBitmap( config_xpm ) );
493 }
494 
495 
496 void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
497 {
498  wxMenu* menu_change_type = new wxMenu;
499  wxString msg;
500 
501  if( !GLabel->GetFlags() )
502  {
503  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
505  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
506  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
507  HK_DRAG );
508  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
509  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
511  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
512  }
513 
514  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
515  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
516  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
517  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
518  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
519  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
520 
521  // add menu change type text (to label, glabel, text):
523  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
525  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
527  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
528  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
529  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
530 }
531 
532 
533 void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
534 {
535  wxMenu* menu_change_type = new wxMenu;
536  wxString msg;
537 
538  if( !HLabel->GetFlags() )
539  {
540  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
542  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
543  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
544  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
545  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
547  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
548  }
549 
550  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
551  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
552  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
553  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
554  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
555  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
556 
557  // add menu change type text (to label, glabel, text):
559  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
561  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
563  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
564  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
565  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
566 }
567 
568 
569 void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
570 {
571  wxMenu* menu_change_type = new wxMenu;
572  wxString msg;
573 
574  if( !Label->GetFlags() )
575  {
576  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
578  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
579  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
580  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
581  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
583  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
584  }
585 
586  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
587  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
588  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
589  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
590  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
591  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
592 
593  // add menu change type text (to label, glabel, text):
595  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
597  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
599  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
600  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
601  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
602 }
603 
604 
605 void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
606 {
607  wxString msg;
608  wxMenu* menu_change_type = new wxMenu;
609 
610  if( !Text->GetFlags() )
611  {
612  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
614  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
615  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
617  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
618  }
619 
620  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
621  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
622  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
623  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
624  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
625  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
626 
627  /* add menu change type text (to label, glabel, text),
628  * but only if this is a single line text
629  */
630  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
631  {
633  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
635  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
637  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
638  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
639  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
640  }
641 }
642 
643 
644 void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction )
645 {
646  wxString msg;
647  SCH_SCREEN* screen = GetScreen();
648 
649  msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
650  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
651 
652  if( !aJunction->IsNew() )
653  {
655  AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
656 
657  if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
658  AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
659  KiBitmap( break_line_xpm ) );
660  }
661 
662  if( screen->GetWireOrBus( aJunction->GetPosition() ) )
663  {
664  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
665  KiBitmap( delete_node_xpm ) );
666  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
667  KiBitmap( delete_connection_xpm ) );
668  }
669 }
670 
671 
672 void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
673 {
674  SCH_SCREEN* screen = frame->GetScreen();
675  wxPoint pos = frame->GetCrossHairPosition();
676  wxString msg;
677 
678  if( Wire == NULL )
679  {
680  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
681  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
682  return;
683  }
684 
685  bool is_new = Wire->IsNew();
686  if( is_new )
687  {
689  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
690  return;
691  }
692 
693  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
694  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
695  PopMenu->AppendSeparator();
696  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
697  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
698  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
699  KiBitmap( delete_node_xpm ) );
700  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
701  KiBitmap( delete_connection_xpm ) );
702 
703  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
704 
705  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
706  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
707  KiBitmap( break_line_xpm ) );
708 
709  PopMenu->AppendSeparator();
710 
711  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
712  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
713  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
714  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
715 
716  // Add global label command only if the cursor is over one end of the wire.
717  if( Wire->IsEndPoint( pos ) )
718  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
719  KiBitmap( add_glabel_xpm ) );
720 }
721 
722 
723 void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
724 {
725  wxPoint pos = frame->GetCrossHairPosition();
726  wxString msg;
727 
728  if( Bus == NULL )
729  {
730  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
731  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
732  return;
733  }
734 
735  bool is_new = Bus->IsNew();
736  if( is_new )
737  {
739  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
740  return;
741  }
742 
743  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
744  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
745 
746  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
747 
748  PopMenu->AppendSeparator();
749  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
750  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
751  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
752  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
753 
754  // Add global label command only if the cursor is over one end of the bus.
755  if( Bus->IsEndPoint( pos ) )
756  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
757  KiBitmap( add_glabel_xpm ) );
758 }
759 
760 
761 void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
762 {
763  wxString msg;
764 
765  if( !Sheet->GetFlags() )
766  {
767  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
768  KiBitmap( enter_sheet_xpm ) );
769  PopMenu->AppendSeparator();
770  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
772  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
773 
774  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
775  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
776 
777  PopMenu->AppendSeparator();
778  msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr,
780  AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
781  PopMenu->AppendSeparator();
782 
783  wxMenu* orientmenu = new wxMenu;
784  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
785  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
786 
787  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
788  KiBitmap( rotate_ccw_xpm ) );
789 
790  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
791  HK_MIRROR_X );
792  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
793  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
794  HK_MIRROR_Y );
795  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
796 
797  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
798  _( "Orientation" ), KiBitmap( orient_xpm ) );
799  }
800 
801  if( Sheet->GetFlags() )
802  {
803  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
804  }
805  else
806  {
807  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
808  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
809 
810  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
811  KiBitmap( resize_sheet_xpm ) );
812  PopMenu->AppendSeparator();
813  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
814  KiBitmap( import_hierarchical_label_xpm ) );
815 
816  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
817  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
818  KiBitmap( options_pinsheet_xpm ) );
819 
820  PopMenu->AppendSeparator();
821  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
822  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
823  }
824 }
825 
826 
827 void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
828 {
829  wxString msg;
830 
831  if( !PinSheet->GetFlags() )
832  {
833  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
835  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
836  }
837 
838  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit" ), KiBitmap( edit_xpm ) );
839 
840  if( !PinSheet->GetFlags() )
841  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ),
842  KiBitmap( delete_xpm ) );
843 }
844 
845 
846 void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
847 {
848  wxString msg;
849 
850  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
851  KiBitmap( cancel_xpm ) );
852 
853  PopMenu->AppendSeparator();
854 
855  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
856  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
857 
858  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
859 
860  // After a block move (that is also a block selection) one can reselect
861  // a block function.
862  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
863  {
864  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
865  HK_CUT_BLOCK );
866  AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
867  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
868  HK_COPY_BLOCK );
869  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
870  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
871  KiBitmap( duplicate_xpm ) );
872  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
874  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
875  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
876  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
877  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
878  HK_MIRROR_Y );
879  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
880  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
882  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
883  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
884  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
885 
886 #if 0
887  #ifdef __WINDOWS__
888  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
889  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
890  #endif
891 #endif
892  }
893 }
894 
895 
896 void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
897 {
898  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
899  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
900  KiBitmap( info_xpm ) );
901 }
902 
903 
904 void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
905 {
906  wxString msg;
907 
908  if( aBitmap->GetFlags() == 0 )
909  {
910  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
912  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
913  }
914 
915  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
916  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
917  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
918  HK_MIRROR_X );
919  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
920  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
921  HK_MIRROR_Y );
922  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
923  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
924  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
925 
926  if( aBitmap->GetFlags() == 0 )
927  {
928  aPopMenu->AppendSeparator();
929  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
930  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
931  }
932 }
933 
934 
935 void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
936 {
937  wxString msg;
938 
939  if( !aBusEntry->GetFlags() )
940  {
941  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
943  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
944  }
945 
946  if( aBusEntry->GetBusEntryShape() == '\\' )
948  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
949  else
951  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
952 
953  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
954  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
955 }
Definition of the SCH_SHEET class for Eeschema.
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
static void AddMenusForComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
Part library alias object definition.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
name of datasheet
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
This file is part of the common library.
bool IsNew() const
Definition: base_struct.h:243
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:173
int GetId() const
Definition: sch_field.h:87
const wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:79
void SetCanStartBlock(int aStartBlock)
static void AddMenusForEditComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
static void AddMenusForHierchicalSheet(wxMenu *PopMenu, SCH_SHEET *Sheet)
SCH_ITEM * LocateAndShowItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0, bool *clarifySelectionMenuCancelled=nullptr)
Check the schematic at aPosition in logical (drawing) units for a item matching the types in aFilterL...
Schematic editor (Eeschema) main window.
Definition: schframe.h:118
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
SCH_COLLECTOR m_collectedItems
List of collected items.
Definition: schframe.h:143
static const KICAD_T AllItemsButPins[]
A scan list for all schematic items except pins.
char GetBusEntryShape() const
function GetBusEntryShape
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
static void AddMenusForGLabel(wxMenu *PopMenu, SCH_GLOBALLABEL *GLabel)
static void AddMenusForBus(wxMenu *PopMenu, SCH_LINE *Bus, SCH_EDIT_FRAME *frame)
Base class for a bus or wire entry.
Definition: sch_bus_entry.h:41
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:533
static void AddMenusForBlock(wxMenu *PopMenu, SCH_EDIT_FRAME *frame)
static void AddMenusForComponentField(wxMenu *PopMenu, SCH_FIELD *Field)
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET_PATH * m_CurrentSheet
which sheet we are presently working on.
Definition: schframe.h:121
bool IsBlockActive() const
hotkey_id_commnand
void addJunctionMenuEntries(wxMenu *aMenu, SCH_JUNCTION *aJunction)
Add the context menu items to aMenu for aJunction.
bool IsDraggableJunction() const
Function IsDraggableJunction tests to see if the collected items form a draggable junction...
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
static void AddMenusForLabel(wxMenu *PopMenu, SCH_LABEL *Label)
wxPoint GetPosition() const override
Function GetPosition.
Definition: sch_junction.h:94
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
static void AddMenusForHLabel(wxMenu *PopMenu, SCH_HIERLABEL *GLabel)
static void AddMenusForMarkers(wxMenu *aPopMenu, SCH_MARKER *aMarker, SCH_EDIT_FRAME *aFrame)
Define a library symbol object.
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Definition: sch_sheet.h:61
SCH_LINE * GetWire(const wxPoint &aPosition, int aAccuracy=0, SCH_LINE_TEST_T aSearchType=ENTIRE_LENGTH_T)
int GetUnit() const
SCH_SHEET * Last() const
Function Last returns a pointer to the last sheet of the list One can see the others sheet as the "pa...
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:42
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition: sch_sheet.h:209
LIB_PART * GetPart() const
Get the shared LIB_PART.
static void AddMenusForBusEntry(wxMenu *aPopMenu, SCH_BUS_ENTRY_BASE *aBusEntry)
int GetUnitCount() const
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:93
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:231
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:69
Definition the SCH_COMPONENT class for Eeschema.
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Segment description base class to describe items which have 2 end points (track, wire, draw line ...)
Definition: sch_line.h:41
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
static void AddMenusForSheetPin(wxMenu *PopMenu, SCH_SHEET_PIN *PinSheet)
int GetToolId() const
Definition: draw_frame.h:480
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
const LIB_ID & GetLibId() const
const char * name
SCH_LINE * GetWireOrBus(const wxPoint &aPosition)
Return a wire or bus item located at aPosition.
Definition: sch_screen.cpp:955
BLOCK_COMMAND_T GetCommand() const
bool OnRightClick(const wxPoint &aPosition, wxMenu *PopMenu) override
static void AddMenusForBitmap(wxMenu *aPopMenu, SCH_BITMAP *aBitmap)
static void AddMenusForWire(wxMenu *PopMenu, SCH_LINE *Wire, SCH_EDIT_FRAME *frame)
static void AddMenusForText(wxMenu *PopMenu, SCH_TEXT *Text)
Definition for part library class.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
#define VALUE
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
Implementation of the label properties dialog.
bool IsNormal() const
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]