2007-08-30 08:15:05 +00:00
|
|
|
/***************/
|
|
|
|
/* hotkeys.cpp */
|
|
|
|
/***************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "eeschema_id.h"
|
|
|
|
#include "hotkeys.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "wxEeschemaStruct.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2010-02-16 16:21:52 +00:00
|
|
|
#include "libeditframe.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_libentry.h"
|
2011-01-12 21:47:54 +00:00
|
|
|
#include "sch_junction.h"
|
2010-12-21 15:13:09 +00:00
|
|
|
#include "sch_line.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_component.h"
|
|
|
|
#include "sch_sheet.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2010-10-26 20:25:48 +00:00
|
|
|
#include "dialogs/dialog_schematic_find.h"
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
/* How to add a new hotkey:
|
2009-12-02 21:44:03 +00:00
|
|
|
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see
|
2009-02-25 20:54:49 +00:00
|
|
|
* hotkeys.h).
|
|
|
|
* add a new Ki_HotkeyInfo entry like:
|
|
|
|
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION,
|
|
|
|
* default key value);
|
|
|
|
* wxT("Command Label") is the name used in hotkey list display, and the
|
|
|
|
* identifier in the hotkey list file
|
|
|
|
* MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in
|
|
|
|
* OnHotKey() function.
|
|
|
|
* default key value is the default hotkey for this command. Can be overridden
|
|
|
|
* by the user hotkey list file
|
|
|
|
* add the HkMyNewEntry pointer in the s_Schematic_Hotkey_List list or the
|
|
|
|
* s_LibEdit_Hotkey_List list or s_Common_Hotkey_List if the same command is
|
|
|
|
* added both in eeschema and libedit)
|
|
|
|
* Add the new code in the switch in OnHotKey() function.
|
2010-10-30 10:03:41 +00:00
|
|
|
* when the variable itemInEdit is true, an item is currently edited.
|
2010-02-04 17:46:12 +00:00
|
|
|
* This can be useful if the new function cannot be executed while an item is
|
2009-02-25 20:54:49 +00:00
|
|
|
* currently being edited
|
|
|
|
* ( For example, one cannot start a new wire when a component is moving.)
|
|
|
|
*
|
|
|
|
* Note: If an hotkey is a special key be sure the corresponding wxWidget
|
|
|
|
* keycode (WXK_XXXX) is handled in the hotkey_name_descr
|
|
|
|
* s_Hotkey_Name_List list (see hotkeys_basic.cpp) and see this list
|
|
|
|
* for some ascii keys (space ...)
|
2007-08-30 08:15:05 +00:00
|
|
|
*
|
2007-09-19 15:29:50 +00:00
|
|
|
* Key modifier are: GR_KB_CTRL GR_KB_ALT
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2007-08-10 18:05:42 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-08-10 18:05:42 +00:00
|
|
|
/* local variables */
|
|
|
|
/* Hotkey list: */
|
2007-09-10 04:51:01 +00:00
|
|
|
|
2010-01-18 19:33:45 +00:00
|
|
|
/**
|
|
|
|
* Common commands
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Fit on Screen */
|
2010-02-16 10:42:57 +00:00
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
static Ki_HotkeyInfo HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME );
|
|
|
|
#else
|
|
|
|
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
/* Refresh Screen */
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
|
|
|
|
#else
|
|
|
|
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' );
|
|
|
|
#endif
|
2010-01-18 19:33:45 +00:00
|
|
|
|
|
|
|
/* Zoom In */
|
|
|
|
#if !defined( __WXMAC__ )
|
2010-02-04 17:46:12 +00:00
|
|
|
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
|
2010-01-18 19:33:45 +00:00
|
|
|
#else
|
2010-02-04 17:46:12 +00:00
|
|
|
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' );
|
2010-01-18 19:33:45 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Zoom Out */
|
|
|
|
#if !defined( __WXMAC__ )
|
2010-02-04 17:46:12 +00:00
|
|
|
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
|
2010-01-18 19:33:45 +00:00
|
|
|
#else
|
2010-02-04 17:46:12 +00:00
|
|
|
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
|
2010-01-18 19:33:45 +00:00
|
|
|
#endif
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
static Ki_HotkeyInfo HkHelp( wxT( "Help: this message" ), HK_HELP, '?' );
|
|
|
|
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset local coord." ),
|
|
|
|
HK_RESET_LOCAL_COORD, ' ' );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
|
|
|
/* Undo */
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
|
|
|
/* Redo */
|
|
|
|
#if !defined( __WXMAC__ )
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
|
2010-01-18 19:33:45 +00:00
|
|
|
#else
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z',
|
2010-02-12 23:12:00 +00:00
|
|
|
(int) wxID_REDO );
|
2010-01-18 19:33:45 +00:00
|
|
|
#endif
|
2007-09-06 11:52:26 +00:00
|
|
|
|
|
|
|
// Schematic editor
|
2010-07-15 14:18:11 +00:00
|
|
|
static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' );
|
2010-11-11 17:54:24 +00:00
|
|
|
static Ki_HotkeyInfo HkAddHierarchicalLabel( wxT( "add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
|
|
|
|
static Ki_HotkeyInfo HkAddGlobalLabel( wxT( "add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' );
|
2010-10-30 10:03:41 +00:00
|
|
|
static Ki_HotkeyInfo HkAddJunction( wxT( "add Junction" ), HK_ADD_JUNCTION, 'J' );
|
2009-02-25 20:54:49 +00:00
|
|
|
static Ki_HotkeyInfo HkBeginWire( wxT( "begin Wire" ), HK_BEGIN_WIRE, 'W' );
|
2010-11-11 17:54:24 +00:00
|
|
|
static Ki_HotkeyInfo HkBeginBus( wxT( "begin Bus" ), HK_BEGIN_BUS, 'B' );
|
|
|
|
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' );
|
|
|
|
static Ki_HotkeyInfo HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' );
|
|
|
|
static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' );
|
|
|
|
static Ki_HotkeyInfo HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' );
|
|
|
|
static Ki_HotkeyInfo HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' );
|
|
|
|
static Ki_HotkeyInfo HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' );
|
|
|
|
static Ki_HotkeyInfo HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' );
|
|
|
|
static Ki_HotkeyInfo HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' );
|
|
|
|
static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' );
|
|
|
|
static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' );
|
2009-02-25 20:54:49 +00:00
|
|
|
static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ),
|
|
|
|
HK_ORIENT_NORMAL_COMPONENT, 'N' );
|
2010-10-23 10:09:23 +00:00
|
|
|
static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' );
|
|
|
|
static Ki_HotkeyInfo HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E' );
|
2009-02-25 20:54:49 +00:00
|
|
|
static Ki_HotkeyInfo HkEditComponentValue( wxT( "Edit Component Value" ),
|
|
|
|
HK_EDIT_COMPONENT_VALUE, 'V' );
|
|
|
|
static Ki_HotkeyInfo HkEditComponentFootprint( wxT( "Edit Component Footprint" ),
|
2010-10-23 10:09:23 +00:00
|
|
|
HK_EDIT_COMPONENT_FOOTPRINT, 'F' );
|
2010-02-04 17:46:12 +00:00
|
|
|
static Ki_HotkeyInfo HkMove( wxT( "Move Schematic Item" ),
|
|
|
|
HK_MOVE_COMPONENT_OR_ITEM, 'M',
|
|
|
|
ID_POPUP_SCH_MOVE_CMP_REQUEST );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
|
|
|
static Ki_HotkeyInfo HkCopyComponentOrText( wxT( "Copy Component or Label" ),
|
2010-02-04 17:46:12 +00:00
|
|
|
HK_COPY_COMPONENT_OR_LABEL, 'C',
|
|
|
|
ID_POPUP_SCH_COPY_ITEM );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkDrag( wxT( "Drag Schematic Item" ), HK_DRAG, 'G',
|
2010-02-04 17:46:12 +00:00
|
|
|
ID_POPUP_SCH_DRAG_CMP_REQUEST );
|
2009-02-25 20:54:49 +00:00
|
|
|
static Ki_HotkeyInfo HkMove2Drag( wxT( "Switch move block to drag block" ),
|
|
|
|
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
|
2009-02-25 20:54:49 +00:00
|
|
|
static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
|
2010-02-16 10:42:57 +00:00
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
|
|
|
|
static Ki_HotkeyInfo HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5 );
|
2010-03-16 18:22:59 +00:00
|
|
|
static Ki_HotkeyInfo HkFindNextDrcMarker( wxT( "Find next DRC marker" ), HK_FIND_NEXT_DRC_MARKER,
|
|
|
|
WXK_F5 + GR_KB_SHIFT );
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
// Special keys for library editor:
|
2010-10-20 20:24:26 +00:00
|
|
|
static Ki_HotkeyInfo HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
|
|
|
|
static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
|
2010-10-23 10:09:23 +00:00
|
|
|
static Ki_HotkeyInfo HkMoveLibItem( wxT( "Move Lib Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
|
2007-09-06 11:52:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
// List of common hotkey descriptors
|
|
|
|
Ki_HotkeyInfo* s_Common_Hotkey_List[] =
|
|
|
|
{
|
|
|
|
&HkHelp,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkZoomIn,
|
|
|
|
&HkZoomOut,
|
|
|
|
&HkZoomRedraw,
|
|
|
|
&HkZoomCenter,
|
|
|
|
&HkZoomAuto,
|
2007-09-06 11:52:26 +00:00
|
|
|
&HkResetLocalCoord,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkUndo,
|
|
|
|
&HkRedo,
|
2007-09-06 11:52:26 +00:00
|
|
|
NULL
|
|
|
|
};
|
2007-08-10 18:05:42 +00:00
|
|
|
|
|
|
|
// List of hotkey descriptors for schematic
|
2009-02-25 20:54:49 +00:00
|
|
|
Ki_HotkeyInfo* s_Schematic_Hotkey_List[] =
|
|
|
|
{
|
2010-02-16 10:42:57 +00:00
|
|
|
&HkFindItem,
|
2010-03-16 18:22:59 +00:00
|
|
|
&HkFindNextItem,
|
|
|
|
&HkFindNextDrcMarker,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkDelete,
|
|
|
|
&HkInsert,
|
|
|
|
&HkMove2Drag,
|
|
|
|
&HkMove,
|
|
|
|
&HkCopyComponentOrText,
|
|
|
|
&HkDrag,
|
|
|
|
&HkAddComponent,
|
2010-11-11 17:54:24 +00:00
|
|
|
&HkAddPower,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkRotate,
|
|
|
|
&HkMirrorXComponent,
|
|
|
|
&HkMirrorYComponent,
|
2009-02-25 20:54:49 +00:00
|
|
|
&HkOrientNormalComponent,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkEdit,
|
|
|
|
&HkEditComponentValue,
|
|
|
|
&HkEditComponentFootprint,
|
2007-08-30 08:15:05 +00:00
|
|
|
&HkBeginWire,
|
2010-11-11 17:54:24 +00:00
|
|
|
&HkBeginBus,
|
2010-07-15 14:18:11 +00:00
|
|
|
&HkAddLabel,
|
2010-11-11 17:54:24 +00:00
|
|
|
&HkAddHierarchicalLabel,
|
|
|
|
&HkAddGlobalLabel,
|
2010-10-30 10:03:41 +00:00
|
|
|
&HkAddJunction,
|
2010-07-26 17:06:36 +00:00
|
|
|
&HkAddNoConn,
|
2010-11-11 17:54:24 +00:00
|
|
|
&HkAddHierSheet,
|
|
|
|
&HkAddWireEntry,
|
|
|
|
&HkAddBusEntry,
|
|
|
|
&HkAddGraphicPolyLine,
|
|
|
|
&HkAddGraphicText,
|
2007-08-30 08:15:05 +00:00
|
|
|
NULL
|
2007-08-10 18:05:42 +00:00
|
|
|
};
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
// List of hotkey descriptors for library editor
|
2007-08-30 08:15:05 +00:00
|
|
|
Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
|
2007-08-10 18:05:42 +00:00
|
|
|
{
|
2010-07-26 17:06:36 +00:00
|
|
|
&HkCreatePin,
|
2007-08-30 08:15:05 +00:00
|
|
|
&HkInsertPin,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkEdit,
|
2010-10-23 10:09:23 +00:00
|
|
|
&HkMoveLibItem,
|
2010-07-26 17:06:36 +00:00
|
|
|
&HkDelete,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkRotate,
|
|
|
|
&HkDrag,
|
2007-08-30 08:15:05 +00:00
|
|
|
NULL
|
2007-08-10 18:05:42 +00:00
|
|
|
};
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
// list of sections and corresponding hotkey list for eeschema (used to create
|
|
|
|
// an hotkey config file)
|
2007-09-10 04:51:01 +00:00
|
|
|
struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[] =
|
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
{ &g_CommonSectionTag, s_Common_Hotkey_List, L"Common keys" },
|
|
|
|
{ &g_SchematicSectionTag, s_Schematic_Hotkey_List, L"Schematic editor keys" },
|
|
|
|
{ &g_LibEditSectionTag, s_LibEdit_Hotkey_List, L"library editor keys" },
|
2010-02-04 17:46:12 +00:00
|
|
|
{ NULL, NULL, NULL }
|
2007-09-06 11:52:26 +00:00
|
|
|
};
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
// list of sections and corresponding hotkey list for the schematic editor
|
|
|
|
// (used to list current hotkeys)
|
2007-09-10 04:51:01 +00:00
|
|
|
struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] =
|
|
|
|
{
|
|
|
|
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
|
|
|
|
{ &g_SchematicSectionTag, s_Schematic_Hotkey_List, NULL },
|
2010-02-04 17:46:12 +00:00
|
|
|
{ NULL, NULL, NULL }
|
2007-09-06 11:52:26 +00:00
|
|
|
};
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
// list of sections and corresponding hotkey list for the component editor
|
|
|
|
// (used to list current hotkeys)
|
2007-09-10 04:51:01 +00:00
|
|
|
struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] =
|
|
|
|
{
|
|
|
|
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
|
|
|
|
{ &g_LibEditSectionTag, s_LibEdit_Hotkey_List, NULL },
|
2010-02-04 17:46:12 +00:00
|
|
|
{ NULL, NULL, NULL }
|
2007-09-06 11:52:26 +00:00
|
|
|
};
|
|
|
|
|
2009-09-27 14:09:26 +00:00
|
|
|
// list of sections and corresponding hotkey list for the component browser
|
|
|
|
// (used to list current hotkeys)
|
|
|
|
struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[] =
|
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
|
|
|
|
{ NULL, NULL, NULL }
|
2009-09-27 14:09:26 +00:00
|
|
|
};
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
/*
|
|
|
|
* Hot keys. Some commands are relative to the item under the mouse cursor
|
|
|
|
* Commands are case insensitive
|
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-01-07 15:59:49 +00:00
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
2009-02-25 20:54:49 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetEventObject( this );
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2010-10-30 10:03:41 +00:00
|
|
|
// itemInEdit == false means no item currently edited. We can ask for editing a new item
|
|
|
|
bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->m_Flags;
|
|
|
|
// notBusy == true means no item currently edited and no other command in progress
|
|
|
|
// We can change active tool and ask for editing a new item
|
|
|
|
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK);
|
|
|
|
bool RefreshToolBar = FALSE;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
if( hotkey == 0 )
|
|
|
|
return;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
wxPoint MousePos = GetScreen()->m_MousePosition;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
/* Convert lower to upper case (the usual toupper function has problem
|
|
|
|
* with non ascii codes like function keys */
|
2007-08-30 08:15:05 +00:00
|
|
|
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
|
|
|
hotkey += 'A' - 'a';
|
|
|
|
|
|
|
|
// Search command from key :
|
2010-10-20 20:24:26 +00:00
|
|
|
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
|
2007-09-22 14:31:20 +00:00
|
|
|
if( HK_Descr == NULL )
|
|
|
|
HK_Descr = GetDescriptorFromHotkey( hotkey, s_Schematic_Hotkey_List );
|
2009-02-25 20:54:49 +00:00
|
|
|
if( HK_Descr == NULL )
|
|
|
|
return;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
switch( HK_Descr->m_Idcommand )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case HK_NOT_FOUND:
|
|
|
|
return;
|
|
|
|
|
|
|
|
case HK_HELP: // Display Current hotkey list
|
2007-09-06 11:52:26 +00:00
|
|
|
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
|
2008-03-20 01:50:21 +00:00
|
|
|
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_IN:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_POPUP_ZOOM_IN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_OUT:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_REDRAW:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_ZOOM_REDRAW );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_CENTER:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-27 14:09:26 +00:00
|
|
|
case HK_ZOOM_AUTO:
|
|
|
|
cmd.SetId( ID_ZOOM_PAGE );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
case HK_UNDO:
|
|
|
|
case HK_REDO:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
2010-10-20 20:24:26 +00:00
|
|
|
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
|
2009-02-25 20:54:49 +00:00
|
|
|
wxPostEvent( this, event );
|
|
|
|
}
|
2007-09-22 14:31:20 +00:00
|
|
|
break;
|
2007-09-19 15:29:50 +00:00
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
|
2007-08-30 08:15:05 +00:00
|
|
|
HandleBlockEndByPopUp( BLOCK_DRAG, DC );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_DELETE:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy)
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
|
|
|
RefreshToolBar = LocateAndDeleteItem( this, DC );
|
2010-07-26 17:06:36 +00:00
|
|
|
OnModify();
|
2009-02-25 20:54:49 +00:00
|
|
|
GetScreen()->SetCurItem( NULL );
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds( DrawPanel, DC );
|
2009-02-25 20:54:49 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_REPEAT_LAST:
|
2011-01-12 21:47:54 +00:00
|
|
|
if( notBusy && m_itemToRepeat && ( m_itemToRepeat->m_Flags == 0 ) )
|
2007-08-30 08:15:05 +00:00
|
|
|
RepeatDrawItem( DC );
|
|
|
|
break;
|
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
case HK_FIND_ITEM:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2010-02-16 10:42:57 +00:00
|
|
|
{
|
|
|
|
wxCommandEvent evt;
|
|
|
|
evt.SetId( ID_FIND_ITEMS );
|
|
|
|
Process_Special_Functions( evt );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
case HK_FIND_NEXT_ITEM:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2010-03-16 18:22:59 +00:00
|
|
|
{
|
|
|
|
wxFindDialogEvent event( wxEVT_COMMAND_FIND, GetId() );
|
|
|
|
event.SetEventObject( this );
|
|
|
|
event.SetFlags( m_findReplaceData->GetFlags() );
|
|
|
|
event.SetFindString( m_findReplaceData->GetFindString() );
|
|
|
|
GetEventHandler()->ProcessEvent( event );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_FIND_NEXT_DRC_MARKER:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
2010-03-16 18:22:59 +00:00
|
|
|
wxFindDialogEvent event( EVT_COMMAND_FIND_DRC_MARKER, GetId() );
|
|
|
|
event.SetEventObject( this );
|
|
|
|
event.SetFlags( m_findReplaceData->GetFlags() );
|
|
|
|
event.SetFindString( m_findReplaceData->GetFindString() );
|
|
|
|
GetEventHandler()->ProcessEvent( event );
|
2009-02-25 20:54:49 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ADD_NEW_COMPONENT: // Add component
|
2010-10-30 10:03:41 +00:00
|
|
|
if( !itemInEdit )
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_COMPONENT_BUTT;
|
|
|
|
if( m_ID_current_state != ID_COMPONENT_BUTT )
|
2010-10-20 20:24:26 +00:00
|
|
|
SetToolID( ID_COMPONENT_BUTT, wxCURSOR_PENCIL, _( "Add Component" ) );
|
2009-02-25 20:54:49 +00:00
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_ADD_NEW_POWER: // Add power component
|
|
|
|
if( !itemInEdit )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_PLACE_POWER_BUTT;
|
|
|
|
if( m_ID_current_state != ID_PLACE_POWER_BUTT )
|
|
|
|
SetToolID( ID_PLACE_POWER_BUTT, wxCURSOR_PENCIL, _( "Add Power" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-07-15 14:18:11 +00:00
|
|
|
case HK_ADD_LABEL:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2010-07-17 12:04:42 +00:00
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_LABEL_BUTT;
|
|
|
|
if( m_ID_current_state != ID_LABEL_BUTT )
|
|
|
|
SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add Label" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
2010-07-26 17:06:36 +00:00
|
|
|
break;
|
2010-07-15 14:18:11 +00:00
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_ADD_HLABEL:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_HIERLABEL_BUTT;
|
|
|
|
if( m_ID_current_state != ID_HIERLABEL_BUTT )
|
|
|
|
SetToolID( ID_HIERLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Hierarchical Label" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ADD_GLABEL:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_GLABEL_BUTT;
|
|
|
|
if( m_ID_current_state != ID_GLABEL_BUTT )
|
|
|
|
SetToolID( ID_GLABEL_BUTT, wxCURSOR_PENCIL, _( "Add Global Label" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-10-30 10:03:41 +00:00
|
|
|
case HK_ADD_JUNCTION:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_JUNCTION_BUTT;
|
|
|
|
if( m_ID_current_state != ID_JUNCTION_BUTT )
|
|
|
|
SetToolID( ID_JUNCTION_BUTT, wxCURSOR_PENCIL, _( "Add Junction" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
2010-07-26 17:06:36 +00:00
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_ADD_WIRE_ENTRY:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_WIRETOBUS_ENTRY_BUTT;
|
|
|
|
if( m_ID_current_state != ID_WIRETOBUS_ENTRY_BUTT )
|
|
|
|
SetToolID( ID_WIRETOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Wire to Bus entry" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ADD_BUS_ENTRY:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-11-11 17:54:24 +00:00
|
|
|
// switch to m_ID_current_state = ID_BUSTOBUS_ENTRY_BUTT;
|
|
|
|
if( m_ID_current_state != ID_BUSTOBUS_ENTRY_BUTT )
|
|
|
|
SetToolID( ID_BUSTOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add Bus to Bus entry" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ADD_HIER_SHEET:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_SHEET_SYMBOL_BUTT;
|
|
|
|
if( m_ID_current_state != ID_SHEET_SYMBOL_BUTT )
|
|
|
|
SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add Sheet" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ADD_GRAPHIC_TEXT:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_TEXT_COMMENT_BUTT;
|
|
|
|
if( m_ID_current_state != ID_TEXT_COMMENT_BUTT )
|
|
|
|
SetToolID( ID_TEXT_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Text" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ADD_GRAPHIC_POLYLINE:
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_LINE_COMMENT_BUTT;
|
|
|
|
if( m_ID_current_state != ID_LINE_COMMENT_BUTT )
|
|
|
|
SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add Lines" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_BEGIN_BUS:
|
|
|
|
// An item can be selected. If not a Bus, a begin command is not possible
|
|
|
|
if( notBusy )
|
|
|
|
{
|
|
|
|
// switch to m_ID_current_state = ID_WIRE_BUTT;
|
|
|
|
if( m_ID_current_state != ID_BUS_BUTT )
|
|
|
|
SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add Bus" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_BUS_BUTT ) )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_LINE_T )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-11-11 17:54:24 +00:00
|
|
|
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
if( segment->GetLayer() != LAYER_BUS )
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
2010-12-21 15:13:09 +00:00
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
// Bus in progress:
|
|
|
|
OnLeftClick( DC, MousePos );
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
2010-11-11 17:54:24 +00:00
|
|
|
}
|
|
|
|
break;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_BEGIN_WIRE:
|
|
|
|
// An item can be selected. If not a wire, a begin command is not possible
|
|
|
|
if( notBusy )
|
|
|
|
{
|
2009-02-25 20:54:49 +00:00
|
|
|
// switch to m_ID_current_state = ID_WIRE_BUTT;
|
|
|
|
if( m_ID_current_state != ID_WIRE_BUTT )
|
|
|
|
SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add Wire" ) );
|
|
|
|
OnLeftClick( DC, MousePos );
|
2010-11-11 17:54:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if( DrawStruct && DrawStruct->IsNew() && ( m_ID_current_state == ID_WIRE_BUTT ) )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_LINE_T )
|
2010-11-11 17:54:24 +00:00
|
|
|
{
|
|
|
|
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
|
|
|
|
if( segment->GetLayer() != LAYER_WIRE )
|
|
|
|
break;
|
|
|
|
// Wire in progress:
|
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
2009-02-25 20:54:49 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2010-07-26 17:06:36 +00:00
|
|
|
case HK_ADD_NOCONN_FLAG: // Add a no connected flag
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2010-07-26 17:06:36 +00:00
|
|
|
{
|
|
|
|
if( m_ID_current_state != ID_NOCONN_BUTT )
|
2010-10-20 20:24:26 +00:00
|
|
|
SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL, _( "Add \"NoNonnect\" Flags" ) );
|
2010-07-26 17:06:36 +00:00
|
|
|
OnLeftClick( DC, MousePos );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_ROTATE: // Component or other schematic item rotation
|
2010-09-05 17:01:48 +00:00
|
|
|
if ( screen->m_BlockLocate.m_State != STATE_NO_BLOCK)//allows bloc operation on hotkey
|
|
|
|
{
|
|
|
|
HandleBlockEndByPopUp(BLOCK_ROTATE, DC );
|
|
|
|
break;
|
2010-10-20 20:24:26 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
// Find the schematic object to rotate under the cursor
|
|
|
|
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_COMPONENT_T )
|
2008-04-17 16:25:29 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
if( DrawStruct )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
// Create the events for rotating a component or other schematic item
|
2010-01-17 20:25:10 +00:00
|
|
|
wxCommandEvent eventRotateComponent( wxEVT_COMMAND_TOOL_CLICKED,
|
2010-02-04 17:46:12 +00:00
|
|
|
ID_POPUP_SCH_ROTATE_CMP_COUNTERCLOCKWISE );
|
|
|
|
wxCommandEvent eventRotateText( wxEVT_COMMAND_TOOL_CLICKED,
|
|
|
|
ID_POPUP_SCH_ROTATE_TEXT );
|
|
|
|
wxCommandEvent eventRotateField( wxEVT_COMMAND_TOOL_CLICKED,
|
|
|
|
ID_POPUP_SCH_ROTATE_FIELD );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-01-17 20:25:10 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_T: //TODO allow sheet rotate on hotkey
|
2010-09-05 17:01:48 +00:00
|
|
|
//wxPostEvent( this, eventRotateSheet );
|
|
|
|
break;
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
wxPostEvent( this, eventRotateComponent );
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
wxPostEvent( this, eventRotateText );
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_FIELD_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
wxPostEvent( this, eventRotateField );
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_MIRROR_Y_COMPONENT: // Mirror Y (Component)
|
2010-10-20 20:24:26 +00:00
|
|
|
if ( screen->m_BlockLocate.m_State != STATE_NO_BLOCK )
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
|
|
|
HandleBlockEndByPopUp(BLOCK_MIRROR_Y, DC );
|
|
|
|
break;
|
2010-10-20 20:24:26 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct == NULL )
|
2010-12-10 19:47:44 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct )
|
|
|
|
{
|
|
|
|
if( DrawStruct->m_Flags == 0 )
|
|
|
|
{
|
2009-07-26 17:16:42 +00:00
|
|
|
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
|
2007-08-30 08:15:05 +00:00
|
|
|
RefreshToolBar = TRUE;
|
|
|
|
}
|
2010-01-13 21:15:54 +00:00
|
|
|
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_Y );
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_MIRROR_X_COMPONENT: // Mirror X (Component)
|
2010-10-20 20:24:26 +00:00
|
|
|
if ( screen->m_BlockLocate.m_State != STATE_NO_BLOCK ) //allows bloc operation on hotkey
|
2010-09-05 17:01:48 +00:00
|
|
|
{
|
|
|
|
HandleBlockEndByPopUp(BLOCK_MIRROR_X, DC );
|
|
|
|
break;
|
2010-10-20 20:24:26 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct )
|
|
|
|
{
|
|
|
|
if( DrawStruct->m_Flags == 0 )
|
|
|
|
{
|
2009-07-26 17:16:42 +00:00
|
|
|
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
|
2007-08-30 08:15:05 +00:00
|
|
|
RefreshToolBar = TRUE;
|
|
|
|
}
|
2010-01-13 21:15:54 +00:00
|
|
|
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIRROR_X );
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
|
|
|
if( DrawStruct == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct )
|
|
|
|
{
|
|
|
|
if( DrawStruct->m_Flags == 0 )
|
|
|
|
{
|
2009-07-26 17:16:42 +00:00
|
|
|
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, UR_CHANGED );
|
2007-08-30 08:15:05 +00:00
|
|
|
RefreshToolBar = TRUE;
|
|
|
|
}
|
2008-04-14 19:22:48 +00:00
|
|
|
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
|
2011-01-21 19:30:59 +00:00
|
|
|
GetScreen()->TestDanglingEnds( DrawPanel, DC );
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_DRAG: // Start drag
|
2010-01-17 20:25:10 +00:00
|
|
|
case HK_MOVE_COMPONENT_OR_ITEM: // Start move component or other schematic item
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_COPY_COMPONENT_OR_LABEL: // Duplicate component or text/label
|
2010-10-30 10:03:41 +00:00
|
|
|
if( itemInEdit )
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
2009-10-16 10:44:44 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
{
|
2010-12-22 11:18:38 +00:00
|
|
|
// For a drag or copy command, try to find first a component:
|
|
|
|
if( DrawStruct == NULL && HK_Descr->m_Idcommand != HK_MOVE_COMPONENT_OR_ITEM )
|
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
|
|
|
|
|
|
|
// If no component, find the schematic object to move/drag or copy under the cursor
|
|
|
|
if( DrawStruct == NULL )
|
|
|
|
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2009-10-16 10:44:44 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_COMPONENT_T )
|
2009-10-16 10:44:44 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2010-01-28 13:10:46 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_SHEET_T )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
2011-01-10 20:35:24 +00:00
|
|
|
SCH_SHEET* sheet = (SCH_SHEET*) DrawStruct;
|
2010-02-04 17:46:12 +00:00
|
|
|
// If it's a sheet, then check if a pinsheet is under the cursor
|
2011-01-10 20:35:24 +00:00
|
|
|
SCH_SHEET_PIN* slabel = sheet->GetLabel( GetScreen()->m_Curseur );
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
if( slabel )
|
|
|
|
DrawStruct = slabel;
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_JUNCTION_T )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
|
|
|
// If it's a junction, pick the underlying wire instead
|
2011-01-25 14:06:17 +00:00
|
|
|
DrawStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(), WIRE_T );
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
2009-10-16 10:44:44 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-01-09 08:50:30 +00:00
|
|
|
if( HK_Descr->m_Idcommand == HK_COPY_COMPONENT_OR_LABEL )
|
|
|
|
{
|
|
|
|
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
|
2011-01-10 20:35:24 +00:00
|
|
|
wxCommandEvent event( wxEVT_COMMAND_TOOL_CLICKED, HK_Descr->m_IdMenuEvent );
|
2010-01-09 08:50:30 +00:00
|
|
|
wxPostEvent( this, event );
|
|
|
|
break;
|
|
|
|
}
|
2009-10-16 10:44:44 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2010-01-17 20:25:10 +00:00
|
|
|
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
|
2007-09-22 14:31:20 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
// Create the events for moving a component or other schematic item
|
2010-03-24 18:26:04 +00:00
|
|
|
wxCommandEvent eventMoveOrDragComponent( wxEVT_COMMAND_TOOL_CLICKED,
|
2010-07-26 17:06:36 +00:00
|
|
|
HK_Descr->m_IdMenuEvent );
|
2010-02-04 17:46:12 +00:00
|
|
|
wxCommandEvent eventMoveItem( wxEVT_COMMAND_TOOL_CLICKED,
|
|
|
|
ID_POPUP_SCH_MOVE_ITEM_REQUEST );
|
|
|
|
wxCommandEvent eventMovePinsheet( wxEVT_COMMAND_TOOL_CLICKED,
|
|
|
|
ID_POPUP_SCH_MOVE_PINSHEET );
|
|
|
|
wxCommandEvent eventDragWire( wxEVT_COMMAND_TOOL_CLICKED,
|
|
|
|
ID_POPUP_SCH_DRAG_WIRE_REQUEST );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
|
|
|
switch( DrawStruct->Type() )
|
2009-10-16 10:44:44 +00:00
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
// select the correct event for moving an schematic object
|
|
|
|
// and add it to the event queue
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_T:
|
|
|
|
case SCH_COMPONENT_T:
|
2010-03-24 18:26:04 +00:00
|
|
|
wxPostEvent( this, eventMoveOrDragComponent );
|
2010-02-04 17:46:12 +00:00
|
|
|
break;
|
2009-10-16 10:44:44 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2010-07-17 11:14:57 +00:00
|
|
|
wxPostEvent( this, eventMoveOrDragComponent );
|
2010-07-26 17:06:36 +00:00
|
|
|
break;
|
2010-07-17 11:14:57 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_FIELD_T:
|
|
|
|
case SCH_BUS_ENTRY_T:
|
2010-03-24 18:26:04 +00:00
|
|
|
if( HK_Descr->m_Idcommand != HK_DRAG )
|
|
|
|
wxPostEvent( this, eventMoveItem );
|
2010-02-04 17:46:12 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_LABEL_T:
|
2010-03-24 18:26:04 +00:00
|
|
|
if( HK_Descr->m_Idcommand != HK_DRAG )
|
|
|
|
wxPostEvent( this, eventMovePinsheet );
|
2010-02-04 17:46:12 +00:00
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_LINE_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
if( ( (SCH_ITEM*) DrawStruct )->GetLayer() == LAYER_WIRE )
|
2010-12-20 17:44:25 +00:00
|
|
|
{
|
|
|
|
if( HK_Descr->m_Idcommand == HK_DRAG )
|
|
|
|
wxPostEvent( this, eventDragWire );
|
|
|
|
else
|
|
|
|
wxPostEvent( this, eventMoveItem );
|
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
2010-01-17 20:25:10 +00:00
|
|
|
}
|
2009-10-16 10:44:44 +00:00
|
|
|
}
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2009-10-16 10:44:44 +00:00
|
|
|
break;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_EDIT:
|
2009-10-16 10:44:44 +00:00
|
|
|
|
2010-10-30 10:03:41 +00:00
|
|
|
if( itemInEdit )
|
2009-10-16 10:44:44 +00:00
|
|
|
break;
|
|
|
|
if( DrawStruct == NULL )
|
|
|
|
{
|
2010-10-20 20:24:26 +00:00
|
|
|
DrawStruct = PickStruct( GetScreen()->m_Curseur, GetScreen(),
|
2011-01-25 14:06:17 +00:00
|
|
|
COMPONENT_T | TEXT_T | LABEL_T | SHEET_T );
|
2009-10-16 10:44:44 +00:00
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
2010-12-10 19:47:44 +00:00
|
|
|
if( DrawStruct->Type() == SCH_COMPONENT_T )
|
2009-10-16 10:44:44 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
|
|
|
if( DrawStruct == NULL )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-01-17 20:25:10 +00:00
|
|
|
if( DrawStruct )
|
2009-10-16 10:44:44 +00:00
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
wxCommandEvent eventEditPinsheet( wxEVT_COMMAND_TOOL_CLICKED,
|
|
|
|
ID_POPUP_SCH_EDIT_SHEET );
|
2009-10-16 10:44:44 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
switch( DrawStruct->Type() )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_COMPONENT_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
InstallCmpeditFrame( this, MousePos, (SCH_COMPONENT*) DrawStruct );
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_SHEET_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
GetScreen()->SetCurItem( (SCH_ITEM*) DrawStruct );
|
|
|
|
wxPostEvent( this, eventEditPinsheet );
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case SCH_TEXT_T:
|
|
|
|
case SCH_LABEL_T:
|
|
|
|
case SCH_GLOBAL_LABEL_T:
|
|
|
|
case SCH_HIERARCHICAL_LABEL_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
EditSchematicText( (SCH_TEXT*) DrawStruct );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-02-25 20:54:49 +00:00
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case HK_EDIT_COMPONENT_VALUE:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( itemInEdit )
|
2007-12-11 16:41:43 +00:00
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
if( DrawStruct == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2009-02-25 20:54:49 +00:00
|
|
|
if( DrawStruct )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2009-02-25 20:54:49 +00:00
|
|
|
EditComponentValue( (SCH_COMPONENT*) DrawStruct, DC );
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_EDIT_COMPONENT_FOOTPRINT:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( itemInEdit )
|
2007-12-11 16:41:43 +00:00
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
if( DrawStruct == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
DrawStruct = LocateSmallestComponent( GetScreen() );
|
2009-02-25 20:54:49 +00:00
|
|
|
if( DrawStruct )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2009-02-25 20:54:49 +00:00
|
|
|
EditComponentFootprint( (SCH_COMPONENT*) DrawStruct, DC );
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
2007-12-11 16:41:43 +00:00
|
|
|
break;
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( RefreshToolBar )
|
|
|
|
SetToolbars();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-08-10 18:05:42 +00:00
|
|
|
|
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
/*
|
|
|
|
* Hot keys for the component editor. Some commands are relatives to the item
|
|
|
|
* under the mouse cursor
|
|
|
|
* Commands are case insensitive
|
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
void LIB_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
|
2007-08-10 18:05:42 +00:00
|
|
|
{
|
2009-01-07 15:59:49 +00:00
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
2009-02-25 20:54:49 +00:00
|
|
|
wxCommandEvent toolCmd( wxEVT_COMMAND_TOOL_CLICKED );
|
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetEventObject( this );
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
wxPoint MousePos = GetScreen()->m_MousePosition;
|
2010-10-30 10:03:41 +00:00
|
|
|
bool itemInEdit = GetScreen()->GetCurItem()&& GetScreen()->GetCurItem()->m_Flags;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
if( hotkey == 0 )
|
|
|
|
return;
|
2007-08-20 10:55:09 +00:00
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
/* Convert lower to upper case (the usual toupper function has problem
|
|
|
|
* with non ascii codes like function keys */
|
2007-08-30 08:15:05 +00:00
|
|
|
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
|
|
|
hotkey += 'A' - 'a';
|
2010-10-20 20:24:26 +00:00
|
|
|
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( hotkey, s_Common_Hotkey_List );
|
2007-09-22 14:31:20 +00:00
|
|
|
if( HK_Descr == NULL )
|
|
|
|
HK_Descr = GetDescriptorFromHotkey( hotkey, s_LibEdit_Hotkey_List );
|
2009-02-25 20:54:49 +00:00
|
|
|
if( HK_Descr == NULL )
|
|
|
|
return;
|
2007-08-20 10:55:09 +00:00
|
|
|
|
2007-09-22 14:31:20 +00:00
|
|
|
switch( HK_Descr->m_Idcommand )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case HK_NOT_FOUND:
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_HELP: // Display Current hotkey list
|
2007-09-06 11:52:26 +00:00
|
|
|
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
|
2008-03-20 01:50:21 +00:00
|
|
|
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_IN:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_POPUP_ZOOM_IN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_OUT:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_REDRAW:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_ZOOM_REDRAW );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_CENTER:
|
2009-01-07 15:59:49 +00:00
|
|
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-27 14:09:26 +00:00
|
|
|
case HK_ZOOM_AUTO:
|
|
|
|
cmd.SetId( ID_ZOOM_PAGE );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2007-09-22 14:31:20 +00:00
|
|
|
case HK_UNDO:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( !itemInEdit )
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
2010-01-19 20:43:44 +00:00
|
|
|
toolCmd.SetId( wxID_UNDO );
|
2009-02-25 20:54:49 +00:00
|
|
|
GetEventHandler()->ProcessEvent( toolCmd );
|
|
|
|
}
|
|
|
|
break;
|
2007-09-22 14:31:20 +00:00
|
|
|
|
2009-02-25 20:54:49 +00:00
|
|
|
case HK_REDO:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( !itemInEdit )
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
2010-01-19 20:43:44 +00:00
|
|
|
toolCmd.SetId( wxID_REDO );
|
2009-02-25 20:54:49 +00:00
|
|
|
GetEventHandler()->ProcessEvent( toolCmd );
|
|
|
|
}
|
2007-09-22 14:31:20 +00:00
|
|
|
break;
|
2007-09-19 15:29:50 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
case HK_REPEAT_LAST:
|
2009-09-25 18:49:04 +00:00
|
|
|
if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0)
|
2010-12-10 19:47:44 +00:00
|
|
|
&& ( m_lastDrawItem->Type() == LIB_PIN_T ) )
|
2009-10-08 13:19:28 +00:00
|
|
|
RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem );
|
2010-10-23 13:49:14 +00:00
|
|
|
break;
|
2009-02-25 20:54:49 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_EDIT:
|
2009-09-29 18:38:21 +00:00
|
|
|
m_drawItem = LocateItemUsingCursor();
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
if( m_drawItem )
|
2009-10-30 19:26:25 +00:00
|
|
|
{
|
2010-02-04 17:46:12 +00:00
|
|
|
switch( m_drawItem->Type() )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_PIN_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
cmd.SetId( ID_LIBEDIT_EDIT_PIN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_ARC_T:
|
|
|
|
case LIB_CIRCLE_T:
|
|
|
|
case LIB_RECTANGLE_T:
|
|
|
|
case LIB_POLYLINE_T:
|
|
|
|
case LIB_TEXT_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_BODY_EDIT_ITEM );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_FIELD_T:
|
2010-10-23 10:09:23 +00:00
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
break;
|
2009-02-25 20:54:49 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_ROTATE:
|
|
|
|
m_drawItem = LocateItemUsingCursor();
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2010-10-23 13:49:14 +00:00
|
|
|
if( m_drawItem )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
|
|
|
switch( m_drawItem->Type() )
|
|
|
|
{
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_PIN_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
cmd.SetId( ID_LIBEDIT_ROTATE_PIN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_TEXT_T:
|
2010-02-04 17:46:12 +00:00
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
2010-02-13 18:38:26 +00:00
|
|
|
|
2010-12-10 19:47:44 +00:00
|
|
|
case LIB_FIELD_T:
|
2010-10-23 10:09:23 +00:00
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2010-07-26 17:06:36 +00:00
|
|
|
case HK_LIBEDIT_CREATE_PIN:
|
|
|
|
{
|
|
|
|
wxCommandEvent evt;
|
|
|
|
evt.SetId( ID_LIBEDIT_PIN_BUTT );
|
|
|
|
Process_Special_Functions( evt );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2010-07-26 17:06:36 +00:00
|
|
|
case HK_DELETE:
|
2009-09-29 18:38:21 +00:00
|
|
|
m_drawItem = LocateItemUsingCursor();
|
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
if( m_drawItem && !m_drawItem->InEditMode() )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
|
|
|
wxCommandEvent evt;
|
2009-02-25 20:54:49 +00:00
|
|
|
evt.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
|
|
|
|
Process_Special_Functions( evt );
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-02-25 20:54:49 +00:00
|
|
|
|
2009-12-06 18:04:41 +00:00
|
|
|
case HK_LIBEDIT_MOVE_GRAPHIC_ITEM:
|
2009-09-29 18:38:21 +00:00
|
|
|
m_drawItem = LocateItemUsingCursor();
|
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
if( m_drawItem && !m_drawItem->InEditMode() )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
|
|
|
wxCommandEvent evt;
|
2009-02-25 20:54:49 +00:00
|
|
|
evt.SetId( ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST );
|
|
|
|
Process_Special_Functions( evt );
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
case HK_DRAG:
|
|
|
|
m_drawItem = LocateItemUsingCursor();
|
|
|
|
|
2010-10-20 20:24:26 +00:00
|
|
|
if( m_drawItem && !m_drawItem->InEditMode() )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
|
|
|
wxCommandEvent evt;
|
|
|
|
evt.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
|
|
|
|
Process_Special_Functions( evt );
|
|
|
|
}
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
2007-08-10 18:05:42 +00:00
|
|
|
}
|