KiCad PCB EDA Suite
eeschema/onrightclick.cpp File Reference
#include <fctsys.h>
#include <eeschema_id.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <menus_helpers.h>
#include <general.h>
#include <hotkeys.h>
#include <class_library.h>
#include <sch_bus_entry.h>
#include <sch_marker.h>
#include <sch_text.h>
#include <sch_junction.h>
#include <sch_component.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_bitmap.h>
#include <symbol_lib_table.h>
#include <sch_view.h>
#include <iostream>

Go to the source code of this file.

Functions

static void AddMenusForBlock (wxMenu *PopMenu, SCH_EDIT_FRAME *frame)
 
static void AddMenusForWire (wxMenu *PopMenu, SCH_LINE *Wire, SCH_EDIT_FRAME *frame)
 
static void AddMenusForBus (wxMenu *PopMenu, SCH_LINE *Bus, SCH_EDIT_FRAME *frame)
 
static void AddMenusForHierchicalSheet (wxMenu *PopMenu, SCH_SHEET *Sheet)
 
static void AddMenusForSheetPin (wxMenu *PopMenu, SCH_SHEET_PIN *PinSheet)
 
static void AddMenusForText (wxMenu *PopMenu, SCH_TEXT *Text)
 
static void AddMenusForLabel (wxMenu *PopMenu, SCH_LABEL *Label)
 
static void AddMenusForGLabel (wxMenu *PopMenu, SCH_GLOBALLABEL *GLabel)
 
static void AddMenusForHLabel (wxMenu *PopMenu, SCH_HIERLABEL *GLabel)
 
static void AddMenusForEditComponent (wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
 
static void AddMenusForComponent (wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
 
static void AddMenusForComponentField (wxMenu *PopMenu, SCH_FIELD *Field)
 
static void AddMenusForMarkers (wxMenu *aPopMenu, SCH_MARKER *aMarker, SCH_EDIT_FRAME *aFrame)
 
static void AddMenusForBitmap (wxMenu *aPopMenu, SCH_BITMAP *aBitmap)
 
static void AddMenusForBusEntry (wxMenu *aPopMenu, SCH_BUS_ENTRY_BASE *aBusEntry)
 

Function Documentation

◆ AddMenusForBitmap()

void AddMenusForBitmap ( wxMenu *  aPopMenu,
SCH_BITMAP aBitmap 
)
static

Definition at line 923 of file eeschema/onrightclick.cpp.

924 {
925  wxString msg;
926 
927  if( aBitmap->GetFlags() == 0 )
928  {
929  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
931  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
932  }
933 
934  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
935  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
936  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
937  HK_MIRROR_X );
938  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
939  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
940  HK_MIRROR_Y );
941  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
942  msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
943  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
944 
945  if( aBitmap->GetFlags() == 0 )
946  {
947  aPopMenu->AppendSeparator();
948  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
949  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
950  }
951 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_DELETE, HK_EDIT, HK_MIRROR_X, HK_MIRROR_Y, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, ID_POPUP_SCH_DELETE, ID_SCH_EDIT_ITEM, ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForBlock()

void AddMenusForBlock ( wxMenu *  PopMenu,
SCH_EDIT_FRAME frame 
)
static

Definition at line 865 of file eeschema/onrightclick.cpp.

866 {
867  wxString msg;
868 
869  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
870  KiBitmap( cancel_xpm ) );
871 
872  PopMenu->AppendSeparator();
873 
874  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
875  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
876 
877  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
878 
879  // After a block move (that is also a block selection) one can reselect
880  // a block function.
881  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
882  {
883  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
884  HK_EDIT_CUT );
885  AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
886  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
887  HK_EDIT_COPY );
888  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
889  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
890  KiBitmap( duplicate_xpm ) );
891  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
893  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
894  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
895  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
896  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
897  HK_MIRROR_Y );
898  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
899  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
901  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
902  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
903  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
904 
905 #if 0
906  #ifdef __WINDOWS__
907  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
908  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
909  #endif
910 #endif
911  }
912 }
BLOCK_COMMAND_T GetCommand() const
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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)
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), BLOCK_MOVE, g_Schematic_Hokeys_Descr, BLOCK_SELECTOR::GetCommand(), SCH_EDIT_FRAME::GetScreen(), HK_DELETE, HK_EDIT_COPY, HK_EDIT_CUT, HK_MIRROR_X, HK_MIRROR_Y, HK_MOVEBLOCK_TO_DRAGBLOCK, HK_ROTATE, ID_GEN_COPY_BLOCK_TO_CLIPBOARD, ID_POPUP_CANCEL_CURRENT_COMMAND, ID_POPUP_COPY_BLOCK, ID_POPUP_CUT_BLOCK, ID_POPUP_DELETE_BLOCK, ID_POPUP_DRAG_BLOCK, ID_POPUP_DUPLICATE_BLOCK, ID_POPUP_PLACE_BLOCK, ID_POPUP_ZOOM_BLOCK, ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, ID_SCH_ROTATE_CLOCKWISE, KiBitmap(), and BASE_SCREEN::m_BlockLocate.

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForBus()

void AddMenusForBus ( wxMenu *  PopMenu,
SCH_LINE Bus,
SCH_EDIT_FRAME frame 
)
static

Definition at line 745 of file eeschema/onrightclick.cpp.

746 {
747  wxPoint pos = frame->GetCrossHairPosition();
748  wxString msg;
749 
750  if( Bus == NULL )
751  {
752  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
753  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
754  return;
755  }
756 
757  if( Bus->IsNew() )
758  {
760  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
761  return;
762  }
763 
764  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
765  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
766 
767  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
768 
769  PopMenu->AppendSeparator();
770  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
771  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
772  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
773  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
774 
775  // Add global label command only if the cursor is over one end of the bus.
776  if( Bus->IsEndPoint( pos ) )
777  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
778  KiBitmap( add_glabel_xpm ) );
779 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
bool IsNew() const
Definition: base_struct.h:219
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:69
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)
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_DRAW_FRAME::GetCrossHairPosition(), HK_ADD_JUNCTION, HK_ADD_LABEL, HK_BEGIN_BUS, HK_DELETE, HK_END_CURR_LINEWIREBUS, ID_POPUP_END_LINE, ID_POPUP_SCH_ADD_GLABEL, ID_POPUP_SCH_ADD_JUNCTION, ID_POPUP_SCH_ADD_LABEL, ID_POPUP_SCH_BEGIN_BUS, ID_POPUP_SCH_BREAK_WIRE, ID_POPUP_SCH_DELETE, SCH_LINE::IsEndPoint(), EDA_ITEM::IsNew(), and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForBusEntry()

void AddMenusForBusEntry ( wxMenu *  aPopMenu,
SCH_BUS_ENTRY_BASE aBusEntry 
)
static

Definition at line 954 of file eeschema/onrightclick.cpp.

955 {
956  wxString msg;
957 
958  if( !aBusEntry->GetFlags() )
959  {
960  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
962  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
963  }
964 
965  if( aBusEntry->GetBusEntryShape() == '\\' )
967  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
968  else
970  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
971 
972  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
973  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
974 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
char GetBusEntryShape() const
function GetBusEntryShape
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, SCH_BUS_ENTRY_BASE::GetBusEntryShape(), EDA_ITEM::GetFlags(), HK_DELETE, HK_MOVE_COMPONENT_OR_ITEM, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH, ID_POPUP_SCH_ENTRY_SELECT_SLASH, ID_SCH_MOVE_ITEM, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForComponent()

void AddMenusForComponent ( wxMenu *  PopMenu,
SCH_COMPONENT Component,
SYMBOL_LIB_TABLE aLibs 
)
static

Definition at line 375 of file eeschema/onrightclick.cpp.

376 {
377  if( Component->Type() != SCH_COMPONENT_T )
378  {
379  wxASSERT( 0 );
380  return;
381  }
382 
383  wxString msg;
384 
385  if( !Component->GetFlags() )
386  {
387  msg.Printf( _( "Move %s" ), Component->GetField( REFERENCE )->GetText() );
389  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
390  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
391  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
392  }
393 
394  wxMenu* orientmenu = new wxMenu;
395  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
396  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
397  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
398  KiBitmap( rotate_ccw_xpm ) );
399  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
400  HK_MIRROR_X );
401  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
402  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
403  HK_MIRROR_Y );
404  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
405  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
407  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
408  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
409  _( "Orientation" ), KiBitmap( orient_xpm ) );
410 
411  AddMenusForEditComponent( PopMenu, Component, aLibs );
412 
413  if( !Component->GetFlags() )
414  {
415  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
417  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
418  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
419  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
420  }
421 
422  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
423  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
424 
425  if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
426  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
427  KiBitmap( datasheet_xpm ) );
428 }
name of datasheet
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
static void AddMenusForEditComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
Field Reference of part, i.e. "IC21".
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
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 wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:80
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), AddMenusForEditComponent(), DATASHEET, g_Schematic_Hokeys_Descr, SCH_COMPONENT::GetField(), EDA_ITEM::GetFlags(), SCH_FIELD::GetFullyQualifiedText(), EDA_TEXT::GetText(), HK_AUTOPLACE_FIELDS, HK_DELETE, HK_DRAG, HK_DUPLICATE_ITEM, HK_MIRROR_X, HK_MIRROR_Y, HK_MOVE_COMPONENT_OR_ITEM, HK_ORIENT_NORMAL_COMPONENT, HK_ROTATE, ID_AUTOPLACE_FIELDS, ID_POPUP_SCH_DELETE_CMP, ID_POPUP_SCH_DISPLAYDOC_CMP, ID_POPUP_SCH_DUPLICATE_ITEM, ID_POPUP_SCH_GENERIC_ORIENT_CMP, ID_SCH_DRAG_ITEM, ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, ID_SCH_MOVE_ITEM, ID_SCH_ORIENT_NORMAL, ID_SCH_ROTATE_CLOCKWISE, ID_SCH_ROTATE_COUNTERCLOCKWISE, KiBitmap(), REFERENCE, SCH_COMPONENT_T, and EDA_ITEM::Type().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForComponentField()

void AddMenusForComponentField ( wxMenu *  PopMenu,
SCH_FIELD Field 
)
static

Definition at line 315 of file eeschema/onrightclick.cpp.

316 {
317  wxString msg, name;
318 
319  if( !Field->GetFlags() )
320  {
321  switch( Field->GetId() )
322  {
323  case REFERENCE: name = _( "Move Reference" ); break;
324  case VALUE: name = _( "Move Value" ); break;
325  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
326  default: name = _( "Move Field" ); break;
327  }
328 
331  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
332  }
333 
334  switch( Field->GetId() )
335  {
336  case REFERENCE: name = _( "Rotate Reference" ); break;
337  case VALUE: name = _( "Rotate Value" ); break;
338  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
339  default: name = _( "Rotate Field" ); break;
340  }
341 
343  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
344 
345  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
347  switch( Field->GetId() )
348  {
349  case REFERENCE:
351  name = _( "Edit Reference..." );
352  break;
353  case VALUE:
355  name = _( "Edit Value..." );
356  break;
357  case FOOTPRINT:
359  name = _( "Edit Footprint Field..." );
360  break;
361  case DATASHEET:
363  name = _( "Show Datasheet" );
364  break;
365  default:
366  id = HK_EDIT;
367  name = _( "Edit Field..." );
368  break;
369  }
371  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
372 }
name of datasheet
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
int GetId() const
Definition: sch_field.h:87
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
hotkey_id_commnand
#define VALUE
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
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), DATASHEET, FOOTPRINT, g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), SCH_FIELD::GetId(), HK_EDIT, HK_EDIT_COMPONENT_FOOTPRINT, HK_EDIT_COMPONENT_REFERENCE, HK_EDIT_COMPONENT_VALUE, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, HK_SHOW_COMPONENT_DATASHEET, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, KiBitmap(), name, REFERENCE, and VALUE.

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForEditComponent()

void AddMenusForEditComponent ( wxMenu *  PopMenu,
SCH_COMPONENT Component,
SYMBOL_LIB_TABLE aLibs 
)
static

Definition at line 431 of file eeschema/onrightclick.cpp.

432 {
433  if( Component->Type() != SCH_COMPONENT_T )
434  {
435  wxASSERT( 0 );
436  return;
437  }
438 
439  wxString msg;
440  LIB_PART* part = NULL;
441  LIB_ALIAS* alias = NULL;
442 
443  try
444  {
445  alias = aLibs->LoadSymbol( Component->GetLibId() );
446  }
447  catch( ... )
448  {
449  }
450 
451  if( alias )
452  part = alias->GetPart();
453 
454  wxMenu* editmenu = new wxMenu;
455  msg = AddHotkeyName( _( "Edit Properties..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
456  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
457 
458  if( part && part->IsNormal() )
459  {
460  msg = AddHotkeyName( _( "Edit Value..." ), g_Schematic_Hokeys_Descr,
463  KiBitmap( edit_comp_value_xpm ) );
464 
465  msg = AddHotkeyName( _( "Edit Reference..." ), g_Schematic_Hokeys_Descr,
468  KiBitmap( edit_comp_ref_xpm ) );
469 
470  msg = AddHotkeyName( _( "Edit Footprint..." ), g_Schematic_Hokeys_Descr,
473  KiBitmap( edit_comp_footprint_xpm ) );
474 
475  msg = AddHotkeyName( _( "Show Datasheet" ), g_Schematic_Hokeys_Descr,
478  KiBitmap( datasheet_xpm ) );
479  }
480 
481  if( part && part->HasConversion() )
482  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
483  KiBitmap( component_select_alternate_shape_xpm ) );
484 
485  if( part && part->GetUnitCount() >= 2 )
486  {
487  wxMenu* sel_unit_menu = new wxMenu; int ii;
488 
489  for( ii = 0; ii < part->GetUnitCount(); ii++ )
490  {
491  wxString num_unit;
492  int unit = Component->GetUnit();
493  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
494  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
495  num_unit, wxEmptyString,
496  wxITEM_CHECK );
497  if( unit == ii + 1 )
498  item->Check(true);
499 
500  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
501  // See eeschema_id to modify this value.
503  break; // We have used all IDs for these submenus
504  }
505 
506  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
507  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
508  }
509 
510  if( !Component->GetFlags() )
511  {
512  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
515  msg, KiBitmap( libedit_xpm ) );
516  }
517 
518  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
519  _( "Properties" ), KiBitmap( config_xpm ) );
520 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
int GetUnitCount() const
Part library alias object definition.
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
bool IsNormal() const
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
int GetUnit() const
Define a library symbol object.
LIB_PART * GetPart() const
Get the shared LIB_PART.
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)
static wxString SubReference(int aUnit, bool aAddSeparator=true)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
const LIB_ID & GetLibId() const
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, GetChars(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), LIB_ALIAS::GetPart(), SCH_COMPONENT::GetUnit(), LIB_PART::GetUnitCount(), LIB_PART::HasConversion(), HK_EDIT, HK_EDIT_COMPONENT_FOOTPRINT, HK_EDIT_COMPONENT_REFERENCE, HK_EDIT_COMPONENT_VALUE, HK_EDIT_COMPONENT_WITH_LIBEDIT, HK_SHOW_COMPONENT_DATASHEET, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP, ID_POPUP_SCH_DISPLAYDOC_CMP, ID_POPUP_SCH_EDIT_CONVERT_CMP, ID_POPUP_SCH_SELECT_UNIT1, ID_POPUP_SCH_SELECT_UNIT_CMP, ID_POPUP_SCH_SELECT_UNIT_CMP_MAX, ID_SCH_EDIT_COMPONENT_FOOTPRINT, ID_SCH_EDIT_COMPONENT_REFERENCE, ID_SCH_EDIT_COMPONENT_VALUE, ID_SCH_EDIT_ITEM, LIB_PART::IsNormal(), KiBitmap(), SYMBOL_LIB_TABLE::LoadSymbol(), SCH_COMPONENT_T, LIB_PART::SubReference(), and EDA_ITEM::Type().

Referenced by AddMenusForComponent(), and SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForGLabel()

void AddMenusForGLabel ( wxMenu *  PopMenu,
SCH_GLOBALLABEL GLabel 
)
static

Definition at line 523 of file eeschema/onrightclick.cpp.

524 {
525  wxMenu* menu_change_type = new wxMenu;
526  wxString msg;
527 
528  if( !GLabel->GetFlags() )
529  {
530  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
532  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
533  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
534  HK_DRAG );
535  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
536  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
538  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
539  }
540 
541  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
542  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
543  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
544  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
545  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
546  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
547 
548  // add menu change type text (to label, glabel, text):
550  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
552  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
554  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
555  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
556  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
557 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_DELETE, HK_DRAG, HK_DUPLICATE_ITEM, HK_EDIT, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_DUPLICATE_ITEM, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForHierchicalSheet()

void AddMenusForHierchicalSheet ( wxMenu *  PopMenu,
SCH_SHEET Sheet 
)
static

Definition at line 782 of file eeschema/onrightclick.cpp.

783 {
784  wxString msg;
785 
786  if( !Sheet->GetFlags() )
787  {
788  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
789  KiBitmap( enter_sheet_xpm ) );
790  PopMenu->AppendSeparator();
791  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
793  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
794 
795  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
796  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
797 
798  PopMenu->AppendSeparator();
799  msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr,
801  AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
802  PopMenu->AppendSeparator();
803 
804  wxMenu* orientmenu = new wxMenu;
805  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
806  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
807 
808  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
809  KiBitmap( rotate_ccw_xpm ) );
810 
811  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
812  HK_MIRROR_X );
813  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
814  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
815  HK_MIRROR_Y );
816  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
817 
818  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
819  _( "Orientation" ), KiBitmap( orient_xpm ) );
820  }
821 
822  if( Sheet->GetFlags() )
823  {
824  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
825  }
826  else
827  {
828  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
829  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
830 
831  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
832  KiBitmap( resize_sheet_xpm ) );
833  PopMenu->AppendSeparator();
834  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
835  KiBitmap( import_hierarchical_label_xpm ) );
836 
837  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
838  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
839  KiBitmap( options_pinsheet_xpm ) );
840 
841  PopMenu->AppendSeparator();
842  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
843  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
844  }
845 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:232
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), SCH_SHEET::HasUndefinedPins(), HK_DELETE, HK_DRAG, HK_EDIT, HK_MIRROR_X, HK_MIRROR_Y, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, HK_SELECT_ITEMS_ON_PCB, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, ID_POPUP_SCH_CLEANUP_SHEET, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_END_SHEET, ID_POPUP_SCH_ENTER_SHEET, ID_POPUP_SCH_GENERIC_ORIENT_CMP, ID_POPUP_SCH_RESIZE_SHEET, ID_POPUP_SCH_SELECT_ON_PCB, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MIRROR_X, ID_SCH_MIRROR_Y, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, ID_SCH_ROTATE_COUNTERCLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForHLabel()

void AddMenusForHLabel ( wxMenu *  PopMenu,
SCH_HIERLABEL GLabel 
)
static

Definition at line 560 of file eeschema/onrightclick.cpp.

561 {
562  wxMenu* menu_change_type = new wxMenu;
563  wxString msg;
564 
565  if( !HLabel->GetFlags() )
566  {
567  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
569  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
570  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
571  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
572  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
574  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
575  }
576 
577  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
578  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
579  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
580  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
581  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
582  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
583 
584  // add menu change type text (to label, glabel, text):
586  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
588  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
590  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
591  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
592  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
593 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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)
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_DELETE, HK_DRAG, HK_DUPLICATE_ITEM, HK_EDIT, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_DUPLICATE_ITEM, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForLabel()

void AddMenusForLabel ( wxMenu *  PopMenu,
SCH_LABEL Label 
)
static

Definition at line 596 of file eeschema/onrightclick.cpp.

597 {
598  wxMenu* menu_change_type = new wxMenu;
599  wxString msg;
600 
601  if( !Label->GetFlags() )
602  {
604  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
605  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
606  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
607  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr, HK_DUPLICATE_ITEM );
608  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
609  }
610 
611  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
612  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
613  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
614  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
615  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
616  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
617 
618  // add menu change type text (to label, glabel, text):
620  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
622  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
624  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
625  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
626  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
627 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_DELETE, HK_DRAG, HK_DUPLICATE_ITEM, HK_EDIT, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_DUPLICATE_ITEM, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForMarkers()

void AddMenusForMarkers ( wxMenu *  aPopMenu,
SCH_MARKER aMarker,
SCH_EDIT_FRAME aFrame 
)
static

Definition at line 915 of file eeschema/onrightclick.cpp.

916 {
917  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
918  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
919  KiBitmap( info_xpm ) );
920 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79

References AddMenuItem(), ID_POPUP_SCH_DELETE, ID_POPUP_SCH_GETINFO_MARKER, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForSheetPin()

void AddMenusForSheetPin ( wxMenu *  PopMenu,
SCH_SHEET_PIN PinSheet 
)
static

Definition at line 848 of file eeschema/onrightclick.cpp.

849 {
850  wxString msg;
851 
852  if( !PinSheet->GetFlags() )
853  {
855  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
856  }
857 
858  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ), KiBitmap( edit_xpm ) );
859 
860  if( !PinSheet->GetFlags() )
861  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ), KiBitmap( delete_xpm ) );
862 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_MOVE_COMPONENT_OR_ITEM, ID_POPUP_SCH_DELETE, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForText()

void AddMenusForText ( wxMenu *  PopMenu,
SCH_TEXT Text 
)
static

Definition at line 630 of file eeschema/onrightclick.cpp.

631 {
632  wxString msg;
633  wxMenu* menu_change_type = new wxMenu;
634 
635  if( !Text->GetFlags() )
636  {
638  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
639  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr, HK_DUPLICATE_ITEM );
640  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
641  }
642 
643  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
644  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
645  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
646  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
647  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
648  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
649 
650  /* add menu change type text (to label, glabel, text),
651  * but only if this is a single line text
652  */
653  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
654  {
656  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
658  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
660  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
661  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
662  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
663  }
664 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:143
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)
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:258
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), EDA_TEXT::GetText(), HK_DELETE, HK_DUPLICATE_ITEM, HK_EDIT, HK_MOVE_COMPONENT_OR_ITEM, HK_ROTATE, ID_POPUP_SCH_CHANGE_TYPE_TEXT, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL, ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_DUPLICATE_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

◆ AddMenusForWire()

void AddMenusForWire ( wxMenu *  PopMenu,
SCH_LINE Wire,
SCH_EDIT_FRAME frame 
)
static

Definition at line 695 of file eeschema/onrightclick.cpp.

696 {
697  SCH_SCREEN* screen = frame->GetScreen();
698  wxPoint pos = frame->GetCrossHairPosition();
699  wxString msg;
700 
701  if( Wire == NULL )
702  {
703  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
704  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
705  return;
706  }
707 
708  if( Wire->IsNew() )
709  {
711  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
712  return;
713  }
714 
715  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
716  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
717  PopMenu->AppendSeparator();
718  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
719  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
720  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
721  KiBitmap( delete_node_xpm ) );
722  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
723  KiBitmap( delete_connection_xpm ) );
724 
725  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
726 
727  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
728  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
729  KiBitmap( break_line_xpm ) );
730 
731  PopMenu->AppendSeparator();
732 
733  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
734  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
735  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
736  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
737 
738  // Add global label command only if the cursor is over one end of the wire.
739  if( Wire->IsEndPoint( pos ) )
740  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
741  KiBitmap( add_glabel_xpm ) );
742 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
bool IsNew() const
Definition: base_struct.h:219
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
bool IsEndPoint(const wxPoint &aPoint) const
Definition: sch_line.h:69
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value)
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:41
SCH_LINE * GetWireOrBus(const wxPoint &aPosition)
Return a wire or bus item located at aPosition.
Definition: sch_screen.cpp:952
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_DRAW_FRAME::GetCrossHairPosition(), SCH_EDIT_FRAME::GetScreen(), SCH_SCREEN::GetWireOrBus(), HK_ADD_JUNCTION, HK_ADD_LABEL, HK_BEGIN_WIRE, HK_DELETE, HK_DRAG, HK_END_CURR_LINEWIREBUS, ID_POPUP_END_LINE, ID_POPUP_SCH_ADD_GLABEL, ID_POPUP_SCH_ADD_JUNCTION, ID_POPUP_SCH_ADD_LABEL, ID_POPUP_SCH_BEGIN_WIRE, ID_POPUP_SCH_BREAK_WIRE, ID_POPUP_SCH_DELETE, ID_POPUP_SCH_DELETE_CONNECTION, ID_POPUP_SCH_DELETE_NODE, ID_SCH_DRAG_ITEM, SCH_LINE::IsEndPoint(), EDA_ITEM::IsNew(), and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().