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 <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  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( GetToolId() == ID_NO_TOOL_SELECTED )
196  {
197  msg = AddHotkeyName( _( "&Paste" ), g_Schematic_Hokeys_Descr, HK_EDIT_PASTE );
198  AddMenuItem( PopMenu, wxID_PASTE, msg,
199  _( "Pastes item(s) from the Clipboard" ),
200  KiBitmap( paste_xpm ) );
201  }
202 
203  if( m_CurrentSheet->Last() != g_RootSheet )
204  {
205  msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
206  AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, msg,
207  KiBitmap( leave_sheet_xpm ) );
208  PopMenu->AppendSeparator();
209  }
210 
211  return true;
212  }
213 
214  bool is_new = item->IsNew();
215 
216  switch( item->Type() )
217  {
218  case SCH_NO_CONNECT_T:
219  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ),
220  KiBitmap( delete_xpm ) );
221  break;
222 
223  case SCH_JUNCTION_T:
224  addJunctionMenuEntries( PopMenu, (SCH_JUNCTION*) item );
225  break;
226 
227  case SCH_BUS_BUS_ENTRY_T:
229  AddMenusForBusEntry( PopMenu, static_cast<SCH_BUS_ENTRY_BASE*>( item ) );
230  break;
231 
232  case SCH_MARKER_T:
233  AddMenusForMarkers( PopMenu, (SCH_MARKER*) item, this );
234  break;
235 
236  case SCH_TEXT_T:
237  AddMenusForText( PopMenu, (SCH_TEXT*) item );
238  break;
239 
240  case SCH_LABEL_T:
241  AddMenusForLabel( PopMenu, (SCH_LABEL*) item );
242  break;
243 
244  case SCH_GLOBAL_LABEL_T:
245  AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) item );
246  break;
247 
249  AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) item );
250  break;
251 
252  case SCH_FIELD_T:
253  AddMenusForComponentField( PopMenu, (SCH_FIELD*) item );
254  break;
255 
256  case SCH_COMPONENT_T:
257  AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item, Prj().SchSymbolLibTable() );
258  break;
259 
260  case SCH_BITMAP_T:
261  AddMenusForBitmap( PopMenu, (SCH_BITMAP*) item );
262  break;
263 
264  case SCH_LINE_T:
265  switch( item->GetLayer() )
266  {
267  case LAYER_WIRE:
268  AddMenusForWire( PopMenu, (SCH_LINE*) item, this );
269  break;
270 
271  case LAYER_BUS:
272  AddMenusForBus( PopMenu, (SCH_LINE*) item, this );
273  break;
274 
275  default:
276  if( is_new )
277  AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
278  KiBitmap( checked_ok_xpm ) );
279 
280  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
281  KiBitmap( delete_xpm ) );
282  break;
283  }
284  break;
285 
286  case SCH_SHEET_T:
287  AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
288  break;
289 
290  case SCH_SHEET_PIN_T:
291  AddMenusForSheetPin( PopMenu, (SCH_SHEET_PIN*) item );
292  break;
293 
294  default:
295  wxFAIL_MSG( wxString::Format( wxT( "Cannot create context menu for unknown type %d" ),
296  item->Type() ) );
297  break;
298  }
299 
300  PopMenu->AppendSeparator();
301  return true;
302 }
303 
304 
305 void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
306 {
307  wxString msg, name;
308 
309  if( !Field->GetFlags() )
310  {
311  switch( Field->GetId() )
312  {
313  case REFERENCE: name = _( "Move Reference" ); break;
314  case VALUE: name = _( "Move Value" ); break;
315  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
316  default: name = _( "Move Field" ); break;
317  }
318 
321  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
322  }
323 
324  switch( Field->GetId() )
325  {
326  case REFERENCE: name = _( "Rotate Reference" ); break;
327  case VALUE: name = _( "Rotate Value" ); break;
328  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
329  default: name = _( "Rotate Field" ); break;
330  }
331 
333  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
334 
335  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
337  switch( Field->GetId() )
338  {
339  case REFERENCE:
341  name = _( "Edit Reference..." );
342  break;
343  case VALUE:
345  name = _( "Edit Value..." );
346  break;
347  case FOOTPRINT:
349  name = _( "Edit Footprint Field..." );
350  break;
351  default:
352  id = HK_EDIT;
353  name = _( "Edit Field..." );
354  break;
355  }
356  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
357  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
358 }
359 
360 
361 void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
362 {
363  if( Component->Type() != SCH_COMPONENT_T )
364  {
365  wxASSERT( 0 );
366  return;
367  }
368 
369  wxString msg;
370 
371  if( !Component->GetFlags() )
372  {
373  msg.Printf( _( "Move %s" ),
374  GetChars( Component->GetField( REFERENCE )->GetText() ) );
376  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
377  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
378  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
379  }
380 
381  wxMenu* orientmenu = new wxMenu;
382  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
383  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
384  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
385  KiBitmap( rotate_ccw_xpm ) );
386  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
387  HK_MIRROR_X );
388  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
389  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
390  HK_MIRROR_Y );
391  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
392  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
394  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
395  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
396  _( "Orientation" ), KiBitmap( orient_xpm ) );
397 
398  AddMenusForEditComponent( PopMenu, Component, aLibs );
399 
400  if( !Component->GetFlags() )
401  {
402  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
404  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
405  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
406  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
407  }
408 
409  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
410  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
411 
412  if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
413  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
414  KiBitmap( datasheet_xpm ) );
415 }
416 
417 
418 void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, SYMBOL_LIB_TABLE* aLibs )
419 {
420  if( Component->Type() != SCH_COMPONENT_T )
421  {
422  wxASSERT( 0 );
423  return;
424  }
425 
426  wxString msg;
427  LIB_PART* part = NULL;
428  LIB_ALIAS* alias = NULL;
429 
430  try
431  {
432  alias = aLibs->LoadSymbol( Component->GetLibId() );
433  }
434  catch( ... )
435  {
436  }
437 
438  if( alias )
439  part = alias->GetPart();
440 
441  wxMenu* editmenu = new wxMenu;
442  msg = AddHotkeyName( _( "Edit Properties..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
443  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
444 
445  if( part && part->IsNormal() )
446  {
447  msg = AddHotkeyName( _( "Edit Value..." ), g_Schematic_Hokeys_Descr,
450  KiBitmap( edit_comp_value_xpm ) );
451 
452  msg = AddHotkeyName( _( "Edit Reference..." ), g_Schematic_Hokeys_Descr,
455  KiBitmap( edit_comp_ref_xpm ) );
456 
457  msg = AddHotkeyName( _( "Edit Footprint..." ), g_Schematic_Hokeys_Descr,
460  KiBitmap( edit_comp_footprint_xpm ) );
461  }
462 
463  if( part && part->HasConversion() )
464  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
465  KiBitmap( component_select_alternate_shape_xpm ) );
466 
467  if( part && part->GetUnitCount() >= 2 )
468  {
469  wxMenu* sel_unit_menu = new wxMenu; int ii;
470 
471  for( ii = 0; ii < part->GetUnitCount(); ii++ )
472  {
473  wxString num_unit;
474  int unit = Component->GetUnit();
475  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
476  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
477  num_unit, wxEmptyString,
478  wxITEM_CHECK );
479  if( unit == ii + 1 )
480  item->Check(true);
481 
482  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
483  // See eeschema_id to modify this value.
485  break; // We have used all IDs for these submenus
486  }
487 
488  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
489  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
490  }
491 
492  if( !Component->GetFlags() )
493  {
494  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
497  msg, KiBitmap( libedit_xpm ) );
498  }
499 
500  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
501  _( "Properties" ), KiBitmap( config_xpm ) );
502 }
503 
504 
505 void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
506 {
507  wxMenu* menu_change_type = new wxMenu;
508  wxString msg;
509 
510  if( !GLabel->GetFlags() )
511  {
512  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
514  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
515  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
516  HK_DRAG );
517  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
518  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
520  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
521  }
522 
523  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
524  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
525  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
526  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
527  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
528  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
529 
530  // add menu change type text (to label, glabel, text):
532  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
534  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
536  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
537  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
538  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
539 }
540 
541 
542 void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
543 {
544  wxMenu* menu_change_type = new wxMenu;
545  wxString msg;
546 
547  if( !HLabel->GetFlags() )
548  {
549  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
551  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
552  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
553  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
554  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
556  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
557  }
558 
559  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
560  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
561  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
562  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
563  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
564  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
565 
566  // add menu change type text (to label, glabel, text):
568  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
570  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
572  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
573  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
574  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
575 }
576 
577 
578 void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
579 {
580  wxMenu* menu_change_type = new wxMenu;
581  wxString msg;
582 
583  if( !Label->GetFlags() )
584  {
585  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
587  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
588  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
589  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
590  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
592  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
593  }
594 
595  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
596  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
597  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
598  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
599  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
600  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
601 
602  // add menu change type text (to label, glabel, text):
604  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
606  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
608  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
609  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
610  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
611 }
612 
613 
614 void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
615 {
616  wxString msg;
617  wxMenu* menu_change_type = new wxMenu;
618 
619  if( !Text->GetFlags() )
620  {
621  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
623  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
624  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
626  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
627  }
628 
629  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
630  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
631  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
632  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
633  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
634  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
635 
636  /* add menu change type text (to label, glabel, text),
637  * but only if this is a single line text
638  */
639  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
640  {
642  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
644  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
646  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
647  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
648  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
649  }
650 }
651 
652 
653 void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction )
654 {
655  wxString msg;
656  SCH_SCREEN* screen = GetScreen();
657 
658  msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
659  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
660 
661  if( !aJunction->IsNew() )
662  {
664  AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
665 
666  if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
667  AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
668  KiBitmap( break_line_xpm ) );
669  }
670 
671  if( screen->GetWireOrBus( aJunction->GetPosition() ) )
672  {
673  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
674  KiBitmap( delete_node_xpm ) );
675  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
676  KiBitmap( delete_connection_xpm ) );
677  }
678 }
679 
680 
681 void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
682 {
683  SCH_SCREEN* screen = frame->GetScreen();
684  wxPoint pos = frame->GetCrossHairPosition();
685  wxString msg;
686 
687  if( Wire == NULL )
688  {
689  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
690  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
691  return;
692  }
693 
694  bool is_new = Wire->IsNew();
695  if( is_new )
696  {
698  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
699  return;
700  }
701 
702  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
703  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
704  PopMenu->AppendSeparator();
705  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
706  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
707  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
708  KiBitmap( delete_node_xpm ) );
709  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
710  KiBitmap( delete_connection_xpm ) );
711 
712  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
713 
714  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
715  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
716  KiBitmap( break_line_xpm ) );
717 
718  PopMenu->AppendSeparator();
719 
720  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
721  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
722  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
723  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
724 
725  // Add global label command only if the cursor is over one end of the wire.
726  if( Wire->IsEndPoint( pos ) )
727  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
728  KiBitmap( add_glabel_xpm ) );
729 }
730 
731 
732 void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
733 {
734  wxPoint pos = frame->GetCrossHairPosition();
735  wxString msg;
736 
737  if( Bus == NULL )
738  {
739  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
740  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
741  return;
742  }
743 
744  bool is_new = Bus->IsNew();
745  if( is_new )
746  {
748  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
749  return;
750  }
751 
752  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
753  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
754 
755  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
756 
757  PopMenu->AppendSeparator();
758  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
759  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
760  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
761  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
762 
763  // Add global label command only if the cursor is over one end of the bus.
764  if( Bus->IsEndPoint( pos ) )
765  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
766  KiBitmap( add_glabel_xpm ) );
767 }
768 
769 
770 void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
771 {
772  wxString msg;
773 
774  if( !Sheet->GetFlags() )
775  {
776  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
777  KiBitmap( enter_sheet_xpm ) );
778  PopMenu->AppendSeparator();
779  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
781  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
782 
783  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
784  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
785 
786  PopMenu->AppendSeparator();
787  msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr,
789  AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
790  PopMenu->AppendSeparator();
791 
792  wxMenu* orientmenu = new wxMenu;
793  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
794  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
795 
796  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
797  KiBitmap( rotate_ccw_xpm ) );
798 
799  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
800  HK_MIRROR_X );
801  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
802  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
803  HK_MIRROR_Y );
804  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
805 
806  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
807  _( "Orientation" ), KiBitmap( orient_xpm ) );
808  }
809 
810  if( Sheet->GetFlags() )
811  {
812  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
813  }
814  else
815  {
816  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
817  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
818 
819  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
820  KiBitmap( resize_sheet_xpm ) );
821  PopMenu->AppendSeparator();
822  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
823  KiBitmap( import_hierarchical_label_xpm ) );
824 
825  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
826  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
827  KiBitmap( options_pinsheet_xpm ) );
828 
829  PopMenu->AppendSeparator();
830  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
831  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
832  }
833 }
834 
835 
836 void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
837 {
838  wxString msg;
839 
840  if( !PinSheet->GetFlags() )
841  {
842  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
844  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
845  }
846 
847  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ), KiBitmap( edit_xpm ) );
848 
849  if( !PinSheet->GetFlags() )
850  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ),
851  KiBitmap( delete_xpm ) );
852 }
853 
854 
855 void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
856 {
857  wxString msg;
858 
859  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
860  KiBitmap( cancel_xpm ) );
861 
862  PopMenu->AppendSeparator();
863 
864  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
865  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
866 
867  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
868 
869  // After a block move (that is also a block selection) one can reselect
870  // a block function.
871  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
872  {
873  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
874  HK_EDIT_CUT );
875  AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
876  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
877  HK_EDIT_COPY );
878  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
879  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
880  KiBitmap( duplicate_xpm ) );
881  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
883  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
884  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
885  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
886  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
887  HK_MIRROR_Y );
888  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
889  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
891  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
892  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
893  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
894 
895 #if 0
896  #ifdef __WINDOWS__
897  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
898  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
899  #endif
900 #endif
901  }
902 }
903 
904 
905 void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
906 {
907  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
908  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
909  KiBitmap( info_xpm ) );
910 }
911 
912 
913 void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
914 {
915  wxString msg;
916 
917  if( aBitmap->GetFlags() == 0 )
918  {
919  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
921  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
922  }
923 
924  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
925  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
926  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
927  HK_MIRROR_X );
928  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
929  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
930  HK_MIRROR_Y );
931  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
932  msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
933  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
934 
935  if( aBitmap->GetFlags() == 0 )
936  {
937  aPopMenu->AppendSeparator();
938  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
939  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
940  }
941 }
942 
943 
944 void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
945 {
946  wxString msg;
947 
948  if( !aBusEntry->GetFlags() )
949  {
950  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
952  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
953  }
954 
955  if( aBusEntry->GetBusEntryShape() == '\\' )
957  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
958  else
960  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
961 
962  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
963  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
964 }
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:209
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:266
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:227
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:174
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)
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.
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
Function GetScreen returns 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)
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.
bool IsBlockActive() const
Definition: base_screen.h:499
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().
Definition: sch_screen.h:174
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)
Definition: sch_screen.h:442
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:98
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) ...
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:488
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:953
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[]