Browse Source

Use more descriptive names for hotkeys

Ivan Savenko 2 years ago
parent
commit
dea10e6091

+ 2 - 2
client/adventureMap/CAdventureMapInterface.cpp

@@ -110,7 +110,7 @@ CAdventureMapInterface::CAdventureMapInterface():
 	sleepWake    = makeButton(296, std::bind(&CAdventureMapInterface::fsleepWake,this),        ADVOPT.sleepWake,    EShortcut::ADVENTURE_TOGGLE_SLEEP);
 	moveHero     = makeButton(297, std::bind(&CAdventureMapInterface::fmoveHero,this),         ADVOPT.moveHero,     EShortcut::ADVENTURE_MOVE_HERO);
 	spellbook    = makeButton(298, std::bind(&CAdventureMapInterface::fshowSpellbok,this),     ADVOPT.spellbook,    EShortcut::ADVENTURE_CAST_SPELL);
-	advOptions   = makeButton(299, std::bind(&CAdventureMapInterface::fadventureOPtions,this), ADVOPT.advOptions,   EShortcut::ADVENTURE_OPTIONS);
+	advOptions   = makeButton(299, std::bind(&CAdventureMapInterface::fadventureOPtions,this), ADVOPT.advOptions,   EShortcut::ADVENTURE_GAME_OPTIONS);
 	sysOptions   = makeButton(300, std::bind(&CAdventureMapInterface::fsystemOptions,this),    ADVOPT.sysOptions,   EShortcut::GLOBAL_OPTIONS);
 	nextHero     = makeButton(301, std::bind(&CAdventureMapInterface::fnextHero,this),         ADVOPT.nextHero,     EShortcut::ADVENTURE_NEXT_HERO);
 	endTurn      = makeButton(302, std::bind(&CAdventureMapInterface::fendTurn,this),          ADVOPT.endTurn,      EShortcut::ADVENTURE_END_TURN);
@@ -699,7 +699,7 @@ void CAdventureMapInterface::keyPressed(EShortcut key)
 			abortCastingMode();
 			return;
 		}
-	case EShortcut::GAME_MARKETPLACE:
+	case EShortcut::GAME_OPEN_MARKETPLACE:
 		{
 			//act on key down if marketplace windows is not already opened
 			if(GH.topInt()->type & BLOCK_ADV_HOTKEYS)

+ 3 - 3
client/adventureMap/CInGameConsole.cpp

@@ -131,7 +131,7 @@ void CInGameConsole::keyPressed (EShortcut key)
 			startEnteringText();
 		break;
 
-	case EShortcut::GLOBAL_CONFIRM:
+	case EShortcut::GLOBAL_ACCEPT:
 		{
 			if(!enteredText.empty() && captureAllKeys)
 			{
@@ -155,7 +155,7 @@ void CInGameConsole::keyPressed (EShortcut key)
 			}
 			break;
 		}
-	case EShortcut::SELECT_UP:
+	case EShortcut::MOVE_UP:
 		{
 			if(previouslyEntered.empty())
 				break;
@@ -174,7 +174,7 @@ void CInGameConsole::keyPressed (EShortcut key)
 			}
 			break;
 		}
-	case EShortcut::SELECT_DOWN:
+	case EShortcut::MOVE_DOWN:
 		{
 			if(prevEntDisp != -1 && prevEntDisp+1 < previouslyEntered.size())
 			{

+ 1 - 1
client/battle/BattleInterfaceClasses.cpp

@@ -407,7 +407,7 @@ BattleResultWindow::BattleResultWindow(const BattleResult & br, CPlayerInterface
 	background->colorize(owner.playerID);
 	pos = center(background->pos);
 
-	exit = std::make_shared<CButton>(Point(384, 505), "iok6432.def", std::make_pair("", ""), [&](){ bExitf();}, EShortcut::GLOBAL_CONFIRM);
+	exit = std::make_shared<CButton>(Point(384, 505), "iok6432.def", std::make_pair("", ""), [&](){ bExitf();}, EShortcut::GLOBAL_ACCEPT);
 	exit->setBorderColor(Colors::METALLIC_GOLD);
 	
 	if(allowReplay)

+ 4 - 4
client/gui/CGuiHandler.cpp

@@ -95,7 +95,7 @@ void CGuiHandler::processLists(const ui16 activityFlag, std::function<void (std:
 
 void CGuiHandler::init()
 {
-	shortcutsHandler = std::make_unique<ShortcutHandler>();
+	shortcutsHandlerInstance = std::make_unique<ShortcutHandler>();
 	mainFPSmng = new CFramerateManager();
 	mainFPSmng->init(settings["video"]["targetfps"].Integer());
 	isPointerRelativeMode = settings["general"]["userRelativePointer"].Bool();
@@ -404,7 +404,7 @@ void CGuiHandler::handleCurrentEvent( SDL_Event & current )
 			return;
 		}
 
-		auto shortcutsVector = shortcutsHandler->translateKeycode(key.keysym.sym);
+		auto shortcutsVector = shortcutsHandler().translateKeycode(key.keysym.sym);
 
 		bool keysCaptured = false;
 		for(auto i = keyinterested.begin(); i != keyinterested.end() && continueEventHandling; i++)
@@ -714,9 +714,9 @@ CGuiHandler::~CGuiHandler()
 	delete terminate_cond;
 }
 
-ShortcutHandler & CGuiHandler::getShortcutsHandler()
+ShortcutHandler & CGuiHandler::shortcutsHandler()
 {
-	return *shortcutsHandler;
+	return *shortcutsHandlerInstance;
 }
 
 void CGuiHandler::moveCursorToPosition(const Point & position)

+ 2 - 2
client/gui/CGuiHandler.h

@@ -78,7 +78,7 @@ private:
 
 	std::vector<std::shared_ptr<IShowActivatable>> disposed;
 
-	std::unique_ptr<ShortcutHandler> shortcutsHandler;
+	std::unique_ptr<ShortcutHandler> shortcutsHandlerInstance;
 
 	std::atomic<bool> continueEventHandling;
 	using CIntObjectList = std::list<CIntObject *>;
@@ -114,7 +114,7 @@ public:
 	/// returns current position of mouse cursor, relative to vcmi window
 	const Point & getCursorPosition() const;
 
-	ShortcutHandler & getShortcutsHandler();
+	ShortcutHandler & shortcutsHandler();
 
 	Point screenDimensions() const;
 

+ 1 - 1
client/gui/InterfaceObjectConfigurable.cpp

@@ -211,7 +211,7 @@ EShortcut InterfaceObjectConfigurable::readKeycode(const JsonNode & config) cons
 		return EShortcut::NONE;
 	}
 
-	EShortcut result = GH.getShortcutsHandler().findShortcut(config.String());
+	EShortcut result = GH.shortcutsHandler().findShortcut(config.String());
 	if (result == EShortcut::NONE)
 		logGlobal->error("Invalid keycode '%s' in interface configuration!", config.String());
 	return result;;

+ 67 - 52
client/gui/Shortcut.h

@@ -13,23 +13,26 @@ enum class EShortcut
 {
 	NONE,
 
-	GLOBAL_CONFIRM,    // Enter
-	GLOBAL_CANCEL,     // Escape
-	GLOBAL_RETURN,     // Enter, Escape
-	GLOBAL_FULLSCREEN, // F4
-	GLOBAL_OPTIONS,
-	GLOBAL_BACKSPACE,
-	GLOBAL_MOVE_FOCUS,
-
-	SELECT_LEFT,
-	SELECT_RIGHT,
-	SELECT_UP,
-	SELECT_DOWN,
-	SELECT_FIRST,
-	SELECT_LAST,
-	SELECT_PAGE_UP,
-	SELECT_PAGE_DOWN,
-
+	// Global hotkeys that are available in multiple dialogs
+	GLOBAL_ACCEPT,     // Return - Accept query
+	GLOBAL_CANCEL,     // Escape - Cancel query
+	GLOBAL_RETURN,     // Enter, Escape - Close current window and return to previous view
+	GLOBAL_FULLSCREEN, // F4 - TODO: remove hardcoded check for key
+	GLOBAL_OPTIONS,    // 'O' - Open System Options dialog
+	GLOBAL_BACKSPACE,  // Backspace - erase last symbol in text input
+	GLOBAL_MOVE_FOCUS, // Tab - move focus to next text input
+
+	// Movement hotkeys, usually - for moving through lists with slider
+	MOVE_LEFT,
+	MOVE_RIGHT,
+	MOVE_UP,
+	MOVE_DOWN,
+	MOVE_FIRST,
+	MOVE_LAST,
+	MOVE_PAGE_UP,
+	MOVE_PAGE_DOWN,
+
+	// Element selection - for multiple choice dialog popups
 	SELECT_INDEX_1,
 	SELECT_INDEX_2,
 	SELECT_INDEX_3,
@@ -39,9 +42,10 @@ enum class EShortcut
 	SELECT_INDEX_7,
 	SELECT_INDEX_8,
 
-	MAIN_MENU_NEW,
-	MAIN_MENU_LOAD,
-	MAIN_MENU_SCORES,
+	// Main menu hotkeys - for navigation between main menu windows
+	MAIN_MENU_NEW_GAME,
+	MAIN_MENU_LOAD_GAME,
+	MAIN_MENU_HIGH_SCORES,
 	MAIN_MENU_CREDITS,
 	MAIN_MENU_BACK,
 	MAIN_MENU_QUIT,
@@ -54,44 +58,39 @@ enum class EShortcut
 	MAIN_MENU_CAMPAIGN_AB,
 	MAIN_MENU_CAMPAIGN_CUSTOM,
 
+	// Game lobby / scenario selection
 	LOBBY_BEGIN_GAME, // b, Return
 	LOBBY_LOAD_GAME,  // l, Return
 	LOBBY_SAVE_GAME,  // s, Return
-	LOBBY_RANDOM_MAP,
+	LOBBY_RANDOM_MAP, // Open random map tab
 	LOBBY_HIDE_CHAT,
-	LOBBY_ADDITIONAL_OPTIONS,
-	LOBBY_SELECT,
+	LOBBY_ADDITIONAL_OPTIONS, // Open additional options tab
+	LOBBY_SELECT_SCENARIO,    // Open map list tab
 
+	// In-game hotkeys, require game state but may be available in windows other than adventure map
 	GAME_END_TURN,
 	GAME_LOAD_GAME,
 	GAME_SAVE_GAME,
 	GAME_RESTART_GAME,
 	GAME_TO_MAIN_MENU,
 	GAME_QUIT_GAME,
-	GAME_MARKETPLACE,
-	GAME_THIEVES_GUILD,
-	GAME_ACTIVATE_CONSOLE,
-
-	ADVENTURE_OPTIONS,
-	ADVENTURE_TOGGLE_GRID,
-	ADVENTURE_TOGGLE_SLEEP,
-	ADVENTURE_MOVE_HERO,
-	ADVENTURE_VISIT_OBJECT,
-	ADVENTURE_MOVE_HERO_SW,
-	ADVENTURE_MOVE_HERO_SS,
-	ADVENTURE_MOVE_HERO_SE,
-	ADVENTURE_MOVE_HERO_WW,
-	ADVENTURE_MOVE_HERO_EE,
-	ADVENTURE_MOVE_HERO_NW,
-	ADVENTURE_MOVE_HERO_NN,
-	ADVENTURE_MOVE_HERO_NE,
-	ADVENTURE_VIEW_SELECTED,
-	ADVENTURE_NEXT_OBJECT,
+	GAME_OPEN_MARKETPLACE,
+	GAME_OPEN_THIEVES_GUILD,
+	GAME_ACTIVATE_CONSOLE, // Tab, activates in-game console
+
+	// Adventure map screen
+	ADVENTURE_GAME_OPTIONS, // 'o', Open CAdventureOptions window
+	ADVENTURE_TOGGLE_GRID,  // F6, Toggles map grid
+	ADVENTURE_TOGGLE_SLEEP, // z,w, Toggles hero sleep status
+	ADVENTURE_MOVE_HERO,    // Moves hero alongside set path
+	ADVENTURE_VISIT_OBJECT, // Revisits object hero is standing on
+	ADVENTURE_VIEW_SELECTED,// Open window with currently selected hero/town
 	ADVENTURE_NEXT_TOWN,
 	ADVENTURE_NEXT_HERO,
-	ADVENTURE_FIRST_TOWN,
-	ADVENTURE_FIRST_HERO,
-	ADVENTURE_VIEW_SCENARIO,
+	ADVENTURE_NEXT_OBJECT,  // TODO: context-sensitive next object - select next hero/town, depending on current selection
+	ADVENTURE_FIRST_TOWN,   // TODO: select first available town in the list
+	ADVENTURE_FIRST_HERO,   // TODO: select first available hero in the list
+	ADVENTURE_VIEW_SCENARIO,// View Scenario Information window
 	ADVENTURE_DIG_GRAIL,
 	ADVENTURE_VIEW_PUZZLE,
 	ADVENTURE_VIEW_WORLD,
@@ -102,6 +101,17 @@ enum class EShortcut
 	ADVENTURE_END_TURN,
 	ADVENTURE_THIEVES_GUILD,
 
+	// Move hero one tile in specified direction. Bound to cursors & numpad buttons
+	ADVENTURE_MOVE_HERO_SW,
+	ADVENTURE_MOVE_HERO_SS,
+	ADVENTURE_MOVE_HERO_SE,
+	ADVENTURE_MOVE_HERO_WW,
+	ADVENTURE_MOVE_HERO_EE,
+	ADVENTURE_MOVE_HERO_NW,
+	ADVENTURE_MOVE_HERO_NN,
+	ADVENTURE_MOVE_HERO_NE,
+
+	// Battle screen
 	BATTLE_TOGGLE_QUEUE,
 	BATTLE_USE_CREATURE_SPELL,
 	BATTLE_SURRENDER,
@@ -115,23 +125,28 @@ enum class EShortcut
 	BATTLE_TACTICS_NEXT,
 	BATTLE_TACTICS_END,
 
+	// Town screen
 	TOWN_OPEN_TAVERN,
-	TOWN_SWAP_ARMIES,
+	TOWN_SWAP_ARMIES, // Swap garrisoned and visiting armies
 
-	RECRUITMENT_MAX,
-	RECRUITMENT_MIN,
-	RECRUITMENT_UPGRADE, // U
-	RECRUITMENT_UPGRADE_ALL, // A, U
+	// Creature & creature recruitment screen
+	RECRUITMENT_MAX, // Set number of creatures to recruit to max
+	RECRUITMENT_MIN, // Set number of creatures to recruit to min (1)
+	RECRUITMENT_UPGRADE, // Upgrade current creature
+	RECRUITMENT_UPGRADE_ALL, // Upgrade all creatures (Hill Fort / Skeleton Transformer)
 
-	KINGDOM_HEROES,
-	KINGDOM_TOWNS,
+	// Kingdom Overview window
+	KINGDOM_HEROES_TAB,
+	KINGDOM_TOWNS_TAB,
 
+	// Hero screen
 	HERO_DISMISS,
 	HERO_COMMANDER,
 	HERO_LOOSE_FORMATION,
 	HERO_TIGHT_FORMATION,
 	HERO_TOGGLE_TACTICS, // b
 
+	// Spellbook screen
 	SPELLBOOK_TAB_ADVENTURE,
 	SPELLBOOK_TAB_COMBAT,
 

+ 43 - 39
client/gui/ShortcutHandler.cpp

@@ -14,11 +14,11 @@
 #include "Shortcut.h"
 #include <SDL_keycode.h>
 
-std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
+std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key) const
 {
 	static const std::multimap<SDL_Keycode, EShortcut> keyToShortcut = {
-		{SDLK_RETURN,    EShortcut::GLOBAL_CONFIRM            },
-		{SDLK_KP_ENTER,  EShortcut::GLOBAL_CONFIRM            },
+		{SDLK_RETURN,    EShortcut::GLOBAL_ACCEPT             },
+		{SDLK_KP_ENTER,  EShortcut::GLOBAL_ACCEPT             },
 		{SDLK_ESCAPE,    EShortcut::GLOBAL_CANCEL             },
 		{SDLK_RETURN,    EShortcut::GLOBAL_RETURN             },
 		{SDLK_KP_ENTER,  EShortcut::GLOBAL_RETURN             },
@@ -27,14 +27,14 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
 		{SDLK_BACKSPACE, EShortcut::GLOBAL_BACKSPACE          },
 		{SDLK_TAB,       EShortcut::GLOBAL_MOVE_FOCUS         },
 		{SDLK_o,         EShortcut::GLOBAL_OPTIONS            },
-		{SDLK_LEFT,      EShortcut::SELECT_LEFT               },
-		{SDLK_RIGHT,     EShortcut::SELECT_RIGHT              },
-		{SDLK_UP,        EShortcut::SELECT_UP                 },
-		{SDLK_DOWN,      EShortcut::SELECT_DOWN               },
-		{SDLK_HOME,      EShortcut::SELECT_FIRST              },
-		{SDLK_END,       EShortcut::SELECT_LAST               },
-		{SDLK_PAGEUP,    EShortcut::SELECT_PAGE_UP            },
-		{SDLK_PAGEDOWN,  EShortcut::SELECT_PAGE_DOWN          },
+		{SDLK_LEFT,      EShortcut::MOVE_LEFT                 },
+		{SDLK_RIGHT,     EShortcut::MOVE_RIGHT                },
+		{SDLK_UP,        EShortcut::MOVE_UP                   },
+		{SDLK_DOWN,      EShortcut::MOVE_DOWN                 },
+		{SDLK_HOME,      EShortcut::MOVE_FIRST                },
+		{SDLK_END,       EShortcut::MOVE_LAST                 },
+		{SDLK_PAGEUP,    EShortcut::MOVE_PAGE_UP              },
+		{SDLK_PAGEDOWN,  EShortcut::MOVE_PAGE_DOWN            },
 		{SDLK_1,         EShortcut::SELECT_INDEX_1            },
 		{SDLK_2,         EShortcut::SELECT_INDEX_2            },
 		{SDLK_3,         EShortcut::SELECT_INDEX_3            },
@@ -43,9 +43,9 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
 		{SDLK_6,         EShortcut::SELECT_INDEX_6            },
 		{SDLK_7,         EShortcut::SELECT_INDEX_7            },
 		{SDLK_8,         EShortcut::SELECT_INDEX_8            },
-		{SDLK_n,         EShortcut::MAIN_MENU_NEW             },
-		{SDLK_l,         EShortcut::MAIN_MENU_LOAD            },
-		{SDLK_h,         EShortcut::MAIN_MENU_SCORES          },
+		{SDLK_n,         EShortcut::MAIN_MENU_NEW_GAME        },
+		{SDLK_l,         EShortcut::MAIN_MENU_LOAD_GAME       },
+		{SDLK_h,         EShortcut::MAIN_MENU_HIGH_SCORES     },
 		{SDLK_c,         EShortcut::MAIN_MENU_CREDITS         },
 		{SDLK_q,         EShortcut::MAIN_MENU_QUIT            },
 		{SDLK_b,         EShortcut::MAIN_MENU_BACK            },
@@ -67,17 +67,17 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
 		{SDLK_r,         EShortcut::LOBBY_RANDOM_MAP          },
 		{SDLK_h,         EShortcut::LOBBY_HIDE_CHAT           },
 		{SDLK_a,         EShortcut::LOBBY_ADDITIONAL_OPTIONS  },
-		{SDLK_s,         EShortcut::LOBBY_SELECT              },
+		{SDLK_s,         EShortcut::LOBBY_SELECT_SCENARIO     },
 		{SDLK_e,         EShortcut::GAME_END_TURN             },
 		{SDLK_l,         EShortcut::GAME_LOAD_GAME            },
 		{SDLK_s,         EShortcut::GAME_SAVE_GAME            },
 		{SDLK_r,         EShortcut::GAME_RESTART_GAME         },
 		{SDLK_m,         EShortcut::GAME_TO_MAIN_MENU         },
 		{SDLK_q,         EShortcut::GAME_QUIT_GAME            },
-		{SDLK_t,         EShortcut::GAME_MARKETPLACE          },
-		{SDLK_g,         EShortcut::GAME_THIEVES_GUILD        },
+		{SDLK_t,         EShortcut::GAME_OPEN_MARKETPLACE     },
+		{SDLK_g,         EShortcut::GAME_OPEN_THIEVES_GUILD   },
 		{SDLK_TAB,       EShortcut::GAME_ACTIVATE_CONSOLE     },
-		{SDLK_o,         EShortcut::ADVENTURE_OPTIONS         },
+		{SDLK_o,         EShortcut::ADVENTURE_GAME_OPTIONS    },
 		{SDLK_F6,        EShortcut::ADVENTURE_TOGGLE_GRID     },
 		{SDLK_z,         EShortcut::ADVENTURE_TOGGLE_SLEEP    },
 		{SDLK_w,         EShortcut::ADVENTURE_TOGGLE_SLEEP    },
@@ -91,6 +91,10 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
 		{SDLK_KP_7,      EShortcut::ADVENTURE_MOVE_HERO_NW    },
 		{SDLK_KP_8,      EShortcut::ADVENTURE_MOVE_HERO_NN    },
 		{SDLK_KP_9,      EShortcut::ADVENTURE_MOVE_HERO_NE    },
+		{SDLK_DOWN,      EShortcut::ADVENTURE_MOVE_HERO_SS    },
+		{SDLK_LEFT,      EShortcut::ADVENTURE_MOVE_HERO_WW    },
+		{SDLK_RIGHT,     EShortcut::ADVENTURE_MOVE_HERO_EE    },
+		{SDLK_UP,        EShortcut::ADVENTURE_MOVE_HERO_NN    },
 		{SDLK_RETURN,    EShortcut::ADVENTURE_VIEW_SELECTED   },
 		{SDLK_KP_ENTER,  EShortcut::ADVENTURE_VIEW_SELECTED   },
  //		{SDLK_,          EShortcut::ADVENTURE_NEXT_OBJECT     },
@@ -129,8 +133,8 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
 		{SDLK_u,         EShortcut::RECRUITMENT_UPGRADE       },
 		{SDLK_a,         EShortcut::RECRUITMENT_UPGRADE_ALL   },
 		{SDLK_u,         EShortcut::RECRUITMENT_UPGRADE_ALL   },
-		{SDLK_h,         EShortcut::KINGDOM_HEROES            },
-		{SDLK_t,         EShortcut::KINGDOM_TOWNS             },
+		{SDLK_h,         EShortcut::KINGDOM_HEROES_TAB        },
+		{SDLK_t,         EShortcut::KINGDOM_TOWNS_TAB         },
 		{SDLK_d,         EShortcut::HERO_DISMISS              },
 		{SDLK_c,         EShortcut::HERO_COMMANDER            },
 		{SDLK_l,         EShortcut::HERO_LOOSE_FORMATION      },
@@ -154,24 +158,24 @@ std::vector<EShortcut> ShortcutHandler::translateKeycode(SDL_Keycode key)
 	return result;
 }
 
-EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
+EShortcut ShortcutHandler::findShortcut(const std::string & identifier ) const
 {
 	static const std::map<std::string, EShortcut> shortcutNames = {
-		{"globalConfirm",            EShortcut::GLOBAL_CONFIRM            },
+		{"globalAccept",             EShortcut::GLOBAL_ACCEPT             },
 		{"globalCancel",             EShortcut::GLOBAL_CANCEL             },
 		{"globalReturn",             EShortcut::GLOBAL_RETURN             },
 		{"globalFullscreen",         EShortcut::GLOBAL_FULLSCREEN         },
 		{"globalOptions",            EShortcut::GLOBAL_OPTIONS            },
 		{"globalBackspace",          EShortcut::GLOBAL_BACKSPACE          },
 		{"globalMoveFocus",          EShortcut::GLOBAL_MOVE_FOCUS         },
-		{"selectLeft",               EShortcut::SELECT_LEFT               },
-		{"selectRight",              EShortcut::SELECT_RIGHT              },
-		{"selectUp",                 EShortcut::SELECT_UP                 },
-		{"selectDown",               EShortcut::SELECT_DOWN               },
-		{"selectFirst",              EShortcut::SELECT_FIRST              },
-		{"selectLast",               EShortcut::SELECT_LAST               },
-		{"selectPageUp",             EShortcut::SELECT_PAGE_UP            },
-		{"selectPageDown",           EShortcut::SELECT_PAGE_DOWN          },
+		{"moveLeft",                 EShortcut::MOVE_LEFT                 },
+		{"moveRight",                EShortcut::MOVE_RIGHT                },
+		{"moveUp",                   EShortcut::MOVE_UP                   },
+		{"moveDown",                 EShortcut::MOVE_DOWN                 },
+		{"moveFirst",                EShortcut::MOVE_FIRST                },
+		{"moveLast",                 EShortcut::MOVE_LAST                 },
+		{"movePageUp",               EShortcut::MOVE_PAGE_UP              },
+		{"movePageDown",             EShortcut::MOVE_PAGE_DOWN            },
 		{"selectIndex1",             EShortcut::SELECT_INDEX_1            },
 		{"selectIndex2",             EShortcut::SELECT_INDEX_2            },
 		{"selectIndex3",             EShortcut::SELECT_INDEX_3            },
@@ -180,9 +184,9 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
 		{"selectIndex6",             EShortcut::SELECT_INDEX_6            },
 		{"selectIndex7",             EShortcut::SELECT_INDEX_7            },
 		{"selectIndex8",             EShortcut::SELECT_INDEX_8            },
-		{"mainMenuNew",              EShortcut::MAIN_MENU_NEW             },
-		{"mainMenuLoad",             EShortcut::MAIN_MENU_LOAD            },
-		{"mainMenuScores",           EShortcut::MAIN_MENU_SCORES          },
+		{"mainMenuNewGame",          EShortcut::MAIN_MENU_NEW_GAME        },
+		{"mainMenuLoadGame",         EShortcut::MAIN_MENU_LOAD_GAME       },
+		{"mainMenuHighScores",       EShortcut::MAIN_MENU_HIGH_SCORES     },
 		{"mainMenuCredits",          EShortcut::MAIN_MENU_CREDITS         },
 		{"mainMenuQuit",             EShortcut::MAIN_MENU_QUIT            },
 		{"mainMenuBack",             EShortcut::MAIN_MENU_BACK            },
@@ -200,17 +204,17 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
 		{"lobbyRandomMap",           EShortcut::LOBBY_RANDOM_MAP          },
 		{"lobbyHideChat",            EShortcut::LOBBY_HIDE_CHAT           },
 		{"lobbyAdditionalOptions",   EShortcut::LOBBY_ADDITIONAL_OPTIONS  },
-		{"lobbySelect",              EShortcut::LOBBY_SELECT              },
+		{"lobbySelectScenario",      EShortcut::LOBBY_SELECT_SCENARIO     },
 		{"gameEndTurn",              EShortcut::GAME_END_TURN             },
 		{"gameLoadGame",             EShortcut::GAME_LOAD_GAME            },
 		{"gameSaveGame",             EShortcut::GAME_SAVE_GAME            },
 		{"gameRestartGame",          EShortcut::GAME_RESTART_GAME         },
 		{"gameMainMenu",             EShortcut::GAME_TO_MAIN_MENU         },
 		{"gameQuitGame",             EShortcut::GAME_QUIT_GAME            },
-		{"gameMarketplace",          EShortcut::GAME_MARKETPLACE          },
-		{"gameThievesGuild",         EShortcut::GAME_THIEVES_GUILD        },
+		{"gameOpenMarketplace",      EShortcut::GAME_OPEN_MARKETPLACE     },
+		{"gameOpenThievesGuild",     EShortcut::GAME_OPEN_THIEVES_GUILD   },
 		{"gameActivateConsole",      EShortcut::GAME_ACTIVATE_CONSOLE     },
-		{"adventureOptions",         EShortcut::ADVENTURE_OPTIONS         },
+		{"adventureGameOptions",     EShortcut::ADVENTURE_GAME_OPTIONS    },
 		{"adventureToggleGrid",      EShortcut::ADVENTURE_TOGGLE_GRID     },
 		{"adventureToggleSleep",     EShortcut::ADVENTURE_TOGGLE_SLEEP    },
 		{"adventureMoveHero",        EShortcut::ADVENTURE_MOVE_HERO       },
@@ -257,8 +261,8 @@ EShortcut ShortcutHandler::findShortcut(const std::string & identifier )
 		{"recruitmentMin",           EShortcut::RECRUITMENT_MIN           },
 		{"recruitmentUpgrade",       EShortcut::RECRUITMENT_UPGRADE       },
 		{"recruitmentUpgradeAll",    EShortcut::RECRUITMENT_UPGRADE_ALL   },
-		{"kingdomHeroes",            EShortcut::KINGDOM_HEROES            },
-		{"kingdomTowns",             EShortcut::KINGDOM_TOWNS             },
+		{"kingdomHeroesTab",         EShortcut::KINGDOM_HEROES_TAB        },
+		{"kingdomTownsTab",          EShortcut::KINGDOM_TOWNS_TAB         },
 		{"heroDismiss",              EShortcut::HERO_DISMISS              },
 		{"heroCommander",            EShortcut::HERO_COMMANDER            },
 		{"heroLooseFormation",       EShortcut::HERO_LOOSE_FORMATION      },

+ 2 - 2
client/gui/ShortcutHandler.h

@@ -17,8 +17,8 @@ class ShortcutHandler
 {
 public:
 	/// returns list of shortcuts assigned to provided SDL keycode
-	std::vector<EShortcut> translateKeycode(SDL_Keycode key);
+	std::vector<EShortcut> translateKeycode(SDL_Keycode key) const;
 
 	/// attempts to find shortcut by its unique identifier. Returns EShortcut::NONE on failure
-	EShortcut findShortcut(const std::string & identifier );
+	EShortcut findShortcut(const std::string & identifier ) const;
 };

+ 2 - 2
client/lobby/CBonusSelection.cpp

@@ -68,8 +68,8 @@ CBonusSelection::CBonusSelection()
 
 	panelBackground = std::make_shared<CPicture>("CAMPBRF.BMP", 456, 6);
 
-	buttonStart = std::make_shared<CButton>(Point(475, 536), "CBBEGIB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::startMap, this), EShortcut::GLOBAL_CONFIRM);
-	buttonRestart = std::make_shared<CButton>(Point(475, 536), "CBRESTB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::restartMap, this), EShortcut::GLOBAL_CONFIRM);
+	buttonStart = std::make_shared<CButton>(Point(475, 536), "CBBEGIB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::startMap, this), EShortcut::GLOBAL_ACCEPT);
+	buttonRestart = std::make_shared<CButton>(Point(475, 536), "CBRESTB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::restartMap, this), EShortcut::GLOBAL_ACCEPT);
 	buttonBack = std::make_shared<CButton>(Point(624, 536), "CBCANCB.DEF", CButton::tooltip(), std::bind(&CBonusSelection::goBack, this), EShortcut::GLOBAL_CANCEL);
 
 	campaignName = std::make_shared<CLabel>(481, 28, FONT_BIG, ETextAlignment::TOPLEFT, Colors::YELLOW, CSH->si->getCampaignName());

+ 1 - 1
client/lobby/CLobbyScreen.cpp

@@ -41,7 +41,7 @@ CLobbyScreen::CLobbyScreen(ESelectionScreen screenType)
 	{
 		tabSel->callOnSelect = std::bind(&IServerAPI::setMapInfo, CSH, _1, nullptr);
 
-		buttonSelect = std::make_shared<CButton>(Point(411, 80), "GSPBUTT.DEF", CGI->generaltexth->zelp[45], 0, EShortcut::LOBBY_SELECT);
+		buttonSelect = std::make_shared<CButton>(Point(411, 80), "GSPBUTT.DEF", CGI->generaltexth->zelp[45], 0, EShortcut::LOBBY_SELECT_SCENARIO);
 		buttonSelect->addCallback([&]()
 		{
 			toggleTab(tabSel);

+ 1 - 1
client/lobby/CSelectionBase.cpp

@@ -321,7 +321,7 @@ CChatBox::CChatBox(const Rect & rect)
 
 void CChatBox::keyPressed(EShortcut key)
 {
-	if(key == EShortcut::GLOBAL_CONFIRM && inputBox->getText().size())
+	if(key == EShortcut::GLOBAL_ACCEPT && inputBox->getText().size())
 	{
 		CSH->sendMessage(inputBox->getText());
 		inputBox->setText("");

+ 6 - 6
client/lobby/SelectionTab.cpp

@@ -287,22 +287,22 @@ void SelectionTab::keyPressed(EShortcut key)
 	int moveBy = 0;
 	switch(key)
 	{
-	case EShortcut::SELECT_UP:
+	case EShortcut::MOVE_UP:
 		moveBy = -1;
 		break;
-	case EShortcut::SELECT_DOWN:
+	case EShortcut::MOVE_DOWN:
 		moveBy = +1;
 		break;
-	case EShortcut::SELECT_PAGE_UP:
+	case EShortcut::MOVE_PAGE_UP:
 		moveBy = -(int)listItems.size() + 1;
 		break;
-	case EShortcut::SELECT_PAGE_DOWN:
+	case EShortcut::MOVE_PAGE_DOWN:
 		moveBy = +(int)listItems.size() - 1;
 		break;
-	case EShortcut::SELECT_FIRST:
+	case EShortcut::MOVE_FIRST:
 		select(-slider->getValue());
 		return;
-	case EShortcut::SELECT_LAST:
+	case EShortcut::MOVE_LAST:
 		select((int)curItems.size() - slider->getValue());
 		return;
 	default:

+ 3 - 3
client/mainmenu/CMainMenu.cpp

@@ -232,7 +232,7 @@ std::shared_ptr<CButton> CMenuEntry::createButton(CMenuScreen * parent, const Js
 	if(posy < 0)
 		posy = pos.h + posy;
 
-	EShortcut shortcut = GH.getShortcutsHandler().findShortcut(button["shortcut"].String());
+	EShortcut shortcut = GH.shortcutsHandler().findShortcut(button["shortcut"].String());
 
 	auto result = std::make_shared<CButton>(Point(posx, posy), button["name"].String(), help, command, shortcut);
 
@@ -426,7 +426,7 @@ CMultiPlayers::CMultiPlayers(const std::string & firstPlayer, ESelectionScreen S
 		inputNames[i]->cb += std::bind(&CMultiPlayers::onChange, this, _1);
 	}
 
-	buttonOk = std::make_shared<CButton>(Point(95, 338), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], std::bind(&CMultiPlayers::enterSelectionScreen, this), EShortcut::GLOBAL_CONFIRM);
+	buttonOk = std::make_shared<CButton>(Point(95, 338), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], std::bind(&CMultiPlayers::enterSelectionScreen, this), EShortcut::GLOBAL_ACCEPT);
 	buttonCancel = std::make_shared<CButton>(Point(205, 338), "MUBCANC.DEF", CGI->generaltexth->zelp[561], [=](){ close();}, EShortcut::GLOBAL_CANCEL);
 	statusBar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(7, 381, 348, 18), 7, 381));
 
@@ -475,7 +475,7 @@ CSimpleJoinScreen::CSimpleJoinScreen(bool host)
 		inputAddress->cb += std::bind(&CSimpleJoinScreen::onChange, this, _1);
 		inputPort->cb += std::bind(&CSimpleJoinScreen::onChange, this, _1);
 		inputPort->filters += std::bind(&CTextInput::numberFilter, _1, _2, 0, 65535);
-		buttonOk = std::make_shared<CButton>(Point(26, 142), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], std::bind(&CSimpleJoinScreen::connectToServer, this), EShortcut::GLOBAL_CONFIRM);
+		buttonOk = std::make_shared<CButton>(Point(26, 142), "MUBCHCK.DEF", CGI->generaltexth->zelp[560], std::bind(&CSimpleJoinScreen::connectToServer, this), EShortcut::GLOBAL_ACCEPT);
 
 		inputAddress->giveFocus();
 	}

+ 8 - 8
client/widgets/Buttons.cpp

@@ -806,32 +806,32 @@ void CSlider::keyPressed(EShortcut key)
 	int moveDest = value;
 	switch(key)
 	{
-	case EShortcut::SELECT_UP:
+	case EShortcut::MOVE_UP:
 		if (!horizontal)
 			moveDest = value - scrollStep;
 		break;
-	case EShortcut::SELECT_LEFT:
+	case EShortcut::MOVE_LEFT:
 		if (horizontal)
 			moveDest = value - scrollStep;
 		break;
-	case EShortcut::SELECT_DOWN:
+	case EShortcut::MOVE_DOWN:
 		if (!horizontal)
 			moveDest = value + scrollStep;
 		break;
-	case EShortcut::SELECT_RIGHT:
+	case EShortcut::MOVE_RIGHT:
 		if (horizontal)
 			moveDest = value + scrollStep;
 		break;
-	case EShortcut::SELECT_PAGE_UP:
+	case EShortcut::MOVE_PAGE_UP:
 		moveDest = value - capacity + scrollStep;
 		break;
-	case EShortcut::SELECT_PAGE_DOWN:
+	case EShortcut::MOVE_PAGE_DOWN:
 		moveDest = value + capacity - scrollStep;
 		break;
-	case EShortcut::SELECT_FIRST:
+	case EShortcut::MOVE_FIRST:
 		moveDest = 0;
 		break;
-	case EShortcut::SELECT_LAST:
+	case EShortcut::MOVE_LAST:
 		moveDest = amount - capacity;
 		break;
 	default:

+ 3 - 3
client/widgets/CArtifactsOfHeroBase.cpp

@@ -12,7 +12,7 @@
 
 #include "../gui/CGuiHandler.h"
 #include "../gui/CursorHandler.h"
-#include "../gui/EShortcut.h
+#include "../gui/EShortcut.h"
 
 #include "Buttons.h"
 
@@ -83,8 +83,8 @@ void CArtifactsOfHeroBase::init(
 		artPlace->leftClickCallback = lClickCallback;
 		artPlace->rightClickCallback = rClickCallback;
 	}
-	leftBackpackRoll = std::make_shared<CButton>(Point(379, 364), "hsbtns3.def", CButton::tooltip(), [scrollHandler]() { scrollHandler(-1); }, EShortcut::SELECT_LEFT);
-	rightBackpackRoll = std::make_shared<CButton>(Point(632, 364), "hsbtns5.def", CButton::tooltip(), [scrollHandler]() { scrollHandler(+1); }, EShortcut::SELECT_RIGHT);
+	leftBackpackRoll = std::make_shared<CButton>(Point(379, 364), "hsbtns3.def", CButton::tooltip(), [scrollHandler]() { scrollHandler(-1); }, EShortcut::MOVE_LEFT);
+	rightBackpackRoll = std::make_shared<CButton>(Point(632, 364), "hsbtns5.def", CButton::tooltip(), [scrollHandler]() { scrollHandler(+1); }, EShortcut::MOVE_RIGHT);
 	leftBackpackRoll->block(true);
 	rightBackpackRoll->block(true);
 }

+ 4 - 4
client/windows/CCastleInterface.cpp

@@ -1312,10 +1312,10 @@ void CCastleInterface::keyPressed(EShortcut key)
 {
 	switch(key)
 	{
-	case EShortcut::SELECT_UP:
+	case EShortcut::MOVE_UP:
 		townlist->selectPrev();
 		break;
-	case EShortcut::SELECT_DOWN:
+	case EShortcut::MOVE_DOWN:
 		townlist->selectNext();
 		break;
 	case EShortcut::TOWN_SWAP_ARMIES:
@@ -1485,7 +1485,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
 		std::string tooltipYes = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % building->getNameTranslated());
 		std::string tooltipNo  = boost::str(boost::format(CGI->generaltexth->allTexts[596]) % building->getNameTranslated());
 
-		buy = std::make_shared<CButton>(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes), [&](){ buyFunc(); }, EShortcut::GLOBAL_CONFIRM);
+		buy = std::make_shared<CButton>(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes), [&](){ buyFunc(); }, EShortcut::GLOBAL_ACCEPT);
 		buy->setBorderColor(Colors::METALLIC_GOLD);
 		buy->block(state!=7 || LOCPLINT->playerID != town->tempOwner);
 
@@ -1863,7 +1863,7 @@ CBlacksmithDialog::CBlacksmithDialog(bool possible, CreatureID creMachineID, Art
 	                std::to_string(aid.toArtifact(CGI->artifacts())->getPrice()));
 
 	std::string text = boost::str(boost::format(CGI->generaltexth->allTexts[595]) % creature->getNameSingularTranslated());
-	buy = std::make_shared<CButton>(Point(42, 312), "IBUY30.DEF", CButton::tooltip(text), [&](){ close(); }, EShortcut::GLOBAL_CONFIRM);
+	buy = std::make_shared<CButton>(Point(42, 312), "IBUY30.DEF", CButton::tooltip(text), [&](){ close(); }, EShortcut::GLOBAL_ACCEPT);
 
 	text = boost::str(boost::format(CGI->generaltexth->allTexts[596]) % creature->getNameSingularTranslated());
 	cancel = std::make_shared<CButton>(Point(224, 312), "ICANCEL.DEF", CButton::tooltip(text), [&](){ close(); }, EShortcut::GLOBAL_CANCEL);

+ 2 - 2
client/windows/CCreatureWindow.cpp

@@ -455,8 +455,8 @@ CStackWindow::CommanderMainSection::CommanderMainSection(CStackWindow * owner, i
 
 		abilities = std::make_shared<CListBox>(onCreate, Point(38, 3+pos.h), Point(63, 0), 6, abilitiesCount);
 
-		leftBtn = std::make_shared<CButton>(Point(10,  pos.h + 6), "hsbtns3.def", CButton::tooltip(), [=](){ abilities->moveToPrev(); }, EShortcut::SELECT_LEFT);
-		rightBtn = std::make_shared<CButton>(Point(411, pos.h + 6), "hsbtns5.def", CButton::tooltip(), [=](){ abilities->moveToNext(); }, EShortcut::SELECT_RIGHT);
+		leftBtn = std::make_shared<CButton>(Point(10,  pos.h + 6), "hsbtns3.def", CButton::tooltip(), [=](){ abilities->moveToPrev(); }, EShortcut::MOVE_LEFT);
+		rightBtn = std::make_shared<CButton>(Point(411, pos.h + 6), "hsbtns5.def", CButton::tooltip(), [=](){ abilities->moveToNext(); }, EShortcut::MOVE_RIGHT);
 
 		if(abilitiesCount <= 6)
 		{

+ 2 - 2
client/windows/CKingdomInterface.cpp

@@ -614,11 +614,11 @@ void CKingdomInterface::generateButtons()
 
 	//Main control buttons
 	btnHeroes = std::make_shared<CButton>(Point(748, 28+footerPos), "OVBUTN1.DEF", CButton::tooltip(CGI->generaltexth->overview[11], CGI->generaltexth->overview[6]),
-		std::bind(&CKingdomInterface::activateTab, this, 0), EShortcut::KINGDOM_HEROES);
+		std::bind(&CKingdomInterface::activateTab, this, 0), EShortcut::KINGDOM_HEROES_TAB);
 	btnHeroes->block(true);
 
 	btnTowns = std::make_shared<CButton>(Point(748, 64+footerPos), "OVBUTN6.DEF", CButton::tooltip(CGI->generaltexth->overview[12], CGI->generaltexth->overview[7]),
-		std::bind(&CKingdomInterface::activateTab, this, 1), EShortcut::KINGDOM_TOWNS);
+		std::bind(&CKingdomInterface::activateTab, this, 1), EShortcut::KINGDOM_TOWNS_TAB);
 
 	btnExit = std::make_shared<CButton>(Point(748,99+footerPos), "OVBUTN1.DEF", CButton::tooltip(CGI->generaltexth->allTexts[600]),
 		std::bind(&CKingdomInterface::close, this), EShortcut::GLOBAL_RETURN);

+ 1 - 1
client/windows/CQuestLog.cpp

@@ -128,7 +128,7 @@ CQuestLog::CQuestLog (const std::vector<QuestInfo> & Quests)
 	minimap = std::make_shared<CQuestMinimap>(Rect(12, 12, 169, 169));
 	// TextBox have it's own 4 pixel padding from top at least for English. To achieve 10px from both left and top only add 6px margin
 	description = std::make_shared<CTextBox>("", Rect(205, 18, 385, DESCRIPTION_HEIGHT_MAX), CSlider::BROWN, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE);
-	ok = std::make_shared<CButton>(Point(539, 398), "IOKAY.DEF", CGI->generaltexth->zelp[445], std::bind(&CQuestLog::close, this), EShortcut::GLOBAL_CONFIRM);
+	ok = std::make_shared<CButton>(Point(539, 398), "IOKAY.DEF", CGI->generaltexth->zelp[445], std::bind(&CQuestLog::close, this), EShortcut::GLOBAL_ACCEPT);
 	// Both button and lable are shifted to -2px by x and y to not make them actually look like they're on same line with quests list and ok button
 	hideCompleteButton = std::make_shared<CToggleButton>(Point(10, 396), "sysopchk.def", CButton::tooltipLocalized("vcmi.questLog.hideComplete"), std::bind(&CQuestLog::toggleComplete, this, _1));
 	hideCompleteLabel = std::make_shared<CLabel>(46, 398, FONT_MEDIUM, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->translate("vcmi.questLog.hideComplete.hover"));

+ 5 - 5
client/windows/CSpellWindow.cpp

@@ -418,16 +418,16 @@ void CSpellWindow::keyPressed(EShortcut key)
 			fexitb();
 			break;
 
-		case EShortcut::SELECT_LEFT:
+		case EShortcut::MOVE_LEFT:
 			fLcornerb();
 			break;
-		case EShortcut::SELECT_RIGHT:
+		case EShortcut::MOVE_RIGHT:
 			fRcornerb();
 			break;
-		case EShortcut::SELECT_UP:
-		case EShortcut::SELECT_DOWN:
+		case EShortcut::MOVE_UP:
+		case EShortcut::MOVE_DOWN:
 		{
-			bool down = key == EShortcut::SELECT_DOWN;
+			bool down = key == EShortcut::MOVE_DOWN;
 			static const int schoolsOrder[] = { 0, 3, 1, 2, 4 };
 			int index = -1;
 			while(schoolsOrder[++index] != selectedTab);

+ 18 - 18
client/windows/GUIClasses.cpp

@@ -212,7 +212,7 @@ CRecruitmentWindow::CRecruitmentWindow(const CGDwelling * Dwelling, int Level, c
 	slider = std::make_shared<CSlider>(Point(176,279),135,std::bind(&CRecruitmentWindow::sliderMoved,this, _1),0,0,0,true);
 
 	maxButton = std::make_shared<CButton>(Point(134, 313), "IRCBTNS.DEF", CGI->generaltexth->zelp[553], std::bind(&CSlider::moveToMax, slider), EShortcut::RECRUITMENT_MAX);
-	buyButton = std::make_shared<CButton>(Point(212, 313), "IBY6432.DEF", CGI->generaltexth->zelp[554], std::bind(&CRecruitmentWindow::buy, this), EShortcut::GLOBAL_CONFIRM);
+	buyButton = std::make_shared<CButton>(Point(212, 313), "IBY6432.DEF", CGI->generaltexth->zelp[554], std::bind(&CRecruitmentWindow::buy, this), EShortcut::GLOBAL_ACCEPT);
 	cancelButton = std::make_shared<CButton>(Point(290, 313), "ICN6432.DEF", CGI->generaltexth->zelp[555], std::bind(&CRecruitmentWindow::close, this), EShortcut::GLOBAL_CANCEL);
 
 	title = std::make_shared<CLabel>(243, 32, FONT_BIG, ETextAlignment::CENTER, Colors::YELLOW);
@@ -314,7 +314,7 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, i
 	int leftMax = total - rightMin;
 	int rightMax = total - leftMin;
 
-	ok = std::make_shared<CButton>(Point(20, 263), "IOK6432", CButton::tooltip(), std::bind(&CSplitWindow::apply, this), EShortcut::GLOBAL_CONFIRM);
+	ok = std::make_shared<CButton>(Point(20, 263), "IOK6432", CButton::tooltip(), std::bind(&CSplitWindow::apply, this), EShortcut::GLOBAL_ACCEPT);
 	cancel = std::make_shared<CButton>(Point(214, 263), "ICN6432", CButton::tooltip(), std::bind(&CSplitWindow::close, this), EShortcut::GLOBAL_CANCEL);
 
 	int sliderPosition = total - leftMin - rightMin;
@@ -404,7 +404,7 @@ CLevelWindow::CLevelWindow(const CGHeroInstance * hero, PrimarySkill::PrimarySki
 	}
 
 	portrait = std::make_shared<CAnimImage>("PortraitsLarge", hero->portrait, 0, 170, 66);
-	ok = std::make_shared<CButton>(Point(297, 413), "IOKAY", CButton::tooltip(), std::bind(&CLevelWindow::close, this), EShortcut::GLOBAL_CONFIRM);
+	ok = std::make_shared<CButton>(Point(297, 413), "IOKAY", CButton::tooltip(), std::bind(&CLevelWindow::close, this), EShortcut::GLOBAL_ACCEPT);
 
 	//%s has gained a level.
 	mainTitle = std::make_shared<CLabel>(192, 33, FONT_MEDIUM, ETextAlignment::CENTER, Colors::WHITE, boost::str(boost::format(CGI->generaltexth->allTexts[444]) % hero->getNameTranslated()));
@@ -461,7 +461,7 @@ CTavernWindow::CTavernWindow(const CGObjectInstance * TavernObj)
 
 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
 	cancel = std::make_shared<CButton>(Point(310, 428), "ICANCEL.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[7]), std::bind(&CTavernWindow::close, this), EShortcut::GLOBAL_CANCEL);
-	recruit = std::make_shared<CButton>(Point(272, 355), "TPTAV01.DEF", CButton::tooltip(), std::bind(&CTavernWindow::recruitb, this), EShortcut::GLOBAL_CONFIRM);
+	recruit = std::make_shared<CButton>(Point(272, 355), "TPTAV01.DEF", CButton::tooltip(), std::bind(&CTavernWindow::recruitb, this), EShortcut::GLOBAL_ACCEPT);
 	thiefGuild = std::make_shared<CButton>(Point(22, 428), "TPTAV02.DEF", CButton::tooltip(CGI->generaltexth->tavernInfo[5]), std::bind(&CTavernWindow::thievesguildb, this), EShortcut::ADVENTURE_THIEVES_GUILD);
 
 	if(LOCPLINT->cb->getResourceAmount(EGameResID::GOLD) < GameConstants::HERO_GOLD_COST) //not enough gold
@@ -983,7 +983,7 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
 		luck[b] = std::make_shared<MoraleLuckBox>(false,  Rect(Point(212 + 490 * b, 39), Point(32, 32)), true);
 	}
 
-	quit = std::make_shared<CButton>(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), EShortcut::GLOBAL_CONFIRM);
+	quit = std::make_shared<CButton>(Point(732, 567), "IOKAY.DEF", CGI->generaltexth->zelp[600], std::bind(&CExchangeWindow::close, this), EShortcut::GLOBAL_ACCEPT);
 	if(queryID.getNum() > 0)
 		quit->addCallback([=](){ LOCPLINT->cb->selectionMade(0, queryID); });
 
@@ -1100,7 +1100,7 @@ CShipyardWindow::CShipyardWindow(const TResources & cost, int state, BoatId boat
 	woodPic = std::make_shared<CAnimImage>("RESOURCE", GameResID(EGameResID::WOOD), 0, 196, 244);
 
 	quit = std::make_shared<CButton>(Point(224, 312), "ICANCEL", CButton::tooltip(CGI->generaltexth->allTexts[599]), std::bind(&CShipyardWindow::close, this), EShortcut::GLOBAL_CANCEL);
-	build = std::make_shared<CButton>(Point(42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), std::bind(&CShipyardWindow::close, this), EShortcut::GLOBAL_CONFIRM);
+	build = std::make_shared<CButton>(Point(42, 312), "IBUY30", CButton::tooltip(CGI->generaltexth->allTexts[598]), std::bind(&CShipyardWindow::close, this), EShortcut::GLOBAL_ACCEPT);
 	build->addCallback(onBuy);
 
 	for(GameResID i = EGameResID::WOOD; i <= EGameResID::GOLD; ++i)
@@ -1201,7 +1201,7 @@ CTransformerWindow::CTransformerWindow(const CGHeroInstance * _hero, const CGTow
 	}
 
 	all = std::make_shared<CButton>(Point(146, 416), "ALTARMY.DEF", CGI->generaltexth->zelp[590], [&](){ addAll(); }, EShortcut::RECRUITMENT_UPGRADE_ALL);
-	convert = std::make_shared<CButton>(Point(269, 416), "ALTSACR.DEF", CGI->generaltexth->zelp[591], [&](){ makeDeal(); }, EShortcut::GLOBAL_CONFIRM);
+	convert = std::make_shared<CButton>(Point(269, 416), "ALTSACR.DEF", CGI->generaltexth->zelp[591], [&](){ makeDeal(); }, EShortcut::GLOBAL_ACCEPT);
 	cancel = std::make_shared<CButton>(Point(392, 416), "ICANCEL.DEF", CGI->generaltexth->zelp[592], [&](){ close(); },EShortcut::GLOBAL_CANCEL);
 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
 
@@ -1316,7 +1316,7 @@ CUniversityWindow::CUniversityWindow(const CGHeroInstance * _hero, const IMarket
 	for(int i=0; i<goods.size(); i++)//prepare clickable items
 		items.push_back(std::make_shared<CItem>(this, goods[i], 54+i*104, 234));
 
-	cancel = std::make_shared<CButton>(Point(200, 313), "IOKAY.DEF", CGI->generaltexth->zelp[632], [&](){ close(); }, EShortcut::GLOBAL_CONFIRM);
+	cancel = std::make_shared<CButton>(Point(200, 313), "IOKAY.DEF", CGI->generaltexth->zelp[632], [&](){ close(); }, EShortcut::GLOBAL_ACCEPT);
 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
 }
 
@@ -1354,7 +1354,7 @@ CUnivConfirmWindow::CUnivConfirmWindow(CUniversityWindow * owner_, int SKILL, bo
 	boost::replace_first(text, "%s", CGI->skillh->getByIndex(SKILL)->getNameTranslated());
 	boost::replace_first(text, "%d", "2000");
 
-	confirm = std::make_shared<CButton>(Point(148, 299), "IBY6432.DEF", CButton::tooltip(hoverText, text), [=](){makeDeal(SKILL);}, EShortcut::GLOBAL_CONFIRM);
+	confirm = std::make_shared<CButton>(Point(148, 299), "IBY6432.DEF", CButton::tooltip(hoverText, text), [=](){makeDeal(SKILL);}, EShortcut::GLOBAL_ACCEPT);
 	confirm->block(!available);
 
 	cancel = std::make_shared<CButton>(Point(252,299), "ICANCEL.DEF", CGI->generaltexth->zelp[631], [&](){ close(); }, EShortcut::GLOBAL_CANCEL);
@@ -1377,7 +1377,7 @@ CGarrisonWindow::CGarrisonWindow(const CArmedInstance * up, const CGHeroInstance
 		auto split = std::make_shared<CButton>(Point(88, 314), "IDV6432.DEF", CButton::tooltip(CGI->generaltexth->tcommands[3], ""), [&](){ garr->splitClick(); } );
 		garr->addSplitBtn(split);
 	}
-	quit = std::make_shared<CButton>(Point(399, 314), "IOK6432.DEF", CButton::tooltip(CGI->generaltexth->tcommands[8], ""), [&](){ close(); }, EShortcut::GLOBAL_CONFIRM);
+	quit = std::make_shared<CButton>(Point(399, 314), "IOK6432.DEF", CButton::tooltip(CGI->generaltexth->tcommands[8], ""), [&](){ close(); }, EShortcut::GLOBAL_ACCEPT);
 
 	std::string titleText;
 	if(down->tempOwner == up->tempOwner)
@@ -1442,7 +1442,7 @@ CHillFortWindow::CHillFortWindow(const CGHeroInstance * visitor, const CGObjectI
 	for(auto image : { "APHLF4R.DEF", "APHLF4Y.DEF", "APHLF4G.DEF" })
 		upgradeAll->addImage(image);
 
-	quit = std::make_shared<CButton>(Point(294, 275), "IOKAY.DEF", CButton::tooltip(), std::bind(&CHillFortWindow::close, this), EShortcut::GLOBAL_CONFIRM);
+	quit = std::make_shared<CButton>(Point(294, 275), "IOKAY.DEF", CButton::tooltip(), std::bind(&CHillFortWindow::close, this), EShortcut::GLOBAL_ACCEPT);
 	statusbar = CGStatusBar::create(std::make_shared<CPicture>(background->getSurface(), Rect(8, pos.h - 26, pos.w - 16, 19), 8, pos.h - 26));
 
 	garr = std::make_shared<CGarrisonInt>(108, 60, 18, Point(), hero, nullptr);
@@ -1827,7 +1827,7 @@ void CObjectListWindow::init(std::shared_ptr<CIntObject> titleWidget_, std::stri
 		Point(14, 151), Point(0, 25), 9, items.size(), 0, 1, Rect(262, -32, 256, 256) );
 	list->type |= REDRAW_PARENT;
 
-	ok = std::make_shared<CButton>(Point(15, 402), "IOKAY.DEF", CButton::tooltip(), std::bind(&CObjectListWindow::elementSelected, this), EShortcut::GLOBAL_CONFIRM);
+	ok = std::make_shared<CButton>(Point(15, 402), "IOKAY.DEF", CButton::tooltip(), std::bind(&CObjectListWindow::elementSelected, this), EShortcut::GLOBAL_ACCEPT);
 	ok->block(!list->size());
 }
 
@@ -1881,22 +1881,22 @@ void CObjectListWindow::keyPressed (EShortcut key)
 
 	switch(key)
 	{
-	break; case EShortcut::SELECT_UP:
+	break; case EShortcut::MOVE_UP:
 		sel -=1;
 
-	break; case EShortcut::SELECT_DOWN:
+	break; case EShortcut::MOVE_DOWN:
 		sel +=1;
 
-	break; case EShortcut::SELECT_PAGE_UP:
+	break; case EShortcut::MOVE_PAGE_UP:
 		sel -=9;
 
-	break; case EShortcut::SELECT_PAGE_DOWN:
+	break; case EShortcut::MOVE_PAGE_DOWN:
 		sel +=9;
 
-	break; case EShortcut::SELECT_FIRST:
+	break; case EShortcut::MOVE_FIRST:
 		sel = 0;
 
-	break; case EShortcut::SELECT_LAST:
+	break; case EShortcut::MOVE_LAST:
 		sel = static_cast<int>(items.size());
 
 	break; default:

+ 9 - 0
client/windows/InfoWindows.cpp

@@ -135,6 +135,15 @@ CInfoWindow::CInfoWindow(std::string Text, PlayerColor player, const TCompsInfo
 		text->resize(text->label->textSize);
 	}
 
+	if(buttons.size() == 1)
+		buttons.front()->assignedKey = EShortcut::GLOBAL_RETURN;
+
+	if(buttons.size() == 2)
+	{
+		buttons.front()->assignedKey = EShortcut::GLOBAL_ACCEPT;
+		buttons.back()->assignedKey = EShortcut::GLOBAL_CANCEL;
+	}
+
 	for(auto & comp : comps)
 	{
 		comp->recActions = 0xff & ~DISPOSE;

+ 1 - 1
client/windows/QuickRecruitmentWindow.cpp

@@ -36,7 +36,7 @@ void QuickRecruitmentWindow::setCancelButton()
 
 void QuickRecruitmentWindow::setBuyButton()
 {
-	buyButton = std::make_shared<CButton>(Point((pos.w / 2) - 32, 418), "IBY6432.DEF", CButton::tooltip(), [&](){ purchaseUnits(); }, EShortcut::GLOBAL_CONFIRM);
+	buyButton = std::make_shared<CButton>(Point((pos.w / 2) - 32, 418), "IBY6432.DEF", CButton::tooltip(), [&](){ purchaseUnits(); }, EShortcut::GLOBAL_ACCEPT);
 	buyButton->setImageOrder(0, 1, 2, 3);
 }