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

915 {
916  wxString msg;
917 
918  if( aBitmap->GetFlags() == 0 )
919  {
920  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
922  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
923  }
924 
925  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
926  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
927  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
928  HK_MIRROR_X );
929  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
930  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
931  HK_MIRROR_Y );
932  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
933  msg = AddHotkeyName( _( "Edit Image..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
934  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
935 
936  if( aBitmap->GetFlags() == 0 )
937  {
938  aPopMenu->AppendSeparator();
939  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
940  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
941  }
942 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 856 of file eeschema/onrightclick.cpp.

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

857 {
858  wxString msg;
859 
860  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
861  KiBitmap( cancel_xpm ) );
862 
863  PopMenu->AppendSeparator();
864 
865  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
866  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
867 
868  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
869 
870  // After a block move (that is also a block selection) one can reselect
871  // a block function.
872  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
873  {
874  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
875  HK_EDIT_CUT );
876  AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
877  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
878  HK_EDIT_COPY );
879  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg, KiBitmap( copy_xpm ) );
880  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
881  KiBitmap( duplicate_xpm ) );
882  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
884  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( drag_xpm ) );
885  msg = AddHotkeyName( _( "Delete Block" ), g_Schematic_Hokeys_Descr, HK_DELETE );
886  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, msg, KiBitmap( delete_xpm ) );
887  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
888  HK_MIRROR_Y );
889  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
890  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ),
892  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
893  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
894  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
895 
896 #if 0
897  #ifdef __WINDOWS__
898  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
899  _( "Copy to Clipboard" ), KiBitmap( copy_xpm ) );
900  #endif
901 #endif
902  }
903 }
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:174
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 733 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().

734 {
735  wxPoint pos = frame->GetCrossHairPosition();
736  wxString msg;
737 
738  if( Bus == NULL )
739  {
740  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
741  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
742  return;
743  }
744 
745  bool is_new = Bus->IsNew();
746  if( is_new )
747  {
749  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
750  return;
751  }
752 
753  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
754  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
755 
756  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
757 
758  PopMenu->AppendSeparator();
759  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
760  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
761  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
762  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
763 
764  // Add global label command only if the cursor is over one end of the bus.
765  if( Bus->IsEndPoint( pos ) )
766  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
767  KiBitmap( add_glabel_xpm ) );
768 }
bool IsNew() const
Definition: base_struct.h:227
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 945 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().

946 {
947  wxString msg;
948 
949  if( !aBusEntry->GetFlags() )
950  {
951  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
953  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
954  }
955 
956  if( aBusEntry->GetBusEntryShape() == '\\' )
958  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
959  else
961  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
962 
963  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
964  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
965 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
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:78
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 362 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().

363 {
364  if( Component->Type() != SCH_COMPONENT_T )
365  {
366  wxASSERT( 0 );
367  return;
368  }
369 
370  wxString msg;
371 
372  if( !Component->GetFlags() )
373  {
374  msg.Printf( _( "Move %s" ),
375  GetChars( Component->GetField( REFERENCE )->GetText() ) );
377  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
378  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
379  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
380  }
381 
382  wxMenu* orientmenu = new wxMenu;
383  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
384  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
385  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
386  KiBitmap( rotate_ccw_xpm ) );
387  msg = AddHotkeyName( _( "Mirror Around Horizontal(X) Axis" ), g_Schematic_Hokeys_Descr,
388  HK_MIRROR_X );
389  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
390  msg = AddHotkeyName( _( "Mirror Around Vertical(Y) Axis" ), g_Schematic_Hokeys_Descr,
391  HK_MIRROR_Y );
392  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
393  msg = AddHotkeyName( _( "Reset to Default" ), g_Schematic_Hokeys_Descr,
395  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
396  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
397  _( "Orientation" ), KiBitmap( orient_xpm ) );
398 
399  AddMenusForEditComponent( PopMenu, Component, aLibs );
400 
401  if( !Component->GetFlags() )
402  {
403  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
405  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
406  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
407  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
408  }
409 
410  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
411  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
412 
413  if( !Component->GetField( DATASHEET )->GetFullyQualifiedText().IsEmpty() )
414  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ),
415  KiBitmap( datasheet_xpm ) );
416 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
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:174
const wxString GetFullyQualifiedText() const
Function GetFullyQualifiedText returns the fully qualified field text by allowing for the part suffix...
Definition: sch_field.cpp:80
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:78
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:128
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 306 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().

307 {
308  wxString msg, name;
309 
310  if( !Field->GetFlags() )
311  {
312  switch( Field->GetId() )
313  {
314  case REFERENCE: name = _( "Move Reference" ); break;
315  case VALUE: name = _( "Move Value" ); break;
316  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
317  default: name = _( "Move Field" ); break;
318  }
319 
322  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
323  }
324 
325  switch( Field->GetId() )
326  {
327  case REFERENCE: name = _( "Rotate Reference" ); break;
328  case VALUE: name = _( "Rotate Value" ); break;
329  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
330  default: name = _( "Rotate Field" ); break;
331  }
332 
334  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
335 
336  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
338  switch( Field->GetId() )
339  {
340  case REFERENCE:
342  name = _( "Edit Reference..." );
343  break;
344  case VALUE:
346  name = _( "Edit Value..." );
347  break;
348  case FOOTPRINT:
350  name = _( "Edit Footprint Field..." );
351  break;
352  default:
353  id = HK_EDIT;
354  name = _( "Edit Field..." );
355  break;
356  }
357  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
358  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
359 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
int GetId() const
Definition: sch_field.h:87
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:78
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
Definition: DXF_plotter.cpp:61
#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 419 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().

420 {
421  if( Component->Type() != SCH_COMPONENT_T )
422  {
423  wxASSERT( 0 );
424  return;
425  }
426 
427  wxString msg;
428  LIB_PART* part = NULL;
429  LIB_ALIAS* alias = NULL;
430 
431  try
432  {
433  alias = aLibs->LoadSymbol( Component->GetLibId() );
434  }
435  catch( ... )
436  {
437  }
438 
439  if( alias )
440  part = alias->GetPart();
441 
442  wxMenu* editmenu = new wxMenu;
443  msg = AddHotkeyName( _( "Edit Properties..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
444  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( config_xpm ) );
445 
446  if( part && part->IsNormal() )
447  {
448  msg = AddHotkeyName( _( "Edit Value..." ), g_Schematic_Hokeys_Descr,
451  KiBitmap( edit_comp_value_xpm ) );
452 
453  msg = AddHotkeyName( _( "Edit Reference..." ), g_Schematic_Hokeys_Descr,
456  KiBitmap( edit_comp_ref_xpm ) );
457 
458  msg = AddHotkeyName( _( "Edit Footprint..." ), g_Schematic_Hokeys_Descr,
461  KiBitmap( edit_comp_footprint_xpm ) );
462  }
463 
464  if( part && part->HasConversion() )
465  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
466  KiBitmap( component_select_alternate_shape_xpm ) );
467 
468  if( part && part->GetUnitCount() >= 2 )
469  {
470  wxMenu* sel_unit_menu = new wxMenu; int ii;
471 
472  for( ii = 0; ii < part->GetUnitCount(); ii++ )
473  {
474  wxString num_unit;
475  int unit = Component->GetUnit();
476  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
477  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
478  num_unit, wxEmptyString,
479  wxITEM_CHECK );
480  if( unit == ii + 1 )
481  item->Check(true);
482 
483  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
484  // See eeschema_id to modify this value.
486  break; // We have used all IDs for these submenus
487  }
488 
489  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
490  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
491  }
492 
493  if( !Component->GetFlags() )
494  {
495  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
498  msg, KiBitmap( libedit_xpm ) );
499  }
500 
501  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
502  _( "Properties" ), KiBitmap( config_xpm ) );
503 }
LIB_ALIAS * LoadSymbol(const wxString &aNickname, const wxString &aAliasName)
Load a LIB_ALIAS having aAliasName from the library given by aNickname.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
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:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 506 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().

507 {
508  wxMenu* menu_change_type = new wxMenu;
509  wxString msg;
510 
511  if( !GLabel->GetFlags() )
512  {
513  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
515  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
516  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr,
517  HK_DRAG );
518  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
519  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
521  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
522  }
523 
524  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
525  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
526  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
527  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
528  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
529  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
530 
531  // add menu change type text (to label, glabel, text):
533  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
535  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
537  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
538  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
539  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
540 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 771 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().

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

Definition at line 543 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().

544 {
545  wxMenu* menu_change_type = new wxMenu;
546  wxString msg;
547 
548  if( !HLabel->GetFlags() )
549  {
550  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
552  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
553  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
554  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
555  msg = AddHotkeyName( _( "Copy" ), g_Schematic_Hokeys_Descr,
557  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( copy_xpm ) );
558  }
559 
560  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
561  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
562  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
563  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
564  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
565  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
566 
567  // add menu change type text (to label, glabel, text):
569  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
571  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
573  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
574  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
575  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
576 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 579 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().

580 {
581  wxMenu* menu_change_type = new wxMenu;
582  wxString msg;
583 
584  if( !Label->GetFlags() )
585  {
586  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
588  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
589  msg = AddHotkeyName( _( "Drag" ), g_Schematic_Hokeys_Descr, HK_DRAG );
590  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
591  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
593  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
594  }
595 
596  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
597  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
598  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
599  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
600  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
601  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
602 
603  // add menu change type text (to label, glabel, text):
605  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
607  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
609  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
610  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
611  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
612 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 906 of file eeschema/onrightclick.cpp.

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

Referenced by SCH_EDIT_FRAME::OnRightClick().

907 {
908  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
909  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
910  KiBitmap( info_xpm ) );
911 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
void AddMenusForSheetPin ( wxMenu *  PopMenu,
SCH_SHEET_PIN PinSheet 
)
static

Definition at line 837 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().

838 {
839  wxString msg;
840 
841  if( !PinSheet->GetFlags() )
842  {
843  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
845  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
846  }
847 
848  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit..." ), KiBitmap( edit_xpm ) );
849 
850  if( !PinSheet->GetFlags() )
851  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete" ),
852  KiBitmap( delete_xpm ) );
853 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 615 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().

616 {
617  wxString msg;
618  wxMenu* menu_change_type = new wxMenu;
619 
620  if( !Text->GetFlags() )
621  {
622  msg = AddHotkeyName( _( "Move" ), g_Schematic_Hokeys_Descr,
624  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
625  msg = AddHotkeyName( _( "Duplicate" ), g_Schematic_Hokeys_Descr,
627  AddMenuItem( PopMenu, ID_POPUP_SCH_DUPLICATE_ITEM, msg, KiBitmap( duplicate_xpm ) );
628  }
629 
630  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
631  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
632  msg = AddHotkeyName( _( "Edit..." ), g_Schematic_Hokeys_Descr, HK_EDIT );
633  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
634  msg = AddHotkeyName( _( "Delete" ), g_Schematic_Hokeys_Descr, HK_DELETE );
635  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
636 
637  /* add menu change type text (to label, glabel, text),
638  * but only if this is a single line text
639  */
640  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
641  {
643  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
645  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
647  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
648  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
649  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
650  }
651 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:266
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:128
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 682 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().

683 {
684  SCH_SCREEN* screen = frame->GetScreen();
685  wxPoint pos = frame->GetCrossHairPosition();
686  wxString msg;
687 
688  if( Wire == NULL )
689  {
690  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
691  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
692  return;
693  }
694 
695  bool is_new = Wire->IsNew();
696  if( is_new )
697  {
699  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
700  return;
701  }
702 
703  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
704  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( drag_xpm ) );
705  PopMenu->AppendSeparator();
706  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
707  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
708  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
709  KiBitmap( delete_node_xpm ) );
710  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
711  KiBitmap( delete_connection_xpm ) );
712 
713  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
714 
715  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
716  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
717  KiBitmap( break_line_xpm ) );
718 
719  PopMenu->AppendSeparator();
720 
721  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
722  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
723  msg = AddHotkeyName( _( "Add Label..." ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
724  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
725 
726  // Add global label command only if the cursor is over one end of the wire.
727  if( Wire->IsEndPoint( pos ) )
728  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label..." ),
729  KiBitmap( add_glabel_xpm ) );
730 }
bool IsNew() const
Definition: base_struct.h:227
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:174
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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:953
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[]