diff --git a/common/tool/action_manager.cpp b/common/tool/action_manager.cpp index e41f9af5db..dd3d64a4d1 100644 --- a/common/tool/action_manager.cpp +++ b/common/tool/action_manager.cpp @@ -79,12 +79,10 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction ) if( hotkey ) { std::list& actions = m_actionHotKeys[hotkey]; - std::list::iterator action = std::find( actions.begin(), actions.end(), aAction ); + auto action = std::find( actions.begin(), actions.end(), aAction ); if( action != actions.end() ) actions.erase( action ); - else - wxASSERT( false ); } } @@ -208,6 +206,13 @@ void ACTION_MANAGER::UpdateHotKeys() // are loaded after 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(); it != m_actionHotKeys[hotkey].end(); ) { diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index e4807f14bf..ea8075fe4d 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -155,8 +155,6 @@ static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y', ID_SCH_MIRROR_Y ); static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, '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 HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E', ID_SCH_EDIT_ITEM ); static EDA_HOTKEY HkEditComponentValue( _HKI( "Edit Symbol Value" ), HK_EDIT_COMPONENT_VALUE, 'V', @@ -306,7 +304,6 @@ static EDA_HOTKEY* schematic_Hotkey_List[] = &HkAddPower, &HkMirrorX, &HkMirrorY, - &HkOrientNormalComponent, &HkEditComponentValue, &HkEditComponentReference, &HkEditComponentFootprint, diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index 708904faa5..ed1c681a63 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -31,9 +31,9 @@ #include // 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 -enum hotkey_id_commnand { +enum hotkey_id_command { HK_FIND_NEXT_ITEM = HK_COMMON_END, HK_FIND_NEXT_DRC_MARKER, HK_FIND_ITEM, @@ -54,7 +54,6 @@ enum hotkey_id_commnand { HK_EDIT_COMPONENT_WITH_LIBEDIT, HK_MIRROR_X, HK_MIRROR_Y, - HK_ORIENT_NORMAL_COMPONENT, HK_MOVE_COMPONENT_OR_ITEM, HK_DUPLICATE, HK_DRAG, diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index dfcdf19dcc..a56b9464d5 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -38,7 +38,7 @@ /* 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: * 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 diff --git a/gerbview/hotkeys.h b/gerbview/hotkeys.h index b110e4db02..3b6d6ec003 100644 --- a/gerbview/hotkeys.h +++ b/gerbview/hotkeys.h @@ -32,9 +32,9 @@ #include // 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 -enum hotkey_id_commnand { +enum hotkey_id_command { HK_SWITCH_UNITS = HK_COMMON_END, HK_GBR_LINES_DISPLAY_MODE, HK_GBR_FLASHED_DISPLAY_MODE, diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index f990827cf8..ee0616105b 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -64,7 +64,7 @@ private: public: int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key 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) public: @@ -258,7 +258,7 @@ void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescLis // common hotkeys event id // 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_NEW, HK_OPEN, @@ -273,6 +273,10 @@ enum common_hotkey_id_commnand { HK_RESET_LOCAL_COORD, HK_SET_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_ZOOM_IN, HK_ZOOM_OUT, diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 049781d317..6904c487f7 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -110,7 +110,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME ) END_EVENT_TABLE() -enum hotkey_id_commnand +enum hotkey_id_command { HK_RUN_EESCHEMA = HK_COMMON_END, HK_NEW_PRJ_TEMPLATE, diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp index 646d320cb6..fcc318b949 100644 --- a/pagelayout_editor/hotkeys.cpp +++ b/pagelayout_editor/hotkeys.cpp @@ -47,7 +47,7 @@ /* 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: * 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 diff --git a/pagelayout_editor/hotkeys.h b/pagelayout_editor/hotkeys.h index e30963fc7f..b07ecfd8b9 100644 --- a/pagelayout_editor/hotkeys.h +++ b/pagelayout_editor/hotkeys.h @@ -32,9 +32,9 @@ #include // 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 -enum hotkey_id_commnand { +enum hotkey_id_command { HK_SWITCH_UNITS = HK_COMMON_END, HK_MOVE_ITEM, HK_MOVE_START_POINT, diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index ae71ce93b7..7823ea5a90 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -42,7 +42,7 @@ /* 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: * 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 diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index 3d5930142c..aff28b6780 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -32,9 +32,9 @@ #include // 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 -enum hotkey_id_commnand { +enum hotkey_id_command { HK_DELETE = HK_COMMON_END, HK_BACK_SPACE, HK_ROTATE_ITEM, @@ -76,10 +76,6 @@ enum hotkey_id_commnand { HK_PLACE_ITEM, HK_SWITCH_TRACK_WIDTH_TO_NEXT, 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_COMPONENT, HK_SWITCH_LAYER_TO_NEXT,