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@verizon.net>
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 
51 #include <iostream>
52 
53 static void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame );
54 static void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame );
55 static void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame );
56 static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
57 static void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
58 static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
59 static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
60 static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
61 static void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* GLabel );
62 static void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS* aLibs );
63 static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS* aLibs );
64 static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field );
65 static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame );
66 static void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap );
67 static void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE * aBusEntry );
68 
69 
70 bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
71 {
72  SCH_ITEM* item = GetScreen()->GetCurItem();
73  bool blockActive = GetScreen()->IsBlockActive();
74  wxString msg;
75 
76  // Do not start a block command on context menu.
78 
79  if( blockActive )
80  {
81  AddMenusForBlock( PopMenu, this );
82  PopMenu->AppendSeparator();
83 
84  // If we have a block containing only one main element
85  // we append its edition submenu
86  if( item != NULL )
87  {
88  switch( item->Type() )
89  {
90  case SCH_COMPONENT_T:
91  AddMenusForEditComponent( PopMenu, (SCH_COMPONENT *) item, Prj().SchLibs() );
92  PopMenu->AppendSeparator();
93  break;
94 
95  case SCH_TEXT_T:
96  msg = AddHotkeyName( _( "Edit Text" ), g_Schematic_Hokeys_Descr, HK_EDIT );
97  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
98  PopMenu->AppendSeparator();
99  break;
100 
101  case SCH_LABEL_T:
102  msg = AddHotkeyName( _( "Edit Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
103  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
104  PopMenu->AppendSeparator();
105  break;
106 
107  case SCH_GLOBAL_LABEL_T:
108  msg = AddHotkeyName( _( "Edit Global Label" ), g_Schematic_Hokeys_Descr,
109  HK_EDIT );
110  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
111  PopMenu->AppendSeparator();
112  break;
113 
115  msg = AddHotkeyName( _( "Edit Hierarchical Label" ), g_Schematic_Hokeys_Descr,
116  HK_EDIT );
117  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
118  PopMenu->AppendSeparator();
119  break;
120 
121  case SCH_BITMAP_T:
122  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
123  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
124  PopMenu->AppendSeparator();
125  break;
126 
127  default:
128  break;
129  }
130  }
131  return true;
132  }
133 
134  // Try to locate items at cursor position.
135  if( (item == NULL) || (item->GetFlags() == 0) )
136  {
138 
139  // If the clarify item selection context menu is aborted, don't show the context menu.
140  if( item == NULL && m_canvas->GetAbortRequest() )
141  {
142  m_canvas->SetAbortRequest( false );
143  return false;
144  }
145  }
146 
147  // If a command is in progress: add "cancel" and "end tool" menu
148  // If
149  if( GetToolId() != ID_NO_TOOL_SELECTED )
150  {
151  if( item && item->GetFlags() )
152  {
153  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
154  KiBitmap( cancel_xpm ) );
155  }
156  else
157  {
158  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "End Tool" ),
159  KiBitmap( cursor_xpm ) );
160  }
161 
162  PopMenu->AppendSeparator();
163 
164  switch( GetToolId() )
165  {
166  case ID_WIRE_BUTT:
167  AddMenusForWire( PopMenu, NULL, this );
168  if( item == NULL )
169  PopMenu->AppendSeparator();
170  break;
171 
172  case ID_BUS_BUTT:
173  AddMenusForBus( PopMenu, NULL, this );
174  if( item == NULL )
175  PopMenu->AppendSeparator();
176  break;
177 
178  default:
179  break;
180  }
181  }
182  else
183  {
184  if( item && item->GetFlags() )
185  {
186  AddMenuItem( PopMenu, ID_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
187  KiBitmap( cancel_xpm ) );
188  PopMenu->AppendSeparator();
189  }
190  }
191 
192  if( item == NULL )
193  {
194  if( m_CurrentSheet->Last() != g_RootSheet )
195  {
196  msg = AddHotkeyName( _( "Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
197  AddMenuItem( PopMenu, ID_POPUP_SCH_LEAVE_SHEET, msg,
198  KiBitmap( leave_sheet_xpm ) );
199  PopMenu->AppendSeparator();
200  }
201  return true;
202  }
203 
204  bool is_new = item->IsNew();
205 
206  switch( item->Type() )
207  {
208  case SCH_NO_CONNECT_T:
209  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete No Connect" ),
210  KiBitmap( delete_xpm ) );
211  break;
212 
213  case SCH_JUNCTION_T:
214  addJunctionMenuEntries( PopMenu, (SCH_JUNCTION*) item );
215  break;
216 
217  case SCH_BUS_BUS_ENTRY_T:
219  AddMenusForBusEntry( PopMenu, static_cast<SCH_BUS_ENTRY_BASE*>( item ) );
220  break;
221 
222  case SCH_MARKER_T:
223  AddMenusForMarkers( PopMenu, (SCH_MARKER*) item, this );
224  break;
225 
226  case SCH_TEXT_T:
227  AddMenusForText( PopMenu, (SCH_TEXT*) item );
228  break;
229 
230  case SCH_LABEL_T:
231  AddMenusForLabel( PopMenu, (SCH_LABEL*) item );
232  break;
233 
234  case SCH_GLOBAL_LABEL_T:
235  AddMenusForGLabel( PopMenu, (SCH_GLOBALLABEL*) item );
236  break;
237 
239  AddMenusForHLabel( PopMenu, (SCH_HIERLABEL*) item );
240  break;
241 
242  case SCH_FIELD_T:
243  AddMenusForComponentField( PopMenu, (SCH_FIELD*) item );
244  break;
245 
246  case SCH_COMPONENT_T:
247  AddMenusForComponent( PopMenu, (SCH_COMPONENT*) item, Prj().SchLibs() );
248  break;
249 
250  case SCH_BITMAP_T:
251  AddMenusForBitmap( PopMenu, (SCH_BITMAP*) item );
252  break;
253 
254  case SCH_LINE_T:
255  switch( item->GetLayer() )
256  {
257  case LAYER_WIRE:
258  AddMenusForWire( PopMenu, (SCH_LINE*) item, this );
259  break;
260 
261  case LAYER_BUS:
262  AddMenusForBus( PopMenu, (SCH_LINE*) item, this );
263  break;
264 
265  default:
266  if( is_new )
267  AddMenuItem( PopMenu, ID_POPUP_END_LINE, _( "End Drawing" ),
268  KiBitmap( checked_ok_xpm ) );
269 
270  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Drawing" ),
271  KiBitmap( delete_xpm ) );
272  break;
273  }
274  break;
275 
276  case SCH_SHEET_T:
277  AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) item );
278  break;
279 
280  case SCH_SHEET_PIN_T:
281  AddMenusForSheetPin( PopMenu, (SCH_SHEET_PIN*) item );
282  break;
283 
284  default:
285  wxFAIL_MSG( wxString::Format( wxT( "Cannot create context menu for unknown type %d" ),
286  item->Type() ) );
287  break;
288  }
289 
290  PopMenu->AppendSeparator();
291  return true;
292 }
293 
294 
295 void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field )
296 {
297  wxString msg, name;
298 
299  if( !Field->GetFlags() )
300  {
301  switch( Field->GetId() )
302  {
303  case REFERENCE: name = _( "Move Reference" ); break;
304  case VALUE: name = _( "Move Value" ); break;
305  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
306  default: name = _( "Move Field" ); break;
307  }
308 
311  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
312  }
313 
314  switch( Field->GetId() )
315  {
316  case REFERENCE: name = _( "Rotate Reference" ); break;
317  case VALUE: name = _( "Rotate Value" ); break;
318  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
319  default: name = _( "Rotate Field" ); break;
320  }
321 
323  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
324 
325  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
327  switch( Field->GetId() )
328  {
329  case REFERENCE:
331  name = _( "Edit Reference" );
332  break;
333  case VALUE:
335  name = _( "Edit Value" );
336  break;
337  case FOOTPRINT:
339  name = _( "Edit Footprint Field" );
340  break;
341  default:
342  id = HK_EDIT;
343  name = _( "Edit Field" );
344  break;
345  }
346  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
347  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
348 }
349 
350 
351 void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS* aLibs )
352 {
353  if( Component->Type() != SCH_COMPONENT_T )
354  {
355  wxASSERT( 0 );
356  return;
357  }
358 
359  wxString msg;
360  LIB_ALIAS* libEntry = aLibs->FindLibraryAlias( Component->GetLibId() );
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( _( "Flip Vertical" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
378  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
379  msg = AddHotkeyName( _( "Flip Horizontal" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
380  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
381  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr, HK_ORIENT_NORMAL_COMPONENT );
382  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
383  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
384  _( "Orientation" ), KiBitmap( orient_xpm ) );
385 
386  AddMenusForEditComponent( PopMenu, Component, aLibs );
387 
388  if( !Component->GetFlags() )
389  {
390  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
392  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
393  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
394  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
395  }
396 
397  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
398  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
399 
400  if( !Component->GetFieldText("Datasheet").IsEmpty() )
401  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ), KiBitmap( datasheet_xpm ) );
402 }
403 
404 
405 void AddMenusForEditComponent( wxMenu* PopMenu, SCH_COMPONENT* Component, PART_LIBS* aLibs )
406 {
407  if( Component->Type() != SCH_COMPONENT_T )
408  {
409  wxASSERT( 0 );
410  return;
411  }
412 
413  wxString msg;
414  LIB_PART* part = NULL;
415  LIB_ALIAS* libEntry = aLibs->FindLibraryAlias( Component->GetLibId() );
416 
417  if( libEntry )
418  part = libEntry->GetPart();
419 
420  wxMenu* editmenu = new wxMenu;
421  msg = AddHotkeyName( _( "Edit Properties" ), g_Schematic_Hokeys_Descr, HK_EDIT );
422  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
423 
424  if( part && part->IsNormal() )
425  {
426  msg = AddHotkeyName( _( "Edit Value" ), g_Schematic_Hokeys_Descr,
429  KiBitmap( edit_comp_value_xpm ) );
430 
431  msg = AddHotkeyName( _( "Edit Reference" ), g_Schematic_Hokeys_Descr,
434  KiBitmap( edit_comp_ref_xpm ) );
435 
436  msg = AddHotkeyName( _( "Edit Footprint" ), g_Schematic_Hokeys_Descr,
439  KiBitmap( edit_comp_footprint_xpm ) );
440  }
441 
442  if( part && part->HasConversion() )
443  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
444  KiBitmap( component_select_alternate_shape_xpm ) );
445 
446  if( part && part->GetUnitCount() >= 2 )
447  {
448  wxMenu* sel_unit_menu = new wxMenu; int ii;
449 
450  for( ii = 0; ii < part->GetUnitCount(); ii++ )
451  {
452  wxString num_unit;
453  int unit = Component->GetUnit();
454  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
455  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
456  num_unit, wxEmptyString,
457  wxITEM_CHECK );
458  if( unit == ii + 1 )
459  item->Check(true);
460 
461  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
462  // See eeschema_id to modify this value.
464  break; // We have used all IDs for these submenus
465  }
466 
467  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
468  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
469  }
470 
471  if( !Component->GetFlags() )
472  {
473  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
476  msg, KiBitmap( libedit_xpm ) );
477  }
478 
479  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
480  _( "Properties" ), KiBitmap( config_xpm ) );
481 }
482 
483 
484 void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
485 {
486  wxMenu* menu_change_type = new wxMenu;
487  wxString msg;
488 
489  if( !GLabel->GetFlags() )
490  {
491  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
493  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
494  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
495  HK_DRAG );
496  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
497  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
499  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
500  }
501 
502  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
503  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
504  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
505  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
506  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
507  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
508 
509  // add menu change type text (to label, glabel, text):
511  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
513  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
515  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
516  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
517  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
518 }
519 
520 
521 void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
522 {
523  wxMenu* menu_change_type = new wxMenu;
524  wxString msg;
525 
526  if( !HLabel->GetFlags() )
527  {
528  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
530  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
531  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
532  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
533  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
535  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
536  }
537 
538  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
539  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
540  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
541  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
542  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
543  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
544 
545  // add menu change type text (to label, glabel, text):
547  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
549  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
551  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
552  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
553  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
554 }
555 
556 
557 void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
558 {
559  wxMenu* menu_change_type = new wxMenu;
560  wxString msg;
561 
562  if( !Label->GetFlags() )
563  {
564  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
566  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
567  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
568  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
569  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
571  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
572  }
573 
574  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
575  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
576  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
577  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
578  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
579  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
580 
581  // add menu change type text (to label, glabel, text):
583  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
585  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
587  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
588  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
589  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
590 }
591 
592 
593 void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
594 {
595  wxString msg;
596  wxMenu* menu_change_type = new wxMenu;
597 
598  if( !Text->GetFlags() )
599  {
600  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
602  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
603  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
605  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
606  }
607 
608  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
609  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
610  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
611  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
612  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
613  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
614 
615  /* add menu change type text (to label, glabel, text),
616  * but only if this is a single line text
617  */
618  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
619  {
621  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
623  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
625  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
626  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
627  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
628  }
629 }
630 
631 
632 void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction )
633 {
634  wxString msg;
635  SCH_SCREEN* screen = GetScreen();
636 
637  msg = AddHotkeyName( _( "Delete Junction" ), g_Schematic_Hokeys_Descr, HK_DELETE );
638  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
639 
640  if( !aJunction->IsNew() )
641  {
643  AddMenuItem( aMenu, ID_SCH_DRAG_ITEM, _( "Drag Junction" ), KiBitmap( drag_xpm ) );
644 
645  if( screen->GetWire( aJunction->GetPosition(), EXCLUDE_END_POINTS_T ) )
646  AddMenuItem( aMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
647  KiBitmap( break_line_xpm ) );
648  }
649 
650  if( screen->GetWireOrBus( aJunction->GetPosition() ) )
651  {
652  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
653  KiBitmap( delete_node_xpm ) );
654  AddMenuItem( aMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
655  KiBitmap( delete_connection_xpm ) );
656  }
657 }
658 
659 
660 void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
661 {
662  SCH_SCREEN* screen = frame->GetScreen();
663  wxPoint pos = frame->GetCrossHairPosition();
664  wxString msg;
665 
666  if( Wire == NULL )
667  {
668  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
669  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
670  return;
671  }
672 
673  bool is_new = Wire->IsNew();
674  if( is_new )
675  {
677  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
678  return;
679  }
680 
681  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
682  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
683  PopMenu->AppendSeparator();
684  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
685  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
686  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
687  KiBitmap( delete_node_xpm ) );
688  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
689  KiBitmap( delete_connection_xpm ) );
690 
691  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
692 
693  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
694  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
695  KiBitmap( break_line_xpm ) );
696 
697  PopMenu->AppendSeparator();
698 
699  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
700  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
701  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
702  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
703 
704  // Add global label command only if the cursor is over one end of the wire.
705  if( Wire->IsEndPoint( pos ) )
706  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
707  KiBitmap( add_glabel_xpm ) );
708 }
709 
710 
711 void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
712 {
713  wxPoint pos = frame->GetCrossHairPosition();
714  wxString msg;
715 
716  if( Bus == NULL )
717  {
718  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
719  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
720  return;
721  }
722 
723  bool is_new = Bus->IsNew();
724  if( is_new )
725  {
727  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
728  return;
729  }
730 
731  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
732  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
733 
734  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
735 
736  PopMenu->AppendSeparator();
737  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
738  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
739  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
740  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
741 
742  // Add global label command only if the cursor is over one end of the bus.
743  if( Bus->IsEndPoint( pos ) )
744  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
745  KiBitmap( add_glabel_xpm ) );
746 }
747 
748 
749 void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
750 {
751  wxString msg;
752 
753  if( !Sheet->GetFlags() )
754  {
755  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
756  KiBitmap( enter_sheet_xpm ) );
757  PopMenu->AppendSeparator();
758  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
760  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
761 
762  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
763  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
764 
765  PopMenu->AppendSeparator();
766  msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr, HK_SELECT_ITEMS_ON_PCB );
767  AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
768  PopMenu->AppendSeparator();
769 
770  wxMenu* orientmenu = new wxMenu;
771  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
772  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
773 
774  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
775  KiBitmap( rotate_ccw_xpm ) );
776 
777  msg = AddHotkeyName( _( "Flip Vertical" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
778  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
779  msg = AddHotkeyName( _( "Flip Horizontal" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
780  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
781 
782  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
783  _( "Orientation" ), KiBitmap( orient_xpm ) );
784  }
785 
786  if( Sheet->GetFlags() )
787  {
788  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
789  }
790  else
791  {
792  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
793  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
794 
795  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
796  KiBitmap( resize_sheet_xpm ) );
797  PopMenu->AppendSeparator();
798  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
799  KiBitmap( import_hierarchical_label_xpm ) );
800 
801  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
802  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
803  KiBitmap( options_pinsheet_xpm ) );
804 
805  PopMenu->AppendSeparator();
806  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
807  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
808  }
809 }
810 
811 
812 void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
813 {
814  wxString msg;
815 
816  if( !PinSheet->GetFlags() )
817  {
818  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
820  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
821  }
822 
823  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit" ), KiBitmap( edit_xpm ) );
824 
825  if( !PinSheet->GetFlags() )
826  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ),
827  KiBitmap( delete_xpm ) );
828 }
829 
830 
831 void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
832 {
833  wxString msg;
834 
835  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
836  KiBitmap( cancel_xpm ) );
837 
838  PopMenu->AppendSeparator();
839 
840  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
841  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
842 
843  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
844 
845  // After a block move (that is also a block selection) one can reselect
846  // a block function.
847  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
848  {
849  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
850  HK_CUT_BLOCK );
851  AddMenuItem( PopMenu, wxID_CUT, msg, KiBitmap( cut_xpm ) );
852  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
853  HK_COPY_BLOCK );
854  AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_xpm ) );
855  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
856  KiBitmap( duplicate_xpm ) );
857  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
859  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
860  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
861  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
862  msg = AddHotkeyName( _( "Flip Block Vertical" ), g_Schematic_Hokeys_Descr,
863  HK_MIRROR_Y );
864  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
865  msg = AddHotkeyName( _( "Flip Block Horizontal" ), g_Schematic_Hokeys_Descr,
866  HK_MIRROR_X );
867  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
868  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
869  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
870 
871 #if 0
872  #ifdef __WINDOWS__
873  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
874  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
875  #endif
876 #endif
877  }
878 }
879 
880 
881 void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
882 {
883  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
884  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
885  KiBitmap( info_xpm ) );
886 }
887 
888 
889 void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
890 {
891  wxString msg;
892 
893  if( aBitmap->GetFlags() == 0 )
894  {
895  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
897  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
898  }
899 
900  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
901  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
902  msg = AddHotkeyName( _( "Flip Vertical" ), g_Schematic_Hokeys_Descr,
903  HK_MIRROR_X );
904  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
905  msg = AddHotkeyName( _( "Flip Horizontal" ), g_Schematic_Hokeys_Descr,
906  HK_MIRROR_Y );
907  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
908  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
909  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
910 
911  if( aBitmap->GetFlags() == 0 )
912  {
913  aPopMenu->AppendSeparator();
914  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
915  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
916  }
917 }
918 
919 
920 void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
921 {
922  wxString msg;
923 
924  if( !aBusEntry->GetFlags() )
925  {
926  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
928  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
929  }
930 
931  if( aBusEntry->GetBusEntryShape() == '\\' )
933  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
934  else
936  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
937 
938  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
939  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
940 }
Definition of the SCH_SHEET class for Eeschema.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
Class SCH_FIELD instances are attached to a component and provide a place for the component's value...
Definition: sch_field.h:56
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:269
static void AddMenusForComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, PART_LIBS *aLibs)
Part library alias object definition.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
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:230
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:55
int GetId() const
Definition: sch_field.h:87
void SetCanStartBlock(int aStartBlock)
static void AddMenusForHierchicalSheet(wxMenu *PopMenu, SCH_SHEET *Sheet)
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
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:142
static const KICAD_T AllItemsButPins[]
A scan list for all schematic items except pins.
LIB_ALIAS * FindLibraryAlias(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryEntry searches all libraries in the list for an entry.
char GetBusEntryShape() const
function GetBusEntryShape
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
wxString GetFieldText(wxString aFieldName, bool aIncludeDefaultFields=true) const
Search for a field named aFieldName and returns text associated with this field.
static void AddMenusForGLabel(wxMenu *PopMenu, SCH_GLOBALLABEL *GLabel)
static void AddMenusForBus(wxMenu *PopMenu, SCH_LINE *Bus, SCH_EDIT_FRAME *frame)
Class SCH_BUS_ENTRY_BASE.
Definition: sch_bus_entry.h:43
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:530
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:36
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:120
bool IsBlockActive() const
SCH_ITEM * LocateAndShowItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0)
Function LocateAndShowItem checks the schematic at aPosition in logical (drawing) units for a item ma...
hotkey_id_commnand
void addJunctionMenuEntries(wxMenu *aMenu, SCH_JUNCTION *aJunction)
Function addJunctionMenuEntries adds 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:92
SCH_ITEM * GetCurItem() const
Function GetCurItem returns 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:130
static void AddMenusForHLabel(wxMenu *PopMenu, SCH_HIERLABEL *GLabel)
static void AddMenusForMarkers(wxMenu *aPopMenu, SCH_MARKER *aMarker, SCH_EDIT_FRAME *aFrame)
Class LIB_PART defines a library part object.
Class SCH_SHEET_PIN defines a sheet pin (label) used in sheets to create hierarchical schematics...
Definition: sch_sheet.h:62
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...
static void AddMenusForEditComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, PART_LIBS *aLibs)
void SetAbortRequest(bool aAbortRequest)
Class SCH_SHEET is the sheet symbol placed in a schematic, and is the entry point for a sub schematic...
Definition: sch_sheet.h:216
LIB_PART * GetPart() const
Function GetPart gets the shared LIB_PART.
static void AddMenusForBusEntry(wxMenu *aPopMenu, SCH_BUS_ENTRY_BASE *aBusEntry)
int GetUnitCount() const
Class PART_LIBS is a collection of PART_LIBs.
Field Value of part, i.e. "3.3K".
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:413
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:64
bool GetAbortRequest() const
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) ...
Class SCH_LINE is a segment description base class to describe items which have 2 end points (track...
Definition: sch_line.h:42
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:471
static wxString SubReference(int aUnit, bool aAddSeparator=true)
Function SubReference.
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)
Function GetWireOrBus returns a wire or bus item located at aPosition.
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.
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[]