From 86f0f97e22d845e3cfa58b0fa609bac0e4fe8c1d Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sat, 21 Jun 2014 22:03:50 +0200 Subject: [PATCH 1/3] add const --- src/font.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/font.cpp b/src/font.cpp index c6363a53778c..7c6a01a1c698 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -1217,10 +1217,10 @@ void undraw_floating_labels(surface screen) } -static bool add_font_to_fontlist(config &fonts_config, +static bool add_font_to_fontlist(const config &fonts_config, std::vector& fontlist, const std::string& name) { - config &font = fonts_config.find_child("font", "name", name); + const config &font = fonts_config.find_child("font", "name", name); if (!font) return false; @@ -1272,7 +1272,7 @@ bool load_font_config() return false; } - config &fonts_config = cfg.child("fonts"); + const config &fonts_config = cfg.child("fonts"); if (!fonts_config) return false; From 7e3ba43934af27c5600b4530ca368695e164e2d5 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sat, 21 Jun 2014 22:04:23 +0200 Subject: [PATCH 2/3] use std::bitset instead of vector for hotkey scope. --- src/hotkey/hotkey_command.cpp | 4 ++-- src/hotkey/hotkey_command.hpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hotkey/hotkey_command.cpp b/src/hotkey/hotkey_command.cpp index 0d170695fabc..7524bc2fdd38 100644 --- a/src/hotkey/hotkey_command.cpp +++ b/src/hotkey/hotkey_command.cpp @@ -264,7 +264,7 @@ boost::ptr_vector known_hotkeys; std::map command_map_; // -std::vector scope_active_(hotkey::SCOPE_COUNT, false); +hotkey::hk_scopes scope_active_(0); } @@ -275,7 +275,7 @@ scope_changer::scope_changer() scope_changer::~scope_changer() { - scope_active_.swap(prev_scope_active_); + scope_active_ = prev_scope_active_; } diff --git a/src/hotkey/hotkey_command.hpp b/src/hotkey/hotkey_command.hpp index bc34b6723f4b..69e0a797ea2c 100644 --- a/src/hotkey/hotkey_command.hpp +++ b/src/hotkey/hotkey_command.hpp @@ -19,6 +19,7 @@ #include "tstring.hpp" #include "boost/ptr_container/ptr_vector.hpp" +#include class config; namespace hotkey { @@ -181,6 +182,8 @@ enum HOTKEY_COMMAND { HOTKEY_NULL }; +typedef std::bitset hk_scopes; + /// Stores all information related to functions that can be bound to hotkeys. /// this is currently a semi struct: it haves a constructor, but only const-public members. struct hotkey_command { @@ -234,7 +237,7 @@ class scope_changer { scope_changer(); ~scope_changer(); private: - std::vector prev_scope_active_; + hk_scopes prev_scope_active_; }; /// returns a container that contains all currently active hotkey_commands. From 436be9a306030b8a3c7dd6c08c7c5525309da58f Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Sat, 21 Jun 2014 23:44:24 +0200 Subject: [PATCH 3/3] more flexible hotkey scopes there are some hotkeys that are senseful in editor and in game but not in teh main menu, so now instead of having hotkeys eigher in GAME, EDITOR, MAIN_MENU or GENERAL we now allow any combination of the first 3. this is also intended to fix a bug in add_hotkey() if new_scope == hotkey::SCOPE_COUNT where new hotkeys doesn't correctly overwrite other scoped hotkeys. --- src/editor/editor_main.cpp | 1 - src/game_config_manager.cpp | 1 - src/hotkey/hotkey_command.cpp | 425 +++++++++++----------- src/hotkey/hotkey_command.hpp | 14 +- src/hotkey/hotkey_item.cpp | 9 +- src/hotkey/hotkey_preferences_display.cpp | 39 +- src/play_controller.cpp | 1 - src/tests/utils/game_config_manager.cpp | 1 - 8 files changed, 245 insertions(+), 246 deletions(-) diff --git a/src/editor/editor_main.cpp b/src/editor/editor_main.cpp index c5dfca85d12a..6085cc2bf203 100644 --- a/src/editor/editor_main.cpp +++ b/src/editor/editor_main.cpp @@ -33,7 +33,6 @@ EXIT_STATUS start(const config& game_conf, CVideo& video, const std::string& fil try { hotkey::scope_changer h_; hotkey::deactivate_all_scopes(); - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_EDITOR); editor_controller editor(game_conf, video); if (!filename.empty()) { diff --git a/src/game_config_manager.cpp b/src/game_config_manager.cpp index e1c4e872925d..0bf8ced1601d 100644 --- a/src/game_config_manager.cpp +++ b/src/game_config_manager.cpp @@ -81,7 +81,6 @@ bool game_config_manager::init_game_config(FORCE_RELOAD_CONFIG force_reload) game_config::load_config(game_config_.child("game_config")); hotkey::deactivate_all_scopes(); - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_MAIN_MENU); hotkey::load_hotkeys(game_config(), true); diff --git a/src/hotkey/hotkey_command.cpp b/src/hotkey/hotkey_command.cpp index 7524bc2fdd38..a52f9918a0b6 100644 --- a/src/hotkey/hotkey_command.cpp +++ b/src/hotkey/hotkey_command.cpp @@ -31,226 +31,229 @@ static lg::log_domain log_config("config"); namespace { - + //make them global ? + hotkey::hk_scopes scope_game(1 << hotkey::SCOPE_GAME); + hotkey::hk_scopes scope_editor(1 << hotkey::SCOPE_EDITOR); + hotkey::hk_scopes scope_main(1 << hotkey::SCOPE_MAIN_MENU); // this contains all static hotkeys hotkey::hotkey_command_temp hotkey_list_[] = { - { hotkey::HOTKEY_CANCEL, N_("cancel"), N_("Cancel"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_SELECT_HEX, "selecthex", N_("Select Hex"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_DESELECT_HEX, "deselecthex", N_("Deselect Hex"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_MOVE_ACTION, "moveaction", N_("Move/Attack"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SELECT_AND_ACTION, "selectmoveaction", N_("Select/Move/Attack"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_ANIMATE_MAP, "animatemap", N_("Animate Map"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_CYCLE_UNITS, "cycle", N_("Next Unit"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_CYCLE_BACK_UNITS, "cycleback", N_("Previous Unit"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_UNIT_HOLD_POSITION, "holdposition", N_("Hold Position"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_END_UNIT_TURN, "endunitturn", N_("End Unit Turn"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_LEADER, "leader", N_("Leader"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_UNDO, "undo", N_("Undo"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_REDO, "redo", N_("Redo"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_ZOOM_IN, "zoomin", N_("Zoom In"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_ZOOM_OUT, "zoomout", N_("Zoom Out"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_ZOOM_DEFAULT, "zoomdefault", N_("Default Zoom"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_FULLSCREEN, "fullscreen", N_("Toggle Full Screen"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_SCREENSHOT, "screenshot", N_("Screenshot"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_MAP_SCREENSHOT, "mapscreenshot", N_("Map Screenshot"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_ACCELERATED, "accelerated", N_("Accelerated"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_TERRAIN_DESCRIPTION, "describeterrain", N_("Terrain Description"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_UNIT_DESCRIPTION, "describeunit", N_("Unit Description"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_RENAME_UNIT, "renameunit", N_("Rename Unit"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_DELETE_UNIT, "editor-deleteunit", N_("Delete Unit"), false, hotkey::SCOPE_GENERAL, "" }, - - { hotkey::HOTKEY_SAVE_GAME, "save", N_("Save Game"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SAVE_REPLAY, "savereplay", N_("Save Replay"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SAVE_MAP, "savemap", N_("Save Map"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_LOAD_GAME, "load", N_("Load Game"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_RECRUIT, "recruit", N_("Recruit"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPEAT_RECRUIT, "repeatrecruit", N_("Repeat Recruit"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_RECALL, "recall", N_("Recall"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_ENDTURN, "endturn", N_("End Turn"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_TOGGLE_ELLIPSES, "toggleellipses", N_("Toggle Ellipses"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_TOGGLE_GRID, "togglegrid", N_("Toggle Grid"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_MOUSE_SCROLL, "mousescroll", N_("Mouse Scrolling"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_STATUS_TABLE, "statustable", N_("Status Table"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_MUTE, "mute", N_("Mute"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_SPEAK, "speak", N_("Speak"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_CREATE_UNIT, "createunit", N_("Create Unit (Debug!)"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_CHANGE_SIDE, "changeside", N_("Change Side (Debug!)"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_KILL_UNIT, "killunit", N_("Kill Unit (Debug!)"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_PREFERENCES, "preferences", N_("Preferences"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_OBJECTIVES, "objectives", N_("Scenario Objectives"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_UNIT_LIST, "unitlist", N_("Unit List"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_STATISTICS, "statistics", N_("Statistics"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_STOP_NETWORK, "stopnetwork", N_("Pause Network Game"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_START_NETWORK, "startnetwork", N_("Continue Network Game"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_QUIT_GAME, "quit", N_("Quit Game"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_QUIT_GAME, "quit-editor", N_("Quit Editor"), true, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_LABEL_TEAM_TERRAIN, "labelteamterrain", N_("Set Team Label"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_LABEL_TERRAIN, "labelterrain", N_("Set Label"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_CLEAR_LABELS, "clearlabels", N_("Clear Labels"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SHOW_ENEMY_MOVES, "showenemymoves", N_("Show Enemy Moves"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_BEST_ENEMY_MOVES, "bestenemymoves", N_("Best Possible Enemy Moves"), false, hotkey::SCOPE_GAME, "" }, - - { hotkey::HOTKEY_REPLAY_PLAY, "playreplay", N_("Play Replay"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_RESET, "resetreplay", N_("Reset Replay"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_STOP, "stopreplay", N_("Stop Replay"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_NEXT_TURN, "replaynextturn", N_("Next Turn"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_NEXT_SIDE, "replaynextside", N_("Next Side"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_SHOW_EVERYTHING, "replayshoweverything", N_("Full Map"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_SHOW_EACH, "replayshoweach", N_("Each Team"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_SHOW_TEAM1, "replayshowteam1", N_("Team 1"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_REPLAY_SKIP_ANIMATION, "replayskipanimation", N_("Skip Animation"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_CANCEL, N_("cancel"), N_("Cancel"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_SELECT_HEX, "selecthex", N_("Select Hex"), false, scope_game, "" }, + { hotkey::HOTKEY_DESELECT_HEX, "deselecthex", N_("Deselect Hex"), false, scope_game, "" }, + { hotkey::HOTKEY_MOVE_ACTION, "moveaction", N_("Move/Attack"), false, scope_game, "" }, + { hotkey::HOTKEY_SELECT_AND_ACTION, "selectmoveaction", N_("Select/Move/Attack"), false, scope_game, "" }, + { hotkey::HOTKEY_ANIMATE_MAP, "animatemap", N_("Animate Map"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_CYCLE_UNITS, "cycle", N_("Next Unit"), false, scope_game, "" }, + { hotkey::HOTKEY_CYCLE_BACK_UNITS, "cycleback", N_("Previous Unit"), false, scope_game, "" }, + { hotkey::HOTKEY_UNIT_HOLD_POSITION, "holdposition", N_("Hold Position"), false, scope_game, "" }, + { hotkey::HOTKEY_END_UNIT_TURN, "endunitturn", N_("End Unit Turn"), false, scope_game, "" }, + { hotkey::HOTKEY_LEADER, "leader", N_("Leader"), false, scope_game, "" }, + { hotkey::HOTKEY_UNDO, "undo", N_("Undo"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_REDO, "redo", N_("Redo"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_ZOOM_IN, "zoomin", N_("Zoom In"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_ZOOM_OUT, "zoomout", N_("Zoom Out"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_ZOOM_DEFAULT, "zoomdefault", N_("Default Zoom"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_FULLSCREEN, "fullscreen", N_("Toggle Full Screen"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_SCREENSHOT, "screenshot", N_("Screenshot"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_MAP_SCREENSHOT, "mapscreenshot", N_("Map Screenshot"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_ACCELERATED, "accelerated", N_("Accelerated"), false, scope_game, "" }, + { hotkey::HOTKEY_TERRAIN_DESCRIPTION, "describeterrain", N_("Terrain Description"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_UNIT_DESCRIPTION, "describeunit", N_("Unit Description"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_RENAME_UNIT, "renameunit", N_("Rename Unit"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_DELETE_UNIT, "editor-deleteunit", N_("Delete Unit"), false, scope_game | scope_editor | scope_main, "" }, + + { hotkey::HOTKEY_SAVE_GAME, "save", N_("Save Game"), false, scope_game, "" }, + { hotkey::HOTKEY_SAVE_REPLAY, "savereplay", N_("Save Replay"), false, scope_game, "" }, + { hotkey::HOTKEY_SAVE_MAP, "savemap", N_("Save Map"), false, scope_game, "" }, + { hotkey::HOTKEY_LOAD_GAME, "load", N_("Load Game"), false, scope_game, "" }, + { hotkey::HOTKEY_RECRUIT, "recruit", N_("Recruit"), false, scope_game, "" }, + { hotkey::HOTKEY_REPEAT_RECRUIT, "repeatrecruit", N_("Repeat Recruit"), false, scope_game, "" }, + { hotkey::HOTKEY_RECALL, "recall", N_("Recall"), false, scope_game, "" }, + { hotkey::HOTKEY_ENDTURN, "endturn", N_("End Turn"), false, scope_game, "" }, + { hotkey::HOTKEY_TOGGLE_ELLIPSES, "toggleellipses", N_("Toggle Ellipses"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_TOGGLE_GRID, "togglegrid", N_("Toggle Grid"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_MOUSE_SCROLL, "mousescroll", N_("Mouse Scrolling"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_STATUS_TABLE, "statustable", N_("Status Table"), false, scope_game, "" }, + { hotkey::HOTKEY_MUTE, "mute", N_("Mute"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_SPEAK, "speak", N_("Speak"), false, scope_game, "" }, + { hotkey::HOTKEY_CREATE_UNIT, "createunit", N_("Create Unit (Debug!)"), false, scope_game, "" }, + { hotkey::HOTKEY_CHANGE_SIDE, "changeside", N_("Change Side (Debug!)"), false, scope_game, "" }, + { hotkey::HOTKEY_KILL_UNIT, "killunit", N_("Kill Unit (Debug!)"), false, scope_game, "" }, + { hotkey::HOTKEY_PREFERENCES, "preferences", N_("Preferences"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_OBJECTIVES, "objectives", N_("Scenario Objectives"), false, scope_game, "" }, + { hotkey::HOTKEY_UNIT_LIST, "unitlist", N_("Unit List"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_STATISTICS, "statistics", N_("Statistics"), false, scope_game, "" }, + { hotkey::HOTKEY_STOP_NETWORK, "stopnetwork", N_("Pause Network Game"), false, scope_game, "" }, + { hotkey::HOTKEY_START_NETWORK, "startnetwork", N_("Continue Network Game"), false, scope_game, "" }, + { hotkey::HOTKEY_QUIT_GAME, "quit", N_("Quit Game"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_QUIT_GAME, "quit-editor", N_("Quit Editor"), true, scope_editor, "" }, + { hotkey::HOTKEY_LABEL_TEAM_TERRAIN, "labelteamterrain", N_("Set Team Label"), false, scope_game, "" }, + { hotkey::HOTKEY_LABEL_TERRAIN, "labelterrain", N_("Set Label"), false, scope_game, "" }, + { hotkey::HOTKEY_CLEAR_LABELS, "clearlabels", N_("Clear Labels"), false, scope_game, "" }, + { hotkey::HOTKEY_SHOW_ENEMY_MOVES, "showenemymoves", N_("Show Enemy Moves"), false, scope_game, "" }, + { hotkey::HOTKEY_BEST_ENEMY_MOVES, "bestenemymoves", N_("Best Possible Enemy Moves"), false, scope_game, "" }, + + { hotkey::HOTKEY_REPLAY_PLAY, "playreplay", N_("Play Replay"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_RESET, "resetreplay", N_("Reset Replay"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_STOP, "stopreplay", N_("Stop Replay"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_NEXT_TURN, "replaynextturn", N_("Next Turn"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_NEXT_SIDE, "replaynextside", N_("Next Side"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_SHOW_EVERYTHING, "replayshoweverything", N_("Full Map"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_SHOW_EACH, "replayshoweach", N_("Each Team"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_SHOW_TEAM1, "replayshowteam1", N_("Team 1"), false, scope_game, "" }, + { hotkey::HOTKEY_REPLAY_SKIP_ANIMATION, "replayskipanimation", N_("Skip Animation"), false, scope_game, "" }, // Whiteboard commands // TRANSLATORS: whiteboard menu entry: toggle planning mode - { hotkey::HOTKEY_WB_TOGGLE, "wbtoggle", N_("whiteboard^Planning Mode"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_TOGGLE, "wbtoggle", N_("whiteboard^Planning Mode"), false, scope_game, "" }, // TRANSLATORS: whiteboard menu entry: execute planned action - { hotkey::HOTKEY_WB_EXECUTE_ACTION, "wbexecuteaction", N_("whiteboard^Execute Action"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_EXECUTE_ACTION, "wbexecuteaction", N_("whiteboard^Execute Action"), false, scope_game, "" }, // TRANSLATORS: whiteboard menu entry: execute all planned actions - { hotkey::HOTKEY_WB_EXECUTE_ALL_ACTIONS, "wbexecuteallactions", N_("whiteboard^Execute All Actions"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_EXECUTE_ALL_ACTIONS, "wbexecuteallactions", N_("whiteboard^Execute All Actions"), false, scope_game, "" }, // TRANSLATORS: whiteboard menu entry: delete planned action - { hotkey::HOTKEY_WB_DELETE_ACTION, "wbdeleteaction", N_("whiteboard^Delete Action"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_DELETE_ACTION, "wbdeleteaction", N_("whiteboard^Delete Action"), false, scope_game, "" }, // TRANSLATORS: whiteboard menu entry: move planned action up queue - { hotkey::HOTKEY_WB_BUMP_UP_ACTION, "wbbumpupaction", N_("whiteboard^Move Action Up"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_BUMP_UP_ACTION, "wbbumpupaction", N_("whiteboard^Move Action Up"), false, scope_game, "" }, // TRANSLATORS: whiteboard menu entry: move planned action down queue - { hotkey::HOTKEY_WB_BUMP_DOWN_ACTION, "wbbumpdownaction", N_("whiteboard^Move Action Down"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_BUMP_DOWN_ACTION, "wbbumpdownaction", N_("whiteboard^Move Action Down"), false, scope_game, "" }, // TRANSLATORS: whiteboard menu entry: plan as though the chosen unit were dead - { hotkey::HOTKEY_WB_SUPPOSE_DEAD, "wbsupposedead", N_("whiteboard^Suppose Dead"), false, hotkey::SCOPE_GAME, "" }, + { hotkey::HOTKEY_WB_SUPPOSE_DEAD, "wbsupposedead", N_("whiteboard^Suppose Dead"), false, scope_game, "" }, - { hotkey::HOTKEY_EDITOR_QUIT_TO_DESKTOP, "editor-quit-to-desktop", N_("Quit to Desktop"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_CLOSE, "editor-close-map", N_("Close Map"), false, hotkey::SCOPE_EDITOR, "" }, + { hotkey::HOTKEY_EDITOR_QUIT_TO_DESKTOP, "editor-quit-to-desktop", N_("Quit to Desktop"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_CLOSE, "editor-close-map", N_("Close Map"), false, scope_editor, "" }, // These are not really hotkey items but menu entries to get expanded. // They need to have their own hotkey to control their active state. - { hotkey::HOTKEY_EDITOR_PLAYLIST, "editor-playlist", N_("Switch Time of Day"), true, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_SWITCH, "editor-switch-map", N_("Switch Map"), true, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_LOCAL_TIME, "menu-editor-local-time", N_("Assign Local Time"), true, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_CUSTOM_TODS, "editor-custom-tods", N_("Custom Time of Day Creator"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_PARTIAL_UNDO, "editor-partial-undo", N_("Partial Undo"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_NEW, "editor-map-new", N_("New Map"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SCENARIO_NEW, "editor-scenario-new", N_("New Scenario"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_LOAD, "editor-map-load", N_("Load Map"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_SAVE, "editor-map-save", N_("Save Map"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_SAVE_AS, "editor-map-save-as", N_("Save Map As"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SCENARIO_SAVE_AS, "editor-scenario-save-as", N_("Save Scenario As"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_SAVE_ALL, "editor-map-save-all", N_("Save All Maps"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_REVERT, "editor-map-revert", N_("Revert All Changes"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_INFO, "editor-map-info", N_("Map Information"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_PALETTE_ITEMS_CLEAR, "editor-palette-items-clear", N_("Clear Selected Item Set"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_PALETTE_ITEM_SWAP, "editor-terrain-palette-swap", N_("Swap Foreground/Background Palette Item"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_PALETTE_GROUPS, "editor-palette-groups", N_("Change Palette Group"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_PALETTE_UPSCROLL, "editor-palette-upscroll", N_("Scroll Palette Left"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_PALETTE_DOWNSCROLL, "editor-palette-downscroll", N_("Scroll Palette Right"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_SIDE_NEW, "editor-side-new", N_("Add New Side"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_TOOL_NEXT, "editor-tool-next", N_("Next Tool"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_TOOL_PAINT, "editor-tool-paint", N_("Paint Tool"), false, hotkey::SCOPE_EDITOR, N_("Use left/right mouse button to draw fore-/background terrain. Hold Shift to paint base layer only. Ctrl+click to sample terrain under cursor.") }, - { hotkey::HOTKEY_EDITOR_TOOL_FILL, "editor-tool-fill", N_("Fill Tool"), false, hotkey::SCOPE_EDITOR, N_("Use left/right mouse button to draw fore-/background terrain. Hold Shift to paint base layer only. Ctrl+click to sample terrain under cursor.") }, - { hotkey::HOTKEY_EDITOR_TOOL_SELECT, "editor-tool-select", N_("Selection Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button selects or deselects with Ctrl, right brings up a context menu. Hold Shift for magic-wand selection of tiles with same terrain.") }, - { hotkey::HOTKEY_EDITOR_TOOL_STARTING_POSITION, "editor-tool-starting-position", N_("Starting Positions Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button displays player selection, right clears. Number keys scroll to the starting position, alt+number sets respective starting position under cursor, delete clears.") }, - { hotkey::HOTKEY_EDITOR_TOOL_LABEL, "editor-tool-label", N_("Label Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button sets or drags a label, right clears.") }, - { hotkey::HOTKEY_EDITOR_TOOL_UNIT, "editor-tool-unit", N_("Unit Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button sets a new unit or moves a unit via drag and drop, right brings up a context menu. Needs a defined side.") }, - { hotkey::HOTKEY_EDITOR_TOOL_ITEM, "editor-tool-item", N_("Item Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button sets a new item or moves it via drag and drop, right clears. Not implemented yet.") }, - { hotkey::HOTKEY_EDITOR_TOOL_SOUNDSOURCE, "editor-tool-soundsource", N_("Sound Source Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button sets or drags a sound source, right clears. Not implemented yet.") }, - { hotkey::HOTKEY_EDITOR_TOOL_VILLAGE, "editor-tool-village", N_("Village Tool"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button sets the village ownership to the current side, right clears. Needs a defined side.") }, - - { hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, "editor-toggle-canrecruit", N_("Can Recruit"), false, hotkey::SCOPE_EDITOR, N_("Toggle the recruit attribute of a unit.") }, - { hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, "editor-toggle-renameable", N_("Can be Renamed"), false, hotkey::SCOPE_EDITOR, N_("Toggle the unit being renameable.") }, - { hotkey::HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN, "editor-unit-recruit", N_("Assign Recruit List"), false, hotkey::SCOPE_EDITOR, N_("Assign the selected unit set as recruit list to the unit.") }, - - { hotkey::HOTKEY_EDITOR_UNIT_CHANGE_ID, "editor-change-unitid", N_("Change Unit ID"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, "editor-unit-toggle-loyal", N_("Loyal"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_UNIT_FACING, "menu-unit-facing", "", true, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_MINIMAP_CODING_UNIT, "minimap-unit-coding", N_("Toggle Minimap Unit Coding"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_MINIMAP_CODING_TERRAIN, "minimap-terrain-coding", N_("Toggle Minimap Terrain Coding"), false, hotkey::SCOPE_GENERAL, "" }, - - { hotkey::HOTKEY_MINIMAP_DRAW_UNITS, "minimap-draw-units", N_("Toggle Minimap Unit Drawing"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES, "minimap-draw-villages", N_("Toggle Minimap Village Drawing"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_MINIMAP_DRAW_TERRAIN, "minimap-draw-terrain", N_("Toggle Minimap Terrain Drawing"), false, hotkey::SCOPE_GENERAL, "" }, - - { hotkey::HOTKEY_EDITOR_BRUSH_NEXT, "editor-brush-next", N_("Next Brush"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_BRUSH_DEFAULT, "editor-brush-default", N_("Default Brush"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_BRUSH_1, "editor-brush-1", N_("Single Tile"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_BRUSH_2, "editor-brush-2", N_("Radius One"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_BRUSH_3, "editor-brush-3", N_("Radius Two"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_BRUSH_NW_SE, "editor-brush-nw-se", N_("Brush NW-SE"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_BRUSH_SW_NE, "editor-brush-sw-ne", N_("Brush SW-NE"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_SELECTION_CUT, "editor-cut", N_("Cut"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECTION_COPY, "editor-copy", N_("Copy"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_CLIPBOARD_PASTE, "editor-paste", N_("Paste"), false, hotkey::SCOPE_EDITOR, N_("Left mouse button pastes from the clipboard, right brings up a context menu.") }, - { hotkey::HOTKEY_EDITOR_SELECTION_EXPORT, "editor-export-selection-coords", N_("Export Selected Coordinates to System Clipboard"), true, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECT_ALL, "editor-select-all", N_("Select All"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECT_INVERSE, "editor-select-inverse", N_("Select Inverse"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECT_NONE, "editor-select-none", N_("Select None"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, "editor-clipboard-rotate-cw", N_("Rotate Clipboard Clockwise"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW, "editor-clipboard-rotate-ccw", N_("Rotate Clipboard Counter-Clockwise"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, "editor-clipboard-flip-horizontal", N_("Flip Clipboard Horizontally"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, "editor-clipboard-flip-vertical", N_("Flip Clipboard Vertically"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECTION_ROTATE, "editor-selection-rotate", N_("Rotate Selection"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECTION_FLIP, "editor-selection-flip", N_("Flip Selection"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECTION_FILL, "editor-selection-fill", N_("Fill Selection"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECTION_GENERATE, "editor-selection-generate", N_("Generate Tiles in Selection"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SELECTION_RANDOMIZE, "editor-selection-randomize", N_("Randomize Tiles in Selection"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_RESIZE, "editor-map-resize", N_("Resize Map"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_ROTATE, "editor-map-rotate", N_("Rotate Map"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_GENERATE, "editor-map-generate", N_("Generate Map"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_APPLY_MASK, "editor-map-apply-mask", N_("Apply a Mask"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_MAP_CREATE_MASK_TO, "editor-map-create-mask-to", N_("Create Mask"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_REFRESH, "editor-refresh", N_("Refresh Display"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_UPDATE_TRANSITIONS, "editor-update-transitions", N_("Update Terrain Transitions"), false, hotkey::SCOPE_EDITOR, "" }, + { hotkey::HOTKEY_EDITOR_PLAYLIST, "editor-playlist", N_("Switch Time of Day"), true, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_SWITCH, "editor-switch-map", N_("Switch Map"), true, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_LOCAL_TIME, "menu-editor-local-time", N_("Assign Local Time"), true, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_CUSTOM_TODS, "editor-custom-tods", N_("Custom Time of Day Creator"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_PARTIAL_UNDO, "editor-partial-undo", N_("Partial Undo"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_NEW, "editor-map-new", N_("New Map"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SCENARIO_NEW, "editor-scenario-new", N_("New Scenario"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_LOAD, "editor-map-load", N_("Load Map"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_SAVE, "editor-map-save", N_("Save Map"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_SAVE_AS, "editor-map-save-as", N_("Save Map As"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SCENARIO_SAVE_AS, "editor-scenario-save-as", N_("Save Scenario As"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_SAVE_ALL, "editor-map-save-all", N_("Save All Maps"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_REVERT, "editor-map-revert", N_("Revert All Changes"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_INFO, "editor-map-info", N_("Map Information"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_PALETTE_ITEMS_CLEAR, "editor-palette-items-clear", N_("Clear Selected Item Set"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_PALETTE_ITEM_SWAP, "editor-terrain-palette-swap", N_("Swap Foreground/Background Palette Item"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_PALETTE_GROUPS, "editor-palette-groups", N_("Change Palette Group"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_PALETTE_UPSCROLL, "editor-palette-upscroll", N_("Scroll Palette Left"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_PALETTE_DOWNSCROLL, "editor-palette-downscroll", N_("Scroll Palette Right"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_SIDE_NEW, "editor-side-new", N_("Add New Side"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_TOOL_NEXT, "editor-tool-next", N_("Next Tool"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_TOOL_PAINT, "editor-tool-paint", N_("Paint Tool"), false, scope_editor, N_("Use left/right mouse button to draw fore-/background terrain. Hold Shift to paint base layer only. Ctrl+click to sample terrain under cursor.") }, + { hotkey::HOTKEY_EDITOR_TOOL_FILL, "editor-tool-fill", N_("Fill Tool"), false, scope_editor, N_("Use left/right mouse button to draw fore-/background terrain. Hold Shift to paint base layer only. Ctrl+click to sample terrain under cursor.") }, + { hotkey::HOTKEY_EDITOR_TOOL_SELECT, "editor-tool-select", N_("Selection Tool"), false, scope_editor, N_("Left mouse button selects or deselects with Ctrl, right brings up a context menu. Hold Shift for magic-wand selection of tiles with same terrain.") }, + { hotkey::HOTKEY_EDITOR_TOOL_STARTING_POSITION, "editor-tool-starting-position", N_("Starting Positions Tool"), false, scope_editor, N_("Left mouse button displays player selection, right clears. Number keys scroll to the starting position, alt+number sets respective starting position under cursor, delete clears.") }, + { hotkey::HOTKEY_EDITOR_TOOL_LABEL, "editor-tool-label", N_("Label Tool"), false, scope_editor, N_("Left mouse button sets or drags a label, right clears.") }, + { hotkey::HOTKEY_EDITOR_TOOL_UNIT, "editor-tool-unit", N_("Unit Tool"), false, scope_editor, N_("Left mouse button sets a new unit or moves a unit via drag and drop, right brings up a context menu. Needs a defined side.") }, + { hotkey::HOTKEY_EDITOR_TOOL_ITEM, "editor-tool-item", N_("Item Tool"), false, scope_editor, N_("Left mouse button sets a new item or moves it via drag and drop, right clears. Not implemented yet.") }, + { hotkey::HOTKEY_EDITOR_TOOL_SOUNDSOURCE, "editor-tool-soundsource", N_("Sound Source Tool"), false, scope_editor, N_("Left mouse button sets or drags a sound source, right clears. Not implemented yet.") }, + { hotkey::HOTKEY_EDITOR_TOOL_VILLAGE, "editor-tool-village", N_("Village Tool"), false, scope_editor, N_("Left mouse button sets the village ownership to the current side, right clears. Needs a defined side.") }, + + { hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, "editor-toggle-canrecruit", N_("Can Recruit"), false, scope_editor, N_("Toggle the recruit attribute of a unit.") }, + { hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, "editor-toggle-renameable", N_("Can be Renamed"), false, scope_editor, N_("Toggle the unit being renameable.") }, + { hotkey::HOTKEY_EDITOR_UNIT_RECRUIT_ASSIGN, "editor-unit-recruit", N_("Assign Recruit List"), false, scope_editor, N_("Assign the selected unit set as recruit list to the unit.") }, + + { hotkey::HOTKEY_EDITOR_UNIT_CHANGE_ID, "editor-change-unitid", N_("Change Unit ID"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, "editor-unit-toggle-loyal", N_("Loyal"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_UNIT_FACING, "menu-unit-facing", "", true, scope_editor, "" }, + + { hotkey::HOTKEY_MINIMAP_CODING_UNIT, "minimap-unit-coding", N_("Toggle Minimap Unit Coding"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_MINIMAP_CODING_TERRAIN, "minimap-terrain-coding", N_("Toggle Minimap Terrain Coding"), false, scope_game | scope_editor | scope_main, "" }, + + { hotkey::HOTKEY_MINIMAP_DRAW_UNITS, "minimap-draw-units", N_("Toggle Minimap Unit Drawing"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES, "minimap-draw-villages", N_("Toggle Minimap Village Drawing"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_MINIMAP_DRAW_TERRAIN, "minimap-draw-terrain", N_("Toggle Minimap Terrain Drawing"), false, scope_game | scope_editor | scope_main, "" }, + + { hotkey::HOTKEY_EDITOR_BRUSH_NEXT, "editor-brush-next", N_("Next Brush"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_BRUSH_DEFAULT, "editor-brush-default", N_("Default Brush"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_BRUSH_1, "editor-brush-1", N_("Single Tile"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_BRUSH_2, "editor-brush-2", N_("Radius One"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_BRUSH_3, "editor-brush-3", N_("Radius Two"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_BRUSH_NW_SE, "editor-brush-nw-se", N_("Brush NW-SE"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_BRUSH_SW_NE, "editor-brush-sw-ne", N_("Brush SW-NE"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_SELECTION_CUT, "editor-cut", N_("Cut"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECTION_COPY, "editor-copy", N_("Copy"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_CLIPBOARD_PASTE, "editor-paste", N_("Paste"), false, scope_editor, N_("Left mouse button pastes from the clipboard, right brings up a context menu.") }, + { hotkey::HOTKEY_EDITOR_SELECTION_EXPORT, "editor-export-selection-coords", N_("Export Selected Coordinates to System Clipboard"), true, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECT_ALL, "editor-select-all", N_("Select All"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECT_INVERSE, "editor-select-inverse", N_("Select Inverse"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECT_NONE, "editor-select-none", N_("Select None"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, "editor-clipboard-rotate-cw", N_("Rotate Clipboard Clockwise"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW, "editor-clipboard-rotate-ccw", N_("Rotate Clipboard Counter-Clockwise"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, "editor-clipboard-flip-horizontal", N_("Flip Clipboard Horizontally"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, "editor-clipboard-flip-vertical", N_("Flip Clipboard Vertically"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECTION_ROTATE, "editor-selection-rotate", N_("Rotate Selection"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECTION_FLIP, "editor-selection-flip", N_("Flip Selection"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECTION_FILL, "editor-selection-fill", N_("Fill Selection"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECTION_GENERATE, "editor-selection-generate", N_("Generate Tiles in Selection"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SELECTION_RANDOMIZE, "editor-selection-randomize", N_("Randomize Tiles in Selection"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_RESIZE, "editor-map-resize", N_("Resize Map"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_ROTATE, "editor-map-rotate", N_("Rotate Map"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_GENERATE, "editor-map-generate", N_("Generate Map"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_APPLY_MASK, "editor-map-apply-mask", N_("Apply a Mask"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_MAP_CREATE_MASK_TO, "editor-map-create-mask-to", N_("Create Mask"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_REFRESH, "editor-refresh", N_("Refresh Display"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_UPDATE_TRANSITIONS, "editor-update-transitions", N_("Update Terrain Transitions"), false, scope_editor, "" }, // This item is for binding in the preferences - { hotkey::HOTKEY_EDITOR_TOGGLE_TRANSITIONS, "editor-toggle-transitions", N_("Toggle Terrain Transition Update"), false, hotkey::SCOPE_EDITOR, "" }, + { hotkey::HOTKEY_EDITOR_TOGGLE_TRANSITIONS, "editor-toggle-transitions", N_("Toggle Terrain Transition Update"), false, scope_editor, "" }, // The next three are for displaying the different states in the menu - { hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, "editor-auto-update-transitions", N_("Auto-update Terrain Transitions"), true, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, "editor-no-update-transitions", N_("Auto-update Terrain Transitions: No"), true, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, "editor-partial-update-transitions", N_("Auto-update Terrain Transitions: Partial"), true, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_REFRESH_IMAGE_CACHE, "editor-refresh-image-cache", N_("Refresh Image Cache"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, "editor-draw-coordinates", N_("Draw Hex Coordinates"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES, "editor-draw-terrain-codes", N_("Draw Terrain Codes"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_AREA_SAVE, "editor-save-area", N_("Save Selection to Area"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_AREA_RENAME, "editor-rename-area", N_("Rename Selected Area"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_AREA_REMOVE, "editor-remove-area", N_("Remove Selected Area"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_AREA_ADD, "editor-add-area", N_("Add New Area"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_EDITOR_SCENARIO_EDIT, "editor-scenario-edit", N_("Edit Scenario"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SIDE_EDIT, "editor-side-edit", N_("Edit Side"), false, hotkey::SCOPE_EDITOR, "" }, - { hotkey::HOTKEY_EDITOR_SIDE_REMOVE, "editor-side-remove", N_("Remove Side"), false, hotkey::SCOPE_EDITOR, "" }, - - { hotkey::HOTKEY_DELAY_SHROUD, "delayshroud", N_("Delay Shroud Updates"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_UPDATE_SHROUD, "updateshroud", N_("Update Shroud Now"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_CONTINUE_MOVE, "continue", N_("Continue Move"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SEARCH, "search", N_("Find Label or Unit"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SPEAK_ALLY, "speaktoally", N_("Speak to Ally"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_SPEAK_ALL, "speaktoall", N_("Speak to All"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_HELP, "help", N_("Help"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_CHAT_LOG, "chatlog", N_("View Chat Log"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_USER_CMD, "command", N_("Enter User Command"), false, hotkey::SCOPE_GENERAL, "" }, - { hotkey::HOTKEY_CUSTOM_CMD, "customcommand", N_("Custom Command"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_AI_FORMULA, "aiformula", N_("Run Formula"), false, hotkey::SCOPE_GAME, "" }, - { hotkey::HOTKEY_CLEAR_MSG, "clearmessages", N_("Clear Messages"), false, hotkey::SCOPE_GAME, "" }, - - { hotkey::HOTKEY_LANGUAGE, "changelanguage", N_("Change Language"), false, hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__RELOAD_WML, "title_screen__reload_wml", N_("Refresh WML"), true ,hotkey::SCOPE_GENERAL, "" }, - { hotkey::TITLE_SCREEN__NEXT_TIP, "title_screen__next_tip", N_("Next Tip of the Day"), false, hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__PREVIOUS_TIP, "title_screen__previous_tip", N_("Previous Tip of the Day"), false, hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__TUTORIAL, "title_screen__tutorial", N_("Start Tutorial"), false , hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__CAMPAIGN, "title_screen__campaign", N_("Start Campaign"), false , hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__MULTIPLAYER, "title_screen__multiplayer", N_("Start Multiplayer Game"), false, hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__ADDONS, "title_screen__addons", N_("Manage Add-ons"), false , hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__CORES, "title_screen__cores", N_("Manage Cores"), false , hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__EDITOR, "title_screen__editor", N_("Start Editor"), false, hotkey::SCOPE_MAIN_MENU, "" }, - { hotkey::TITLE_SCREEN__CREDITS, "title_screen__credits", N_("Show Credits"), false , hotkey::SCOPE_MAIN_MENU, "" }, - - { hotkey::GLOBAL__HELPTIP, "global__helptip", N_("Show Helptip"), false, hotkey::SCOPE_GENERAL, "" }, + { hotkey::HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, "editor-auto-update-transitions", N_("Auto-update Terrain Transitions"), true, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, "editor-no-update-transitions", N_("Auto-update Terrain Transitions: No"), true, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, "editor-partial-update-transitions", N_("Auto-update Terrain Transitions: Partial"), true, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_REFRESH_IMAGE_CACHE, "editor-refresh-image-cache", N_("Refresh Image Cache"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_DRAW_COORDINATES, "editor-draw-coordinates", N_("Draw Hex Coordinates"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_DRAW_TERRAIN_CODES, "editor-draw-terrain-codes", N_("Draw Terrain Codes"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_AREA_SAVE, "editor-save-area", N_("Save Selection to Area"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_AREA_RENAME, "editor-rename-area", N_("Rename Selected Area"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_AREA_REMOVE, "editor-remove-area", N_("Remove Selected Area"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_AREA_ADD, "editor-add-area", N_("Add New Area"), false, scope_editor, "" }, + + { hotkey::HOTKEY_EDITOR_SCENARIO_EDIT, "editor-scenario-edit", N_("Edit Scenario"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SIDE_EDIT, "editor-side-edit", N_("Edit Side"), false, scope_editor, "" }, + { hotkey::HOTKEY_EDITOR_SIDE_REMOVE, "editor-side-remove", N_("Remove Side"), false, scope_editor, "" }, + + { hotkey::HOTKEY_DELAY_SHROUD, "delayshroud", N_("Delay Shroud Updates"), false, scope_game, "" }, + { hotkey::HOTKEY_UPDATE_SHROUD, "updateshroud", N_("Update Shroud Now"), false, scope_game, "" }, + { hotkey::HOTKEY_CONTINUE_MOVE, "continue", N_("Continue Move"), false, scope_game, "" }, + { hotkey::HOTKEY_SEARCH, "search", N_("Find Label or Unit"), false, scope_game, "" }, + { hotkey::HOTKEY_SPEAK_ALLY, "speaktoally", N_("Speak to Ally"), false, scope_game, "" }, + { hotkey::HOTKEY_SPEAK_ALL, "speaktoall", N_("Speak to All"), false, scope_game, "" }, + { hotkey::HOTKEY_HELP, "help", N_("Help"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_CHAT_LOG, "chatlog", N_("View Chat Log"), false, scope_game, "" }, + { hotkey::HOTKEY_USER_CMD, "command", N_("Enter User Command"), false, scope_game | scope_editor | scope_main, "" }, + { hotkey::HOTKEY_CUSTOM_CMD, "customcommand", N_("Custom Command"), false, scope_game, "" }, + { hotkey::HOTKEY_AI_FORMULA, "aiformula", N_("Run Formula"), false, scope_game, "" }, + { hotkey::HOTKEY_CLEAR_MSG, "clearmessages", N_("Clear Messages"), false, scope_game, "" }, + + { hotkey::HOTKEY_LANGUAGE, "changelanguage", N_("Change Language"), false, scope_main, "" }, + { hotkey::TITLE_SCREEN__RELOAD_WML, "title_screen__reload_wml", N_("Refresh WML"), true ,scope_game | scope_editor | scope_main, "" }, + { hotkey::TITLE_SCREEN__NEXT_TIP, "title_screen__next_tip", N_("Next Tip of the Day"), false, scope_main, "" }, + { hotkey::TITLE_SCREEN__PREVIOUS_TIP, "title_screen__previous_tip", N_("Previous Tip of the Day"), false, scope_main, "" }, + { hotkey::TITLE_SCREEN__TUTORIAL, "title_screen__tutorial", N_("Start Tutorial"), false , scope_main, "" }, + { hotkey::TITLE_SCREEN__CAMPAIGN, "title_screen__campaign", N_("Start Campaign"), false , scope_main, "" }, + { hotkey::TITLE_SCREEN__MULTIPLAYER, "title_screen__multiplayer", N_("Start Multiplayer Game"), false, scope_main, "" }, + { hotkey::TITLE_SCREEN__ADDONS, "title_screen__addons", N_("Manage Add-ons"), false , scope_main, "" }, + { hotkey::TITLE_SCREEN__CORES, "title_screen__cores", N_("Manage Cores"), false , scope_main, "" }, + { hotkey::TITLE_SCREEN__EDITOR, "title_screen__editor", N_("Start Editor"), false, scope_main, "" }, + { hotkey::TITLE_SCREEN__CREDITS, "title_screen__credits", N_("Show Credits"), false , scope_main, "" }, + + { hotkey::GLOBAL__HELPTIP, "global__helptip", N_("Show Helptip"), false, scope_game | scope_editor | scope_main, "" }, //This list item must stay at the end since it is used as terminator for iterating. { hotkey::HOTKEY_NULL, "null", N_("Unrecognized Command"), true, hotkey::SCOPE_COUNT, "" } @@ -290,12 +293,16 @@ void set_scope_active(scope s, bool set) { scope_active_[s] = set; } +void set_active_scopes(hk_scopes s) +{ + scope_active_ = s; +} -bool is_scope_active(scope s) +bool is_scope_active(hk_scopes s) { - if( s == hotkey::SCOPE_COUNT ) - return false; - return scope_active_[s]; + //s is a copy because we need one + s &= scope_active_; + return s.any(); } @@ -370,7 +377,7 @@ void add_wml_hotkey(const std::string& id, const t_string& description, const co remove_wml_hotkey(id); } DBG_G << "Added wml hotkey with id = '" << id << "' and description = '" << description << "'.\n"; - known_hotkeys.push_back(new hotkey_command(hotkey::HOTKEY_WML, id, description, false, hotkey::SCOPE_GAME, t_string(""))); + known_hotkeys.push_back(new hotkey_command(hotkey::HOTKEY_WML, id, description, false, scope_game, t_string(""))); command_map_[id] = known_hotkeys.size() - 1; @@ -395,12 +402,12 @@ void add_wml_hotkey(const std::string& id, const t_string& description, const co hotkey_command::hotkey_command() - : id(HOTKEY_NULL), command(""), description(""), hidden(true), scope(SCOPE_GENERAL), tooltip("") + : id(HOTKEY_NULL), command(""), description(""), hidden(true), scope(), tooltip("") { ERR_G << "hotkey_command's default constructor called. This shouldn't happen, because all its members are const."; } -hotkey_command::hotkey_command(hotkey::HOTKEY_COMMAND cmd, const std::string& id_, const t_string& desc, bool hid, hotkey::scope scop, const t_string& toolt) +hotkey_command::hotkey_command(hotkey::HOTKEY_COMMAND cmd, const std::string& id_, const t_string& desc, bool hid, hotkey::hk_scopes scop, const t_string& toolt) : id(cmd), command(id_), description(desc), hidden(hid), scope(scop), tooltip(toolt) { } diff --git a/src/hotkey/hotkey_command.hpp b/src/hotkey/hotkey_command.hpp index 69e0a797ea2c..5efeaa787561 100644 --- a/src/hotkey/hotkey_command.hpp +++ b/src/hotkey/hotkey_command.hpp @@ -29,11 +29,12 @@ namespace hotkey { * non-overlapping areas of the game share the same key */ enum scope { - SCOPE_GENERAL, SCOPE_MAIN_MENU, SCOPE_GAME, SCOPE_EDITOR, - SCOPE_COUNT + SCOPE_COUNT, + //SCOPE_GENERAL is onyl used by teh preferences menu as a categors = all of the above. + SCOPE_GENERAL }; enum HOTKEY_COMMAND { @@ -191,7 +192,7 @@ struct hotkey_command { /// the compiler want me to make a default constructor /// since most member are const, calling the default constructor is normally no use. hotkey_command(); - hotkey_command(hotkey::HOTKEY_COMMAND cmd, const std::string& id, const t_string& desc, bool hidden, hotkey::scope scope, const t_string& tooltip); + hotkey_command(hotkey::HOTKEY_COMMAND cmd, const std::string& id, const t_string& desc, bool hidden, hotkey::hk_scopes scope, const t_string& tooltip); /// the names are strange: the "hotkey::HOTKEY_COMMAND" is named id, and the string to identify the object is called "command" /// there is some inconstancy with that names in this file. /// This binds the command to a function. Does not need to be unique. @@ -203,7 +204,7 @@ struct hotkey_command { /// If hidden then don't show the command in the hotkey preferences. const bool hidden; /// The visibility scope of the command. - const hotkey::scope scope; + const hotkey::hk_scopes scope; const t_string tooltip; @@ -227,7 +228,7 @@ struct hotkey_command_temp { bool hidden; - hotkey::scope scope; + hotkey::hk_scopes scope; const char* tooltip; }; @@ -252,7 +253,8 @@ const hotkey_command& get_hotkey_null(); void deactivate_all_scopes(); void set_scope_active(scope s, bool set = true); -bool is_scope_active(scope s); +void set_active_scopes(hk_scopes s); +bool is_scope_active(hk_scopes s); /// bool has_hotkey_command(const std::string& id); diff --git a/src/hotkey/hotkey_item.cpp b/src/hotkey/hotkey_item.cpp index a8bdf9f3c6e0..702d77e215f9 100644 --- a/src/hotkey/hotkey_item.cpp +++ b/src/hotkey/hotkey_item.cpp @@ -234,14 +234,9 @@ bool has_hotkey_item(const std::string& command) } void add_hotkey(const hotkey_item& item) { - - scope new_scope = hotkey::get_hotkey_command(item.get_command()).scope; - if(new_scope == hotkey::SCOPE_COUNT) - new_scope = hotkey::SCOPE_GAME; + scope_changer scope_ch; - deactivate_all_scopes(); - hotkey::set_scope_active(new_scope); - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); + set_active_scopes(hotkey::get_hotkey_command(item.get_command()).scope); hotkey_item& old_hk = (item.get_mouse() != -1 || item.get_joystick() != -1) ? ::get_hotkey(item.get_mouse(), item.get_joystick(), item.get_button(), item.get_hat() diff --git a/src/hotkey/hotkey_preferences_display.cpp b/src/hotkey/hotkey_preferences_display.cpp index b9955980847e..942c5cd0708b 100644 --- a/src/hotkey/hotkey_preferences_display.cpp +++ b/src/hotkey/hotkey_preferences_display.cpp @@ -286,23 +286,26 @@ hotkey_preferences_dialog::hotkey_preferences_dialog(display& disp) : { continue; } - - switch (command.scope) { - - case hotkey::SCOPE_GAME: - game_commands_.push_back(command.command); - break; - case hotkey::SCOPE_EDITOR: - editor_commands_.push_back(command.command); - break; - case hotkey::SCOPE_GENERAL: + // We move hotkeys in all categories thet they belog to, except for hotkeys that + // belong to all 3 scoped that we put in a seperate HOTKEY_GENERAL category. + if(command.scope.count() < hotkey::SCOPE_COUNT) //Not all + { + if(command.scope[hotkey::SCOPE_GAME]) + { + game_commands_.push_back(command.command); + } + if(command.scope[hotkey::SCOPE_EDITOR]) + { + editor_commands_.push_back(command.command); + } + if(command.scope[hotkey::SCOPE_MAIN_MENU]) + { + title_screen_commands_.push_back(command.command); + } + } + else + { general_commands_.push_back(command.command); - break; - case hotkey::SCOPE_MAIN_MENU: - title_screen_commands_.push_back(command.command); - break; - case hotkey::SCOPE_COUNT: - break; } } @@ -433,21 +436,17 @@ void hotkey_preferences_dialog::set_selection(int index) { hotkey::deactivate_all_scopes(); switch (tab_) { case hotkey::SCOPE_MAIN_MENU: - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_MAIN_MENU); break; case hotkey::SCOPE_GENERAL: - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_GAME); hotkey::set_scope_active(hotkey::SCOPE_EDITOR); hotkey::set_scope_active(hotkey::SCOPE_MAIN_MENU); break; case hotkey::SCOPE_GAME: - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_GAME); break; case hotkey::SCOPE_EDITOR: - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_EDITOR); break; case hotkey::SCOPE_COUNT: diff --git a/src/play_controller.cpp b/src/play_controller.cpp index 596891b819a4..64cdea2c1139 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -162,7 +162,6 @@ play_controller::play_controller(const config& level, saved_game& state_of_game, game_config::add_color_info(level); hotkey::deactivate_all_scopes(); - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_GAME); try { init(video); diff --git a/src/tests/utils/game_config_manager.cpp b/src/tests/utils/game_config_manager.cpp index 0c79f5ea3086..98e1a3119a97 100644 --- a/src/tests/utils/game_config_manager.cpp +++ b/src/tests/utils/game_config_manager.cpp @@ -95,7 +95,6 @@ namespace test_utils { game_config::load_config(cfg_.child("game_config")); hotkey::deactivate_all_scopes(); - hotkey::set_scope_active(hotkey::SCOPE_GENERAL); hotkey::set_scope_active(hotkey::SCOPE_GAME); hotkey::load_hotkeys(cfg_);