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 <sch_draw_panel.h>
33 #include <confirm.h>
34 #include <sch_edit_frame.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 
79  DBG(printf("on-rclick cur %p blk %d\n", item, blockActive ? 1 : 0 );)
80 
81  // Do not start a block command on context menu.
83 
84  if( blockActive )
85  {
86  AddMenusForBlock( PopMenu, this );
87  PopMenu->AppendSeparator();
88 
89  // If we have a block containing only one main element we append its edit 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  bool actionCancelled = false;
143  item = LocateAndShowItem( aPosition, SCH_COLLECTOR::AllItemsButPins, 0, &actionCancelled );
144 
145  printf("Locateandshow %d %d item %p type %d\n", aPosition.x, aPosition.y,
146  item, item ? item->Type() : 0 ); fflush(0);
147 
148  // If the clarify item selection context menu is aborted, don't show the context menu.
149  if( item == NULL && actionCancelled )
150  return false;
151 
152  if( item )
153  SetCrossHairPosition( item->GetPosition(), false );
154  }
155 
156  // If a command is in progress: add "cancel" and "end tool" menu
157  if( GetToolId() != ID_NO_TOOL_SELECTED )
158  {
159  if( item && item->GetFlags() )
160  {
161  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
162  KiBitmap( cancel_xpm ) );
163  }
164  else
165  {
166  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ),
167  KiBitmap( cursor_xpm ) );
168  }
169 
170  PopMenu->AppendSeparator();
171 
172  switch( GetToolId() )
173  {
174  case ID_WIRE_BUTT:
175  AddMenusForWire( PopMenu, NULL, this );
176  if( item == NULL )
177  PopMenu->AppendSeparator();
178  break;
179 
180  case ID_BUS_BUTT:
181  AddMenusForBus( PopMenu, NULL, this );
182  if( item == NULL )
183  PopMenu->AppendSeparator();
184  break;
185 
186  default:
187  break;
188  }
189  }
190  else
191  {
192  if( item && item->GetFlags() )
193  {
194  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
195  KiBitmap( cancel_xpm ) );
196  PopMenu->AppendSeparator();
197  }
198  }
199 
200  if( item == NULL )
201  {
203  {
204  msg = AddHotkeyName( _( "&Paste" ), g_Schematic_Hokeys_Descr, HK_EDIT_PASTE );
205  AddMenuItem( PopMenu, wxID_PASTE, msg,
206  _( "Pastes item(s) from the Clipboard" ),
207  KiBitmap( paste_xpm ) );
208  PopMenu->AppendSeparator();
209  }
210 
211  if( m_CurrentSheet->Last() != g_RootSheet )
212  {
213  msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
214  AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, msg,
215  KiBitmap( leave_sheet_xpm ) );
216  PopMenu->AppendSeparator();
217  }
218 
219  return true;
220  }
221 
222  bool is_new = item->IsNew();
223 
224  switch( item->Type() )
225  {
226  case SCH_NO_CONNECT_T:
227  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ),
228  KiBitmap( delete_xpm ) );
229  break;
230 
231  case SCH_JUNCTION_T:
232  addJunctionMenuEntries( PopMenu, (SCH_JUNCTION*) item );
233  break;
234 
235  case SCH_BUS_BUS_ENTRY_T:
237  AddMenusForBusEntry( PopMenu, static_cast<SCH_BUS_ENTRY_BASE*>( item ) );
238  break;
239 
240  case SCH_MARKER_T:
241  AddMenusForMarkers( PopMenu, (SCH_MARKER*) item, this );
242  break;
243 
244  case SCH_TEXT_T:
245  AddMenusForText( PopMenu, (SCH_TEXT*) item );
246  break;
247 
248  case SCH_LABEL_T:
249  AddMenusForLabel( PopMenu, (SCH_LABEL*) item );
250  break;
251 
252  case SCH_GLOBAL_LABEL_T:
253  AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) item );
254  break;
255 
257  AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) item );
258  break;
259 
260  case SCH_FIELD_T:
261  AddMenusForComponentField( PopMenu, (SCH_FIELD*) item );
262  break;
263 
264  case SCH_COMPONENT_T:
265  AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item, Prj().SchSymbolLibTable() );
266  break;
267 
268  case SCH_BITMAP_T:
269  AddMenusForBitmap( PopMenu, (SCH_BITMAP*) item );
270  break;
271 
272  case SCH_LINE_T:
273  switch( item->GetLayer() )
274  {
275  case LAYER_WIRE:
276  AddMenusForWire( PopMenu, (SCH_LINE*) item, this );
277  break;
278 
279  case LAYER_BUS:
280  AddMenusForBus( PopMenu, (SCH_LINE*) item, this );
281  break;
282 
283  default:
284  if( is_new )
285  AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
286  KiBitmap( checked_ok_xpm ) );
287 
288  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ),
289  KiBitmap( edit_xpm ) );
290  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
291  KiBitmap( delete_xpm ) );
292  break;
293  }
294  break;
295 
296  case SCH_SHEET_T:
297  AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
298  break;
299 
300  case SCH_SHEET_PIN_T:
301  AddMenusForSheetPin( PopMenu, (SCH_SHEET_PIN*) item );
302  break;
303 
304  default:
305  wxFAIL_MSG( wxString::Format( wxT( "Cannot create context menu for unknown type %d" ),
306  item->Type() ) );
307  break;
308  }
309 
310  PopMenu->AppendSeparator();
311  return true;
312 }
313 
314 
315 void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
316 {
317  wxString msg, name;
318 
319  if( !Field->GetFlags() )
320  {
321  switch( Field->GetId() )
322  {
323  case REFERENCE: name = _( "Move Reference" ); break;
324  case VALUE: name = _( "Move Value" ); break;
325  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
326  default: name = _( "Move Field" ); break;
327  }
328 
331  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
332  }
333 
334  switch( Field->GetId() )
335  {
336  case REFERENCE: name = _( "Rotate Reference" ); break;
337  case VALUE: name = _( "Rotate Value" ); break;
338  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
339  default: name = _( "Rotate Field" ); break;
340  }
341 
343  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
344 
345  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
347  switch( Field->GetId() )
348  {
349  case REFERENCE:
351  name = _( "Edit Reference..." );
352  break;
353  case VALUE:
355  name = _( "Edit Value..." );
356  break;
357  case FOOTPRINT:
359  name = _( "Edit Footprint Field..." );
360  break;
361  case DATASHEET:
363  name = _( "Show Datasheet" );
364  break;
365  default:
366  id = HK_EDIT;
367  name = _( "Edit Field..." );
368  break;
369  }
370  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
371  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
372 }
373 
374 
375 void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
376 {
377  if( Component->Type() != SCH_COMPONENT_T )
378  {
379  wxASSERT( 0 );
380  return;
381  }
382 
383  wxString msg;
384 
385  if( !Component->GetFlags() )
386  {
387  msg.Printf( _( "Move %s" ), Component->GetField( REFERENCE )->GetText() );
389  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
390  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
391  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
392  }
393 
394  wxMenu* orientmenu = new wxMenu;
395  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
396  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
397  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
398  KiBitmap( rotate_ccw_xpm ) );
399  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
400  HK_MIRROR_X );
401  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
402  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
403  HK_MIRROR_Y );
404  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
405  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
407  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
408  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
409  _( "Orientation" ), KiBitmap( orient_xpm ) );
410 
411  AddMenusForEditComponent( PopMenu, Component, aLibs );
412 
413  if( !Component->GetFlags() )
414  {
415  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
417  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
418  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
419  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
420  }
421 
422  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
423  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
424 
425  if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
426  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
427  KiBitmap( datasheet_xpm ) );
428 }
429 
430 
431 void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
432 {
433  if( Component->Type() != SCH_COMPONENT_T )
434  {
435  wxASSERT( 0 );
436  return;
437  }
438 
439  wxString msg;
440  LIB_PART* part = NULL;
441  LIB_ALIAS* alias = NULL;
442 
443  try
444  {
445  alias = aLibs->LoadSymbol( Component->GetLibId() );
446  }
447  catch( ... )
448  {
449  }
450 
451  if( alias )
452  part = alias->GetPart();
453 
454  wxMenu* editmenu = new wxMenu;
455  msg = AddHotkeyName( _( "Edit Properties..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
456  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
457 
458  if( part && part->IsNormal() )
459  {
460  msg = AddHotkeyName( _( "Edit Value..." ), g_Schematic_Hokeys_Descr,
463  KiBitmap( edit_comp_value_xpm ) );
464 
465  msg = AddHotkeyName( _( "Edit Reference..." ), g_Schematic_Hokeys_Descr,
468  KiBitmap( edit_comp_ref_xpm ) );
469 
470  msg = AddHotkeyName( _( "Edit Footprint..." ), g_Schematic_Hokeys_Descr,
473  KiBitmap( edit_comp_footprint_xpm ) );
474 
475  msg = AddHotkeyName( _( "Show Datasheet" ), g_Schematic_Hokeys_Descr,
478  KiBitmap( datasheet_xpm ) );
479  }
480 
481  if( part && part->HasConversion() )
482  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
483  KiBitmap( component_select_alternate_shape_xpm ) );
484 
485  if( part && part->GetUnitCount() >= 2 )
486  {
487  wxMenu* sel_unit_menu = new wxMenu; int ii;
488 
489  for( ii = 0; ii < part->GetUnitCount(); ii++ )
490  {
491  wxString num_unit;
492  int unit = Component->GetUnit();
493  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
494  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
495  num_unit, wxEmptyString,
496  wxITEM_CHECK );
497  if( unit == ii + 1 )
498  item->Check(true);
499 
500  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
501  // See eeschema_id to modify this value.
503  break; // We have used all IDs for these submenus
504  }
505 
506  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
507  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
508  }
509 
510  if( !Component->GetFlags() )
511  {
512  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
515  msg, KiBitmap( libedit_xpm ) );
516  }
517 
518  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
519  _( "Properties" ), KiBitmap( config_xpm ) );
520 }
521 
522 
523 void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
524 {
525  wxMenu* menu_change_type = new wxMenu;
526  wxString msg;
527 
528  if( !GLabel->GetFlags() )
529  {
530  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
532  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
533  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
534  HK_DRAG );
535  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
536  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
538  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
539  }
540 
541  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
542  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
543  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
544  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
545  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
546  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
547 
548  // add menu change type text (to label, glabel, text):
550  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
552  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
554  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
555  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
556  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
557 }
558 
559 
560 void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
561 {
562  wxMenu* menu_change_type = new wxMenu;
563  wxString msg;
564 
565  if( !HLabel->GetFlags() )
566  {
567  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
569  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
570  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
571  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
572  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
574  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
575  }
576 
577  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
578  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
579  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
580  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
581  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
582  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
583 
584  // add menu change type text (to label, glabel, text):
586  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
588  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
590  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
591  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
592  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
593 }
594 
595 
596 void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
597 {
598  wxMenu* menu_change_type = new wxMenu;
599  wxString msg;
600 
601  if( !Label->GetFlags() )
602  {
604  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
605  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
606  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
607  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr, HK_DUPLICATE_ITEM );
608  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
609  }
610 
611  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
612  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
613  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
614  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
615  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
616  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
617 
618  // add menu change type text (to label, glabel, text):
620  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
622  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
624  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
625  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
626  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
627 }
628 
629 
630 void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
631 {
632  wxString msg;
633  wxMenu* menu_change_type = new wxMenu;
634 
635  if( !Text->GetFlags() )
636  {
638  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
639  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr, HK_DUPLICATE_ITEM );
640  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
641  }
642 
643  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
644  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
645  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
646  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
647  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
648  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
649 
650  /* add menu change type text (to label, glabel, text),
651  * but only if this is a single line text
652  */
653  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
654  {
656  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
658  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
660  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
661  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
662  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
663  }
664 }
665 
666 
667 void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction )
668 {
669  wxString msg;
670  SCH_SCREEN* screen = GetScreen();
671 
672  msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
673  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
674 
675  if( !aJunction->IsNew() )
676  {
678  AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
679 
680  if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
681  AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
682  KiBitmap( break_line_xpm ) );
683  }
684 
685  if( screen->GetWireOrBus( aJunction->GetPosition() ) )
686  {
687  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
688  KiBitmap( delete_node_xpm ) );
689  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
690  KiBitmap( delete_connection_xpm ) );
691  }
692 }
693 
694 
695 void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
696 {
697  SCH_SCREEN* screen = frame->GetScreen();
698  wxPoint pos = frame->GetCrossHairPosition();
699  wxString msg;
700 
701  if( Wire == NULL )
702  {
703  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
704  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
705  return;
706  }
707 
708  if( Wire->IsNew() )
709  {
711  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
712  return;
713  }
714 
715  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
716  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
717  PopMenu->AppendSeparator();
718  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
719  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
720  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
721  KiBitmap( delete_node_xpm ) );
722  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
723  KiBitmap( delete_connection_xpm ) );
724 
725  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
726 
727  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
728  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
729  KiBitmap( break_line_xpm ) );
730 
731  PopMenu->AppendSeparator();
732 
733  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
734  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
735  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
736  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
737 
738  // Add global label command only if the cursor is over one end of the wire.
739  if( Wire->IsEndPoint( pos ) )
740  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
741  KiBitmap( add_glabel_xpm ) );
742 }
743 
744 
745 void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
746 {
747  wxPoint pos = frame->GetCrossHairPosition();
748  wxString msg;
749 
750  if( Bus == NULL )
751  {
752  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
753  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
754  return;
755  }
756 
757  if( Bus->IsNew() )
758  {
760  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
761  return;
762  }
763 
764  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
765  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
766 
767  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
768 
769  PopMenu->AppendSeparator();
770  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
771  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
772  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
773  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
774 
775  // Add global label command only if the cursor is over one end of the bus.
776  if( Bus->IsEndPoint( pos ) )
777  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
778  KiBitmap( add_glabel_xpm ) );
779 }
780 
781 
782 void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
783 {
784  wxString msg;
785 
786  if( !Sheet->GetFlags() )
787  {
788  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
789  KiBitmap( enter_sheet_xpm ) );
790  PopMenu->AppendSeparator();
791  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
793  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
794 
795  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
796  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
797 
798  PopMenu->AppendSeparator();
799  msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr,
801  AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
802  PopMenu->AppendSeparator();
803 
804  wxMenu* orientmenu = new wxMenu;
805  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
806  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
807 
808  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
809  KiBitmap( rotate_ccw_xpm ) );
810 
811  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
812  HK_MIRROR_X );
813  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
814  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
815  HK_MIRROR_Y );
816  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
817 
818  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
819  _( "Orientation" ), KiBitmap( orient_xpm ) );
820  }
821 
822  if( Sheet->GetFlags() )
823  {
824  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
825  }
826  else
827  {
828  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
829  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
830 
831  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
832  KiBitmap( resize_sheet_xpm ) );
833  PopMenu->AppendSeparator();
834  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
835  KiBitmap( import_hierarchical_label_xpm ) );
836 
837  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
838  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
839  KiBitmap( options_pinsheet_xpm ) );
840 
841  PopMenu->AppendSeparator();
842  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
843  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
844  }
845 }
846 
847 
848 void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
849 {
850  wxString msg;
851 
852  if( !PinSheet->GetFlags() )
853  {
855  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
856  }
857 
858  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ), KiBitmap( edit_xpm ) );
859 
860  if( !PinSheet->GetFlags() )
861  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ), KiBitmap( delete_xpm ) );
862 }
863 
864 
865 void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
866 {
867  wxString msg;
868 
869  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
870  KiBitmap( cancel_xpm ) );
871 
872  PopMenu->AppendSeparator();
873 
874  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
875  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
876 
877  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
878 
879  // After a block move (that is also a block selection) one can reselect
880  // a block function.
881  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
882  {
883  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
884  HK_EDIT_CUT );
885  AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
886  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
887  HK_EDIT_COPY );
888  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
889  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
890  KiBitmap( duplicate_xpm ) );
891  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
893  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
894  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
895  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
896  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
897  HK_MIRROR_Y );
898  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
899  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
901  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
902  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
903  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
904 
905 #if 0
906  #ifdef __WINDOWS__
907  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
908  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
909  #endif
910 #endif
911  }
912 }
913 
914 
915 void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
916 {
917  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
918  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
919  KiBitmap( info_xpm ) );
920 }
921 
922 
923 void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
924 {
925  wxString msg;
926 
927  if( aBitmap->GetFlags() == 0 )
928  {
929  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
931  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
932  }
933 
934  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
935  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
936  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
937  HK_MIRROR_X );
938  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
939  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
940  HK_MIRROR_Y );
941  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
942  msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
943  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
944 
945  if( aBitmap->GetFlags() == 0 )
946  {
947  aPopMenu->AppendSeparator();
948  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
949  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
950  }
951 }
952 
953 
954 void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
955 {
956  wxString msg;
957 
958  if( !aBusEntry->GetFlags() )
959  {
960  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
962  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
963  }
964 
965  if( aBusEntry->GetBusEntryShape() == '\\' )
967  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
968  else
970  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
971 
972  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
973  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
974 }
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:201
Class SCH_FIELD instances are attached to a component and provide a place for the component&#39;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:258
Part library alias object definition.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
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:219
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:223
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:80
void SetCanStartBlock(int aStartBlock)
static void AddMenusForEditComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
static void AddMenusForHierchicalSheet(wxMenu *PopMenu, SCH_SHEET *Sheet)
Schematic editor (Eeschema) main window.
SCH_LAYER_ID GetLayer() const
Function GetLayer returns the layer this item is on.
SCH_COLLECTOR m_collectedItems
List of collected items.
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
Return a pointer to a BASE_SCREEN or one of its derivatives.
static void AddMenusForBlock(wxMenu *PopMenu, SCH_EDIT_FRAME *frame)
static void AddMenusForComponentField(wxMenu *PopMenu, SCH_FIELD *Field)
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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.
bool IsBlockActive() const
Definition: base_screen.h:499
hotkey_id_commnand
virtual wxPoint GetPosition() const =0
Function GetPosition.
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:56
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:103
SCH_ITEM * GetCurItem() const
Return the currently selected SCH_ITEM, overriding BASE_SCREEN::GetCurItem().
Definition: sch_screen.h:196
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
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)
Definition: sch_screen.h:462
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...
SCH_ITEM * LocateAndShowItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0, bool *aClarifySelectionMenuCancelled=nullptr)
Check the schematic at aPosition in logical (drawing) units for a item matching the types in aFilterL...
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:123
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:232
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) ...
BLOCK_SELECTOR m_blockItems
List of selected items.
const char * name
Definition: DXF_plotter.cpp:61
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:519
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
SCH_LINE * GetWireOrBus(const wxPoint &aPosition)
Return a wire or bus item located at aPosition.
Definition: sch_screen.cpp:950
BLOCK_COMMAND_T GetCommand() const
bool OnRightClick(const wxPoint &aPosition, wxMenu *PopMenu) override
static void AddMenusForBitmap(wxMenu *aPopMenu, SCH_BITMAP *aBitmap)
#define DBG(x)
Definition: fctsys.h:33
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.
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
#define VALUE
wxPoint GetCrossHairPosition(bool aInvertY=false) const
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.
unsigned GetCount() const
bool IsNormal() const
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]