KiCad PCB EDA Suite
eeschema/onrightclick.cpp File Reference
#include <fctsys.h>
#include <eeschema_id.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <schframe.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 <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

void AddMenusForBitmap ( wxMenu *  aPopMenu,
SCH_BITMAP aBitmap 
)
static

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

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().

903 {
904  wxString msg;
905 
906  if( aBitmap->GetFlags() == 0 )
907  {
908  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
910  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
911  }
912 
913  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
914  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
915  msg = AddHotkeyName( _( "Flip Vertical" ), g_Schematic_Hokeys_Descr,
916  HK_MIRROR_X );
917  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
918  msg = AddHotkeyName( _( "Flip Horizontal" ), g_Schematic_Hokeys_Descr,
919  HK_MIRROR_Y );
920  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
921  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
922  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
923 
924  if( aBitmap->GetFlags() == 0 )
925  {
926  aPopMenu->AppendSeparator();
927  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
928  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
929  }
930 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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[]
void AddMenusForBlock ( wxMenu *  PopMenu,
SCH_EDIT_FRAME frame 
)
static

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

References AddHotkeyName(), AddMenuItem(), BLOCK_MOVE, g_Schematic_Hokeys_Descr, BLOCK_SELECTOR::GetCommand(), SCH_EDIT_FRAME::GetScreen(), HK_COPY_BLOCK, HK_CUT_BLOCK, HK_DELETE, 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_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().

845 {
846  wxString msg;
847 
848  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
849  KiBitmap( cancel_xpm ) );
850 
851  PopMenu->AppendSeparator();
852 
853  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
854  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
855 
856  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
857 
858  // After a block move (that is also a block selection) one can reselect
859  // a block function.
860  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
861  {
862  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
863  HK_CUT_BLOCK );
864  AddMenuItem( PopMenu, wxID_CUT, msg, KiBitmap( cut_xpm ) );
865  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
866  HK_COPY_BLOCK );
867  AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_xpm ) );
868  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
869  KiBitmap( duplicate_xpm ) );
870  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
872  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
873  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
874  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
875  msg = AddHotkeyName( _( "Flip Block Vertical" ), g_Schematic_Hokeys_Descr,
876  HK_MIRROR_Y );
877  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
878  msg = AddHotkeyName( _( "Flip Block Horizontal" ), g_Schematic_Hokeys_Descr,
879  HK_MIRROR_X );
880  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
881  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
882  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
883 
884 #if 0
885  #ifdef __WINDOWS__
886  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
887  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
888  #endif
889 #endif
890  }
891 }
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
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
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:532
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
BLOCK_COMMAND_T GetCommand() const
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void AddMenusForBus ( wxMenu *  PopMenu,
SCH_LINE Bus,
SCH_EDIT_FRAME frame 
)
static

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

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().

725 {
726  wxPoint pos = frame->GetCrossHairPosition();
727  wxString msg;
728 
729  if( Bus == NULL )
730  {
731  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
732  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
733  return;
734  }
735 
736  bool is_new = Bus->IsNew();
737  if( is_new )
738  {
740  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
741  return;
742  }
743 
744  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
745  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
746 
747  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
748 
749  PopMenu->AppendSeparator();
750  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
751  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
752  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
753  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
754 
755  // Add global label command only if the cursor is over one end of the bus.
756  if( Bus->IsEndPoint( pos ) )
757  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
758  KiBitmap( add_glabel_xpm ) );
759 }
bool IsNew() const
Definition: base_struct.h:243
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void AddMenusForBusEntry ( wxMenu *  aPopMenu,
SCH_BUS_ENTRY_BASE aBusEntry 
)
static

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

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().

934 {
935  wxString msg;
936 
937  if( !aBusEntry->GetFlags() )
938  {
939  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
941  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
942  }
943 
944  if( aBusEntry->GetBusEntryShape() == '\\' )
946  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
947  else
949  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
950 
951  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
952  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
953 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
char GetBusEntryShape() const
function GetBusEntryShape
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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[]
void AddMenusForComponent ( wxMenu *  PopMenu,
SCH_COMPONENT Component,
SYMBOL_LIB_TABLE aLibs 
)
static

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

References AddHotkeyName(), AddMenuItem(), AddMenusForEditComponent(), DATASHEET, g_Schematic_Hokeys_Descr, GetChars(), 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().

356 {
357  if( Component->Type() != SCH_COMPONENT_T )
358  {
359  wxASSERT( 0 );
360  return;
361  }
362 
363  wxString msg;
364 
365  if( !Component->GetFlags() )
366  {
367  msg.Printf( _( "Move %s" ),
368  GetChars( Component->GetField( REFERENCE )->GetText() ) );
370  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
371  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
372  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
373  }
374 
375  wxMenu* orientmenu = new wxMenu;
376  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
377  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
378  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
379  KiBitmap( rotate_ccw_xpm ) );
380  msg = AddHotkeyName( _( "Flip Vertical" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
381  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
382  msg = AddHotkeyName( _( "Flip Horizontal" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
383  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
384  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
386  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
387  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
388  _( "Orientation" ), KiBitmap( orient_xpm ) );
389 
390  AddMenusForEditComponent( PopMenu, Component, aLibs );
391 
392  if( !Component->GetFlags() )
393  {
394  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
396  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
397  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
398  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
399  }
400 
401  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
402  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
403 
404  if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
405  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
406  KiBitmap( datasheet_xpm ) );
407 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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:55
const wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:79
static void AddMenusForEditComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, SYMBOL_LIB_TABLE *aLibs)
Field Reference of part, i.e. "IC21".
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
SCH_FIELD * GetField(int aFieldNdx) const
Returns a field in this symbol.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
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) ...
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void AddMenusForComponentField ( wxMenu *  PopMenu,
SCH_FIELD Field 
)
static

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

References AddHotkeyName(), AddMenuItem(), 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, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, KiBitmap(), name, REFERENCE, and VALUE.

Referenced by SCH_EDIT_FRAME::OnRightClick().

300 {
301  wxString msg, name;
302 
303  if( !Field->GetFlags() )
304  {
305  switch( Field->GetId() )
306  {
307  case REFERENCE: name = _( "Move Reference" ); break;
308  case VALUE: name = _( "Move Value" ); break;
309  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
310  default: name = _( "Move Field" ); break;
311  }
312 
315  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
316  }
317 
318  switch( Field->GetId() )
319  {
320  case REFERENCE: name = _( "Rotate Reference" ); break;
321  case VALUE: name = _( "Rotate Value" ); break;
322  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
323  default: name = _( "Rotate Field" ); break;
324  }
325 
327  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
328 
329  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
331  switch( Field->GetId() )
332  {
333  case REFERENCE:
335  name = _( "Edit Reference" );
336  break;
337  case VALUE:
339  name = _( "Edit Value" );
340  break;
341  case FOOTPRINT:
343  name = _( "Edit Footprint Field" );
344  break;
345  default:
346  id = HK_EDIT;
347  name = _( "Edit Field" );
348  break;
349  }
350  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
351  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
352 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
Field Name Module PCB, i.e. "16DIP300".
Field Reference of part, i.e. "IC21".
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
hotkey_id_commnand
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
#define VALUE
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void AddMenusForEditComponent ( wxMenu *  PopMenu,
SCH_COMPONENT Component,
SYMBOL_LIB_TABLE aLibs 
)
static

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

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, ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_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().

411 {
412  if( Component->Type() != SCH_COMPONENT_T )
413  {
414  wxASSERT( 0 );
415  return;
416  }
417 
418  wxString msg;
419  LIB_PART* part = NULL;
420  LIB_ALIAS* alias = NULL;
421 
422  try
423  {
424  alias = aLibs->LoadSymbol( Component->GetLibId() );
425  }
426  catch( ... )
427  {
428  }
429 
430  if( alias )
431  part = alias->GetPart();
432 
433  wxMenu* editmenu = new wxMenu;
434  msg = AddHotkeyName( _( "Edit Properties" ), g_Schematic_Hokeys_Descr, HK_EDIT );
435  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
436 
437  if( part && part->IsNormal() )
438  {
439  msg = AddHotkeyName( _( "Edit Value" ), g_Schematic_Hokeys_Descr,
442  KiBitmap( edit_comp_value_xpm ) );
443 
444  msg = AddHotkeyName( _( "Edit Reference" ), g_Schematic_Hokeys_Descr,
447  KiBitmap( edit_comp_ref_xpm ) );
448 
449  msg = AddHotkeyName( _( "Edit Footprint" ), g_Schematic_Hokeys_Descr,
452  KiBitmap( edit_comp_footprint_xpm ) );
453  }
454 
455  if( part && part->HasConversion() )
456  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
457  KiBitmap( component_select_alternate_shape_xpm ) );
458 
459  if( part && part->GetUnitCount() >= 2 )
460  {
461  wxMenu* sel_unit_menu = new wxMenu; int ii;
462 
463  for( ii = 0; ii < part->GetUnitCount(); ii++ )
464  {
465  wxString num_unit;
466  int unit = Component->GetUnit();
467  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
468  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
469  num_unit, wxEmptyString,
470  wxITEM_CHECK );
471  if( unit == ii + 1 )
472  item->Check(true);
473 
474  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
475  // See eeschema_id to modify this value.
477  break; // We have used all IDs for these submenus
478  }
479 
480  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
481  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
482  }
483 
484  if( !Component->GetFlags() )
485  {
486  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
489  msg, KiBitmap( libedit_xpm ) );
490  }
491 
492  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
493  _( "Properties" ), KiBitmap( config_xpm ) );
494 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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:55
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
Define a library symbol object.
int GetUnit() const
LIB_PART * GetPart() const
Get the shared LIB_PART.
int GetUnitCount() const
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)
const LIB_ID & GetLibId() const
bool IsNormal() const
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void AddMenusForGLabel ( wxMenu *  PopMenu,
SCH_GLOBALLABEL GLabel 
)
static

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

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().

498 {
499  wxMenu* menu_change_type = new wxMenu;
500  wxString msg;
501 
502  if( !GLabel->GetFlags() )
503  {
504  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
506  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
507  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
508  HK_DRAG );
509  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
510  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
512  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
513  }
514 
515  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
516  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
517  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
518  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
519  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
520  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
521 
522  // add menu change type text (to label, glabel, text):
524  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
526  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
528  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
529  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
530  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
531 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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[]
void AddMenusForHierchicalSheet ( wxMenu *  PopMenu,
SCH_SHEET Sheet 
)
static

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

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().

763 {
764  wxString msg;
765 
766  if( !Sheet->GetFlags() )
767  {
768  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
769  KiBitmap( enter_sheet_xpm ) );
770  PopMenu->AppendSeparator();
771  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
773  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
774 
775  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
776  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
777 
778  PopMenu->AppendSeparator();
779  msg = AddHotkeyName( _( "Select Items On PCB" ), g_Schematic_Hokeys_Descr, HK_SELECT_ITEMS_ON_PCB );
780  AddMenuItem( PopMenu, ID_POPUP_SCH_SELECT_ON_PCB, msg, KiBitmap( select_same_sheet_xpm ) );
781  PopMenu->AppendSeparator();
782 
783  wxMenu* orientmenu = new wxMenu;
784  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
785  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
786 
787  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
788  KiBitmap( rotate_ccw_xpm ) );
789 
790  msg = AddHotkeyName( _( "Flip Vertical" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
791  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
792  msg = AddHotkeyName( _( "Flip Horizontal" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
793  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
794 
795  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
796  _( "Orientation" ), KiBitmap( orient_xpm ) );
797  }
798 
799  if( Sheet->GetFlags() )
800  {
801  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place" ), KiBitmap( checked_ok_xpm ) );
802  }
803  else
804  {
805  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
806  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( editor_xpm ) );
807 
808  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize" ),
809  KiBitmap( resize_sheet_xpm ) );
810  PopMenu->AppendSeparator();
811  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
812  KiBitmap( import_hierarchical_label_xpm ) );
813 
814  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
815  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
816  KiBitmap( options_pinsheet_xpm ) );
817 
818  PopMenu->AppendSeparator();
819  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
820  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
821  }
822 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
bool HasUndefinedPins()
Check all sheet labels against schematic for undefined hierarchical labels.
Definition: sch_sheet.cpp:231
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[]
void AddMenusForHLabel ( wxMenu *  PopMenu,
SCH_HIERLABEL GLabel 
)
static

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

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().

535 {
536  wxMenu* menu_change_type = new wxMenu;
537  wxString msg;
538 
539  if( !HLabel->GetFlags() )
540  {
541  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
543  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
544  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
545  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
546  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
548  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
549  }
550 
551  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
552  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
553  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
554  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
555  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
556  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
557 
558  // add menu change type text (to label, glabel, text):
560  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
562  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
564  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
565  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
566  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
567 }
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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[]
void AddMenusForLabel ( wxMenu *  PopMenu,
SCH_LABEL Label 
)
static

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

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().

571 {
572  wxMenu* menu_change_type = new wxMenu;
573  wxString msg;
574 
575  if( !Label->GetFlags() )
576  {
577  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
579  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
580  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
581  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
582  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
584  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
585  }
586 
587  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
588  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
589  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
590  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
591  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
592  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
593 
594  // add menu change type text (to label, glabel, text):
596  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
598  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
600  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
601  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
602  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
603 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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[]
void AddMenusForMarkers ( wxMenu *  aPopMenu,
SCH_MARKER aMarker,
SCH_EDIT_FRAME aFrame 
)
static

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

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

Referenced by SCH_EDIT_FRAME::OnRightClick().

895 {
896  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
897  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
898  KiBitmap( info_xpm ) );
899 }
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
void AddMenusForSheetPin ( wxMenu *  PopMenu,
SCH_SHEET_PIN PinSheet 
)
static

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

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().

826 {
827  wxString msg;
828 
829  if( !PinSheet->GetFlags() )
830  {
831  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
833  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
834  }
835 
836  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit" ), KiBitmap( edit_xpm ) );
837 
838  if( !PinSheet->GetFlags() )
839  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ),
840  KiBitmap( delete_xpm ) );
841 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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[]
void AddMenusForText ( wxMenu *  PopMenu,
SCH_TEXT Text 
)
static

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

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().

607 {
608  wxString msg;
609  wxMenu* menu_change_type = new wxMenu;
610 
611  if( !Text->GetFlags() )
612  {
613  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
615  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
616  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
618  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
619  }
620 
621  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
622  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
623  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
624  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
625  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
626  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
627 
628  /* add menu change type text (to label, glabel, text),
629  * but only if this is a single line text
630  */
631  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
632  {
634  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
636  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
638  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
639  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
640  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
641  }
642 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:282
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
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
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[]
void AddMenusForWire ( wxMenu *  PopMenu,
SCH_LINE Wire,
SCH_EDIT_FRAME frame 
)
static

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

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().

674 {
675  SCH_SCREEN* screen = frame->GetScreen();
676  wxPoint pos = frame->GetCrossHairPosition();
677  wxString msg;
678 
679  if( Wire == NULL )
680  {
681  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
682  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
683  return;
684  }
685 
686  bool is_new = Wire->IsNew();
687  if( is_new )
688  {
690  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
691  return;
692  }
693 
694  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
695  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
696  PopMenu->AppendSeparator();
697  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
698  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
699  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
700  KiBitmap( delete_node_xpm ) );
701  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
702  KiBitmap( delete_connection_xpm ) );
703 
704  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
705 
706  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
707  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
708  KiBitmap( break_line_xpm ) );
709 
710  PopMenu->AppendSeparator();
711 
712  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
713  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
714  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
715  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
716 
717  // Add global label command only if the cursor is over one end of the wire.
718  if( Wire->IsEndPoint( pos ) )
719  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
720  KiBitmap( add_glabel_xpm ) );
721 }
bool IsNew() const
Definition: base_struct.h:243
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
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:532
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
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, draw line ...)
Definition: sch_line.h:41
SCH_LINE * GetWireOrBus(const wxPoint &aPosition)
Return a wire or bus item located at aPosition.
Definition: sch_screen.cpp:919
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]