The Battle for Wesnoth  1.19.9+dev
hotkey_command.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2025
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #define GETTEXT_DOMAIN "wesnoth-lib"
17 
19 
20 #include "config.hpp"
21 #include "gettext.hpp"
22 #include "hotkey/hotkey_item.hpp"
23 #include "log.hpp"
24 
25 #include <array>
26 #include <set>
27 #include <string_view>
28 
29 static lg::log_domain log_config("config");
30 #define ERR_G LOG_STREAM(err, lg::general())
31 #define LOG_G LOG_STREAM(info, lg::general())
32 #define DBG_G LOG_STREAM(debug, lg::general())
33 #define ERR_CF LOG_STREAM(err, log_config)
34 
35 namespace hotkey
36 {
38 {
40  std::string_view id;
41  std::string_view description;
42  bool hidden;
45  std::string_view tooltip;
46 };
47 
48 namespace
49 {
50 const std::map<HOTKEY_CATEGORY, std::string> category_names {
51  { HKCAT_GENERAL, N_("General") },
52  { HKCAT_SAVING, N_("Saved Games") },
53  { HKCAT_MAP, N_("Map Commands") },
54  { HKCAT_UNITS, N_("Unit Commands") },
55  { HKCAT_CHAT, N_("Player Chat") },
56  { HKCAT_REPLAY, N_("Replay Control") },
57  { HKCAT_WHITEBOARD, N_("Planning Mode") },
58  { HKCAT_SCENARIO, N_("Scenario Editor") },
59  { HKCAT_PALETTE, N_("Editor Palettes") },
60  { HKCAT_TOOLS, N_("Editor Tools") },
61  { HKCAT_CLIPBOARD, N_("Editor Clipboard") },
62  { HKCAT_DEBUG, N_("Debug Commands") },
63  { HKCAT_CUSTOM, N_("Custom WML Commands") },
64 };
65 
66 //
67 // All static hotkeys.
68 //
69 // This array should always have the same number of entries as the HOTKEY_COMMAND enum.
70 // Since HOTKEY_NULL is the last entry in said enum, we can use its index to dynamically
71 // size the array.
72 //
73 constexpr std::array<hotkey_command_temp, HOTKEY_NULL - 1> master_hotkey_list {{
74  { HOTKEY_SCROLL_UP, "scroll-up", N_("Scroll Up"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
75  { HOTKEY_SCROLL_DOWN, "scroll-down", N_("Scroll Down"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
76  { HOTKEY_SCROLL_LEFT, "scroll-left", N_("Scroll Left"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
77  { HOTKEY_SCROLL_RIGHT, "scroll-right", N_("Scroll Right"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
78 
79  { HOTKEY_CANCEL, N_("cancel"), N_("Cancel"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
80  { HOTKEY_SELECT_HEX, "selecthex", N_("Select Hex"), false, scope_game, HKCAT_MAP, "" },
81  { HOTKEY_DESELECT_HEX, "deselecthex", N_("Deselect Hex"), false, scope_game, HKCAT_MAP, "" },
82  { HOTKEY_MOVE_ACTION, "moveaction", N_("Move/Attack"), false, scope_game, HKCAT_UNITS, "" },
83  { HOTKEY_SELECT_AND_ACTION, "selectmoveaction", N_("Select/Move/Attack"), false, scope_game, HKCAT_UNITS, "" },
84  { HOTKEY_TOUCH_HEX, "touchhex", N_("Touch"), false, scope_game, HKCAT_UNITS, "" },
85  { HOTKEY_ANIMATE_MAP, "animatemap", N_("Animate Map"), false, scope_game | scope_editor, HKCAT_MAP, "" },
86  { HOTKEY_CYCLE_UNITS, "cycle", N_("Next Unit"), false, scope_game, HKCAT_UNITS, "" },
87  { HOTKEY_CYCLE_BACK_UNITS, "cycleback", N_("Previous Unit"), false, scope_game, HKCAT_UNITS, "" },
88  { HOTKEY_UNIT_HOLD_POSITION, "holdposition", N_("Hold Position"), false, scope_game, HKCAT_UNITS, "" },
89  { HOTKEY_END_UNIT_TURN, "endunitturn", N_("End Unit Turn"), false, scope_game, HKCAT_UNITS, "" },
90  { HOTKEY_LEADER, "leader", N_("Scroll to Leader"), false, scope_game, HKCAT_UNITS, "" },
91  { HOTKEY_UNDO, "undo", N_("Undo"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
92  { HOTKEY_REDO, "redo", N_("Redo"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
93  { HOTKEY_ZOOM_IN, "zoomin", N_("Zoom In"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
94  { HOTKEY_ZOOM_OUT, "zoomout", N_("Zoom Out"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
95  { HOTKEY_ZOOM_DEFAULT, "zoomdefault", N_("Default Zoom"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
96  { HOTKEY_FULLSCREEN, "fullscreen", N_("Toggle Full Screen"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
97  { HOTKEY_ACHIEVEMENTS, "achievements", N_("Achievements"), false, scope_game | scope_main, HKCAT_GENERAL, "" },
98  { HOTKEY_SCREENSHOT, "screenshot", N_("Screenshot"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
99  { HOTKEY_MAP_SCREENSHOT, "mapscreenshot", N_("Map Screenshot"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
100  { HOTKEY_ACCELERATED, "accelerated", N_("Toggle Accelerated Speed"), false, scope_game, HKCAT_GENERAL, "" },
101  { HOTKEY_TERRAIN_DESCRIPTION, "describeterrain", N_("Terrain Description"), false, scope_game | scope_editor, HKCAT_MAP, "" },
102  { HOTKEY_UNIT_DESCRIPTION, "describeunit", N_("Unit Type Description"), false, scope_game | scope_editor, HKCAT_UNITS, "" },
103  { HOTKEY_RENAME_UNIT, "renameunit", N_("Rename Unit"), false, scope_game | scope_editor, HKCAT_UNITS, "" },
104  { HOTKEY_DELETE_UNIT, "editor-deleteunit", N_("Delete Unit"), false, scope_game | scope_editor, HKCAT_TOOLS, "" },
105 
106  { HOTKEY_SAVE_GAME, "save", N_("Save Game"), false, scope_game, HKCAT_SAVING, "" },
107  { HOTKEY_SAVE_REPLAY, "savereplay", N_("Save Replay"), false, scope_game, HKCAT_SAVING, "" },
108  { HOTKEY_SAVE_MAP, "savemap", N_("Save Map"), false, scope_game, HKCAT_SAVING, "" },
109  { HOTKEY_LOAD_GAME, "load", N_("Load Game"), false, scope_game | scope_main, HKCAT_SAVING, "" },
110  { HOTKEY_LOAD_AUTOSAVES, "menu-autosaves", N_("Load Turn..."), true, scope_game, HKCAT_PLACEHOLDER, "" }, // Menu placeholder
111  { HOTKEY_RECRUIT, "recruit", N_("Recruit"), false, scope_game, HKCAT_UNITS, "" },
112  { HOTKEY_REPEAT_RECRUIT, "repeatrecruit", N_("Repeat Recruit"), false, scope_game, HKCAT_UNITS, "" },
113  { HOTKEY_RECALL, "recall", N_("Recall"), false, scope_game, HKCAT_UNITS, "" },
114  { HOTKEY_LABEL_SETTINGS, "label_settings", N_("Show/Hide Labels"), false, scope_game, HKCAT_MAP, "" },
115  { HOTKEY_ENDTURN, "endturn", N_("End Turn"), false, scope_game, HKCAT_GENERAL, "" },
116  //TODO: why has HOTKEY_TOGGLE_ELLIPSES more than scope_game ?
117  { HOTKEY_TOGGLE_ELLIPSES, "toggleellipses", N_("Toggle Ellipses"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
118  { HOTKEY_TOGGLE_GRID, "togglegrid", N_("Toggle Grid"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
119  { HOTKEY_MOUSE_SCROLL, "mousescroll", N_("Mouse Scrolling"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
120  { HOTKEY_STATUS_TABLE, "statustable", N_("Status Table"), false, scope_game, HKCAT_GENERAL, "" },
121  { HOTKEY_MUTE, "mute", N_("Mute"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
122  { HOTKEY_SPEAK, "speak", N_("Speak"), false, scope_game, HKCAT_CHAT, "" },
123  { HOTKEY_CREATE_UNIT, "createunit", N_("Create Unit (Debug!)"), false, scope_game, HKCAT_DEBUG, "" },
124  { HOTKEY_CHANGE_SIDE, "changeside", N_("Change Side (Debug!)"), false, scope_game, HKCAT_DEBUG, "" },
125  { HOTKEY_KILL_UNIT, "killunit", N_("Kill Unit (Debug!)"), false, scope_game, HKCAT_DEBUG, "" },
126  { HOTKEY_TELEPORT_UNIT, "teleportunit", N_("Teleport Unit (Debug!)"), false, scope_game, HKCAT_DEBUG, "" },
127  { HOTKEY_PREFERENCES, "preferences", N_("Preferences"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
128  { HOTKEY_OBJECTIVES, "objectives", N_("Objectives"), false, scope_game, HKCAT_MAP, "" },
129  { HOTKEY_UNIT_LIST, "unitlist", N_("Unit List"), false, scope_game | scope_editor, HKCAT_UNITS, "" },
130  { HOTKEY_STATISTICS, "statistics", N_("Statistics"), false, scope_game, HKCAT_GENERAL, "" },
131  { HOTKEY_STOP_NETWORK, "stopnetwork", N_("Pause Network Game"), false, scope_game, HKCAT_GENERAL, "" },
132  { HOTKEY_START_NETWORK, "startnetwork", N_("Continue Network Game"), false, scope_game, HKCAT_GENERAL, "" },
133  { HOTKEY_SURRENDER, "surrender", N_("Surrender Game"), false, scope_game, HKCAT_SCENARIO, "" },
134  { HOTKEY_QUIT_GAME, "quit", N_("Quit to Menu"), false, scope_game | scope_editor, HKCAT_GENERAL, "" },
135  { HOTKEY_LABEL_TEAM_TERRAIN, "labelteamterrain", N_("Set Team Label"), false, scope_game, HKCAT_MAP, "" },
136  { HOTKEY_LABEL_TERRAIN, "labelterrain", N_("Set Label"), false, scope_game, HKCAT_MAP, "" },
137  { HOTKEY_CLEAR_LABELS, "clearlabels", N_("Clear Labels"), false, scope_game, HKCAT_MAP, "" },
138  { HOTKEY_SHOW_ENEMY_MOVES, "showenemymoves", N_("Show Enemy Moves"), false, scope_game, HKCAT_UNITS, "" },
139  { HOTKEY_BEST_ENEMY_MOVES, "bestenemymoves", N_("Best Possible Enemy Moves"), false, scope_game, HKCAT_UNITS, "" },
140 
141  { HOTKEY_REPLAY_PLAY, "playreplay", N_("Play Replay"), false, scope_game, HKCAT_REPLAY, "" },
142  { HOTKEY_REPLAY_RESET, "resetreplay", N_("Reset Replay"), false, scope_game, HKCAT_REPLAY, "" },
143  { HOTKEY_REPLAY_STOP, "stopreplay", N_("Stop Replay"), false, scope_game, HKCAT_REPLAY, "" },
144  { HOTKEY_REPLAY_NEXT_TURN, "replaynextturn", N_("Next Turn"), false, scope_game, HKCAT_REPLAY, "" },
145  { HOTKEY_REPLAY_NEXT_SIDE, "replaynextside", N_("Next Side"), false, scope_game, HKCAT_REPLAY, "" },
146  { HOTKEY_REPLAY_NEXT_MOVE, "replaynextmove", N_("Next Move"), false, scope_game, HKCAT_REPLAY, "" },
147  { HOTKEY_REPLAY_SHOW_EVERYTHING, "replayshoweverything", N_("View: Full Map"), false, scope_game, HKCAT_REPLAY, "" },
148  { HOTKEY_REPLAY_SHOW_EACH, "replayshoweach", N_("View: Each Team"), false, scope_game, HKCAT_REPLAY, "" },
149  { HOTKEY_REPLAY_SHOW_TEAM1, "replayshowteam1", N_("View: Human Team"), false, scope_game, HKCAT_REPLAY, "" },
150  { HOTKEY_REPLAY_SKIP_ANIMATION, "replayskipanimation", N_("Skip Animation"), false, scope_game, HKCAT_REPLAY, "" },
151  { HOTKEY_REPLAY_EXIT, "replayexit", N_("End Replay"), false, scope_game, HKCAT_REPLAY, "" },
152  // Whiteboard commands
153  // TRANSLATORS: whiteboard menu entry: toggle planning mode
154  { HOTKEY_WB_TOGGLE, "wbtoggle", N_("whiteboard^Planning Mode"), false, scope_game, HKCAT_WHITEBOARD, "" },
155  // TRANSLATORS: whiteboard menu entry: execute planned action
156  { HOTKEY_WB_EXECUTE_ACTION, "wbexecuteaction", N_("whiteboard^Execute Action"), false, scope_game, HKCAT_WHITEBOARD, "" },
157  // TRANSLATORS: whiteboard menu entry: execute all planned actions
158  { HOTKEY_WB_EXECUTE_ALL_ACTIONS, "wbexecuteallactions", N_("whiteboard^Execute All Actions"), false, scope_game, HKCAT_WHITEBOARD, "" },
159  // TRANSLATORS: whiteboard menu entry: delete planned action
160  { HOTKEY_WB_DELETE_ACTION, "wbdeleteaction", N_("whiteboard^Delete Action"), false, scope_game, HKCAT_WHITEBOARD, "" },
161  // TRANSLATORS: whiteboard menu entry: move planned action up queue
162  { HOTKEY_WB_BUMP_UP_ACTION, "wbbumpupaction", N_("whiteboard^Move Action Up"), false, scope_game, HKCAT_WHITEBOARD, "" },
163  // TRANSLATORS: whiteboard menu entry: move planned action down queue
164  { HOTKEY_WB_BUMP_DOWN_ACTION, "wbbumpdownaction", N_("whiteboard^Move Action Down"), false, scope_game, HKCAT_WHITEBOARD, "" },
165  // TRANSLATORS: whiteboard menu entry: plan as though the chosen unit were dead
166  { HOTKEY_WB_SUPPOSE_DEAD, "wbsupposedead", N_("whiteboard^Suppose Dead"), true, scope_game, HKCAT_WHITEBOARD, "" },
167 
168  { HOTKEY_QUIT_TO_DESKTOP, "quit-to-desktop", N_("Quit to Desktop"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
169  { HOTKEY_EDITOR_MAP_CLOSE, "editor-close-map", N_("Close Map"), false, scope_editor, HKCAT_GENERAL, "" },
170 
171  // These are not really hotkey items but menu entries to get expanded.
172  // They need to have their own hotkey to control their active state.
173  { HOTKEY_EDITOR_PLAYLIST, "editor-playlist", N_("Switch Time of Day"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
174  { HOTKEY_EDITOR_SCHEDULE, "menu-editor-schedule", "", true, scope_editor, HKCAT_PLACEHOLDER, "" },
175  { HOTKEY_EDITOR_MAP_SWITCH, "editor-switch-map", N_("Switch Map"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
176  { HOTKEY_EDITOR_LOCAL_TIME, "menu-editor-local-time", N_("Assign Local Time"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
177 
178  { HOTKEY_EDITOR_EDIT_UNIT, "editor-edit-unit", N_("New Unit Type"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
179 
180  { HOTKEY_EDITOR_CUSTOM_TODS, "editor-custom-tods", N_("Time Schedule Editor"), false, scope_editor, HKCAT_SCENARIO, "" },
181  { HOTKEY_EDITOR_PARTIAL_UNDO, "editor-partial-undo", N_("Partial Undo"), false, scope_editor, HKCAT_SCENARIO, "" },
182  { HOTKEY_EDITOR_MAP_NEW, "editor-map-new", N_("New Map"), false, scope_editor, HKCAT_SCENARIO, "" },
183  { HOTKEY_EDITOR_SCENARIO_NEW, "editor-scenario-new", N_("New Scenario"), false, scope_editor, HKCAT_SCENARIO, "" },
184  { HOTKEY_EDITOR_MAP_LOAD, "editor-map-load", N_("Load Map/Scenario"), false, scope_editor, HKCAT_MAP, "" },
185  { HOTKEY_EDITOR_MAP_SAVE, "editor-map-save", N_("Save"), false, scope_editor, HKCAT_MAP, "" },
186  { HOTKEY_EDITOR_MAP_SAVE_AS, "editor-map-save-as", N_("Save Map As"), false, scope_editor, HKCAT_MAP, "" },
187  { HOTKEY_EDITOR_MAP_TO_SCENARIO, "editor-to-scenario", N_("Convert To Scenario"), false, scope_editor, HKCAT_MAP, "" },
188  { HOTKEY_EDITOR_SCENARIO_SAVE_AS, "editor-scenario-save-as", N_("Save Scenario As"), false, scope_editor, HKCAT_SCENARIO, "" },
189  { HOTKEY_EDITOR_MAP_SAVE_ALL, "editor-map-save-all", N_("Save All Maps"), false, scope_editor, HKCAT_MAP, "" },
190  { HOTKEY_EDITOR_MAP_REVERT, "editor-map-revert", N_("Revert All Changes"), false, scope_editor, HKCAT_MAP, "" },
191  { HOTKEY_EDITOR_MAP_INFO, "editor-map-info", N_("Map Information"), false, scope_editor, HKCAT_MAP, "" },
192 
193  { HOTKEY_EDITOR_PALETTE_ITEMS_CLEAR, "editor-palette-items-clear", N_("Clear Selected Item Set"), false, scope_editor, HKCAT_PALETTE, "" },
194  { HOTKEY_EDITOR_PALETTE_ITEM_SWAP, "editor-terrain-palette-swap", N_("Swap Foreground/Background Palette Item"), false, scope_editor, HKCAT_PALETTE, "" },
195  { HOTKEY_EDITOR_PALETTE_GROUPS, "editor-palette-groups", N_("Change Palette Group"), false, scope_editor, HKCAT_PALETTE, "" },
196  { HOTKEY_EDITOR_PALETTE_UPSCROLL, "editor-palette-upscroll", N_("Scroll Palette Left"), false, scope_editor, HKCAT_PALETTE, "" },
197  { HOTKEY_EDITOR_PALETTE_DOWNSCROLL, "editor-palette-downscroll", N_("Scroll Palette Right"), false, scope_editor, HKCAT_PALETTE, "" },
198  { HOTKEY_EDITOR_REMOVE_LOCATION, "editor-remove-location", N_("Remove Location"), false, scope_editor, HKCAT_PALETTE, "" },
199 
200  { HOTKEY_EDITOR_SIDE_NEW, "editor-side-new", N_("Add New Side"), false, scope_editor, HKCAT_SCENARIO, "" },
201 
202  { HOTKEY_EDITOR_TOOL_NEXT, "editor-tool-next", N_("Next Tool"), false, scope_editor, HKCAT_TOOLS, "" },
203 
204  { HOTKEY_EDITOR_TOOL_PAINT, "editor-tool-paint", N_("Paint Tool"), false, scope_editor, HKCAT_TOOLS, 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.") },
205  { HOTKEY_EDITOR_TOOL_FILL, "editor-tool-fill", N_("Fill Tool"), false, scope_editor, HKCAT_TOOLS, 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.") },
206  { HOTKEY_EDITOR_TOOL_SELECT, "editor-tool-select", N_("Selection Tool"), false, scope_editor, HKCAT_TOOLS, 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.") },
207  { HOTKEY_EDITOR_TOOL_STARTING_POSITION, "editor-tool-starting-position", N_("Starting Positions Tool"), false, scope_editor, HKCAT_TOOLS, 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.") },
208  { HOTKEY_EDITOR_TOOL_LABEL, "editor-tool-label", N_("Label Tool"), false, scope_editor, HKCAT_TOOLS, N_("Left mouse button sets or drags a label, right clears.") },
209  { HOTKEY_EDITOR_TOOL_UNIT, "editor-tool-unit", N_("Unit Tool"), false, scope_editor, HKCAT_TOOLS, 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.") },
210  { HOTKEY_EDITOR_TOOL_ITEM, "editor-tool-item", N_("Item Tool"), false, scope_editor, HKCAT_TOOLS, N_("Left mouse button sets a new item. Right click removes item.") },
211  { HOTKEY_EDITOR_TOOL_VILLAGE, "editor-tool-village", N_("Village Tool"), false, scope_editor, HKCAT_TOOLS, N_("Left mouse button sets the village ownership to the current side, right clears. Needs a defined side.") },
212 
213  { HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT, "editor-toggle-canrecruit", N_("Can Recruit"), false, scope_editor, HKCAT_TOOLS, N_("Toggle the recruit attribute of a unit.") },
214  { HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE, "editor-toggle-renameable", N_("Can be Renamed"), false, scope_editor, HKCAT_TOOLS, N_("Toggle the unit being renameable.") },
215 
216  { HOTKEY_EDITOR_UNIT_CHANGE_ID, "editor-change-unitid", N_("Change Unit ID"), false, scope_editor, HKCAT_TOOLS, "" },
217  { HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL, "editor-unit-toggle-loyal", N_("Loyal"), false, scope_editor, HKCAT_TOOLS, "" },
218  { HOTKEY_EDITOR_UNIT_FACING, "menu-unit-facing", "", true, scope_editor, HKCAT_PLACEHOLDER, "" },
219 
220  { HOTKEY_EDITOR_HELP_TEXT_SHOWN, "editor-help-text-shown", N_("Show Tool Information"), false, scope_editor, HKCAT_TOOLS, "" },
221 
222  { HOTKEY_MINIMAP_CODING_UNIT, "minimap-unit-coding", N_("Toggle Minimap Unit Coding"), false, scope_game | scope_editor, HKCAT_MAP, "" },
223  { HOTKEY_MINIMAP_CODING_TERRAIN, "minimap-terrain-coding", N_("Toggle Minimap Terrain Coding"), false, scope_game | scope_editor, HKCAT_MAP, "" },
224 
225  { HOTKEY_MINIMAP_DRAW_UNITS, "minimap-draw-units", N_("Toggle Minimap Unit Drawing"), false, scope_game | scope_editor, HKCAT_MAP, "" },
226  { HOTKEY_MINIMAP_DRAW_VILLAGES, "minimap-draw-villages", N_("Toggle Minimap Village Drawing"), false, scope_game | scope_editor, HKCAT_MAP, "" },
227  { HOTKEY_MINIMAP_DRAW_TERRAIN, "minimap-draw-terrain", N_("Toggle Minimap Terrain Drawing"), false, scope_game | scope_editor, HKCAT_MAP, "" },
228 
229  { HOTKEY_EDITOR_BRUSH_NEXT, "editor-brush-next", N_("Next Brush"), false, scope_editor, HKCAT_TOOLS, "" },
230  { HOTKEY_EDITOR_BRUSH_DEFAULT, "editor-brush-default", N_("Default Brush"), false, scope_editor, HKCAT_TOOLS, "" },
231  { HOTKEY_EDITOR_BRUSH_1, "editor-brush-1", N_("Single Tile"), false, scope_editor, HKCAT_TOOLS, "" },
232  { HOTKEY_EDITOR_BRUSH_2, "editor-brush-2", N_("Radius One"), false, scope_editor, HKCAT_TOOLS, "" },
233  { HOTKEY_EDITOR_BRUSH_3, "editor-brush-3", N_("Radius Two"), false, scope_editor, HKCAT_TOOLS, "" },
234  { HOTKEY_EDITOR_BRUSH_NW_SE, "editor-brush-nw-se", N_("Brush NW-SE"), false, scope_editor, HKCAT_TOOLS, "" },
235  { HOTKEY_EDITOR_BRUSH_SW_NE, "editor-brush-sw-ne", N_("Brush SW-NE"), false, scope_editor, HKCAT_TOOLS, "" },
236 
237  { HOTKEY_EDITOR_SELECTION_CUT, "editor-cut", N_("Cut"), false, scope_editor, HKCAT_CLIPBOARD, "" },
238  { HOTKEY_EDITOR_SELECTION_COPY, "editor-copy", N_("Copy"), false, scope_editor, HKCAT_CLIPBOARD, "" },
239  { HOTKEY_EDITOR_CLIPBOARD_PASTE, "editor-paste", N_("Paste"), false, scope_editor, HKCAT_CLIPBOARD, N_("Left mouse button pastes from the clipboard, right brings up a context menu.") },
240  { HOTKEY_EDITOR_SELECTION_EXPORT, "editor-export-selection-coords", N_("Export Selected Coordinates to System Clipboard"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
241  { HOTKEY_EDITOR_SELECT_ALL, "editor-select-all", N_("Select All"), false, scope_editor, HKCAT_CLIPBOARD, "" },
242  { HOTKEY_EDITOR_SELECT_INVERSE, "editor-select-inverse", N_("Select Inverse"), false, scope_editor, HKCAT_CLIPBOARD, "" },
243  { HOTKEY_EDITOR_SELECT_NONE, "editor-select-none", N_("Select None"), false, scope_editor, HKCAT_CLIPBOARD, "" },
244  { HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW, "editor-clipboard-rotate-cw", N_("Rotate Clipboard Clockwise"), false, scope_editor, HKCAT_CLIPBOARD, "" },
245  { HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW, "editor-clipboard-rotate-ccw", N_("Rotate Clipboard Counter-Clockwise"), false, scope_editor, HKCAT_CLIPBOARD, "" },
246  { HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL, "editor-clipboard-flip-horizontal", N_("Flip Clipboard Horizontally"), false, scope_editor, HKCAT_CLIPBOARD, "" },
247  { HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL, "editor-clipboard-flip-vertical", N_("Flip Clipboard Vertically"), false, scope_editor, HKCAT_CLIPBOARD, "" },
248  { HOTKEY_EDITOR_SELECTION_ROTATE, "editor-selection-rotate", N_("Rotate Selection"), false, scope_editor, HKCAT_TOOLS, "" },
249  { HOTKEY_EDITOR_SELECTION_FLIP, "editor-selection-flip", N_("Flip Selection"), false, scope_editor, HKCAT_TOOLS, "" },
250  { HOTKEY_EDITOR_SELECTION_FILL, "editor-selection-fill", N_("Fill Selection"), false, scope_editor, HKCAT_TOOLS, "" },
251  { HOTKEY_EDITOR_SELECTION_RANDOMIZE, "editor-selection-randomize", N_("Randomize Tiles in Selection"), false, scope_editor, HKCAT_TOOLS, "" },
252  { HOTKEY_EDITOR_MAP_RESIZE, "editor-map-resize", N_("Resize Map"), false, scope_editor, HKCAT_MAP, "" },
253  { HOTKEY_EDITOR_MAP_GENERATE, "editor-map-generate", N_("Generate Map"), false, scope_editor, HKCAT_MAP, "" },
254  { HOTKEY_EDITOR_MAP_APPLY_MASK, "editor-map-apply-mask", N_("Apply a Mask"), false, scope_editor, HKCAT_MAP, "" },
255  { HOTKEY_EDITOR_MAP_CREATE_MASK_TO, "editor-map-create-mask-to", N_("Create Mask"), false, scope_editor, HKCAT_MAP, "" },
256  { HOTKEY_EDITOR_REFRESH, "editor-refresh", N_("Refresh Display"), false, scope_editor, HKCAT_GENERAL, "" },
257 
258  { HOTKEY_EDITOR_UPDATE_TRANSITIONS, "editor-update-transitions", N_("Update Terrain Transitions"), false, scope_editor, HKCAT_MAP, "" },
259 
260  // This item is for binding in the preferences
261  { HOTKEY_EDITOR_TOGGLE_TRANSITIONS, "editor-toggle-transitions", N_("Toggle Terrain Transition Update"), false, scope_editor, HKCAT_MAP, "" },
262  // The next three are for displaying the different states in the menu
263  { HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS, "editor-auto-update-transitions", N_("Auto-update Terrain Transitions"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
264  { HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS, "editor-no-update-transitions", N_("Auto-update Terrain Transitions: No"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
265  { HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS, "editor-partial-update-transitions", N_("Auto-update Terrain Transitions: Partial"), true, scope_editor, HKCAT_PLACEHOLDER, "" },
266 
267  { HOTKEY_EDITOR_REFRESH_IMAGE_CACHE, "editor-refresh-image-cache", N_("Refresh Image Cache"), false, scope_editor, HKCAT_GENERAL, "" },
268  { HOTKEY_EDITOR_DRAW_COORDINATES, "editor-draw-coordinates", N_("Draw Hex Coordinates"), false, scope_editor, HKCAT_MAP, "" },
269  { HOTKEY_EDITOR_DRAW_TERRAIN_CODES, "editor-draw-terrain-codes", N_("Draw Terrain Codes"), false, scope_editor, HKCAT_MAP, "" },
270  { HOTKEY_EDITOR_DRAW_NUM_OF_BITMAPS, "editor-draw-num-of-bitmaps", N_("Draw Number of Bitmaps"), false, scope_editor, HKCAT_MAP, "" },
271 
272  { HOTKEY_EDITOR_AREA_SAVE, "editor-save-area", N_("Save Selection to Area"), false, scope_editor, HKCAT_SCENARIO, "" },
273  { HOTKEY_EDITOR_AREA_RENAME, "editor-rename-area", N_("Rename Selected Area"), false, scope_editor, HKCAT_SCENARIO, "" },
274  { HOTKEY_EDITOR_AREA_REMOVE, "editor-remove-area", N_("Remove Selected Area"), false, scope_editor, HKCAT_SCENARIO, "" },
275  { HOTKEY_EDITOR_AREA_ADD, "editor-add-area", N_("Add New Area"), false, scope_editor, HKCAT_SCENARIO, "" },
276 
277  { HOTKEY_EDITOR_PBL, "editor-pbl", N_("Add-on Publishing Editor"), false, scope_editor, HKCAT_GENERAL, "" },
278  { HOTKEY_EDITOR_CHANGE_ADDON_ID, "editor-addon-id", N_("Change Add-on ID"), false, scope_editor, HKCAT_GENERAL, "" },
279  { HOTKEY_EDITOR_SELECT_ADDON, "editor-addon-select", N_("Select active Add-on"), false, scope_editor, HKCAT_GENERAL, "" },
280  { HOTKEY_EDITOR_OPEN_ADDON, "editor-addon-open", N_("Open Add-on folder"), false, scope_editor, HKCAT_GENERAL, "" },
281 
282  { HOTKEY_EDITOR_SCENARIO_EDIT, "editor-scenario-edit", N_("Edit Scenario Settings"), false, scope_editor, HKCAT_SCENARIO, "" },
283  { HOTKEY_EDITOR_SIDE_EDIT, "editor-side-edit", N_("Edit Side"), false, scope_editor, HKCAT_SCENARIO, "" },
284  { HOTKEY_EDITOR_SIDE_REMOVE, "editor-side-remove", N_("Remove Side"), false, scope_editor, HKCAT_SCENARIO, "" },
285 
286  { HOTKEY_DELAY_SHROUD, "delayshroud", N_("Delay Shroud Updates"), false, scope_game, HKCAT_MAP, "" },
287  { HOTKEY_UPDATE_SHROUD, "updateshroud", N_("Update Shroud Now"), false, scope_game, HKCAT_MAP, "" },
288  { HOTKEY_CONTINUE_MOVE, "continue", N_("Continue Interrupted Move"), false, scope_game, HKCAT_UNITS, "" },
289  { HOTKEY_SEARCH, "search", N_("Find Label or Unit"), false, scope_game, HKCAT_MAP, "" },
290  { HOTKEY_SPEAK_ALLY, "speaktoally", N_("Speak to Ally"), false, scope_game, HKCAT_CHAT, "" },
291  { HOTKEY_SPEAK_ALL, "speaktoall", N_("Speak to All"), false, scope_game, HKCAT_CHAT, "" },
292  { HOTKEY_HELP, "help", N_("Help"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
293  { HOTKEY_HELP_ABOUT_SAVELOAD, "help-about-saveload", N_("Help about save-loading"), false, scope_game, HKCAT_GENERAL, N_("Hint: save-loading is unnecessary")},
294  { HOTKEY_CHAT_LOG, "chatlog", N_("Chat Log"), false, scope_game, HKCAT_CHAT, "" },
295  { HOTKEY_USER_CMD, "command", N_("Enter Command"), false, scope_game, HKCAT_CHAT, "" },
296  { HOTKEY_CUSTOM_CMD, "customcommand", N_("Custom Command"), false, scope_game, HKCAT_CHAT, "" },
297  { HOTKEY_AI_FORMULA, "aiformula", N_("Run Formula"), false, scope_game, HKCAT_DEBUG, "" },
298  { HOTKEY_CLEAR_MSG, "clearmessages", N_("Clear Chat"), false, scope_game, HKCAT_CHAT, "" },
299 
300  { HOTKEY_LANGUAGE, "changelanguage", N_("Change Language"), false, scope_main, HKCAT_GENERAL, "" },
301  { HOTKEY_MP_START_GAME, "mp_startgame", N_("Start Game (MP)"), false, scope_main, HKCAT_GENERAL, "" },
302  { TITLE_SCREEN__RELOAD_WML, "title_screen__reload_wml", N_("Refresh WML"), true , scope_editor | scope_main, HKCAT_PLACEHOLDER, "" },
303  { TITLE_SCREEN__NEXT_TIP, "title_screen__next_tip", N_("Next Tip of the Day"), false, scope_main, HKCAT_GENERAL, "" },
304  { TITLE_SCREEN__PREVIOUS_TIP, "title_screen__previous_tip", N_("Previous Tip of the Day"), false, scope_main, HKCAT_GENERAL, "" },
305  { TITLE_SCREEN__CAMPAIGN, "title_screen__campaign", N_("Start Campaign"), false , scope_main, HKCAT_GENERAL, "" },
306  { TITLE_SCREEN__MULTIPLAYER, "title_screen__multiplayer", N_("Start Multiplayer Game"), false, scope_main, HKCAT_GENERAL, "" },
307  { TITLE_SCREEN__ADDONS, "title_screen__addons", N_("Manage Add-ons"), false , scope_main, HKCAT_GENERAL, "" },
308  { TITLE_SCREEN__CORES, "title_screen__cores", N_("Manage Cores"), false , scope_main, HKCAT_GENERAL, "" },
309  { TITLE_SCREEN__EDITOR, "title_screen__editor", N_("Start Editor"), false, scope_main, HKCAT_GENERAL, "" },
310  { TITLE_SCREEN__CREDITS, "title_screen__credits", N_("Show Credits"), false , scope_main, HKCAT_GENERAL, "" },
311  { TITLE_SCREEN__TEST, "title_screen__test", N_("Choose Test Scenario"), false , scope_main, HKCAT_GENERAL, "" },
312 
313  { GLOBAL__HELPTIP, "global__helptip", N_("Show Helptip"), false, scope_game | scope_editor | scope_main, HKCAT_GENERAL, "" },
314 
315  { LUA_CONSOLE, "global__lua__console", N_("Show Lua Console"), false, scope_game | scope_editor | scope_main, HKCAT_DEBUG, ""},
316 
317  //This list item must stay at the end since it is used as terminator for iterating.
318  { HOTKEY_NULL, "null", N_("Unrecognized Command"), true, 0, HKCAT_PLACEHOLDER, "" }
319 }};
320 
321 const std::set<HOTKEY_COMMAND> toggle_commands {
326 };
327 
328 // Contains copies of master_hotkey_list and all current active wml menu hotkeys
329 std::map<std::string_view, hotkey::hotkey_command> registered_hotkeys;
330 
331 hk_scopes scope_active(0);
332 } // end anon namespace
333 
335  : prev_scope_active_(scope_active)
336  , restore_(true)
337 {
338 }
339 
340 scope_changer::scope_changer(hk_scopes new_scopes, bool restore)
341  : prev_scope_active_(scope_active)
342  , restore_(restore)
343 {
344  scope_active = new_scopes;
345 }
346 
348 {
349  // TODO: evaluate whether we need non-restore behavior in the game_config_manager
350  if(restore_) {
351  scope_active = prev_scope_active_;
352  }
353 }
354 
356 {
357  assert(s < SCOPE_COUNT);
358  return scope_active[s];
359 }
360 
362 {
363  // s is a copy because we need one
364  s &= scope_active;
365  return s.any();
366 }
367 
368 const hotkey_command& get_hotkey_command(const std::string& command)
369 {
370  try {
371  return registered_hotkeys.at(command);
372  } catch(const std::out_of_range&) {
374  }
375 }
376 
377 const std::map<std::string_view, hotkey::hotkey_command>& get_hotkey_commands()
378 {
379  return registered_hotkeys;
380 }
381 
382 bool has_hotkey_command(const std::string& id)
383 {
385 }
386 
387 wml_hotkey_record::wml_hotkey_record(const std::string& id, const t_string& description, const config& default_hotkey)
388  : cleanup_()
389 {
390  if(id == "null") {
391  LOG_G << "Couldn't add wml hotkey with null id and description = '" << description << "'.";
392  return;
393  }
394 
395  const auto& [iter, inserted] = registered_hotkeys.try_emplace(
396  id, hotkey::HOTKEY_WML, id, description, false, false, scope_game, HKCAT_CUSTOM, t_string(""));
397 
398  if(inserted) {
399  DBG_G << "Added wml hotkey with id = '" << id << "' and description = '" << description << "'.";
400  } else {
401  LOG_G << "Hotkey with id '" << id << "' already exists.";
402  return;
403  }
404 
405  if(!default_hotkey.empty() && !has_hotkey_item(id)) {
406  hotkey::hotkey_ptr new_item = hotkey::load_from_config(default_hotkey);
407  new_item->set_command(id);
408 
409  if(new_item->valid()) {
410  DBG_G << "added default description for the wml hotkey with id=" + id;
411  add_hotkey(new_item);
412  } else {
413  ERR_CF << "failed to add default hotkey with id=" + id;
414  }
415  }
416 
417  // Record the cleanup handler
418  cleanup_ = [id] { registered_hotkeys.erase(id); };
419 }
420 
422 {
423  if(cleanup_) {
424  cleanup_();
425  }
426 }
427 
429  : command(temp_command.command)
430  , id(temp_command.id)
431  , description(std::string(temp_command.description), "wesnoth-lib")
432  , hidden(temp_command.hidden)
433  , toggle(toggle_commands.count(temp_command.command) > 0)
434  , scope(temp_command.scope)
435  , category(temp_command.category)
436  , tooltip(std::string(temp_command.tooltip), "wesnoth-lib")
437 {
438 }
439 
441  const std::string& id_,
442  const t_string& desc,
443  bool hid,
444  bool tog,
445  hotkey::hk_scopes scop,
447  const t_string& toolt)
448  : command(cmd)
449  , id(id_)
450  , description(desc)
451  , hidden(hid)
452  , toggle(tog)
453  , scope(scop)
454  , category(cat)
455  , tooltip(toolt)
456 {
457 }
458 
460 {
461  return registered_hotkeys.at("null");
462 }
463 
465 {
466  if(command == HOTKEY_NULL || id == "null") {
467  const hotkey_command& null_cmd = null_command();
468 
469  if(command == null_cmd.command && id == null_cmd.id && scope == null_cmd.scope
470  && description == null_cmd.description) {
471  return true;
472  } else {
473  ERR_G << "the hotkey command seems to be the null command but it is not 100% sure. This shouldn't happen";
474  return true;
475  }
476  }
477 
478  return false;
479 }
480 
482 {
483  for(auto& [id, cmd] : registered_hotkeys) {
484  if(cmd.command == command) {
485  return cmd;
486  }
487  }
488 
489  ERR_G << "No hotkey with requested command '" << command << "' found. Returning null hotkey.";
491 }
492 
494 {
495  registered_hotkeys.clear();
496 
497  for(const hotkey_command_temp& cmd : master_hotkey_list) {
498  // Initialize the full hotkey from the temp data.
499  registered_hotkeys.try_emplace(cmd.id, cmd);
500  }
501 }
502 
504 {
505  return {category_names.at(category), "wesnoth-lib"};
506 }
507 
508 } // namespace hotkey
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:158
bool empty() const
Definition: config.cpp:845
wml_hotkey_record(const wml_hotkey_record &)=delete
Don't allow copying so objects don't get erased early.
std::function< void()> cleanup_
Handles removing the associated hotkey_command on this object's destruction.
Definitions for the interface to Wesnoth Markup Language (WML).
#define N_(String)
Definition: gettext.hpp:101
std::string tooltip
Shown when hovering over an entry in the filter's drop-down list.
Definition: manager.cpp:203
std::string id
Text to match against addon_info.tags()
Definition: manager.cpp:199
#define ERR_G
#define ERR_CF
#define LOG_G
#define DBG_G
static lg::log_domain log_config("config")
Standard logging facilities (interface).
Keyboard shortcuts for game actions.
const hotkey_command & get_hotkey_command(const std::string &command)
returns the hotkey_command with the given name
bool has_hotkey_command(const std::string &id)
std::shared_ptr< class hotkey_base > hotkey_ptr
Definition: hotkey_item.hpp:27
constexpr uint32_t scope_game
bool has_hotkey_item(const std::string &command)
void init_hotkey_commands()
const std::map< std::string_view, hotkey::hotkey_command > & get_hotkey_commands()
returns a container that contains all currently active hotkey_commands.
hotkey_ptr load_from_config(const config &cfg)
Create and instantiate a hotkey from a config element.
std::bitset< SCOPE_COUNT > hk_scopes
bool is_scope_active(scope s)
scope
Available hotkey scopes.
constexpr uint32_t scope_main
void add_hotkey(hotkey_ptr item)
Add a hotkey to the list of hotkeys.
t_string get_translatable_category_name(HOTKEY_CATEGORY category)
Gets the display name for a given hotkey category.
constexpr uint32_t scope_editor
@ HOTKEY_EDITOR_TOOL_VILLAGE
@ HOTKEY_MINIMAP_DRAW_VILLAGES
@ HOTKEY_EDITOR_BRUSH_NW_SE
@ HOTKEY_EDITOR_REFRESH
@ HOTKEY_FULLSCREEN
@ HOTKEY_EDITOR_SELECT_NONE
@ HOTKEY_OBJECTIVES
@ HOTKEY_ANIMATE_MAP
@ HOTKEY_SCREENSHOT
@ HOTKEY_TELEPORT_UNIT
@ HOTKEY_SPEAK_ALLY
@ HOTKEY_ACCELERATED
@ HOTKEY_EDITOR_CLIPBOARD_ROTATE_CCW
@ HOTKEY_MOUSE_SCROLL
@ HOTKEY_EDITOR_PALETTE_GROUPS
@ HOTKEY_TERRAIN_DESCRIPTION
@ HOTKEY_EDITOR_PALETTE_UPSCROLL
@ HOTKEY_END_UNIT_TURN
@ HOTKEY_EDITOR_PALETTE_ITEMS_CLEAR
@ HOTKEY_LABEL_SETTINGS
@ HOTKEY_EDITOR_SIDE_REMOVE
@ HOTKEY_WB_EXECUTE_ALL_ACTIONS
@ HOTKEY_WB_SUPPOSE_DEAD
@ HOTKEY_EDITOR_BRUSH_NEXT
@ HOTKEY_HELP_ABOUT_SAVELOAD
@ HOTKEY_EDITOR_TOOL_LABEL
@ HOTKEY_EDITOR_CLIPBOARD_ROTATE_CW
@ HOTKEY_REPLAY_PLAY
@ HOTKEY_EDITOR_BRUSH_3
@ HOTKEY_SCROLL_LEFT
@ HOTKEY_SAVE_GAME
@ HOTKEY_EDITOR_CLIPBOARD_PASTE
@ HOTKEY_EDITOR_PARTIAL_UNDO
@ HOTKEY_SPEAK_ALL
@ HOTKEY_EDITOR_UNIT_TOGGLE_CANRECRUIT
@ HOTKEY_EDITOR_PALETTE_ITEM_SWAP
@ HOTKEY_EDITOR_TOOL_PAINT
@ HOTKEY_EDITOR_MAP_CLOSE
@ HOTKEY_EDITOR_MAP_GENERATE
@ HOTKEY_SHOW_ENEMY_MOVES
@ HOTKEY_EDITOR_SELECTION_FLIP
@ HOTKEY_EDITOR_SCHEDULE
@ HOTKEY_ACHIEVEMENTS
@ HOTKEY_DESELECT_HEX
@ HOTKEY_EDITOR_TOOL_FILL
@ TITLE_SCREEN__MULTIPLAYER
@ HOTKEY_EDITOR_SCENARIO_SAVE_AS
@ HOTKEY_EDITOR_PLAYLIST
@ TITLE_SCREEN__ADDONS
@ HOTKEY_EDITOR_MAP_SAVE_AS
@ HOTKEY_UNIT_DESCRIPTION
@ HOTKEY_UPDATE_SHROUD
@ HOTKEY_REPEAT_RECRUIT
@ TITLE_SCREEN__CREDITS
@ HOTKEY_REPLAY_STOP
@ HOTKEY_KILL_UNIT
@ HOTKEY_SCROLL_RIGHT
@ HOTKEY_SAVE_REPLAY
@ HOTKEY_EDITOR_SELECT_ALL
@ HOTKEY_LABEL_TEAM_TERRAIN
@ HOTKEY_EDITOR_DRAW_COORDINATES
@ HOTKEY_UNIT_HOLD_POSITION
@ HOTKEY_EDITOR_TOOL_NEXT
@ TITLE_SCREEN__EDITOR
@ HOTKEY_EDITOR_SELECTION_EXPORT
@ HOTKEY_EDITOR_PARTIAL_UPDATE_TRANSITIONS
@ HOTKEY_EDITOR_MAP_CREATE_MASK_TO
@ HOTKEY_REPLAY_NEXT_TURN
@ HOTKEY_TOGGLE_GRID
@ HOTKEY_EDITOR_SELECTION_CUT
@ HOTKEY_EDITOR_UNIT_CHANGE_ID
@ HOTKEY_SURRENDER
@ HOTKEY_SELECT_AND_ACTION
@ HOTKEY_CLEAR_MSG
@ HOTKEY_REPLAY_SHOW_EVERYTHING
@ HOTKEY_REPLAY_SHOW_TEAM1
@ HOTKEY_MINIMAP_DRAW_TERRAIN
@ HOTKEY_LABEL_TERRAIN
@ HOTKEY_EDITOR_DRAW_NUM_OF_BITMAPS
@ HOTKEY_CUSTOM_CMD
@ HOTKEY_STOP_NETWORK
@ HOTKEY_MAP_SCREENSHOT
@ HOTKEY_CLEAR_LABELS
@ HOTKEY_EDITOR_AREA_ADD
@ HOTKEY_EDITOR_BRUSH_SW_NE
@ HOTKEY_EDITOR_TOOL_UNIT
@ HOTKEY_EDITOR_BRUSH_DEFAULT
@ HOTKEY_CONTINUE_MOVE
@ HOTKEY_BEST_ENEMY_MOVES
@ HOTKEY_QUIT_TO_DESKTOP
@ HOTKEY_EDITOR_HELP_TEXT_SHOWN
@ HOTKEY_EDITOR_CHANGE_ADDON_ID
@ HOTKEY_LOAD_AUTOSAVES
@ HOTKEY_EDITOR_CUSTOM_TODS
@ HOTKEY_EDITOR_REFRESH_IMAGE_CACHE
@ HOTKEY_EDITOR_SELECTION_FILL
@ HOTKEY_TOGGLE_ELLIPSES
@ HOTKEY_EDITOR_CLIPBOARD_FLIP_VERTICAL
@ HOTKEY_EDITOR_MAP_SAVE_ALL
@ HOTKEY_EDITOR_BRUSH_1
@ HOTKEY_EDITOR_SELECTION_ROTATE
@ HOTKEY_EDITOR_MAP_LOAD
@ HOTKEY_RENAME_UNIT
@ HOTKEY_EDITOR_BRUSH_2
@ HOTKEY_EDITOR_TOOL_STARTING_POSITION
@ HOTKEY_MINIMAP_CODING_TERRAIN
@ HOTKEY_EDITOR_NO_UPDATE_TRANSITIONS
@ HOTKEY_LOAD_GAME
@ TITLE_SCREEN__TEST
@ HOTKEY_WB_EXECUTE_ACTION
@ HOTKEY_EDITOR_SELECTION_COPY
@ HOTKEY_MINIMAP_DRAW_UNITS
@ HOTKEY_CHANGE_SIDE
@ HOTKEY_EDITOR_PALETTE_DOWNSCROLL
@ HOTKEY_EDITOR_UNIT_TOGGLE_LOYAL
@ TITLE_SCREEN__PREVIOUS_TIP
@ HOTKEY_CYCLE_UNITS
@ HOTKEY_DELAY_SHROUD
@ HOTKEY_WB_BUMP_UP_ACTION
@ HOTKEY_EDITOR_MAP_APPLY_MASK
@ HOTKEY_EDITOR_LOCAL_TIME
@ HOTKEY_CREATE_UNIT
@ HOTKEY_REPLAY_EXIT
@ HOTKEY_EDITOR_UNIT_FACING
@ HOTKEY_PREFERENCES
@ HOTKEY_STATUS_TABLE
@ HOTKEY_REPLAY_NEXT_SIDE
@ HOTKEY_DELETE_UNIT
@ HOTKEY_MOVE_ACTION
@ HOTKEY_REPLAY_NEXT_MOVE
@ HOTKEY_REPLAY_RESET
@ HOTKEY_EDITOR_EDIT_UNIT
@ HOTKEY_TOUCH_HEX
@ HOTKEY_EDITOR_SIDE_NEW
@ HOTKEY_EDITOR_SELECTION_RANDOMIZE
@ HOTKEY_START_NETWORK
@ HOTKEY_WB_TOGGLE
@ HOTKEY_EDITOR_SCENARIO_NEW
@ TITLE_SCREEN__CORES
@ HOTKEY_EDITOR_MAP_SWITCH
@ HOTKEY_STATISTICS
@ HOTKEY_EDITOR_SELECT_INVERSE
@ HOTKEY_EDITOR_TOGGLE_TRANSITIONS
@ HOTKEY_UNIT_LIST
@ HOTKEY_SCROLL_DOWN
@ HOTKEY_EDITOR_AUTO_UPDATE_TRANSITIONS
@ HOTKEY_REPLAY_SKIP_ANIMATION
@ HOTKEY_ZOOM_DEFAULT
@ HOTKEY_EDITOR_MAP_INFO
@ HOTKEY_WB_BUMP_DOWN_ACTION
@ TITLE_SCREEN__CAMPAIGN
@ HOTKEY_EDITOR_AREA_RENAME
@ HOTKEY_EDITOR_MAP_RESIZE
@ HOTKEY_SCROLL_UP
@ HOTKEY_EDITOR_DRAW_TERRAIN_CODES
@ HOTKEY_MP_START_GAME
@ HOTKEY_EDITOR_MAP_TO_SCENARIO
@ HOTKEY_EDITOR_AREA_REMOVE
@ HOTKEY_SELECT_HEX
@ HOTKEY_QUIT_GAME
@ HOTKEY_EDITOR_UPDATE_TRANSITIONS
@ HOTKEY_EDITOR_TOOL_SELECT
@ HOTKEY_EDITOR_MAP_NEW
@ HOTKEY_EDITOR_MAP_SAVE
@ HOTKEY_EDITOR_AREA_SAVE
@ HOTKEY_EDITOR_REMOVE_LOCATION
@ HOTKEY_EDITOR_SIDE_EDIT
@ HOTKEY_AI_FORMULA
@ HOTKEY_EDITOR_SELECT_ADDON
@ HOTKEY_EDITOR_TOOL_ITEM
@ TITLE_SCREEN__RELOAD_WML
@ HOTKEY_REPLAY_SHOW_EACH
@ TITLE_SCREEN__NEXT_TIP
@ HOTKEY_CYCLE_BACK_UNITS
@ HOTKEY_EDITOR_UNIT_TOGGLE_RENAMEABLE
@ HOTKEY_EDITOR_SCENARIO_EDIT
@ HOTKEY_EDITOR_OPEN_ADDON
@ HOTKEY_EDITOR_MAP_REVERT
@ HOTKEY_WB_DELETE_ACTION
@ HOTKEY_EDITOR_CLIPBOARD_FLIP_HORIZONTAL
@ HOTKEY_MINIMAP_CODING_UNIT
Stores all information related to functions that can be bound to hotkeys.
HOTKEY_COMMAND command
The command associated with this hotkey.
std::string id
The unique ID.
hk_scopes scope
The visibility scope of the command.
static const hotkey_command & null_command()
returns the command that is treated as null
bool null() const
checks weather this is the null hotkey_command
static const hotkey_command & get_command_by_command(HOTKEY_COMMAND command)
the execute_command argument was changed from HOTKEY_COMMAND to hotkey_command, to be able to call it...
static map_location::direction s