2011-10-19 20:32:21 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-04-16 15:26:51 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2017-08-29 19:16:56 +00:00
|
|
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
|
2017-01-30 22:30:05 +00:00
|
|
|
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-19 20:32:21 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file eeschema/hotkeys.cpp
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <eeschema_id.h>
|
|
|
|
#include <hotkeys.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <sch_edit_frame.h>
|
2015-01-10 09:28:09 +00:00
|
|
|
#include <class_drawpanel.h>
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <general.h>
|
2018-01-30 10:49:51 +00:00
|
|
|
#include <lib_edit_frame.h>
|
2014-10-15 11:40:38 +00:00
|
|
|
#include <viewlib_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_libentry.h>
|
|
|
|
#include <sch_junction.h>
|
|
|
|
#include <sch_line.h>
|
|
|
|
#include <sch_component.h>
|
|
|
|
#include <sch_sheet.h>
|
2009-09-25 18:49:04 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialogs/dialog_schematic_find.h>
|
2010-03-16 18:22:59 +00:00
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
// Remark: the hotkey message info is used as keyword in hotkey config files and
|
|
|
|
// as comments in help windows, therefore translated only when displayed
|
|
|
|
// they are marked _HKI to be extracted by translation tools
|
|
|
|
// See hotkeys_basic.h for more info
|
|
|
|
|
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).
|
2011-09-29 16:49:40 +00:00
|
|
|
* add a new EDA_HOTKEY entry like:
|
2015-03-22 14:04:09 +00:00
|
|
|
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION,
|
2009-02-25 20:54:49 +00:00
|
|
|
* default key value);
|
2015-03-22 14:04:09 +00:00
|
|
|
* _HKI("Command Label") is the name used in hotkey list display, and the
|
2009-02-25 20:54:49 +00:00
|
|
|
* 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
|
2014-10-15 11:40:38 +00:00
|
|
|
* add the HkMyNewEntry pointer in the schematic_Hotkey_List list or the
|
|
|
|
* libEdit_Hotkey_List list or common_Hotkey_List if the same command is
|
2011-09-30 18:15:37 +00:00
|
|
|
* added both in Eeschema and libedit)
|
2009-02-25 20:54:49 +00:00
|
|
|
* 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
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
// Common commands
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Fit on Screen
|
2010-02-16 10:42:57 +00:00
|
|
|
#if !defined( __WXMAC__ )
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkZoomAuto( _HKI( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
|
2010-02-16 10:42:57 +00:00
|
|
|
#else
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0',
|
2011-10-19 23:17:28 +00:00
|
|
|
ID_ZOOM_PAGE );
|
2010-02-16 10:42:57 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
|
2011-10-19 23:17:28 +00:00
|
|
|
ID_POPUP_ZOOM_CENTER );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Refresh Screen
|
2010-02-16 10:42:57 +00:00
|
|
|
#if !defined( __WXMAC__ )
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
|
2010-02-16 10:42:57 +00:00
|
|
|
#else
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R',
|
2011-10-19 23:17:28 +00:00
|
|
|
ID_ZOOM_REDRAW );
|
2010-02-16 10:42:57 +00:00
|
|
|
#endif
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Zoom In
|
2010-01-18 19:33:45 +00:00
|
|
|
#if !defined( __WXMAC__ )
|
2018-01-12 10:40:55 +00:00
|
|
|
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_KEY_ZOOM_IN );
|
2010-01-18 19:33:45 +00:00
|
|
|
#else
|
2018-01-12 10:40:55 +00:00
|
|
|
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_KEY_ZOOM_IN );
|
2010-01-18 19:33:45 +00:00
|
|
|
#endif
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Zoom Out
|
2010-01-18 19:33:45 +00:00
|
|
|
#if !defined( __WXMAC__ )
|
2018-01-12 10:40:55 +00:00
|
|
|
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_KEY_ZOOM_OUT );
|
2010-01-18 19:33:45 +00:00
|
|
|
#else
|
2018-01-12 10:40:55 +00:00
|
|
|
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', ID_KEY_ZOOM_OUT );
|
2010-01-18 19:33:45 +00:00
|
|
|
#endif
|
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
|
|
|
|
static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
|
2015-06-19 15:24:12 +00:00
|
|
|
static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK,
|
2015-06-12 21:31:44 +00:00
|
|
|
ID_POPUP_SCH_LEAVE_SHEET );
|
2013-08-03 05:15:23 +00:00
|
|
|
|
|
|
|
// Undo
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Redo
|
2010-01-18 19:33:45 +00:00
|
|
|
#if !defined( __WXMAC__ )
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
|
2010-01-18 19:33:45 +00:00
|
|
|
#else
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z',
|
2011-10-24 13:56:35 +00:00
|
|
|
(int) wxID_REDO );
|
2010-01-18 19:33:45 +00:00
|
|
|
#endif
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2014-04-03 07:40:55 +00:00
|
|
|
// mouse click command:
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 );
|
|
|
|
static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK, WXK_END, 0 );
|
2014-04-03 07:40:55 +00:00
|
|
|
|
2007-09-06 11:52:26 +00:00
|
|
|
// Schematic editor
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W', ID_WIRE_BUTT );
|
|
|
|
static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B', ID_BUS_BUTT );
|
|
|
|
static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K',
|
2012-10-23 16:37:19 +00:00
|
|
|
ID_POPUP_END_LINE );
|
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L', ID_LABEL_BUTT );
|
|
|
|
static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_HIERLABEL_BUTT );
|
2015-05-31 11:14:57 +00:00
|
|
|
static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_GLABEL_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J', ID_JUNCTION_BUTT );
|
2017-12-24 15:04:02 +00:00
|
|
|
static EDA_HOTKEY HkAddComponent( _HKI( "Add Symbol" ), HK_ADD_NEW_COMPONENT, 'A',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_SCH_PLACE_COMPONENT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_PLACE_POWER_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_NOCONN_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_SHEET_SYMBOL_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_BUSTOBUS_ENTRY_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_WIRETOBUS_ENTRY_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE,
|
2011-10-24 13:56:35 +00:00
|
|
|
'I', ID_LINE_COMMENT_BUTT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
|
2011-10-24 13:56:35 +00:00
|
|
|
ID_TEXT_COMMENT_BUTT );
|
2015-04-26 16:32:16 +00:00
|
|
|
static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y',
|
2011-10-28 20:30:50 +00:00
|
|
|
ID_SCH_MIRROR_Y );
|
2015-04-26 16:32:16 +00:00
|
|
|
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
|
2011-10-28 20:30:50 +00:00
|
|
|
ID_SCH_MIRROR_X );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkOrientNormalComponent( _HKI( "Orient Normal Component" ),
|
2011-10-28 20:30:50 +00:00
|
|
|
HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE );
|
|
|
|
static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E', ID_SCH_EDIT_ITEM );
|
2017-12-24 15:04:02 +00:00
|
|
|
static EDA_HOTKEY HkEditComponentValue( _HKI( "Edit Symbol Value" ),
|
2011-10-24 13:56:35 +00:00
|
|
|
HK_EDIT_COMPONENT_VALUE, 'V',
|
2011-10-27 13:34:28 +00:00
|
|
|
ID_SCH_EDIT_COMPONENT_VALUE );
|
2017-12-24 15:04:02 +00:00
|
|
|
static EDA_HOTKEY HkEditComponentReference( _HKI( "Edit Symbol Reference" ),
|
2012-12-08 17:24:49 +00:00
|
|
|
HK_EDIT_COMPONENT_REFERENCE, 'U',
|
|
|
|
ID_SCH_EDIT_COMPONENT_REFERENCE );
|
2017-12-24 15:04:02 +00:00
|
|
|
static EDA_HOTKEY HkEditComponentFootprint( _HKI( "Edit Symbol Footprint" ),
|
2011-10-24 13:56:35 +00:00
|
|
|
HK_EDIT_COMPONENT_FOOTPRINT, 'F',
|
2011-10-27 13:34:28 +00:00
|
|
|
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
|
2017-12-24 15:04:02 +00:00
|
|
|
static EDA_HOTKEY HkEditComponentWithLibedit( _HKI( "Edit with Symbol Editor" ),
|
2015-03-14 11:50:39 +00:00
|
|
|
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
|
|
|
'E' + GR_KB_CTRL,
|
|
|
|
ID_POPUP_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ),
|
2011-10-24 13:56:35 +00:00
|
|
|
HK_MOVE_COMPONENT_OR_ITEM, 'M',
|
2011-10-28 20:30:50 +00:00
|
|
|
ID_SCH_MOVE_ITEM );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2017-12-24 15:04:02 +00:00
|
|
|
static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate Symbol or Label" ),
|
2017-07-03 15:37:18 +00:00
|
|
|
HK_DUPLICATE_ITEM, 'C',
|
|
|
|
ID_POPUP_SCH_DUPLICATE_ITEM );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G', ID_SCH_DRAG_ITEM );
|
2017-07-03 15:37:18 +00:00
|
|
|
static EDA_HOTKEY HkCopyBlock( _HKI( "Copy Block" ), HK_COPY_BLOCK, 'C' + GR_KB_CTRL, wxID_COPY );
|
2017-07-03 11:46:59 +00:00
|
|
|
static EDA_HOTKEY HkPasteBlock( _HKI( "Paste Block" ), HK_PASTE_BLOCK, 'V' + GR_KB_CTRL, wxID_PASTE );
|
|
|
|
static EDA_HOTKEY HkCutBlock( _HKI( "Cut Block" ), HK_CUT_BLOCK, 'X' + GR_KB_CTRL, wxID_CUT );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkMove2Drag( _HKI( "Move Block -> Drag Block" ),
|
2013-10-15 16:18:30 +00:00
|
|
|
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t', ID_POPUP_DRAG_BLOCK );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
|
|
|
|
static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
|
2015-06-19 15:24:12 +00:00
|
|
|
static EDA_HOTKEY HkDeleteNode( _HKI( "Delete Node" ), HK_DELETE_NODE, WXK_BACK,
|
|
|
|
ID_POPUP_SCH_DELETE_NODE );
|
2010-02-16 10:42:57 +00:00
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkFindItem( _HKI( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL, ID_FIND_ITEMS );
|
|
|
|
static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
|
2011-10-26 20:46:04 +00:00
|
|
|
wxEVT_COMMAND_FIND );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkFindReplace( _HKI( "Find and Replace" ), HK_FIND_REPLACE,
|
2014-04-03 07:40:55 +00:00
|
|
|
'F' + GR_KB_CTRL + GR_KB_ALT, wxID_REPLACE );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkFindNextDrcMarker( _HKI( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
|
2011-10-26 20:46:04 +00:00
|
|
|
WXK_F5 + GR_KB_SHIFT, EVT_COMMAND_FIND_DRC_MARKER );
|
2016-06-08 11:19:53 +00:00
|
|
|
static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, '@', ID_ZOOM_SELECTION );
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
// Special keys for library editor:
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
|
|
|
|
static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
|
|
|
|
static EDA_HOTKEY HkMoveLibItem( _HKI( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2012-09-12 09:53:11 +00:00
|
|
|
// Load/save files
|
2017-11-14 12:23:16 +00:00
|
|
|
static EDA_HOTKEY HkSaveLib( _HKI( "Save Library" ), HK_SAVE_LIB, 'S' + GR_KB_CTRL + GR_KB_ALT, ID_LIBEDIT_SAVE_LIBRARY );
|
2018-01-18 10:23:59 +00:00
|
|
|
static EDA_HOTKEY HkSavePart( _HKI( "Save Symbol" ), HK_SAVE_PART, 'S' + GR_KB_CTRL, ID_LIBEDIT_SAVE_PART );
|
2015-03-22 14:04:09 +00:00
|
|
|
static EDA_HOTKEY HkSaveSchematic( _HKI( "Save Schematic" ), HK_SAVE_SCH, 'S' + GR_KB_CTRL );
|
|
|
|
static EDA_HOTKEY HkLoadSchematic( _HKI( "Load Schematic" ), HK_LOAD_SCH, 'L' + GR_KB_CTRL );
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2015-12-13 16:56:47 +00:00
|
|
|
// Autoplace fields
|
|
|
|
static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
|
|
|
|
ID_AUTOPLACE_FIELDS );
|
|
|
|
|
2017-06-02 09:51:11 +00:00
|
|
|
static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UPDATE_PCB_FROM_SCH,
|
2017-02-01 15:45:21 +00:00
|
|
|
WXK_F8 );
|
2016-01-29 10:24:39 +00:00
|
|
|
|
2016-11-16 12:09:34 +00:00
|
|
|
// Higtlight connection
|
2017-02-01 15:45:21 +00:00
|
|
|
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Connection" ), ID_HOTKEY_HIGHLIGHT,
|
2017-07-03 11:46:59 +00:00
|
|
|
'B' + GR_KB_CTRL );
|
2016-11-16 12:09:34 +00:00
|
|
|
|
2007-09-06 11:52:26 +00:00
|
|
|
// List of common hotkey descriptors
|
2014-10-15 11:40:38 +00:00
|
|
|
static EDA_HOTKEY* common_Hotkey_List[] =
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
|
|
|
&HkHelp,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkZoomIn,
|
|
|
|
&HkZoomOut,
|
|
|
|
&HkZoomRedraw,
|
|
|
|
&HkZoomCenter,
|
|
|
|
&HkZoomAuto,
|
2016-06-08 11:19:53 +00:00
|
|
|
&HkZoomSelection,
|
2007-09-06 11:52:26 +00:00
|
|
|
&HkResetLocalCoord,
|
2013-05-28 09:49:53 +00:00
|
|
|
&HkEdit,
|
|
|
|
&HkDelete,
|
|
|
|
&HkRotate,
|
|
|
|
&HkDrag,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkUndo,
|
|
|
|
&HkRedo,
|
2014-04-03 07:40:55 +00:00
|
|
|
&HkMouseLeftClick,
|
|
|
|
&HkMouseLeftDClick,
|
2007-09-06 11:52:26 +00:00
|
|
|
NULL
|
|
|
|
};
|
2007-08-10 18:05:42 +00:00
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
// List of common hotkey descriptors, for the library vierwer
|
|
|
|
static EDA_HOTKEY* common_basic_Hotkey_List[] =
|
|
|
|
{
|
|
|
|
&HkHelp,
|
|
|
|
&HkZoomIn,
|
|
|
|
&HkZoomOut,
|
|
|
|
&HkZoomRedraw,
|
|
|
|
&HkZoomCenter,
|
|
|
|
&HkZoomAuto,
|
|
|
|
&HkResetLocalCoord,
|
|
|
|
&HkMouseLeftClick,
|
|
|
|
&HkMouseLeftDClick,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2007-08-10 18:05:42 +00:00
|
|
|
// List of hotkey descriptors for schematic
|
2014-10-15 11:40:38 +00:00
|
|
|
static EDA_HOTKEY* schematic_Hotkey_List[] =
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
2012-09-12 09:53:11 +00:00
|
|
|
&HkSaveSchematic,
|
|
|
|
&HkLoadSchematic,
|
2010-02-16 10:42:57 +00:00
|
|
|
&HkFindItem,
|
2010-03-16 18:22:59 +00:00
|
|
|
&HkFindNextItem,
|
|
|
|
&HkFindNextDrcMarker,
|
2014-04-03 07:40:55 +00:00
|
|
|
&HkFindReplace,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkInsert,
|
|
|
|
&HkMove2Drag,
|
2017-07-03 15:37:18 +00:00
|
|
|
&HkCopyBlock,
|
2017-07-03 11:46:59 +00:00
|
|
|
&HkPasteBlock,
|
|
|
|
&HkCutBlock,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkMove,
|
2017-07-03 15:37:18 +00:00
|
|
|
&HkDuplicateItem,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkAddComponent,
|
2010-11-11 17:54:24 +00:00
|
|
|
&HkAddPower,
|
2011-10-28 20:30:50 +00:00
|
|
|
&HkMirrorX,
|
|
|
|
&HkMirrorY,
|
2009-02-25 20:54:49 +00:00
|
|
|
&HkOrientNormalComponent,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkEditComponentValue,
|
2012-12-08 17:24:49 +00:00
|
|
|
&HkEditComponentReference,
|
2010-02-04 17:46:12 +00:00
|
|
|
&HkEditComponentFootprint,
|
2015-03-14 11:50:39 +00:00
|
|
|
&HkEditComponentWithLibedit,
|
2007-08-30 08:15:05 +00:00
|
|
|
&HkBeginWire,
|
2010-11-11 17:54:24 +00:00
|
|
|
&HkBeginBus,
|
2012-10-23 16:37:19 +00:00
|
|
|
&HkEndLineWireBus,
|
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,
|
2016-01-29 10:24:39 +00:00
|
|
|
&HkUpdatePcbFromSch,
|
2015-12-13 16:56:47 +00:00
|
|
|
&HkAutoplaceFields,
|
2016-01-29 14:43:40 +00:00
|
|
|
&HkLeaveSheet,
|
2015-06-19 15:24:12 +00:00
|
|
|
&HkDeleteNode,
|
2016-11-16 12:09:34 +00:00
|
|
|
&HkHighlightConnection,
|
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
|
2014-10-15 11:40:38 +00:00
|
|
|
static EDA_HOTKEY* libEdit_Hotkey_List[] =
|
2007-08-10 18:05:42 +00:00
|
|
|
{
|
2012-09-12 09:53:11 +00:00
|
|
|
&HkSaveLib,
|
2017-11-14 12:23:16 +00:00
|
|
|
&HkSavePart,
|
2010-07-26 17:06:36 +00:00
|
|
|
&HkCreatePin,
|
2007-08-30 08:15:05 +00:00
|
|
|
&HkInsertPin,
|
2010-10-23 10:09:23 +00:00
|
|
|
&HkMoveLibItem,
|
2016-04-22 14:15:16 +00:00
|
|
|
&HkMirrorX,
|
|
|
|
&HkMirrorY,
|
2017-11-20 13:11:50 +00:00
|
|
|
&HkCopyBlock,
|
|
|
|
&HkPasteBlock,
|
|
|
|
&HkCutBlock,
|
2007-08-30 08:15:05 +00:00
|
|
|
NULL
|
2007-08-10 18:05:42 +00:00
|
|
|
};
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
// List of hotkey descriptors for library viewer (currently empty
|
|
|
|
static EDA_HOTKEY* viewlib_Hotkey_List[] =
|
|
|
|
{
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2015-04-16 15:26:51 +00:00
|
|
|
// Keyword Identifiers (tags) in key code configuration file (section names)
|
|
|
|
// (.m_SectionTag member of a EDA_HOTKEY_CONFIG)
|
|
|
|
static wxString schematicSectionTag( wxT( "[eeschema]" ) );
|
|
|
|
static wxString libEditSectionTag( wxT( "[libedit]" ) );
|
|
|
|
|
|
|
|
// Titles for hotkey editor and hotkey display
|
|
|
|
static wxString commonSectionTitle( _HKI( "Common" ) );
|
|
|
|
static wxString schematicSectionTitle( _HKI( "Schematic Editor" ) );
|
|
|
|
static wxString libEditSectionTitle( _HKI( "Library Editor" ) );
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// list of sections and corresponding hotkey list for Eeschema (used to create
|
2009-02-25 20:54:49 +00:00
|
|
|
// an hotkey config file)
|
2014-10-15 11:40:38 +00:00
|
|
|
struct EDA_HOTKEY_CONFIG g_Eeschema_Hokeys_Descr[] =
|
2007-09-10 04:51:01 +00:00
|
|
|
{
|
2015-04-16 15:26:51 +00:00
|
|
|
{ &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
|
|
|
|
{ &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
|
2015-04-19 11:07:31 +00:00
|
|
|
{ &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
|
|
|
|
{ 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)
|
2014-10-15 11:40:38 +00:00
|
|
|
struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[] =
|
2007-09-10 04:51:01 +00:00
|
|
|
{
|
2015-04-19 11:07:31 +00:00
|
|
|
{ &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
|
2015-11-04 08:48:34 +00:00
|
|
|
{ &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
|
2015-04-16 15:26:51 +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)
|
2014-10-15 11:40:38 +00:00
|
|
|
struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[] =
|
2007-09-10 04:51:01 +00:00
|
|
|
{
|
2015-04-19 11:07:31 +00:00
|
|
|
{ &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
|
|
|
|
{ &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
|
2015-04-16 15:26:51 +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)
|
2014-10-15 11:40:38 +00:00
|
|
|
struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[] =
|
2009-09-27 14:09:26 +00:00
|
|
|
{
|
2015-04-16 15:26:51 +00:00
|
|
|
{ &g_CommonSectionTag, common_basic_Hotkey_List, &commonSectionTitle },
|
2014-10-16 01:17:46 +00:00
|
|
|
{ NULL, NULL, NULL }
|
2009-09-27 14:09:26 +00:00
|
|
|
};
|
|
|
|
|
2015-05-05 18:39:42 +00:00
|
|
|
|
|
|
|
EDA_HOTKEY* SCH_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
|
|
|
|
{
|
|
|
|
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
|
|
|
|
|
|
|
if( HK_Descr == NULL )
|
|
|
|
HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
|
|
|
|
|
|
|
|
return HK_Descr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2014-08-29 20:23:40 +00:00
|
|
|
bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
if( aHotKey == 0 )
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
2009-02-25 20:54:49 +00:00
|
|
|
|
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2011-03-25 19:16:05 +00:00
|
|
|
|
2010-10-30 10:03:41 +00:00
|
|
|
// itemInEdit == false means no item currently edited. We can ask for editing a new item
|
2011-03-25 19:16:05 +00:00
|
|
|
bool itemInEdit = screen->GetCurItem() && screen->GetCurItem()->GetFlags();
|
|
|
|
|
2012-12-28 15:56:41 +00:00
|
|
|
// blocInProgress == false means no block in progress.
|
|
|
|
// Because a drag command uses a drag block, false means also no drag in progress
|
|
|
|
// If false, we can ask for editing a new item
|
|
|
|
bool blocInProgress = screen->m_BlockLocate.GetState() != STATE_NO_BLOCK;
|
|
|
|
|
2010-10-30 10:03:41 +00:00
|
|
|
// 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
|
2012-12-28 15:56:41 +00:00
|
|
|
bool notBusy = (!itemInEdit) && (!blocInProgress);
|
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 */
|
2011-02-02 19:01:21 +00:00
|
|
|
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
|
|
|
|
aHotKey += 'A' - 'a';
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
// Search command from key :
|
2014-10-15 11:40:38 +00:00
|
|
|
EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
if( hotKey == NULL )
|
2014-10-15 11:40:38 +00:00
|
|
|
hotKey = GetDescriptorFromHotkey( aHotKey, schematic_Hotkey_List );
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
if( hotKey == NULL )
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
switch( hotKey->m_Idcommand )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case HK_NOT_FOUND:
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
case HK_HELP: // Display Current hotkey list
|
2014-10-15 11:40:38 +00:00
|
|
|
DisplayHotkeyList( this, g_Schematic_Hokeys_Descr );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
|
|
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2016-11-16 12:09:34 +00:00
|
|
|
case ID_HOTKEY_HIGHLIGHT:
|
|
|
|
if( notBusy )
|
|
|
|
HighlightConnectionAtPosition( GetCrossHairPosition() );
|
|
|
|
break;
|
|
|
|
|
2014-04-03 07:40:55 +00:00
|
|
|
case HK_LEFT_CLICK:
|
|
|
|
case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
|
2015-01-10 09:28:09 +00:00
|
|
|
if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
|
|
|
|
{
|
|
|
|
GetCanvas()->SetAutoPanRequest( false );
|
|
|
|
HandleBlockPlace( aDC );
|
|
|
|
}
|
|
|
|
else if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
|
|
|
|
{
|
|
|
|
OnLeftClick( aDC, aPosition );
|
|
|
|
|
|
|
|
if( hotKey->m_Idcommand == HK_LEFT_DCLICK )
|
|
|
|
OnLeftDClick( aDC, aPosition );
|
|
|
|
}
|
2014-04-03 07:40:55 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
case HK_ZOOM_IN:
|
|
|
|
case HK_ZOOM_OUT:
|
|
|
|
case HK_ZOOM_REDRAW:
|
|
|
|
case HK_ZOOM_CENTER:
|
2009-09-27 14:09:26 +00:00
|
|
|
case HK_ZOOM_AUTO:
|
2016-06-08 11:19:53 +00:00
|
|
|
case HK_ZOOM_SELECTION:
|
2013-10-15 16:18:30 +00:00
|
|
|
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
|
2017-07-03 11:46:59 +00:00
|
|
|
case HK_PASTE_BLOCK:
|
2017-07-03 15:37:18 +00:00
|
|
|
case HK_COPY_BLOCK: // Copy block to paste buffer.
|
2017-07-03 11:46:59 +00:00
|
|
|
case HK_CUT_BLOCK:
|
2011-10-19 23:17:28 +00:00
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
2009-09-27 14:09:26 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
case HK_DELETE:
|
2017-08-29 19:16:56 +00:00
|
|
|
if( blocInProgress )
|
|
|
|
{
|
|
|
|
cmd.SetId( ID_POPUP_DELETE_BLOCK );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
}
|
|
|
|
else if( notBusy )
|
2011-03-10 19:36:30 +00:00
|
|
|
DeleteItemAtCrossHair( aDC );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_REPEAT_LAST:
|
2013-08-06 23:23:50 +00:00
|
|
|
if( notBusy )
|
|
|
|
RepeatDrawItem( aDC );
|
2012-10-23 16:37:19 +00:00
|
|
|
break;
|
2011-10-27 13:34:28 +00:00
|
|
|
|
2012-10-23 16:37:19 +00:00
|
|
|
case HK_END_CURR_LINEWIREBUS:
|
|
|
|
// this key terminates a new line/bus/wire in progress
|
|
|
|
if( aItem && aItem->IsNew() &&
|
|
|
|
aItem->Type() == SCH_LINE_T )
|
|
|
|
{
|
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2016-09-28 00:40:59 +00:00
|
|
|
case HK_UNDO: // Hot keys that map to command IDs that cannot be called
|
|
|
|
case HK_REDO: // while busy performing another command.
|
2010-02-16 10:42:57 +00:00
|
|
|
case HK_FIND_ITEM:
|
2014-04-03 07:40:55 +00:00
|
|
|
case HK_FIND_REPLACE:
|
2016-09-28 00:40:59 +00:00
|
|
|
case HK_DELETE_NODE:
|
|
|
|
case HK_LEAVE_SHEET:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2010-02-16 10:42:57 +00:00
|
|
|
{
|
2011-10-27 13:34:28 +00:00
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2010-02-16 10:42:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2010-03-16 18:22:59 +00:00
|
|
|
case HK_FIND_NEXT_ITEM:
|
|
|
|
case HK_FIND_NEXT_DRC_MARKER:
|
2010-10-30 10:03:41 +00:00
|
|
|
if( notBusy )
|
2009-02-25 20:54:49 +00:00
|
|
|
{
|
2011-10-26 20:46:04 +00:00
|
|
|
wxFindDialogEvent event( hotKey->m_IdMenuEvent, GetId() );
|
2010-03-16 18:22:59 +00:00
|
|
|
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
|
2011-10-24 13:56:35 +00:00
|
|
|
case HK_ADD_NEW_POWER: // Add power component
|
2010-07-15 14:18:11 +00:00
|
|
|
case HK_ADD_LABEL:
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_ADD_HLABEL:
|
|
|
|
case HK_ADD_GLABEL:
|
2010-10-30 10:03:41 +00:00
|
|
|
case HK_ADD_JUNCTION:
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_ADD_WIRE_ENTRY:
|
|
|
|
case HK_ADD_BUS_ENTRY:
|
|
|
|
case HK_ADD_HIER_SHEET:
|
|
|
|
case HK_ADD_GRAPHIC_TEXT:
|
|
|
|
case HK_ADD_GRAPHIC_POLYLINE:
|
2011-10-24 13:56:35 +00:00
|
|
|
case HK_ADD_NOCONN_FLAG: // Add a no connected flag
|
2010-11-11 17:54:24 +00:00
|
|
|
case HK_BEGIN_BUS:
|
2011-10-24 13:56:35 +00:00
|
|
|
case HK_BEGIN_WIRE:
|
2010-11-11 17:54:24 +00:00
|
|
|
if( notBusy )
|
|
|
|
{
|
2011-10-26 20:46:04 +00:00
|
|
|
EDA_HOTKEY_CLIENT_DATA data( aPosition );
|
2011-10-24 13:56:35 +00:00
|
|
|
cmd.SetInt( aHotKey );
|
2011-10-26 20:46:04 +00:00
|
|
|
cmd.SetClientObject( &data );
|
2011-10-24 13:56:35 +00:00
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
2011-10-26 20:46:04 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2010-11-11 17:54:24 +00:00
|
|
|
}
|
2011-10-24 13:56:35 +00:00
|
|
|
else if( aItem && aItem->IsNew() )
|
2010-11-11 17:54:24 +00:00
|
|
|
{
|
2011-10-24 13:56:35 +00:00
|
|
|
// If the item is a bus or a wire, a begin command is not possible.
|
|
|
|
if( (GetToolId() == ID_BUS_BUTT) && (aItem->Type() == SCH_LINE_T) )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
SCH_LINE* segment = (SCH_LINE*) aItem;
|
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
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
// Bus in progress:
|
|
|
|
OnLeftClick( aDC, aPosition );
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
2011-10-24 13:56:35 +00:00
|
|
|
else if( (GetToolId() == ID_WIRE_BUTT ) && (aItem->Type() == SCH_LINE_T) )
|
2010-11-11 17:54:24 +00:00
|
|
|
{
|
2011-02-02 19:01:21 +00:00
|
|
|
SCH_LINE* segment = (SCH_LINE*) aItem;
|
|
|
|
|
2010-11-11 17:54:24 +00:00
|
|
|
if( segment->GetLayer() != LAYER_WIRE )
|
|
|
|
break;
|
2011-02-02 19:01:21 +00:00
|
|
|
|
|
|
|
// Wire in progress:
|
|
|
|
OnLeftClick( aDC, aPosition );
|
2010-11-11 17:54:24 +00:00
|
|
|
}
|
2009-02-25 20:54:49 +00:00
|
|
|
}
|
2010-07-26 17:06:36 +00:00
|
|
|
break;
|
|
|
|
|
2017-07-03 15:37:18 +00:00
|
|
|
case HK_DUPLICATE_ITEM: // 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
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
if( aItem == NULL )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2017-02-11 18:29:22 +00:00
|
|
|
aItem = LocateAndShowItem( aPosition, SCH_COLLECTOR::CopyableItems );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
if( aItem == NULL )
|
2009-10-16 10:44:44 +00:00
|
|
|
break;
|
2011-03-25 19:16:05 +00:00
|
|
|
}
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
2011-03-25 19:16:05 +00:00
|
|
|
wxPostEvent( this, cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_DRAG: // Start drag
|
2011-10-19 20:32:21 +00:00
|
|
|
case HK_MOVE_COMPONENT_OR_ITEM: // Start move schematic item.
|
2012-12-28 15:56:41 +00:00
|
|
|
if( ! notBusy )
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Fall through
|
|
|
|
case HK_EDIT:
|
|
|
|
// Edit schematic item. Do not allow sheet edition when mowing
|
|
|
|
// Because a sheet edition can be complex.
|
|
|
|
if( itemInEdit && screen->GetCurItem()->Type() == SCH_SHEET_T )
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Fall through
|
2013-01-21 20:16:04 +00:00
|
|
|
case HK_EDIT_COMPONENT_VALUE: // Edit component value field.
|
|
|
|
case HK_EDIT_COMPONENT_REFERENCE: // Edit component value reference.
|
|
|
|
case HK_EDIT_COMPONENT_FOOTPRINT: // Edit component footprint field.
|
2015-04-26 16:32:16 +00:00
|
|
|
case HK_MIRROR_Y: // Mirror Y
|
|
|
|
case HK_MIRROR_X: // Mirror X
|
2012-12-28 15:56:41 +00:00
|
|
|
case HK_ORIENT_NORMAL_COMPONENT: // Orient 0, no mirror (Component)
|
|
|
|
case HK_ROTATE: // Rotate schematic item.
|
2015-03-14 11:50:39 +00:00
|
|
|
case HK_EDIT_COMPONENT_WITH_LIBEDIT: // Call Libedit and load the current component
|
2015-12-13 16:56:47 +00:00
|
|
|
case HK_AUTOPLACE_FIELDS: // Autoplace all fields around component
|
2012-10-08 19:34:04 +00:00
|
|
|
{
|
2012-10-31 20:27:31 +00:00
|
|
|
// force a new item search on hot keys at current position,
|
|
|
|
// if there is no currently edited item,
|
|
|
|
// to avoid using a previously selected item
|
|
|
|
if( ! itemInEdit )
|
|
|
|
screen->SetCurItem( NULL );
|
2012-10-08 19:34:04 +00:00
|
|
|
EDA_HOTKEY_CLIENT_DATA data( aPosition );
|
|
|
|
cmd.SetInt( hotKey->m_Idcommand );
|
|
|
|
cmd.SetClientObject( &data );
|
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
}
|
2009-10-16 10:44:44 +00:00
|
|
|
break;
|
2011-10-26 20:46:04 +00:00
|
|
|
}
|
2014-08-29 20:23:40 +00:00
|
|
|
|
|
|
|
// Hot key handled.
|
|
|
|
return true;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-08-10 18:05:42 +00:00
|
|
|
|
|
|
|
|
2015-05-05 18:39:42 +00:00
|
|
|
EDA_HOTKEY* LIB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
|
|
|
|
{
|
|
|
|
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
|
|
|
|
|
|
|
if( HK_Descr == NULL )
|
|
|
|
HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
|
|
|
|
|
|
|
|
return HK_Descr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-08-29 20:23:40 +00:00
|
|
|
bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
|
2007-08-10 18:05:42 +00:00
|
|
|
{
|
2011-03-25 19:16:05 +00:00
|
|
|
if( aHotKey == 0 )
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2011-03-25 19:16:05 +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
|
|
|
/* Convert lower to upper case (the usual toupper function has problem
|
|
|
|
* with non ascii codes like function keys */
|
2011-02-02 19:01:21 +00:00
|
|
|
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
|
|
|
|
aHotKey += 'A' - 'a';
|
|
|
|
|
2014-10-15 11:40:38 +00:00
|
|
|
EDA_HOTKEY* hotKey = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
if( hotKey == NULL )
|
2014-10-15 11:40:38 +00:00
|
|
|
hotKey = GetDescriptorFromHotkey( aHotKey, libEdit_Hotkey_List );
|
2011-02-02 19:01:21 +00:00
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
if( hotKey == NULL )
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2007-08-20 10:55:09 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
// itemInEdit == false means no item currently edited. We can ask for editing a new item
|
|
|
|
bool itemInEdit = IsEditingDrawItem();
|
2017-02-01 15:45:21 +00:00
|
|
|
|
|
|
|
bool blocInProgress = GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK;
|
|
|
|
|
2011-10-19 23:17:28 +00:00
|
|
|
switch( hotKey->m_Idcommand )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
|
|
|
default:
|
|
|
|
case HK_NOT_FOUND:
|
2014-08-29 20:23:40 +00:00
|
|
|
return false;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
case HK_HELP: // Display Current hotkey list
|
2014-10-15 11:40:38 +00:00
|
|
|
DisplayHotkeyList( this, g_Libedit_Hokeys_Descr );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
|
|
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
|
2014-04-03 07:40:55 +00:00
|
|
|
case HK_LEFT_CLICK:
|
|
|
|
OnLeftClick( aDC, aPosition );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
|
|
|
|
OnLeftClick( aDC, aPosition );
|
|
|
|
OnLeftDClick( aDC, aPosition );
|
|
|
|
break;
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
case HK_ZOOM_IN:
|
|
|
|
case HK_ZOOM_OUT:
|
|
|
|
case HK_ZOOM_REDRAW:
|
|
|
|
case HK_ZOOM_CENTER:
|
2009-09-27 14:09:26 +00:00
|
|
|
case HK_ZOOM_AUTO:
|
2017-11-20 13:11:50 +00:00
|
|
|
case HK_PASTE_BLOCK:
|
|
|
|
case HK_COPY_BLOCK:
|
|
|
|
case HK_CUT_BLOCK:
|
2011-10-19 23:17:28 +00:00
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
2009-09-27 14:09:26 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
2007-09-22 14:31:20 +00:00
|
|
|
case HK_UNDO:
|
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
|
|
|
{
|
2013-05-28 09:49:53 +00:00
|
|
|
cmd.SetId( hotKey->m_IdMenuEvent );
|
2011-04-27 19:44:32 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
2009-02-25 20:54:49 +00:00
|
|
|
}
|
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:
|
2013-01-02 08:34:46 +00:00
|
|
|
if( ! itemInEdit )
|
|
|
|
{
|
|
|
|
if( m_lastDrawItem && !m_lastDrawItem->InEditMode() &&
|
|
|
|
( m_lastDrawItem->Type() == LIB_PIN_T ) )
|
|
|
|
RepeatPinItem( aDC, (LIB_PIN*) m_lastDrawItem );
|
|
|
|
}
|
|
|
|
break;
|
2009-02-25 20:54:49 +00:00
|
|
|
|
2010-02-04 17:46:12 +00:00
|
|
|
case HK_EDIT:
|
2017-12-18 05:21:00 +00:00
|
|
|
if ( !itemInEdit )
|
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
if( GetDrawItem() )
|
2009-10-30 19:26:25 +00:00
|
|
|
{
|
2017-12-18 05:21:00 +00:00
|
|
|
switch( GetDrawItem()->Type() )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
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:
|
2017-02-01 15:45:21 +00:00
|
|
|
if( blocInProgress )
|
|
|
|
{
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
|
|
|
HandleBlockPlace( aDC );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-06 07:17:34 +00:00
|
|
|
if ( !itemInEdit )
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
if( GetDrawItem() )
|
2017-02-01 15:45:21 +00:00
|
|
|
{
|
|
|
|
cmd.SetId( ID_LIBEDIT_ROTATE_ITEM );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-01-17 20:25:10 +00:00
|
|
|
|
2010-07-26 17:06:36 +00:00
|
|
|
case HK_LIBEDIT_CREATE_PIN:
|
2013-01-02 08:34:46 +00:00
|
|
|
if( ! itemInEdit )
|
|
|
|
{
|
|
|
|
SetToolID( ID_LIBEDIT_PIN_BUTT, wxCURSOR_PENCIL, _( "Add Pin" ) );
|
|
|
|
OnLeftClick( aDC, aPosition );
|
|
|
|
}
|
2010-07-26 17:06:36 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_DELETE:
|
2017-12-18 05:21:00 +00:00
|
|
|
if ( !itemInEdit )
|
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2009-09-29 18:38:21 +00:00
|
|
|
|
2018-01-06 09:36:56 +00:00
|
|
|
if( GetDrawItem() )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2011-04-27 19:44:32 +00:00
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
|
|
|
|
Process_Special_Functions( cmd );
|
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:
|
2011-02-28 13:53:49 +00:00
|
|
|
if( !itemInEdit )
|
2008-03-20 01:50:21 +00:00
|
|
|
{
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2011-02-28 13:53:49 +00:00
|
|
|
|
2017-12-18 05:21:00 +00:00
|
|
|
if( GetDrawItem() )
|
2011-02-28 13:53:49 +00:00
|
|
|
{
|
2011-04-27 19:44:32 +00:00
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST );
|
|
|
|
Process_Special_Functions( cmd );
|
2011-02-28 13:53:49 +00:00
|
|
|
}
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-02-04 17:46:12 +00:00
|
|
|
|
|
|
|
case HK_DRAG:
|
2013-01-02 08:34:46 +00:00
|
|
|
if( !itemInEdit )
|
2010-02-04 17:46:12 +00:00
|
|
|
{
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2013-01-02 08:34:46 +00:00
|
|
|
|
2018-01-06 09:36:56 +00:00
|
|
|
if( GetDrawItem() )
|
2013-01-02 08:34:46 +00:00
|
|
|
{
|
|
|
|
cmd.SetId( ID_POPUP_LIBEDIT_MODIFY_ITEM );
|
|
|
|
Process_Special_Functions( cmd );
|
|
|
|
}
|
2010-02-04 17:46:12 +00:00
|
|
|
}
|
|
|
|
break;
|
2017-02-01 15:45:21 +00:00
|
|
|
|
2016-04-22 14:15:16 +00:00
|
|
|
case HK_MIRROR_Y: // Mirror Y
|
2017-02-06 07:17:34 +00:00
|
|
|
if( !itemInEdit )
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2017-02-06 07:17:34 +00:00
|
|
|
|
2016-04-22 14:15:16 +00:00
|
|
|
cmd.SetId( ID_LIBEDIT_MIRROR_Y );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_MIRROR_X: // Mirror X
|
2017-02-06 07:17:34 +00:00
|
|
|
if( !itemInEdit )
|
2017-12-18 05:21:00 +00:00
|
|
|
SetDrawItem( LocateItemUsingCursor( aPosition ) );
|
2017-02-06 07:17:34 +00:00
|
|
|
|
2016-04-22 14:15:16 +00:00
|
|
|
cmd.SetId( ID_LIBEDIT_MIRROR_X );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
2008-03-20 01:50:21 +00:00
|
|
|
}
|
2014-08-29 20:23:40 +00:00
|
|
|
|
|
|
|
// Hot key handled.
|
|
|
|
return true;
|
2007-08-10 18:05:42 +00:00
|
|
|
}
|
2014-10-15 11:40:38 +00:00
|
|
|
|
2015-05-05 18:39:42 +00:00
|
|
|
|
|
|
|
EDA_HOTKEY* LIB_VIEW_FRAME::GetHotKeyDescription( int aCommand ) const
|
|
|
|
{
|
|
|
|
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
|
|
|
|
|
|
|
|
if( HK_Descr == NULL )
|
|
|
|
HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
|
|
|
|
|
|
|
|
return HK_Descr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-02-01 15:45:21 +00:00
|
|
|
bool LIB_VIEW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem )
|
2014-10-15 11:40:38 +00:00
|
|
|
{
|
|
|
|
if( aHotKey == 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
|
|
|
cmd.SetEventObject( this );
|
|
|
|
|
|
|
|
/* Convert lower to upper case (the usual toupper function has problem with non ascii
|
|
|
|
* codes like function keys */
|
|
|
|
if( (aHotKey >= 'a') && (aHotKey <= 'z') )
|
|
|
|
aHotKey += 'A' - 'a';
|
|
|
|
|
|
|
|
EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_basic_Hotkey_List );
|
|
|
|
|
|
|
|
if( HK_Descr == NULL )
|
|
|
|
HK_Descr = GetDescriptorFromHotkey( aHotKey, viewlib_Hotkey_List );
|
|
|
|
|
|
|
|
if( HK_Descr == NULL )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
switch( HK_Descr->m_Idcommand )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case HK_NOT_FOUND:
|
|
|
|
return false;
|
|
|
|
|
|
|
|
case HK_HELP: // Display Current hotkey list
|
|
|
|
DisplayHotkeyList( this, g_Viewlib_Hokeys_Descr );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
|
|
|
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_LEFT_CLICK:
|
|
|
|
OnLeftClick( aDC, aPosition );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_LEFT_DCLICK: // Simulate a double left click: generate 2 events
|
|
|
|
OnLeftClick( aDC, aPosition );
|
|
|
|
OnLeftDClick( aDC, aPosition );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_IN:
|
2018-01-12 10:40:55 +00:00
|
|
|
cmd.SetId( ID_KEY_ZOOM_IN );
|
2014-10-15 11:40:38 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_OUT:
|
2018-01-12 10:40:55 +00:00
|
|
|
cmd.SetId( ID_KEY_ZOOM_OUT );
|
2014-10-15 11:40:38 +00:00
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_REDRAW:
|
|
|
|
cmd.SetId( ID_ZOOM_REDRAW );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_CENTER:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HK_ZOOM_AUTO:
|
|
|
|
cmd.SetId( ID_ZOOM_PAGE );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|