Fix colliding hotkeys issue.
All grid commands need to be shared now as they're implemented by a common tool.
This commit is contained in:
parent
f2474d074b
commit
b526461a8e
|
@ -79,12 +79,10 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction )
|
||||||
if( hotkey )
|
if( hotkey )
|
||||||
{
|
{
|
||||||
std::list<TOOL_ACTION*>& actions = m_actionHotKeys[hotkey];
|
std::list<TOOL_ACTION*>& actions = m_actionHotKeys[hotkey];
|
||||||
std::list<TOOL_ACTION*>::iterator action = std::find( actions.begin(), actions.end(), aAction );
|
auto action = std::find( actions.begin(), actions.end(), aAction );
|
||||||
|
|
||||||
if( action != actions.end() )
|
if( action != actions.end() )
|
||||||
actions.erase( action );
|
actions.erase( action );
|
||||||
else
|
|
||||||
wxASSERT( false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +206,13 @@ void ACTION_MANAGER::UpdateHotKeys()
|
||||||
// are loaded after
|
// are loaded after
|
||||||
if( action->GetScope() == AS_GLOBAL && m_actionHotKeys.count( hotkey ) )
|
if( action->GetScope() == AS_GLOBAL && m_actionHotKeys.count( hotkey ) )
|
||||||
{
|
{
|
||||||
|
// Users are free to define colliding hotkeys, but we want to know if
|
||||||
|
// our default set has any collisions.
|
||||||
|
wxFAIL_MSG( wxString::Format( "Duplicate hotkey definitions for %s: %s and %s",
|
||||||
|
KeyNameFromKeyCode( hotkey ),
|
||||||
|
actionName.first,
|
||||||
|
m_actionHotKeys[hotkey].front()->GetName() ) );
|
||||||
|
|
||||||
for( auto it = m_actionHotKeys[hotkey].begin();
|
for( auto it = m_actionHotKeys[hotkey].begin();
|
||||||
it != m_actionHotKeys[hotkey].end(); )
|
it != m_actionHotKeys[hotkey].end(); )
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,8 +155,6 @@ static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y',
|
||||||
ID_SCH_MIRROR_Y );
|
ID_SCH_MIRROR_Y );
|
||||||
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
|
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
|
||||||
ID_SCH_MIRROR_X );
|
ID_SCH_MIRROR_X );
|
||||||
static EDA_HOTKEY HkOrientNormalComponent( _HKI( "Orient Normal Component" ),
|
|
||||||
HK_ORIENT_NORMAL_COMPONENT, 'N', ID_SCH_ORIENT_NORMAL );
|
|
||||||
static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R', ID_SCH_ROTATE_CLOCKWISE );
|
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 );
|
static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E', ID_SCH_EDIT_ITEM );
|
||||||
static EDA_HOTKEY HkEditComponentValue( _HKI( "Edit Symbol Value" ), HK_EDIT_COMPONENT_VALUE, 'V',
|
static EDA_HOTKEY HkEditComponentValue( _HKI( "Edit Symbol Value" ), HK_EDIT_COMPONENT_VALUE, 'V',
|
||||||
|
@ -306,7 +304,6 @@ static EDA_HOTKEY* schematic_Hotkey_List[] =
|
||||||
&HkAddPower,
|
&HkAddPower,
|
||||||
&HkMirrorX,
|
&HkMirrorX,
|
||||||
&HkMirrorY,
|
&HkMirrorY,
|
||||||
&HkOrientNormalComponent,
|
|
||||||
&HkEditComponentValue,
|
&HkEditComponentValue,
|
||||||
&HkEditComponentReference,
|
&HkEditComponentReference,
|
||||||
&HkEditComponentFootprint,
|
&HkEditComponentFootprint,
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
#include <hotkeys_basic.h>
|
#include <hotkeys_basic.h>
|
||||||
|
|
||||||
// List of hot keys id.
|
// List of hot keys id.
|
||||||
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
|
// see also enum common_hotkey_id_command in hotkeys_basic.h
|
||||||
// for shared hotkeys id
|
// for shared hotkeys id
|
||||||
enum hotkey_id_commnand {
|
enum hotkey_id_command {
|
||||||
HK_FIND_NEXT_ITEM = HK_COMMON_END,
|
HK_FIND_NEXT_ITEM = HK_COMMON_END,
|
||||||
HK_FIND_NEXT_DRC_MARKER,
|
HK_FIND_NEXT_DRC_MARKER,
|
||||||
HK_FIND_ITEM,
|
HK_FIND_ITEM,
|
||||||
|
@ -54,7 +54,6 @@ enum hotkey_id_commnand {
|
||||||
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
HK_EDIT_COMPONENT_WITH_LIBEDIT,
|
||||||
HK_MIRROR_X,
|
HK_MIRROR_X,
|
||||||
HK_MIRROR_Y,
|
HK_MIRROR_Y,
|
||||||
HK_ORIENT_NORMAL_COMPONENT,
|
|
||||||
HK_MOVE_COMPONENT_OR_ITEM,
|
HK_MOVE_COMPONENT_OR_ITEM,
|
||||||
HK_DUPLICATE,
|
HK_DUPLICATE,
|
||||||
HK_DRAG,
|
HK_DRAG,
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* How to add a new hotkey:
|
/* How to add a new hotkey:
|
||||||
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
|
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION.
|
||||||
* add a new EDA_HOTKEY entry like:
|
* add a new EDA_HOTKEY entry like:
|
||||||
* static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
|
* static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
|
||||||
* "Command Label" is the name used in hotkey list display, and the identifier in the
|
* "Command Label" is the name used in hotkey list display, and the identifier in the
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
#include <hotkeys_basic.h>
|
#include <hotkeys_basic.h>
|
||||||
|
|
||||||
// List of hot keys id.
|
// List of hot keys id.
|
||||||
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
|
// see also enum common_hotkey_id_command in hotkeys_basic.h
|
||||||
// for shared hotkeys id
|
// for shared hotkeys id
|
||||||
enum hotkey_id_commnand {
|
enum hotkey_id_command {
|
||||||
HK_SWITCH_UNITS = HK_COMMON_END,
|
HK_SWITCH_UNITS = HK_COMMON_END,
|
||||||
HK_GBR_LINES_DISPLAY_MODE,
|
HK_GBR_LINES_DISPLAY_MODE,
|
||||||
HK_GBR_FLASHED_DISPLAY_MODE,
|
HK_GBR_FLASHED_DISPLAY_MODE,
|
||||||
|
|
|
@ -64,7 +64,7 @@ private:
|
||||||
public:
|
public:
|
||||||
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
||||||
wxString m_InfoMsg; // info message.
|
wxString m_InfoMsg; // info message.
|
||||||
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
|
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_command list)
|
||||||
int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h)
|
int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -258,7 +258,7 @@ void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescLis
|
||||||
|
|
||||||
// common hotkeys event id
|
// common hotkeys event id
|
||||||
// these hotkey ID are used in many files, so they are define here only once.
|
// these hotkey ID are used in many files, so they are define here only once.
|
||||||
enum common_hotkey_id_commnand {
|
enum common_hotkey_id_command {
|
||||||
HK_NOT_FOUND = 0,
|
HK_NOT_FOUND = 0,
|
||||||
HK_NEW,
|
HK_NEW,
|
||||||
HK_OPEN,
|
HK_OPEN,
|
||||||
|
@ -273,6 +273,10 @@ enum common_hotkey_id_commnand {
|
||||||
HK_RESET_LOCAL_COORD,
|
HK_RESET_LOCAL_COORD,
|
||||||
HK_SET_GRID_ORIGIN,
|
HK_SET_GRID_ORIGIN,
|
||||||
HK_RESET_GRID_ORIGIN,
|
HK_RESET_GRID_ORIGIN,
|
||||||
|
HK_SWITCH_GRID_TO_FASTGRID1,
|
||||||
|
HK_SWITCH_GRID_TO_FASTGRID2,
|
||||||
|
HK_SWITCH_GRID_TO_NEXT,
|
||||||
|
HK_SWITCH_GRID_TO_PREVIOUS,
|
||||||
HK_HELP,
|
HK_HELP,
|
||||||
HK_ZOOM_IN,
|
HK_ZOOM_IN,
|
||||||
HK_ZOOM_OUT,
|
HK_ZOOM_OUT,
|
||||||
|
|
|
@ -110,7 +110,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
enum hotkey_id_commnand
|
enum hotkey_id_command
|
||||||
{
|
{
|
||||||
HK_RUN_EESCHEMA = HK_COMMON_END,
|
HK_RUN_EESCHEMA = HK_COMMON_END,
|
||||||
HK_NEW_PRJ_TEMPLATE,
|
HK_NEW_PRJ_TEMPLATE,
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* How to add a new hotkey:
|
/* How to add a new hotkey:
|
||||||
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
|
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION.
|
||||||
* add a new EDA_HOTKEY entry like:
|
* add a new EDA_HOTKEY entry like:
|
||||||
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION, default key value);
|
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION, default key value);
|
||||||
* 'Command Label' is the name used in hotkey list display, and the identifier in the
|
* 'Command Label' is the name used in hotkey list display, and the identifier in the
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
#include <hotkeys_basic.h>
|
#include <hotkeys_basic.h>
|
||||||
|
|
||||||
// List of hot keys id.
|
// List of hot keys id.
|
||||||
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
|
// see also enum common_hotkey_id_command in hotkeys_basic.h
|
||||||
// for shared hotkeys id
|
// for shared hotkeys id
|
||||||
enum hotkey_id_commnand {
|
enum hotkey_id_command {
|
||||||
HK_SWITCH_UNITS = HK_COMMON_END,
|
HK_SWITCH_UNITS = HK_COMMON_END,
|
||||||
HK_MOVE_ITEM,
|
HK_MOVE_ITEM,
|
||||||
HK_MOVE_START_POINT,
|
HK_MOVE_START_POINT,
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* How to add a new hotkey:
|
/* How to add a new hotkey:
|
||||||
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
|
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION.
|
||||||
* add a new EDA_HOTKEY entry like:
|
* add a new EDA_HOTKEY entry like:
|
||||||
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION, default key value);
|
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION, default key value);
|
||||||
* "Command Label" is the name used in hotkey list display, and the identifier in the
|
* "Command Label" is the name used in hotkey list display, and the identifier in the
|
||||||
|
|
|
@ -32,9 +32,9 @@
|
||||||
#include <hotkeys_basic.h>
|
#include <hotkeys_basic.h>
|
||||||
|
|
||||||
// List of hot keys id.
|
// List of hot keys id.
|
||||||
// see also enum common_hotkey_id_commnand in hotkeys_basic.h
|
// see also enum common_hotkey_id_command in hotkeys_basic.h
|
||||||
// for shared hotkeys id
|
// for shared hotkeys id
|
||||||
enum hotkey_id_commnand {
|
enum hotkey_id_command {
|
||||||
HK_DELETE = HK_COMMON_END,
|
HK_DELETE = HK_COMMON_END,
|
||||||
HK_BACK_SPACE,
|
HK_BACK_SPACE,
|
||||||
HK_ROTATE_ITEM,
|
HK_ROTATE_ITEM,
|
||||||
|
@ -76,10 +76,6 @@ enum hotkey_id_commnand {
|
||||||
HK_PLACE_ITEM,
|
HK_PLACE_ITEM,
|
||||||
HK_SWITCH_TRACK_WIDTH_TO_NEXT,
|
HK_SWITCH_TRACK_WIDTH_TO_NEXT,
|
||||||
HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS,
|
HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS,
|
||||||
HK_SWITCH_GRID_TO_FASTGRID1,
|
|
||||||
HK_SWITCH_GRID_TO_FASTGRID2,
|
|
||||||
HK_SWITCH_GRID_TO_NEXT,
|
|
||||||
HK_SWITCH_GRID_TO_PREVIOUS,
|
|
||||||
HK_SWITCH_LAYER_TO_COPPER,
|
HK_SWITCH_LAYER_TO_COPPER,
|
||||||
HK_SWITCH_LAYER_TO_COMPONENT,
|
HK_SWITCH_LAYER_TO_COMPONENT,
|
||||||
HK_SWITCH_LAYER_TO_NEXT,
|
HK_SWITCH_LAYER_TO_NEXT,
|
||||||
|
|
Loading…
Reference in New Issue