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 <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, PART_LIBS *aLibs)
 
static void AddMenusForComponent (wxMenu *PopMenu, SCH_COMPONENT *Component, PART_LIBS *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 879 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().

880 {
881  wxString msg;
882 
883  if( aBitmap->GetFlags() == 0 )
884  {
885  msg = AddHotkeyName( _( "Move Image" ), g_Schematic_Hokeys_Descr,
887  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
888  }
889 
890  msg = AddHotkeyName( _( "Rotate Image" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
891  AddMenuItem( aPopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
892  msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr,
893  HK_MIRROR_X );
894  AddMenuItem( aPopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
895  msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr,
896  HK_MIRROR_Y );
897  AddMenuItem( aPopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
898  msg = AddHotkeyName( _( "Edit Image" ), g_Schematic_Hokeys_Descr, HK_EDIT );
899  AddMenuItem( aPopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( image_xpm ) );
900 
901  if( aBitmap->GetFlags() == 0 )
902  {
903  aPopMenu->AppendSeparator();
904  msg = AddHotkeyName( _( "Delete Image" ), g_Schematic_Hokeys_Descr, HK_DELETE );
905  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
906  }
907 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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 826 of file eeschema/onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), BLOCK_MOVE, g_Schematic_Hokeys_Descr, BLOCK_SELECTOR::GetCommand(), SCH_EDIT_FRAME::GetScreen(), HK_MIRROR_X, HK_MIRROR_Y, HK_MOVEBLOCK_TO_DRAGBLOCK, HK_ROTATE, HK_SAVE_BLOCK, ID_GEN_COPY_BLOCK_TO_CLIPBOARD, ID_POPUP_CANCEL_CURRENT_COMMAND, ID_POPUP_COPY_BLOCK, ID_POPUP_DELETE_BLOCK, ID_POPUP_DRAG_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().

827 {
828  wxString msg;
829 
830  AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
831  KiBitmap( cancel_xpm ) );
832 
833  PopMenu->AppendSeparator();
834 
835  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
836  AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
837 
838  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
839 
840  // After a block move (that is also a block selection) one can reselect
841  // a block function.
842  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
843  {
844  msg = AddHotkeyName( _( "Save Block" ), g_Schematic_Hokeys_Descr,
845  HK_SAVE_BLOCK );
846  AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_button_xpm ) );
847  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), KiBitmap( copyblock_xpm ) );
848  msg = AddHotkeyName( _( "Drag Block" ), g_Schematic_Hokeys_Descr,
850  AddMenuItem( PopMenu, ID_POPUP_DRAG_BLOCK, msg, KiBitmap( move_xpm ) );
851  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
852  msg = AddHotkeyName( _( "Mirror Block ||" ), g_Schematic_Hokeys_Descr,
853  HK_MIRROR_Y );
854  AddMenuItem( PopMenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
855  msg = AddHotkeyName( _( "Mirror Block --" ), g_Schematic_Hokeys_Descr,
856  HK_MIRROR_X );
857  AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
858  msg = AddHotkeyName( _( "Rotate Block CCW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
859  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
860 
861 #if 0
862  #ifdef __WINDOWS__
863  AddMenuItem( menu_other_block_commands, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
864  _( "Copy to Clipboard" ), KiBitmap( copy_button_xpm ) );
865  #endif
866 #endif
867  }
868 }
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:520
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 711 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().

712 {
713  wxPoint pos = frame->GetCrossHairPosition();
714  wxString msg;
715 
716  if( Bus == NULL )
717  {
718  msg = AddHotkeyName( _( "Begin Bus" ), g_Schematic_Hokeys_Descr, HK_BEGIN_BUS );
719  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_BUS, msg, KiBitmap( add_bus_xpm ) );
720  return;
721  }
722 
723  bool is_new = Bus->IsNew();
724  if( is_new )
725  {
727  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
728  return;
729  }
730 
731  msg = AddHotkeyName( _( "Delete Bus" ), g_Schematic_Hokeys_Descr, HK_DELETE );
732  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_bus_xpm ) );
733 
734  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Bus" ), KiBitmap( break_bus_xpm ) );
735 
736  PopMenu->AppendSeparator();
737  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
738  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
739  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
740  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
741 
742  // Add global label command only if the cursor is over one end of the bus.
743  if( Bus->IsEndPoint( pos ) )
744  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
745  KiBitmap( add_glabel_xpm ) );
746 }
bool IsNew() const
Definition: base_struct.h:216
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:55
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:64
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 910 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().

911 {
912  wxString msg;
913 
914  if( !aBusEntry->GetFlags() )
915  {
916  msg = AddHotkeyName( _( "Move Bus Entry" ), g_Schematic_Hokeys_Descr,
918  AddMenuItem( aPopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
919  }
920 
921  if( aBusEntry->GetBusEntryShape() == '\\' )
923  _( "Set Bus Entry Shape /" ), KiBitmap( change_entry_orient_xpm ) );
924  else
926  _( "Set Bus Entry Shape \\" ), KiBitmap( change_entry_orient_xpm ) );
927 
928  msg = AddHotkeyName( _( "Delete Bus Entry" ), g_Schematic_Hokeys_Descr, HK_DELETE );
929  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
930 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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,
PART_LIBS aLibs 
)
static

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

References AddHotkeyName(), AddMenuItem(), AddMenusForEditComponent(), PART_LIBS::FindLibraryAlias(), g_Schematic_Hokeys_Descr, GetChars(), LIB_ALIAS::GetDocFileName(), SCH_COMPONENT::GetField(), EDA_ITEM::GetFlags(), SCH_COMPONENT::GetLibId(), EDA_TEXT::GetText(), HK_AUTOPLACE_FIELDS, HK_COPY_COMPONENT_OR_LABEL, HK_DELETE, HK_DRAG, HK_MIRROR_X, HK_MIRROR_Y, HK_MOVE_COMPONENT_OR_ITEM, HK_ORIENT_NORMAL_COMPONENT, HK_ROTATE, ID_AUTOPLACE_FIELDS, ID_POPUP_SCH_COPY_ITEM, ID_POPUP_SCH_DELETE_CMP, ID_POPUP_SCH_DISPLAYDOC_CMP, 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().

352 {
353  if( Component->Type() != SCH_COMPONENT_T )
354  {
355  wxASSERT( 0 );
356  return;
357  }
358 
359  wxString msg;
360  LIB_ALIAS* libEntry = aLibs->FindLibraryAlias( Component->GetLibId() );
361 
362  if( !Component->GetFlags() )
363  {
364  msg.Printf( _( "Move Component %s" ),
365  GetChars( Component->GetField( REFERENCE )->GetText() ) );
367  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
368  msg = AddHotkeyName( _( "Drag Component" ), g_Schematic_Hokeys_Descr, HK_DRAG );
369  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_xpm ) );
370  }
371 
372  wxMenu* orientmenu = new wxMenu;
373  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
374  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
375  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Counterclockwise" ),
376  KiBitmap( rotate_ccw_xpm ) );
377  msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
378  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
379  msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
380  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
382  AddMenuItem( orientmenu, ID_SCH_ORIENT_NORMAL, msg, KiBitmap( normal_xpm ) );
383  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
384  _( "Orient Component" ), KiBitmap( orient_xpm ) );
385 
386  AddMenusForEditComponent( PopMenu, Component, aLibs );
387 
388  if( !Component->GetFlags() )
389  {
390  msg = AddHotkeyName( _( "Copy Component" ), g_Schematic_Hokeys_Descr,
392  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
393  msg = AddHotkeyName( _( "Delete Component" ), g_Schematic_Hokeys_Descr, HK_DELETE );
394  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CMP, msg, KiBitmap( delete_xpm ) );
395  }
396 
397  msg = AddHotkeyName( _( "Autoplace Fields" ), g_Schematic_Hokeys_Descr, HK_AUTOPLACE_FIELDS );
398  AddMenuItem( PopMenu, ID_AUTOPLACE_FIELDS, msg, KiBitmap( autoplace_fields_xpm ) );
399 
400  if( libEntry && !libEntry->GetDocFileName().IsEmpty() )
401  AddMenuItem( PopMenu, ID_POPUP_SCH_DISPLAYDOC_CMP, _( "Open Documentation" ), KiBitmap( datasheet_xpm ) );
402 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
Part library alias object definition.
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
LIB_ALIAS * FindLibraryAlias(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryEntry searches all libraries in the list for an entry.
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
Function GetField returns a field.
const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:130
static void AddMenusForEditComponent(wxMenu *PopMenu, SCH_COMPONENT *Component, PART_LIBS *aLibs)
wxString GetDocFileName() 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) ...
const LIB_ID & GetLibId() const
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[]
void AddMenusForComponentField ( wxMenu *  PopMenu,
SCH_FIELD Field 
)
static

Definition at line 295 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(), REFERENCE, and VALUE.

Referenced by SCH_EDIT_FRAME::OnRightClick().

296 {
297  wxString msg, name;
298 
299  if( !Field->GetFlags() )
300  {
301  switch( Field->GetId() )
302  {
303  case REFERENCE: name = _( "Move Reference" ); break;
304  case VALUE: name = _( "Move Value" ); break;
305  case FOOTPRINT: name = _( "Move Footprint Field" ); break;
306  default: name = _( "Move Field" ); break;
307  }
308 
311  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
312  }
313 
314  switch( Field->GetId() )
315  {
316  case REFERENCE: name = _( "Rotate Reference" ); break;
317  case VALUE: name = _( "Rotate Value" ); break;
318  case FOOTPRINT: name = _( "Rotate Footprint Field" ); break;
319  default: name = _( "Rotate Field" ); break;
320  }
321 
323  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_field_xpm ) );
324 
325  // Ref, value and footprint have specific hotkeys. Show the specific hotkey:
327  switch( Field->GetId() )
328  {
329  case REFERENCE:
331  name = _( "Edit Reference" );
332  break;
333  case VALUE:
335  name = _( "Edit Value" );
336  break;
337  case FOOTPRINT:
339  name = _( "Edit Footprint Field" );
340  break;
341  default:
342  id = HK_EDIT;
343  name = _( "Edit Field" );
344  break;
345  }
346  msg = AddHotkeyName( name, g_Schematic_Hokeys_Descr, id );
347  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
348 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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
Field Value of part, i.e. "3.3K".
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 AddMenusForEditComponent ( wxMenu *  PopMenu,
SCH_COMPONENT Component,
PART_LIBS aLibs 
)
static

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

References AddHotkeyName(), AddMenuItem(), PART_LIBS::FindLibraryAlias(), 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(), SCH_COMPONENT_T, LIB_PART::SubReference(), and EDA_ITEM::Type().

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

406 {
407  if( Component->Type() != SCH_COMPONENT_T )
408  {
409  wxASSERT( 0 );
410  return;
411  }
412 
413  wxString msg;
414  LIB_PART* part = NULL;
415  LIB_ALIAS* libEntry = aLibs->FindLibraryAlias( Component->GetLibId() );
416 
417  if( libEntry )
418  part = libEntry->GetPart();
419 
420  wxMenu* editmenu = new wxMenu;
421  msg = AddHotkeyName( _( "Edit" ), g_Schematic_Hokeys_Descr, HK_EDIT );
422  AddMenuItem( editmenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_component_xpm ) );
423 
424  if( part && part->IsNormal() )
425  {
426  msg = AddHotkeyName( _( "Value" ), g_Schematic_Hokeys_Descr,
429  KiBitmap( edit_comp_value_xpm ) );
430 
431  msg = AddHotkeyName( _( "Reference" ), g_Schematic_Hokeys_Descr,
434  KiBitmap( edit_comp_ref_xpm ) );
435 
436  msg = AddHotkeyName( _( "Footprint" ), g_Schematic_Hokeys_Descr,
439  KiBitmap( edit_comp_footprint_xpm ) );
440  }
441 
442  if( part && part->HasConversion() )
443  AddMenuItem( editmenu, ID_POPUP_SCH_EDIT_CONVERT_CMP, _( "Convert" ),
444  KiBitmap( component_select_alternate_shape_xpm ) );
445 
446  if( part && part->GetUnitCount() >= 2 )
447  {
448  wxMenu* sel_unit_menu = new wxMenu; int ii;
449 
450  for( ii = 0; ii < part->GetUnitCount(); ii++ )
451  {
452  wxString num_unit;
453  int unit = Component->GetUnit();
454  num_unit.Printf( _( "Unit %s" ), GetChars( LIB_PART::SubReference( ii + 1, false ) ) );
455  wxMenuItem * item = sel_unit_menu->Append( ID_POPUP_SCH_SELECT_UNIT1 + ii,
456  num_unit, wxEmptyString,
457  wxITEM_CHECK );
458  if( unit == ii + 1 )
459  item->Check(true);
460 
461  // The ID max for these submenus is ID_POPUP_SCH_SELECT_UNIT_CMP_MAX
462  // See eeschema_id to modify this value.
464  break; // We have used all IDs for these submenus
465  }
466 
467  AddMenuItem( editmenu, sel_unit_menu, ID_POPUP_SCH_SELECT_UNIT_CMP,
468  _( "Unit" ), KiBitmap( component_select_unit_xpm ) );
469  }
470 
471  if( !Component->GetFlags() )
472  {
473  msg = AddHotkeyName( _( "Edit with Library Editor" ), g_Schematic_Hokeys_Descr,
476  msg, KiBitmap( libedit_xpm ) );
477  }
478 
479  AddMenuItem( PopMenu, editmenu, ID_SCH_EDIT_ITEM,
480  _( "Edit Component" ), KiBitmap( edit_component_xpm ) );
481 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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
LIB_ALIAS * FindLibraryAlias(const LIB_ID &aLibId, const wxString &aLibraryName=wxEmptyString)
Function FindLibraryEntry searches all libraries in the list for an entry.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
Class LIB_PART defines a library part object.
int GetUnit() const
LIB_PART * GetPart() const
Function GetPart gets 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)
Function SubReference.
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 484 of file eeschema/onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_COPY_COMPONENT_OR_LABEL, HK_DELETE, HK_DRAG, 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_COPY_ITEM, ID_POPUP_SCH_DELETE, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

485 {
486  wxMenu* menu_change_type = new wxMenu;
487  wxString msg;
488 
489  if( !GLabel->GetFlags() )
490  {
491  msg = AddHotkeyName( _( "Move Global Label" ), g_Schematic_Hokeys_Descr,
493  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
494  msg = AddHotkeyName( _( "Drag Global Label" ), g_Schematic_Hokeys_Descr,
495  HK_DRAG );
496  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) );
497  msg = AddHotkeyName( _( "Copy Global Label" ), g_Schematic_Hokeys_Descr,
499  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
500  }
501 
502  msg = AddHotkeyName( _( "Rotate Global Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
503  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_glabel_xpm ) );
504  msg = AddHotkeyName( _( "Edit Global Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
505  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
506  msg = AddHotkeyName( _( "Delete Global Label" ), g_Schematic_Hokeys_Descr, HK_DELETE );
507  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) );
508 
509  // add menu change type text (to label, glabel, text):
511  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
513  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
515  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
516  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
517  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
518 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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 749 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, 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_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().

750 {
751  wxString msg;
752 
753  if( !Sheet->GetFlags() )
754  {
755  AddMenuItem( PopMenu, ID_POPUP_SCH_ENTER_SHEET, _( "Enter Sheet" ),
756  KiBitmap( enter_sheet_xpm ) );
757  PopMenu->AppendSeparator();
758  msg = AddHotkeyName( _( "Move Sheet" ), g_Schematic_Hokeys_Descr,
760  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_sheet_xpm ) );
761 
762  msg = AddHotkeyName( _( "Drag Sheet" ), g_Schematic_Hokeys_Descr, HK_DRAG );
763  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_sheet_xpm ) );
764 
765  wxMenu* orientmenu = new wxMenu;
766  msg = AddHotkeyName( _( "Rotate Sheet CW" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
767  AddMenuItem( orientmenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_cw_xpm ) );
768 
769  AddMenuItem( orientmenu, ID_SCH_ROTATE_COUNTERCLOCKWISE, _( "Rotate Sheet CCW" ),
770  KiBitmap( rotate_ccw_xpm ) );
771 
772  msg = AddHotkeyName( _( "Mirror --" ), g_Schematic_Hokeys_Descr, HK_MIRROR_X );
773  AddMenuItem( orientmenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) );
774  msg = AddHotkeyName( _( "Mirror ||" ), g_Schematic_Hokeys_Descr, HK_MIRROR_Y );
775  AddMenuItem( orientmenu, ID_SCH_MIRROR_Y, msg, KiBitmap( mirror_h_xpm ) );
776 
777  AddMenuItem( PopMenu, orientmenu, ID_POPUP_SCH_GENERIC_ORIENT_CMP,
778  _( "Orient Sheet" ), KiBitmap( orient_xpm ) );
779  }
780 
781  if( Sheet->GetFlags() )
782  {
783  AddMenuItem( PopMenu, ID_POPUP_SCH_END_SHEET, _( "Place Sheet" ), KiBitmap( checked_ok_xpm ) );
784  }
785  else
786  {
787  msg = AddHotkeyName( _( "Edit Sheet" ), g_Schematic_Hokeys_Descr, HK_EDIT );
788  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_sheet_xpm ) );
789 
790  AddMenuItem( PopMenu, ID_POPUP_SCH_RESIZE_SHEET, _( "Resize Sheet" ),
791  KiBitmap( resize_sheet_xpm ) );
792  PopMenu->AppendSeparator();
793  AddMenuItem( PopMenu, ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN, _( "Import Sheet Pins" ),
794  KiBitmap( import_hierarchical_label_xpm ) );
795 
796  if( Sheet->HasUndefinedPins() ) // Sheet has pin labels, and can be cleaned
797  AddMenuItem( PopMenu, ID_POPUP_SCH_CLEANUP_SHEET, _( "Cleanup Sheet Pins" ),
798  KiBitmap( options_pinsheet_xpm ) );
799 
800  PopMenu->AppendSeparator();
801  msg = AddHotkeyName( _( "Delete Sheet" ), g_Schematic_Hokeys_Descr, HK_DELETE );
802  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_sheet_xpm ) );
803  }
804 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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:415
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 521 of file eeschema/onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_COPY_COMPONENT_OR_LABEL, HK_DELETE, HK_DRAG, 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_COPY_ITEM, ID_POPUP_SCH_DELETE, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

522 {
523  wxMenu* menu_change_type = new wxMenu;
524  wxString msg;
525 
526  if( !HLabel->GetFlags() )
527  {
528  msg = AddHotkeyName( _( "Move Hierarchical Label" ), g_Schematic_Hokeys_Descr,
530  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
531  msg = AddHotkeyName( _( "Drag Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_DRAG );
532  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) );
533  msg = AddHotkeyName( _( "Copy Hierarchical Label" ), g_Schematic_Hokeys_Descr,
535  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
536  }
537 
538  msg = AddHotkeyName( _( "Rotate Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
539  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_glabel_xpm ) );
540  msg = AddHotkeyName( _( "Edit Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
541  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
542  msg = AddHotkeyName( _( "Delete Hierarchical Label" ), g_Schematic_Hokeys_Descr, HK_DELETE );
543  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) );
544 
545  // add menu change type text (to label, glabel, text):
547  _( "Change to Label" ), KiBitmap( glabel2label_xpm ) );
549  _( "Change to Text" ), KiBitmap( glabel2text_xpm ) );
551  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
552  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
553  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
554 }
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 557 of file eeschema/onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), HK_COPY_COMPONENT_OR_LABEL, HK_DELETE, HK_DRAG, 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_COPY_ITEM, ID_POPUP_SCH_DELETE, ID_SCH_DRAG_ITEM, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

558 {
559  wxMenu* menu_change_type = new wxMenu;
560  wxString msg;
561 
562  if( !Label->GetFlags() )
563  {
564  msg = AddHotkeyName( _( "Move Label" ), g_Schematic_Hokeys_Descr,
566  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
567  msg = AddHotkeyName( _( "Drag Label" ), g_Schematic_Hokeys_Descr, HK_DRAG );
568  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_text_xpm ) );
569  msg = AddHotkeyName( _( "Copy Label" ), g_Schematic_Hokeys_Descr,
571  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
572  }
573 
574  msg = AddHotkeyName( _( "Rotate Label" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
575  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
576  msg = AddHotkeyName( _( "Edit Label" ), g_Schematic_Hokeys_Descr, HK_EDIT );
577  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
578  msg = AddHotkeyName( _( "Delete Label" ), g_Schematic_Hokeys_Descr, HK_DELETE );
579  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) );
580 
581  // add menu change type text (to label, glabel, text):
583  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
585  _( "Change to Text" ), KiBitmap( label2text_xpm ) );
587  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
588  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
589  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
590 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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 871 of file eeschema/onrightclick.cpp.

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

Referenced by SCH_EDIT_FRAME::OnRightClick().

872 {
873  AddMenuItem( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ), KiBitmap( delete_xpm ) );
874  AddMenuItem( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER, _( "Marker Error Info" ),
875  KiBitmap( info_xpm ) );
876 }
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 807 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().

808 {
809  wxString msg;
810 
811  if( !PinSheet->GetFlags() )
812  {
813  msg = AddHotkeyName( _( "Move Sheet Pin" ), g_Schematic_Hokeys_Descr,
815  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) );
816  }
817 
818  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, _( "Edit Sheet Pin" ), KiBitmap( edit_xpm ) );
819 
820  if( !PinSheet->GetFlags() )
821  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, _( "Delete Sheet Pin" ),
822  KiBitmap( delete_pinsheet_xpm ) );
823 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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 593 of file eeschema/onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), g_Schematic_Hokeys_Descr, EDA_ITEM::GetFlags(), EDA_TEXT::GetText(), HK_COPY_COMPONENT_OR_LABEL, HK_DELETE, 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_COPY_ITEM, ID_POPUP_SCH_DELETE, ID_SCH_EDIT_ITEM, ID_SCH_MOVE_ITEM, ID_SCH_ROTATE_CLOCKWISE, and KiBitmap().

Referenced by SCH_EDIT_FRAME::OnRightClick().

594 {
595  wxString msg;
596  wxMenu* menu_change_type = new wxMenu;
597 
598  if( !Text->GetFlags() )
599  {
600  msg = AddHotkeyName( _( "Move Text" ), g_Schematic_Hokeys_Descr,
602  AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) );
603  msg = AddHotkeyName( _( "Copy Text" ), g_Schematic_Hokeys_Descr,
605  AddMenuItem( PopMenu, ID_POPUP_SCH_COPY_ITEM, msg, KiBitmap( copy_button_xpm ) );
606  }
607 
608  msg = AddHotkeyName( _( "Rotate Text" ), g_Schematic_Hokeys_Descr, HK_ROTATE );
609  AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) );
610  msg = AddHotkeyName( _( "Edit Text" ), g_Schematic_Hokeys_Descr, HK_EDIT );
611  AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) );
612  msg = AddHotkeyName( _( "Delete Text" ), g_Schematic_Hokeys_Descr, HK_DELETE );
613  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_text_xpm ) );
614 
615  /* add menu change type text (to label, glabel, text),
616  * but only if this is a single line text
617  */
618  if( Text->GetText().Find( wxT( "\n" ) ) == wxNOT_FOUND )
619  {
621  _( "Change to Label" ), KiBitmap( label2text_xpm ) );
623  _( "Change to Hierarchical Label" ), KiBitmap( label2glabel_xpm ) );
625  _( "Change to Global Label" ), KiBitmap( label2glabel_xpm ) );
626  AddMenuItem( PopMenu, menu_change_type, ID_POPUP_SCH_CHANGE_TYPE_TEXT,
627  _( "Change Type" ), KiBitmap( gl_change_xpm ) );
628  }
629 }
STATUS_FLAGS GetFlags() const
Definition: base_struct.h:255
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 660 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().

661 {
662  SCH_SCREEN* screen = frame->GetScreen();
663  wxPoint pos = frame->GetCrossHairPosition();
664  wxString msg;
665 
666  if( Wire == NULL )
667  {
668  msg = AddHotkeyName( _( "Begin Wire" ), g_Schematic_Hokeys_Descr, HK_BEGIN_WIRE );
669  AddMenuItem( PopMenu, ID_POPUP_SCH_BEGIN_WIRE, msg, KiBitmap( add_line_xpm ) );
670  return;
671  }
672 
673  bool is_new = Wire->IsNew();
674  if( is_new )
675  {
677  AddMenuItem( PopMenu, ID_POPUP_END_LINE, msg, KiBitmap( checked_ok_xpm ) );
678  return;
679  }
680 
681  msg = AddHotkeyName( _( "Drag Wire" ), g_Schematic_Hokeys_Descr, HK_DRAG );
682  AddMenuItem( PopMenu, ID_SCH_DRAG_ITEM, msg, KiBitmap( move_track_xpm ) );
683  PopMenu->AppendSeparator();
684  msg = AddHotkeyName( _( "Delete Wire" ), g_Schematic_Hokeys_Descr, HK_DELETE );
685  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE, msg, KiBitmap( delete_xpm ) );
686  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_NODE, _( "Delete Node" ),
687  KiBitmap( delete_node_xpm ) );
688  AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
689  KiBitmap( delete_connection_xpm ) );
690 
691  SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
692 
693  if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
694  AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
695  KiBitmap( break_line_xpm ) );
696 
697  PopMenu->AppendSeparator();
698 
699  msg = AddHotkeyName( _( "Add Junction" ), g_Schematic_Hokeys_Descr, HK_ADD_JUNCTION );
700  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_JUNCTION, msg, KiBitmap( add_junction_xpm ) );
701  msg = AddHotkeyName( _( "Add Label" ), g_Schematic_Hokeys_Descr, HK_ADD_LABEL );
702  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_LABEL, msg, KiBitmap( add_line_label_xpm ) );
703 
704  // Add global label command only if the cursor is over one end of the wire.
705  if( Wire->IsEndPoint( pos ) )
706  AddMenuItem( PopMenu, ID_POPUP_SCH_ADD_GLABEL, _( "Add Global Label" ),
707  KiBitmap( add_glabel_xpm ) );
708 }
bool IsNew() const
Definition: base_struct.h:216
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:55
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:520
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:64
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
Class SCH_LINE is a segment description base class to describe items which have 2 end points (track...
Definition: sch_line.h:42
SCH_LINE * GetWireOrBus(const wxPoint &aPosition)
Function GetWireOrBus returns a wire or bus item located at aPosition.
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[]