KiCad PCB EDA Suite
libedit_onrightclick.cpp File Reference

Library editor: create the pop menus when clicking on mouse right button. More...

#include <fctsys.h>
#include <confirm.h>
#include <eeschema_id.h>
#include <hotkeys.h>
#include <class_drawpanel.h>
#include <sch_screen.h>
#include <msgpanel.h>
#include <general.h>
#include <lib_edit_frame.h>
#include <class_libentry.h>
#include <lib_pin.h>
#include <lib_polyline.h>
#include <menus_helpers.h>

Go to the source code of this file.

Functions

static void AddMenusForBlock (wxMenu *PopMenu, LIB_EDIT_FRAME *frame)
 
static void AddMenusForPin (wxMenu *PopMenu, LIB_PIN *Pin, LIB_EDIT_FRAME *frame)
 

Detailed Description

Library editor: create the pop menus when clicking on mouse right button.

Definition in file libedit_onrightclick.cpp.

Function Documentation

void AddMenusForBlock ( wxMenu *  PopMenu,
LIB_EDIT_FRAME frame 
)
static

Definition at line 329 of file libedit_onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), BLOCK_MOVE, g_Libedit_Hokeys_Descr, g_Schematic_Hokeys_Descr, BLOCK_SELECTOR::GetCommand(), SCH_BASE_FRAME::GetScreen(), HK_EDIT_COPY, HK_EDIT_CUT, HK_MIRROR_X, HK_MIRROR_Y, HK_ROTATE, ID_POPUP_DELETE_BLOCK, ID_POPUP_DUPLICATE_BLOCK, ID_POPUP_LIBEDIT_CANCEL_EDITING, ID_POPUP_MIRROR_X_BLOCK, ID_POPUP_MIRROR_Y_BLOCK, ID_POPUP_PLACE_BLOCK, ID_POPUP_ROTATE_BLOCK, ID_POPUP_SELECT_ITEMS_BLOCK, ID_POPUP_ZOOM_BLOCK, KiBitmap(), and BASE_SCREEN::m_BlockLocate.

Referenced by LIB_EDIT_FRAME::OnRightClick().

330 {
331  wxString msg;
332  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ),
333  KiBitmap( cancel_xpm ) );
334 
335  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
337  _( "Zoom Block" ),
338  KiBitmap( zoom_area_xpm ) );
339 
340  PopMenu->AppendSeparator();
341 
342  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
343 
344  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
345  {
346  AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ),
347  KiBitmap( green_xpm ) );
348  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr,
349  HK_EDIT_CUT );
350  AddMenuItem( PopMenu, wxID_CUT, msg, KiBitmap( cut_xpm ) );
351  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr,
352  HK_EDIT_COPY );
353  AddMenuItem( PopMenu, wxID_COPY, msg, KiBitmap( copy_xpm ) );
354  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
355  KiBitmap( duplicate_xpm ) );
356  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ), g_Libedit_Hokeys_Descr,
357  HK_MIRROR_X );
358  AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, msg,
359  KiBitmap( mirror_v_xpm ) );
360  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Libedit_Hokeys_Descr,
361  HK_MIRROR_Y );
362  AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, msg,
363  KiBitmap( mirror_h_xpm ) );
364  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
365  AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, msg,
366  KiBitmap( rotate_ccw_xpm ) );
367  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
368  }
369 }
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
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
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 AddMenusForPin ( wxMenu *  PopMenu,
LIB_PIN Pin,
LIB_EDIT_FRAME frame 
)
static

Definition at line 283 of file libedit_onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), g_Libedit_Hokeys_Descr, HK_DELETE, HK_EDIT, HK_LIBEDIT_MOVE_GRAPHIC_ITEM, HK_ROTATE, ID_LIBEDIT_EDIT_PIN, ID_LIBEDIT_ROTATE_ITEM, ID_POPUP_LIBEDIT_DELETE_ITEM, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM, EDA_ITEM::IsMoving(), EDA_ITEM::IsSelected(), and KiBitmap().

Referenced by LIB_EDIT_FRAME::OnRightClick().

284 {
285  bool selected = Pin->IsSelected();
286  bool not_in_move = !Pin->IsMoving();
287  wxString msg;
288 
289  if( not_in_move )
290  {
291  msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
293  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_xpm ) );
294  }
295 
296  msg = AddHotkeyName( _( "Edit..." ), g_Libedit_Hokeys_Descr, HK_EDIT);
297  AddMenuItem( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, KiBitmap( edit_xpm ) );
298 
299  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
300  AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_cw_xpm ) );
301 
302  if( not_in_move )
303  {
304  msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
305  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_xpm ) );
306  }
307 
308  wxMenu* global_pin_change = new wxMenu;
309  AddMenuItem( PopMenu, global_pin_change,
311  _( "Global" ), KiBitmap( pin_to_xpm ) );
312  AddMenuItem( global_pin_change,
314  selected ? _( "Push Pin Size to Selected Pin" ) :
315  _( "Push Pin Size to Others" ), KiBitmap( pin_size_to_xpm ) );
316  AddMenuItem( global_pin_change,
318  selected ? _( "Push Pin Name Size to Selected Pin" ) :
319  _( "Push Pin Name Size to Others" ), KiBitmap( pin_name_to_xpm ) );
320  AddMenuItem( global_pin_change,
322  selected ? _( "Push Pin Num Size to Selected Pin" ) :
323  _( "Push Pin Num Size to Others" ), KiBitmap( pin_number_to_xpm ) );
324 }
bool IsMoving() const
Definition: base_struct.h:229
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
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
bool IsSelected() const
Definition: base_struct.h:232
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) ...