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 <class_sch_screen.h>
#include <msgpanel.h>
#include <general.h>
#include <libeditframe.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 321 of file libedit_onrightclick.cpp.

References AddHotkeyName(), AddMenuItem(), BLOCK_MOVE, g_Libedit_Hokeys_Descr, BLOCK_SELECTOR::GetCommand(), SCH_BASE_FRAME::GetScreen(), 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().

322 {
323  wxString msg;
324  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ),
325  KiBitmap( cancel_xpm ) );
326 
327  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
329  _( "Zoom Block (drag middle mouse)" ),
330  KiBitmap( zoom_area_xpm ) );
331 
332  PopMenu->AppendSeparator();
333 
334  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
335 
336  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
337  {
338  AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ),
339  KiBitmap( green_xpm ) );
340  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ), KiBitmap( duplicate_xpm ) );
341  msg = AddHotkeyName( _( "Flip Block Horizonal" ), g_Libedit_Hokeys_Descr, HK_MIRROR_Y );
342  AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, msg,
343  KiBitmap( mirror_h_xpm ) );
344  msg = AddHotkeyName( _( "Flip Block Vertical" ), g_Libedit_Hokeys_Descr, HK_MIRROR_X );
345  AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, msg,
346  KiBitmap( mirror_v_xpm ) );
347  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
348  AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, msg,
349  KiBitmap( rotate_ccw_xpm ) );
350  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
351  }
352 }
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
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: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
void AddMenusForPin ( wxMenu *  PopMenu,
LIB_PIN Pin,
LIB_EDIT_FRAME frame 
)
static

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

276 {
277  bool selected = Pin->IsSelected();
278  bool not_in_move = !Pin->IsMoving();
279  wxString msg;
280 
281  if( not_in_move )
282  {
283  msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
285  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_xpm ) );
286  }
287 
288  msg = AddHotkeyName( _( "Edit" ), g_Libedit_Hokeys_Descr, HK_EDIT);
289  AddMenuItem( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, KiBitmap( edit_xpm ) );
290 
291  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
292  AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_cw_xpm ) );
293 
294  if( not_in_move )
295  {
296  msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
297  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_xpm ) );
298  }
299 
300  wxMenu* global_pin_change = new wxMenu;
301  AddMenuItem( PopMenu, global_pin_change,
303  _( "Global" ), KiBitmap( pin_to_xpm ) );
304  AddMenuItem( global_pin_change,
306  selected ? _( "Pin Size to selected pins" ) :
307  _( "Pin Size to Others" ), KiBitmap( pin_size_to_xpm ) );
308  AddMenuItem( global_pin_change,
310  selected ? _( "Pin Name Size to selected pin" ) :
311  _( "Pin Name Size to Others" ), KiBitmap( pin_name_to_xpm ) );
312  AddMenuItem( global_pin_change,
314  selected ? _( "Pin Num Size to selected pin" ) :
315  _( "Pin Num Size to Others" ), KiBitmap( pin_number_to_xpm ) );
316 }
bool IsMoving() const
Definition: base_struct.h:218
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
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
bool IsSelected() const
Definition: base_struct.h:221
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) ...