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 <sch_draw_panel.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 328 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_COPY_BLOCK, ID_POPUP_CUT_BLOCK, 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().

329 {
330  wxString msg;
331  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ),
332  KiBitmap( cancel_xpm ) );
333 
334  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
336  _( "Zoom Block" ),
337  KiBitmap( zoom_area_xpm ) );
338 
339  PopMenu->AppendSeparator();
340 
341  AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( checked_ok_xpm ) );
342 
343  if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
344  {
345  AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ),
346  KiBitmap( green_xpm ) );
347 
348  msg = AddHotkeyName( _( "Cut Block" ), g_Schematic_Hokeys_Descr, HK_EDIT_CUT );
349  AddMenuItem( PopMenu, ID_POPUP_CUT_BLOCK, msg, KiBitmap( cut_xpm ) );
350 
351  msg = AddHotkeyName( _( "Copy Block" ), g_Schematic_Hokeys_Descr, HK_EDIT_COPY );
352  AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, msg,
353  KiBitmap( copy_xpm ) );
354 
355  AddMenuItem( PopMenu, ID_POPUP_DUPLICATE_BLOCK, _( "Duplicate Block" ),
356  KiBitmap( duplicate_xpm ) );
357 
358  msg = AddHotkeyName( _( "Mirror Block Around Horizontal(X) Axis" ), g_Libedit_Hokeys_Descr, HK_MIRROR_X );
359  AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, msg,
360  KiBitmap( mirror_v_xpm ) );
361 
362  msg = AddHotkeyName( _( "Mirror Block Around Vertical(Y) Axis" ), g_Libedit_Hokeys_Descr, HK_MIRROR_Y );
363  AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, msg,
364  KiBitmap( mirror_h_xpm ) );
365 
366  msg = AddHotkeyName( _( "Rotate Counterclockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
367  AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, msg,
368  KiBitmap( rotate_ccw_xpm ) );
369 
370  AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ),
371  KiBitmap( delete_xpm ) );
372  }
373 }
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:223
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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 282 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().

283 {
284  bool selected = Pin->IsSelected();
285  bool not_in_move = !Pin->IsMoving();
286  wxString msg;
287 
288  if( not_in_move )
289  {
290  msg = AddHotkeyName( _( "Move" ), g_Libedit_Hokeys_Descr,
292  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_xpm ) );
293  }
294 
295  msg = AddHotkeyName( _( "Edit..." ), g_Libedit_Hokeys_Descr, HK_EDIT);
296  AddMenuItem( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, KiBitmap( edit_xpm ) );
297 
298  msg = AddHotkeyName( _( "Rotate Clockwise" ), g_Libedit_Hokeys_Descr, HK_ROTATE );
299  AddMenuItem( PopMenu, ID_LIBEDIT_ROTATE_ITEM, msg, KiBitmap( rotate_cw_xpm ) );
300 
301  if( not_in_move )
302  {
303  msg = AddHotkeyName( _( "Delete" ), g_Libedit_Hokeys_Descr, HK_DELETE );
304  AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_xpm ) );
305  }
306 
307  wxMenu* global_pin_change = new wxMenu;
308  AddMenuItem( PopMenu, global_pin_change,
310  _( "Global" ), KiBitmap( pin_to_xpm ) );
311  AddMenuItem( global_pin_change,
313  selected ? _( "Push Pin Size to Selected Pin" ) :
314  _( "Push Pin Size to Others" ), KiBitmap( pin_size_to_xpm ) );
315  AddMenuItem( global_pin_change,
317  selected ? _( "Push Pin Name Size to Selected Pin" ) :
318  _( "Push Pin Name Size to Others" ), KiBitmap( pin_name_to_xpm ) );
319  AddMenuItem( global_pin_change,
321  selected ? _( "Push Pin Num Size to Selected Pin" ) :
322  _( "Push Pin Num Size to Others" ), KiBitmap( pin_number_to_xpm ) );
323 }
bool IsMoving() const
Definition: base_struct.h:221
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:223
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[]
bool IsSelected() const
Definition: base_struct.h:224
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
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) ...