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-2017 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_text_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_field_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 Component %s" ),
365  GetChars( Component->GetField( REFERENCE )->GetText() ) );
367  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
368  msg = AddHotkeyName( _( "Drag Component" ), g_Schematic_Hokeys_Descr, HK_DRAG );
369  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_xpm ) );
370  }
371 
372  wxMenu* orientmenu = new wxMenu;
373  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
374  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
375  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
376  KiBitmap( rotate_ccw_xpm ) );
377  msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
378  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
379  msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
380  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
382  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
383  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
384  _( "Orient Component" ), KiBitmap( orient_xpm ) );
385 
386  AddMenusForEditComponent( PopMenu, Component, aLibs );
387 
388  if( !Component->GetFlags() )
389  {
390  msg = AddHotkeyName( _( "Copy Component" ), g_Schematic_Hokeys_Descr,
392  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
393  msg = AddHotkeyName( _( "Delete Component" ), 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( libEntry && !libEntry->GetDocFileName().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" ), g_Schematic_Hokeys_Descr, HK_EDIT );
422  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_component_xpm ) );
423 
424  if( part && part->IsNormal() )
425  {
426  msg = AddHotkeyName( _( "Value" ), g_Schematic_Hokeys_Descr,
429  KiBitmap( edit_comp_value_xpm ) );
430 
431  msg = AddHotkeyName( _( "Reference" ), g_Schematic_Hokeys_Descr,
434  KiBitmap( edit_comp_ref_xpm ) );
435 
436  msg = AddHotkeyName( _( "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  _( "Edit Component" ), KiBitmap( edit_component_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 Global Label" ), g_Schematic_Hokeys_Descr,
493  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
494  msg = AddHotkeyName( _( "Drag Global Label" ), g_Schematic_Hokeys_Descr,
495  HK_DRAG );
496  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) );
497  msg = AddHotkeyName( _( "Copy Global Label" ), g_Schematic_Hokeys_Descr,
499  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
500  }
501 
502  msg = AddHotkeyName( _( "Rotate Global Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
503  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_glabel_xpm ) );
504  msg = AddHotkeyName( _( "Edit Global Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
505  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
506  msg = AddHotkeyName( _( "Delete Global Label" ), g_Schematic_Hokeys_Descr, HK_DELETE );
507  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_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 Hierarchical Label" ), g_Schematic_Hokeys_Descr,
530  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
531  msg = AddHotkeyName( _( "Drag Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_DRAG );
532  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) );
533  msg = AddHotkeyName( _( "Copy Hierarchical Label" ), g_Schematic_Hokeys_Descr,
535  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
536  }
537 
538  msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
539  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_glabel_xpm ) );
540  msg = AddHotkeyName( _( "Edit Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
541  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
542  msg = AddHotkeyName( _( "Delete Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_DELETE );
543  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_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 Label" ), g_Schematic_Hokeys_Descr,
566  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
567  msg = AddHotkeyName( _( "Drag Label" ), g_Schematic_Hokeys_Descr, HK_DRAG );
568  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) );
569  msg = AddHotkeyName( _( "Copy Label" ), g_Schematic_Hokeys_Descr,
571  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
572  }
573 
574  msg = AddHotkeyName( _( "Rotate Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
575  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
576  msg = AddHotkeyName( _( "Edit Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
577  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
578  msg = AddHotkeyName( _( "Delete Label" ), g_Schematic_Hokeys_Descr, HK_DELETE );
579  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_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 Text" ), g_Schematic_Hokeys_Descr,
602  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
603  msg = AddHotkeyName( _( "Copy Text" ), g_Schematic_Hokeys_Descr,
605  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
606  }
607 
608  msg = AddHotkeyName( _( "Rotate Text" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
609  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
610  msg = AddHotkeyName( _( "Edit Text" ), g_Schematic_Hokeys_Descr, HK_EDIT );
611  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
612  msg = AddHotkeyName( _( "Delete Text" ), g_Schematic_Hokeys_Descr, HK_DELETE );
613  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_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( move_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( move_track_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 Sheet" ), g_Schematic_Hokeys_Descr,
760  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_sheet_xpm ) );
761 
762  msg = AddHotkeyName( _( "Drag Sheet" ), g_Schematic_Hokeys_Descr, HK_DRAG );
763  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_sheet_xpm ) );
764 
765  wxMenu* orientmenu = new wxMenu;
766  msg = AddHotkeyName( _( "Rotate Sheet CW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
767  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
768 
769  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Sheet CCW" ),
770  KiBitmap( rotate_ccw_xpm ) );
771 
772  msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
773  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
774  msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
775  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
776 
777  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
778  _( "Orient Sheet" ), KiBitmap( orient_xpm ) );
779  }
780 
781  if( Sheet->GetFlags() )
782  {
783  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place Sheet" ), KiBitmap( checked_ok_xpm ) );
784  }
785  else
786  {
787  msg = AddHotkeyName( _( "Edit Sheet" ), g_Schematic_Hokeys_Descr, HK_EDIT );
788  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_sheet_xpm ) );
789 
790  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ),
791  KiBitmap( resize_sheet_xpm ) );
792  PopMenu->AppendSeparator();
793  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
794  KiBitmap( import_hierarchical_label_xpm ) );
795 
796  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
797  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
798  KiBitmap( options_pinsheet_xpm ) );
799 
800  PopMenu->AppendSeparator();
801  msg = AddHotkeyName( _( "Delete Sheet" ), g_Schematic_Hokeys_Descr, HK_DELETE );
802  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
803  }
804 }
805 
806 
807 void AddMenusForSheetPin( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
808 {
809  wxString msg;
810 
811  if( !PinSheet->GetFlags() )
812  {
813  msg = AddHotkeyName( _( "Move Sheet Pin" ), g_Schematic_Hokeys_Descr,
815  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
816  }
817 
818  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit Sheet Pin" ), KiBitmap( edit_xpm ) );
819 
820  if( !PinSheet->GetFlags() )
821  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ),
822  KiBitmap( delete_pinsheet_xpm ) );
823 }
824 
825 
826 void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
827 {
828  wxString msg;
829 
830  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
831  KiBitmap( cancel_xpm ) );
832 
833  PopMenu->AppendSeparator();
834 
835  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
836  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
837 
838  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
839 
840  // After a block move (that is also a block selection) one can reselect
841  // a block function.
842  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
843  {
844  msg = AddHotkeyName( _( "Save Block" ), g_Schematic_Hokeys_Descr,
845  HK_SAVE_BLOCK );
846  AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_button_xpm ) );
847  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), KiBitmap( copyblock_xpm ) );
848  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
850  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) );
851  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
852  msg = AddHotkeyName( _( "Mirror Block ||" ), g_Schematic_Hokeys_Descr,
853  HK_MIRROR_Y );
854  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
855  msg = AddHotkeyName( _( "Mirror Block --" ), g_Schematic_Hokeys_Descr,
856  HK_MIRROR_X );
857  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
858  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
859  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
860 
861 #if 0
862  #ifdef __WINDOWS__
863  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
864  _( "Copy to Clipboard" ), KiBitmap( copy_button_xpm ) );
865  #endif
866 #endif
867  }
868 }
869 
870 
871 void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame )
872 {
873  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
874  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
875  KiBitmap( info_xpm ) );
876 }
877 
878 
879 void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap )
880 {
881  wxString msg;
882 
883  if( aBitmap->GetFlags() == 0 )
884  {
885  msg = AddHotkeyName( _( "Move Image" ), g_Schematic_Hokeys_Descr,
887  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
888  }
889 
890  msg = AddHotkeyName( _( "Rotate Image" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
891  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
892  msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr,
893  HK_MIRROR_X );
894  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
895  msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr,
896  HK_MIRROR_Y );
897  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
898  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
899  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
900 
901  if( aBitmap->GetFlags() == 0 )
902  {
903  aPopMenu->AppendSeparator();
904  msg = AddHotkeyName( _( "Delete Image" ), g_Schematic_Hokeys_Descr, HK_DELETE );
905  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
906  }
907 }
908 
909 
910 void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry )
911 {
912  wxString msg;
913 
914  if( !aBusEntry->GetFlags() )
915  {
916  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
918  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
919  }
920 
921  if( aBusEntry->GetBusEntryShape() == '\\' )
923  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
924  else
926  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
927 
928  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
929  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
930 }
Definition of the SCH_SHEET class for Eeschema.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
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:255
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:216
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".
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:520
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
hotkey_id_commnand
SCH_ITEM * LocateAndShowItem(const wxPoint &aPosition, const KICAD_T aFilterList[]=SCH_COLLECTOR::AllItems, int aHotKeyCommandId=0)
Function LocateAndShowItem checks the schematic at aPosition in logical (drawing) units for a item ma...
void 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:54
SCH_FIELD * GetField(int aFieldNdx) const
Function GetField returns a field.
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:92
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:415
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:64
wxString GetDocFileName() const
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:406
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[]