Changeset - r27524:9bc6967f2b31
[Not reviewed]
master
0 15 0
PeterN - 12 months ago 2023-06-05 17:12:30
peter1138@openttd.org
Codechange: Reorganise hotkey initialisation. (#10951)

Hotkeys are now initialized inline, and use std::vector instead of
separate static C-arrays and std::string instead of char *. The list end
marker is no longer required.
15 files changed with 408 insertions and 500 deletions:
0 comments (0 inline, 0 general)
src/airport_gui.cpp
Show inline comments
 
@@ -177,28 +177,24 @@ struct BuildAirToolbarWindow : Window {
 
		CloseWindowById(WC_SELECT_STATION, 0);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the BuildAirToolbarWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState AirportToolbarGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
		Window *w = ShowBuildAirToolbar();
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
/**
 
 * Handler for global hotkeys of the BuildAirToolbarWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState AirportToolbarGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildAirToolbar();
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey airtoolbar_hotkeys[] = {
 
	Hotkey('1', "airport", WID_AT_AIRPORT),
 
	Hotkey('2', "demolish", WID_AT_DEMOLISH),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"airtoolbar", {
 
		Hotkey('1', "airport", WID_AT_AIRPORT),
 
		Hotkey('2', "demolish", WID_AT_DEMOLISH),
 
	}, AirportToolbarGlobalHotkeys};
 
};
 
HotkeyList BuildAirToolbarWindow::hotkeys("airtoolbar", airtoolbar_hotkeys, AirportToolbarGlobalHotkeys);
 

	
 
static const NWidgetPart _nested_air_toolbar_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1871,15 +1871,11 @@ struct BuildVehicleWindow : Window {
 
		return ES_HANDLED;
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	static inline HotkeyList hotkeys{"buildvehicle", {
 
		Hotkey('F', "focus_filter_box", BVHK_FOCUS_FILTER_BOX),
 
	}};
 
};
 

	
 
static Hotkey buildvehicle_hotkeys[] = {
 
	Hotkey('F', "focus_filter_box", BVHK_FOCUS_FILTER_BOX),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList BuildVehicleWindow::hotkeys("buildvehicle", buildvehicle_hotkeys);
 

	
 
static WindowDesc _build_vehicle_desc(
 
	WDP_AUTO, "build_vehicle", 240, 268,
 
	WC_BUILD_VEHICLE, WC_NONE,
src/dock_gui.cpp
Show inline comments
 
@@ -298,36 +298,30 @@ struct BuildDocksToolbarWindow : Window 
 
		VpSetPresizeRange(tile_from, tile_to);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the BuildDocksToolbarWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState DockToolbarGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
		Window *w = ShowBuildDocksToolbar();
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
/**
 
 * Handler for global hotkeys of the BuildDocksToolbarWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState DockToolbarGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildDocksToolbar();
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
const uint16 _dockstoolbar_aqueduct_keys[] = {'B', '8', 0};
 

	
 
static Hotkey dockstoolbar_hotkeys[] = {
 
	Hotkey('1', "canal", WID_DT_CANAL),
 
	Hotkey('2', "lock", WID_DT_LOCK),
 
	Hotkey('3', "demolish", WID_DT_DEMOLISH),
 
	Hotkey('4', "depot", WID_DT_DEPOT),
 
	Hotkey('5', "dock", WID_DT_STATION),
 
	Hotkey('6', "buoy", WID_DT_BUOY),
 
	Hotkey('7', "river", WID_DT_RIVER),
 
	Hotkey(_dockstoolbar_aqueduct_keys, "aqueduct", WID_DT_BUILD_AQUEDUCT),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"dockstoolbar", {
 
		Hotkey('1', "canal", WID_DT_CANAL),
 
		Hotkey('2', "lock", WID_DT_LOCK),
 
		Hotkey('3', "demolish", WID_DT_DEMOLISH),
 
		Hotkey('4', "depot", WID_DT_DEPOT),
 
		Hotkey('5', "dock", WID_DT_STATION),
 
		Hotkey('6', "buoy", WID_DT_BUOY),
 
		Hotkey('7', "river", WID_DT_RIVER),
 
		Hotkey({'B', '8'}, "aqueduct", WID_DT_BUILD_AQUEDUCT),
 
	}, DockToolbarGlobalHotkeys};
 
};
 
HotkeyList BuildDocksToolbarWindow::hotkeys("dockstoolbar", dockstoolbar_hotkeys, DockToolbarGlobalHotkeys);
 

	
 
/**
 
 * Nested widget parts of docks toolbar, game version.
src/hotkeys.cpp
Show inline comments
 
@@ -149,14 +149,14 @@ static uint16 ParseKeycode(const char *s
 
 * @param hotkey The hotkey object to add the keycodes to
 
 * @param value The string to parse
 
 */
 
static void ParseHotkeys(Hotkey *hotkey, const char *value)
 
static void ParseHotkeys(Hotkey &hotkey, const char *value)
 
{
 
	const char *start = value;
 
	while (*start != '\0') {
 
		const char *end = start;
 
		while (*end != '\0' && *end != ',') end++;
 
		uint16 keycode = ParseKeycode(start, end);
 
		if (keycode != 0) hotkey->AddKeycode(keycode);
 
		if (keycode != 0) hotkey.AddKeycode(keycode);
 
		start = (*end == ',') ? end + 1: end;
 
	}
 
}
 
@@ -210,10 +210,10 @@ static std::string KeycodeToString(uint1
 
 * @param hotkey The keycodes of this hotkey need to be converted to a string.
 
 * @return A string representation of all keycodes.
 
 */
 
std::string SaveKeycodes(const Hotkey *hotkey)
 
std::string SaveKeycodes(const Hotkey &hotkey)
 
{
 
	std::string str;
 
	for (auto keycode : hotkey->keycodes) {
 
	for (auto keycode : hotkey.keycodes) {
 
		if (!str.empty()) str += ",";
 
		str += KeycodeToString(keycode);
 
	}
 
@@ -226,7 +226,7 @@ std::string SaveKeycodes(const Hotkey *h
 
 * @param name The name of this hotkey.
 
 * @param num Number of this hotkey, should be unique within the hotkey list.
 
 */
 
Hotkey::Hotkey(uint16 default_keycode, const char *name, int num) :
 
Hotkey::Hotkey(uint16 default_keycode, const std::string &name, int num) :
 
	name(name),
 
	num(num)
 
{
 
@@ -239,14 +239,12 @@ Hotkey::Hotkey(uint16 default_keycode, c
 
 * @param name The name of this hotkey.
 
 * @param num Number of this hotkey, should be unique within the hotkey list.
 
 */
 
Hotkey::Hotkey(const uint16 *default_keycodes, const char *name, int num) :
 
Hotkey::Hotkey(const std::vector<uint16> &default_keycodes, const std::string &name, int num) :
 
	name(name),
 
	num(num)
 
{
 
	const uint16 *keycode = default_keycodes;
 
	while (*keycode != 0) {
 
		this->AddKeycode(*keycode);
 
		keycode++;
 
	for (uint16 keycode : default_keycodes) {
 
		this->AddKeycode(keycode);
 
	}
 
}
 

	
 
@@ -260,7 +258,7 @@ void Hotkey::AddKeycode(uint16 keycode)
 
	this->keycodes.insert(keycode);
 
}
 

	
 
HotkeyList::HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler) :
 
HotkeyList::HotkeyList(const std::string &ini_group, const std::vector<Hotkey> &items, GlobalHotkeyHandlerFunc global_hotkey_handler) :
 
	global_hotkey_handler(global_hotkey_handler), ini_group(ini_group), items(items)
 
{
 
	if (_hotkey_lists == nullptr) _hotkey_lists = new std::vector<HotkeyList*>();
 
@@ -279,10 +277,10 @@ HotkeyList::~HotkeyList()
 
void HotkeyList::Load(IniFile *ini)
 
{
 
	IniGroup *group = ini->GetGroup(this->ini_group);
 
	for (Hotkey *hotkey = this->items; hotkey->name != nullptr; ++hotkey) {
 
		IniItem *item = group->GetItem(hotkey->name, false);
 
	for (Hotkey &hotkey : this->items) {
 
		IniItem *item = group->GetItem(hotkey.name, false);
 
		if (item != nullptr) {
 
			hotkey->keycodes.clear();
 
			hotkey.keycodes.clear();
 
			if (item->value.has_value()) ParseHotkeys(hotkey, item->value->c_str());
 
		}
 
	}
 
@@ -295,8 +293,8 @@ void HotkeyList::Load(IniFile *ini)
 
void HotkeyList::Save(IniFile *ini) const
 
{
 
	IniGroup *group = ini->GetGroup(this->ini_group);
 
	for (const Hotkey *hotkey = this->items; hotkey->name != nullptr; ++hotkey) {
 
		IniItem *item = group->GetItem(hotkey->name, true);
 
	for (const Hotkey &hotkey : this->items) {
 
		IniItem *item = group->GetItem(hotkey.name, true);
 
		item->SetValue(SaveKeycodes(hotkey));
 
	}
 
}
 
@@ -309,11 +307,11 @@ void HotkeyList::Save(IniFile *ini) cons
 
 */
 
int HotkeyList::CheckMatch(uint16 keycode, bool global_only) const
 
{
 
	for (const Hotkey *list = this->items; list->name != nullptr; ++list) {
 
		auto begin = list->keycodes.begin();
 
		auto end = list->keycodes.end();
 
	for (const Hotkey &hotkey : this->items) {
 
		auto begin = hotkey.keycodes.begin();
 
		auto end = hotkey.keycodes.end();
 
		if (std::find(begin, end, keycode | WKC_GLOBAL_HOTKEY) != end || (!global_only && std::find(begin, end, keycode) != end)) {
 
			return list->num;
 
			return hotkey.num;
 
		}
 
	}
 
	return -1;
src/hotkeys.h
Show inline comments
 
@@ -19,18 +19,16 @@
 
 * a list of keycodes and a number to help identifying this hotkey.
 
 */
 
struct Hotkey {
 
	Hotkey(uint16 default_keycode, const char *name, int num);
 
	Hotkey(const uint16 *default_keycodes, const char *name, int num);
 
	Hotkey(uint16 default_keycode, const std::string &name, int num);
 
	Hotkey(const std::vector<uint16> &default_keycodes, const std::string &name, int num);
 

	
 
	void AddKeycode(uint16 keycode);
 

	
 
	const char *name;
 
	const std::string name;
 
	int num;
 
	std::set<uint16> keycodes;
 
};
 

	
 
#define HOTKEY_LIST_END Hotkey((uint16)0, nullptr, -1)
 

	
 
struct IniFile;
 

	
 
/**
 
@@ -39,7 +37,7 @@ struct IniFile;
 
struct HotkeyList {
 
	typedef EventState (*GlobalHotkeyHandlerFunc)(int hotkey);
 

	
 
	HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler = nullptr);
 
	HotkeyList(const std::string &ini_group, const std::vector<Hotkey> &items, GlobalHotkeyHandlerFunc global_hotkey_handler = nullptr);
 
	~HotkeyList();
 

	
 
	void Load(IniFile *ini);
 
@@ -49,8 +47,8 @@ struct HotkeyList {
 

	
 
	GlobalHotkeyHandlerFunc global_hotkey_handler;
 
private:
 
	const char *ini_group;
 
	Hotkey *items;
 
	const std::string ini_group;
 
	std::vector<Hotkey> items;
 

	
 
	/**
 
	 * Dummy private copy constructor to prevent compilers from
src/main_gui.cpp
Show inline comments
 
@@ -461,62 +461,51 @@ struct MainWindow : Window
 
		InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 

	
 
const uint16 _ghk_quit_keys[] = {'Q' | WKC_CTRL, 'Q' | WKC_META, 0};
 
const uint16 _ghk_abandon_keys[] = {'W' | WKC_CTRL, 'W' | WKC_META, 0};
 
const uint16 _ghk_chat_keys[] = {WKC_RETURN, 'T', 0};
 
const uint16 _ghk_chat_all_keys[] = {WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T', 0};
 
const uint16 _ghk_chat_company_keys[] = {WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T', 0};
 
const uint16 _ghk_chat_server_keys[] = {WKC_CTRL | WKC_SHIFT | WKC_RETURN, WKC_CTRL | WKC_SHIFT | 'T', 0};
 

	
 
static Hotkey global_hotkeys[] = {
 
	Hotkey(_ghk_quit_keys, "quit", GHK_QUIT),
 
	Hotkey(_ghk_abandon_keys, "abandon", GHK_ABANDON),
 
	Hotkey(WKC_BACKQUOTE, "console", GHK_CONSOLE),
 
	Hotkey('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
 
	Hotkey('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
 
	Hotkey('C', "center", GHK_CENTER),
 
	Hotkey('Z', "center_zoom", GHK_CENTER_ZOOM),
 
	Hotkey(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
 
	Hotkey(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
 
	Hotkey(WKC_DELETE | WKC_SHIFT, "delete_all_windows", GHK_DELETE_NONVITAL_WINDOWS),
 
	Hotkey(WKC_DELETE | WKC_CTRL, "delete_all_messages", GHK_DELETE_ALL_MESSAGES),
 
	Hotkey('R' | WKC_CTRL, "refresh_screen", GHK_REFRESH_SCREEN),
 
	static inline HotkeyList hotkeys{"global", {
 
		Hotkey({'Q' | WKC_CTRL, 'Q' | WKC_META}, "quit", GHK_QUIT),
 
		Hotkey({'W' | WKC_CTRL, 'W' | WKC_META}, "abandon", GHK_ABANDON),
 
		Hotkey(WKC_BACKQUOTE, "console", GHK_CONSOLE),
 
		Hotkey('B' | WKC_CTRL, "bounding_boxes", GHK_BOUNDING_BOXES),
 
		Hotkey('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
 
		Hotkey('C', "center", GHK_CENTER),
 
		Hotkey('Z', "center_zoom", GHK_CENTER_ZOOM),
 
		Hotkey(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
 
		Hotkey(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
 
		Hotkey(WKC_DELETE | WKC_SHIFT, "delete_all_windows", GHK_DELETE_NONVITAL_WINDOWS),
 
		Hotkey(WKC_DELETE | WKC_CTRL, "delete_all_messages", GHK_DELETE_ALL_MESSAGES),
 
		Hotkey('R' | WKC_CTRL, "refresh_screen", GHK_REFRESH_SCREEN),
 
#if defined(_DEBUG)
 
	Hotkey('0' | WKC_ALT, "crash_game", GHK_CRASH),
 
	Hotkey('1' | WKC_ALT, "money", GHK_MONEY),
 
	Hotkey('2' | WKC_ALT, "update_coordinates", GHK_UPDATE_COORDS),
 
		Hotkey('0' | WKC_ALT, "crash_game", GHK_CRASH),
 
		Hotkey('1' | WKC_ALT, "money", GHK_MONEY),
 
		Hotkey('2' | WKC_ALT, "update_coordinates", GHK_UPDATE_COORDS),
 
#endif
 
	Hotkey('1' | WKC_CTRL, "transparency_signs", GHK_TOGGLE_TRANSPARENCY),
 
	Hotkey('2' | WKC_CTRL, "transparency_trees", GHK_TOGGLE_TRANSPARENCY + 1),
 
	Hotkey('3' | WKC_CTRL, "transparency_houses", GHK_TOGGLE_TRANSPARENCY + 2),
 
	Hotkey('4' | WKC_CTRL, "transparency_industries", GHK_TOGGLE_TRANSPARENCY + 3),
 
	Hotkey('5' | WKC_CTRL, "transparency_buildings", GHK_TOGGLE_TRANSPARENCY + 4),
 
	Hotkey('6' | WKC_CTRL, "transparency_bridges", GHK_TOGGLE_TRANSPARENCY + 5),
 
	Hotkey('7' | WKC_CTRL, "transparency_structures", GHK_TOGGLE_TRANSPARENCY + 6),
 
	Hotkey('8' | WKC_CTRL, "transparency_catenary", GHK_TOGGLE_TRANSPARENCY + 7),
 
	Hotkey('9' | WKC_CTRL, "transparency_loading", GHK_TOGGLE_TRANSPARENCY + 8),
 
	Hotkey('1' | WKC_CTRL | WKC_SHIFT, "invisibility_signs", GHK_TOGGLE_INVISIBILITY),
 
	Hotkey('2' | WKC_CTRL | WKC_SHIFT, "invisibility_trees", GHK_TOGGLE_INVISIBILITY + 1),
 
	Hotkey('3' | WKC_CTRL | WKC_SHIFT, "invisibility_houses", GHK_TOGGLE_INVISIBILITY + 2),
 
	Hotkey('4' | WKC_CTRL | WKC_SHIFT, "invisibility_industries", GHK_TOGGLE_INVISIBILITY + 3),
 
	Hotkey('5' | WKC_CTRL | WKC_SHIFT, "invisibility_buildings", GHK_TOGGLE_INVISIBILITY + 4),
 
	Hotkey('6' | WKC_CTRL | WKC_SHIFT, "invisibility_bridges", GHK_TOGGLE_INVISIBILITY + 5),
 
	Hotkey('7' | WKC_CTRL | WKC_SHIFT, "invisibility_structures", GHK_TOGGLE_INVISIBILITY + 6),
 
	Hotkey('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7),
 
	Hotkey('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR),
 
	Hotkey('X', "toggle_transparency", GHK_TRANSPARANCY),
 
	Hotkey(_ghk_chat_keys, "chat", GHK_CHAT),
 
	Hotkey(_ghk_chat_all_keys, "chat_all", GHK_CHAT_ALL),
 
	Hotkey(_ghk_chat_company_keys, "chat_company", GHK_CHAT_COMPANY),
 
	Hotkey(_ghk_chat_server_keys, "chat_server", GHK_CHAT_SERVER),
 
	Hotkey(WKC_SPACE, "close_news", GHK_CLOSE_NEWS),
 
	Hotkey(WKC_SPACE, "close_error", GHK_CLOSE_ERROR),
 
	HOTKEY_LIST_END
 
		Hotkey('1' | WKC_CTRL, "transparency_signs", GHK_TOGGLE_TRANSPARENCY),
 
		Hotkey('2' | WKC_CTRL, "transparency_trees", GHK_TOGGLE_TRANSPARENCY + 1),
 
		Hotkey('3' | WKC_CTRL, "transparency_houses", GHK_TOGGLE_TRANSPARENCY + 2),
 
		Hotkey('4' | WKC_CTRL, "transparency_industries", GHK_TOGGLE_TRANSPARENCY + 3),
 
		Hotkey('5' | WKC_CTRL, "transparency_buildings", GHK_TOGGLE_TRANSPARENCY + 4),
 
		Hotkey('6' | WKC_CTRL, "transparency_bridges", GHK_TOGGLE_TRANSPARENCY + 5),
 
		Hotkey('7' | WKC_CTRL, "transparency_structures", GHK_TOGGLE_TRANSPARENCY + 6),
 
		Hotkey('8' | WKC_CTRL, "transparency_catenary", GHK_TOGGLE_TRANSPARENCY + 7),
 
		Hotkey('9' | WKC_CTRL, "transparency_loading", GHK_TOGGLE_TRANSPARENCY + 8),
 
		Hotkey('1' | WKC_CTRL | WKC_SHIFT, "invisibility_signs", GHK_TOGGLE_INVISIBILITY),
 
		Hotkey('2' | WKC_CTRL | WKC_SHIFT, "invisibility_trees", GHK_TOGGLE_INVISIBILITY + 1),
 
		Hotkey('3' | WKC_CTRL | WKC_SHIFT, "invisibility_houses", GHK_TOGGLE_INVISIBILITY + 2),
 
		Hotkey('4' | WKC_CTRL | WKC_SHIFT, "invisibility_industries", GHK_TOGGLE_INVISIBILITY + 3),
 
		Hotkey('5' | WKC_CTRL | WKC_SHIFT, "invisibility_buildings", GHK_TOGGLE_INVISIBILITY + 4),
 
		Hotkey('6' | WKC_CTRL | WKC_SHIFT, "invisibility_bridges", GHK_TOGGLE_INVISIBILITY + 5),
 
		Hotkey('7' | WKC_CTRL | WKC_SHIFT, "invisibility_structures", GHK_TOGGLE_INVISIBILITY + 6),
 
		Hotkey('8' | WKC_CTRL | WKC_SHIFT, "invisibility_catenary", GHK_TOGGLE_INVISIBILITY + 7),
 
		Hotkey('X' | WKC_CTRL, "transparency_toolbar", GHK_TRANSPARENCY_TOOLBAR),
 
		Hotkey('X', "toggle_transparency", GHK_TRANSPARANCY),
 
		Hotkey({WKC_RETURN, 'T'}, "chat", GHK_CHAT),
 
		Hotkey({WKC_SHIFT | WKC_RETURN, WKC_SHIFT | 'T'}, "chat_all", GHK_CHAT_ALL),
 
		Hotkey({WKC_CTRL | WKC_RETURN, WKC_CTRL | 'T'}, "chat_company", GHK_CHAT_COMPANY),
 
		Hotkey({WKC_CTRL | WKC_SHIFT | WKC_RETURN, WKC_CTRL | WKC_SHIFT | 'T'}, "chat_server", GHK_CHAT_SERVER),
 
		Hotkey(WKC_SPACE, "close_news", GHK_CLOSE_NEWS),
 
		Hotkey(WKC_SPACE, "close_error", GHK_CLOSE_ERROR),
 
	}};
 
};
 
HotkeyList MainWindow::hotkeys("global", global_hotkeys);
 

	
 
static WindowDesc _main_window_desc(
 
	WDP_MANUAL, nullptr, 0, 0,
src/object_gui.cpp
Show inline comments
 
@@ -637,27 +637,24 @@ public:
 
		this->SelectOtherObject(-1);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	/**
 
	 * Handler for global hotkeys of the BuildObjectWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState BuildObjectGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
 
		Window *w = ShowBuildObjectPicker();
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
	static inline HotkeyList hotkeys{"buildobject", {
 
		Hotkey('F', "focus_filter_box", BOHK_FOCUS_FILTER_BOX),
 
	}, BuildObjectGlobalHotkeys};
 
};
 

	
 
/**
 
 * Handler for global hotkeys of the BuildObjectWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState BuildObjectGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildObjectPicker();
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey buildobject_hotkeys[] = {
 
	Hotkey('F', "focus_filter_box", BOHK_FOCUS_FILTER_BOX),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList BuildObjectWindow::hotkeys("buildobject", buildobject_hotkeys, BuildObjectGlobalHotkeys);
 

	
 
Listing BuildObjectWindow::last_sorting = { false, 0 };
 
Filtering BuildObjectWindow::last_filtering = { false, 0 };
src/order_gui.cpp
Show inline comments
 
@@ -1546,25 +1546,21 @@ public:
 
		this->vscroll->SetCapacityFromWidget(this, WID_O_ORDER_LIST);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	static inline HotkeyList hotkeys{"order", {
 
		Hotkey('D', "skip", OHK_SKIP),
 
		Hotkey('F', "delete", OHK_DELETE),
 
		Hotkey('G', "goto", OHK_GOTO),
 
		Hotkey('H', "nonstop", OHK_NONSTOP),
 
		Hotkey('J', "fullload", OHK_FULLLOAD),
 
		Hotkey('K', "unload", OHK_UNLOAD),
 
		Hotkey(0, "nearest_depot", OHK_NEAREST_DEPOT),
 
		Hotkey(0, "always_service", OHK_ALWAYS_SERVICE),
 
		Hotkey(0, "transfer", OHK_TRANSFER),
 
		Hotkey(0, "no_unload", OHK_NO_UNLOAD),
 
		Hotkey(0, "no_load", OHK_NO_LOAD),
 
	}};
 
};
 

	
 
static Hotkey order_hotkeys[] = {
 
	Hotkey('D', "skip", OHK_SKIP),
 
	Hotkey('F', "delete", OHK_DELETE),
 
	Hotkey('G', "goto", OHK_GOTO),
 
	Hotkey('H', "nonstop", OHK_NONSTOP),
 
	Hotkey('J', "fullload", OHK_FULLLOAD),
 
	Hotkey('K', "unload", OHK_UNLOAD),
 
	Hotkey((uint16)0, "nearest_depot", OHK_NEAREST_DEPOT),
 
	Hotkey((uint16)0, "always_service", OHK_ALWAYS_SERVICE),
 
	Hotkey((uint16)0, "transfer", OHK_TRANSFER),
 
	Hotkey((uint16)0, "no_unload", OHK_NO_UNLOAD),
 
	Hotkey((uint16)0, "no_load", OHK_NO_LOAD),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList OrdersWindow::hotkeys("order", order_hotkeys);
 

	
 
/** Nested widget definition for "your" train orders. */
 
static const NWidgetPart _nested_orders_train_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/rail_gui.cpp
Show inline comments
 
@@ -764,43 +764,37 @@ struct BuildRailToolbarWindow : Window {
 
		if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) CheckRedrawWaypointCoverage(this);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 

	
 
/**
 
 * Handler for global hotkeys of the BuildRailToolbarWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState RailToolbarGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
	extern RailType _last_built_railtype;
 
	Window *w = ShowBuildRailToolbar(_last_built_railtype);
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
const uint16 _railtoolbar_autorail_keys[] = {'5', 'A' | WKC_GLOBAL_HOTKEY, 0};
 
	/**
 
	 * Handler for global hotkeys of the BuildRailToolbarWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState RailToolbarGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
		extern RailType _last_built_railtype;
 
		Window *w = ShowBuildRailToolbar(_last_built_railtype);
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
static Hotkey railtoolbar_hotkeys[] = {
 
	Hotkey('1', "build_ns", WID_RAT_BUILD_NS),
 
	Hotkey('2', "build_x", WID_RAT_BUILD_X),
 
	Hotkey('3', "build_ew", WID_RAT_BUILD_EW),
 
	Hotkey('4', "build_y", WID_RAT_BUILD_Y),
 
	Hotkey(_railtoolbar_autorail_keys, "autorail", WID_RAT_AUTORAIL),
 
	Hotkey('6', "demolish", WID_RAT_DEMOLISH),
 
	Hotkey('7', "depot", WID_RAT_BUILD_DEPOT),
 
	Hotkey('8', "waypoint", WID_RAT_BUILD_WAYPOINT),
 
	Hotkey('9', "station", WID_RAT_BUILD_STATION),
 
	Hotkey('S', "signal", WID_RAT_BUILD_SIGNALS),
 
	Hotkey('B', "bridge", WID_RAT_BUILD_BRIDGE),
 
	Hotkey('T', "tunnel", WID_RAT_BUILD_TUNNEL),
 
	Hotkey('R', "remove", WID_RAT_REMOVE),
 
	Hotkey('C', "convert", WID_RAT_CONVERT_RAIL),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"railtoolbar", {
 
		Hotkey('1', "build_ns", WID_RAT_BUILD_NS),
 
		Hotkey('2', "build_x", WID_RAT_BUILD_X),
 
		Hotkey('3', "build_ew", WID_RAT_BUILD_EW),
 
		Hotkey('4', "build_y", WID_RAT_BUILD_Y),
 
		Hotkey({'5', 'A' | WKC_GLOBAL_HOTKEY}, "autorail", WID_RAT_AUTORAIL),
 
		Hotkey('6', "demolish", WID_RAT_DEMOLISH),
 
		Hotkey('7', "depot", WID_RAT_BUILD_DEPOT),
 
		Hotkey('8', "waypoint", WID_RAT_BUILD_WAYPOINT),
 
		Hotkey('9', "station", WID_RAT_BUILD_STATION),
 
		Hotkey('S', "signal", WID_RAT_BUILD_SIGNALS),
 
		Hotkey('B', "bridge", WID_RAT_BUILD_BRIDGE),
 
		Hotkey('T', "tunnel", WID_RAT_BUILD_TUNNEL),
 
		Hotkey('R', "remove", WID_RAT_REMOVE),
 
		Hotkey('C', "convert", WID_RAT_CONVERT_RAIL),
 
	}, RailToolbarGlobalHotkeys};
 
};
 
HotkeyList BuildRailToolbarWindow::hotkeys("railtoolbar", railtoolbar_hotkeys, RailToolbarGlobalHotkeys);
 

	
 
static const NWidgetPart _nested_build_rail_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
@@ -1502,27 +1496,23 @@ public:
 
		this->SetDirty();
 
	}};
 

	
 
	static HotkeyList hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the BuildRailStationWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState BuildRailStationGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
 
		Window *w = ShowStationBuilder(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL));
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
/**
 
 * Handler for global hotkeys of the BuildRailStationWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState BuildRailStationGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
 
	Window *w = ShowStationBuilder(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_RAIL));
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey buildrailstation_hotkeys[] = {
 
	Hotkey('F', "focus_filter_box", BRASHK_FOCUS_FILTER_BOX),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"buildrailstation", {
 
		Hotkey('F', "focus_filter_box", BRASHK_FOCUS_FILTER_BOX),
 
	}, BuildRailStationGlobalHotkeys};
 
};
 
HotkeyList BuildRailStationWindow::hotkeys("buildrailstation", buildrailstation_hotkeys, BuildRailStationGlobalHotkeys);
 

	
 
Listing BuildRailStationWindow::last_sorting = { false, 0 };
 
Filtering BuildRailStationWindow::last_filtering = { false, 0 };
src/road_gui.cpp
Show inline comments
 
@@ -750,82 +750,74 @@ struct BuildRoadToolbarWindow : Window {
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	static HotkeyList road_hotkeys;
 
	static HotkeyList tram_hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the BuildRoadToolbarWindow.
 
	 * @param hotkey Hotkey
 
	 * @param last_build Last build road type
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
 
	{
 
		Window* w = nullptr;
 
		switch (_game_mode) {
 
			case GM_NORMAL:
 
				w = ShowBuildRoadToolbar(last_build);
 
				break;
 

	
 
/**
 
 * Handler for global hotkeys of the BuildRoadToolbarWindow.
 
 * @param hotkey Hotkey
 
 * @param last_build Last build road type
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, RoadTramType rtt)
 
{
 
	Window* w = nullptr;
 
	switch (_game_mode) {
 
		case GM_NORMAL:
 
			w = ShowBuildRoadToolbar(last_build);
 
			break;
 
			case GM_EDITOR:
 
				if ((GetRoadTypes(true) & ((rtt == RTT_ROAD) ? ~_roadtypes_type : _roadtypes_type)) == ROADTYPES_NONE) return ES_NOT_HANDLED;
 
				w = ShowBuildRoadScenToolbar(last_build);
 
				break;
 

	
 
			default:
 
				break;
 
		}
 

	
 
		case GM_EDITOR:
 
			if ((GetRoadTypes(true) & ((rtt == RTT_ROAD) ? ~_roadtypes_type : _roadtypes_type)) == ROADTYPES_NONE) return ES_NOT_HANDLED;
 
			w = ShowBuildRoadScenToolbar(last_build);
 
			break;
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
		default:
 
			break;
 
	static EventState RoadToolbarGlobalHotkeys(int hotkey)
 
	{
 
		extern RoadType _last_built_roadtype;
 
		return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_roadtype, RTT_ROAD);
 
	}
 

	
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static EventState RoadToolbarGlobalHotkeys(int hotkey)
 
{
 
	extern RoadType _last_built_roadtype;
 
	return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_roadtype, RTT_ROAD);
 
}
 

	
 
static EventState TramToolbarGlobalHotkeys(int hotkey)
 
{
 
	extern RoadType _last_built_tramtype;
 
	return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_tramtype, RTT_TRAM);
 
}
 
	static EventState TramToolbarGlobalHotkeys(int hotkey)
 
	{
 
		extern RoadType _last_built_tramtype;
 
		return RoadTramToolbarGlobalHotkeys(hotkey, _last_built_tramtype, RTT_TRAM);
 
	}
 

	
 
static Hotkey roadtoolbar_hotkeys[] = {
 
	Hotkey('1', "build_x", WID_ROT_ROAD_X),
 
	Hotkey('2', "build_y", WID_ROT_ROAD_Y),
 
	Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
 
	Hotkey('4', "demolish", WID_ROT_DEMOLISH),
 
	Hotkey('5', "depot", WID_ROT_DEPOT),
 
	Hotkey('6', "bus_station", WID_ROT_BUS_STATION),
 
	Hotkey('7', "truck_station", WID_ROT_TRUCK_STATION),
 
	Hotkey('8', "oneway", WID_ROT_ONE_WAY),
 
	Hotkey('B', "bridge", WID_ROT_BUILD_BRIDGE),
 
	Hotkey('T', "tunnel", WID_ROT_BUILD_TUNNEL),
 
	Hotkey('R', "remove", WID_ROT_REMOVE),
 
	Hotkey('C', "convert", WID_ROT_CONVERT_ROAD),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList BuildRoadToolbarWindow::road_hotkeys("roadtoolbar", roadtoolbar_hotkeys, RoadToolbarGlobalHotkeys);
 
	static inline HotkeyList road_hotkeys{"roadtoolbar", {
 
		Hotkey('1', "build_x", WID_ROT_ROAD_X),
 
		Hotkey('2', "build_y", WID_ROT_ROAD_Y),
 
		Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
 
		Hotkey('4', "demolish", WID_ROT_DEMOLISH),
 
		Hotkey('5', "depot", WID_ROT_DEPOT),
 
		Hotkey('6', "bus_station", WID_ROT_BUS_STATION),
 
		Hotkey('7', "truck_station", WID_ROT_TRUCK_STATION),
 
		Hotkey('8', "oneway", WID_ROT_ONE_WAY),
 
		Hotkey('B', "bridge", WID_ROT_BUILD_BRIDGE),
 
		Hotkey('T', "tunnel", WID_ROT_BUILD_TUNNEL),
 
		Hotkey('R', "remove", WID_ROT_REMOVE),
 
		Hotkey('C', "convert", WID_ROT_CONVERT_ROAD),
 
	}, RoadToolbarGlobalHotkeys};
 

	
 
static Hotkey tramtoolbar_hotkeys[] = {
 
	Hotkey('1', "build_x", WID_ROT_ROAD_X),
 
	Hotkey('2', "build_y", WID_ROT_ROAD_Y),
 
	Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
 
	Hotkey('4', "demolish", WID_ROT_DEMOLISH),
 
	Hotkey('5', "depot", WID_ROT_DEPOT),
 
	Hotkey('6', "bus_station", WID_ROT_BUS_STATION),
 
	Hotkey('7', "truck_station", WID_ROT_TRUCK_STATION),
 
	Hotkey('B', "bridge", WID_ROT_BUILD_BRIDGE),
 
	Hotkey('T', "tunnel", WID_ROT_BUILD_TUNNEL),
 
	Hotkey('R', "remove", WID_ROT_REMOVE),
 
	Hotkey('C', "convert", WID_ROT_CONVERT_ROAD),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList tram_hotkeys{"tramtoolbar", {
 
		Hotkey('1', "build_x", WID_ROT_ROAD_X),
 
		Hotkey('2', "build_y", WID_ROT_ROAD_Y),
 
		Hotkey('3', "autoroad", WID_ROT_AUTOROAD),
 
		Hotkey('4', "demolish", WID_ROT_DEMOLISH),
 
		Hotkey('5', "depot", WID_ROT_DEPOT),
 
		Hotkey('6', "bus_station", WID_ROT_BUS_STATION),
 
		Hotkey('7', "truck_station", WID_ROT_TRUCK_STATION),
 
		Hotkey('B', "bridge", WID_ROT_BUILD_BRIDGE),
 
		Hotkey('T', "tunnel", WID_ROT_BUILD_TUNNEL),
 
		Hotkey('R', "remove", WID_ROT_REMOVE),
 
		Hotkey('C', "convert", WID_ROT_CONVERT_ROAD),
 
	}, TramToolbarGlobalHotkeys};
 
};
 
HotkeyList BuildRoadToolbarWindow::tram_hotkeys("tramtoolbar", tramtoolbar_hotkeys, TramToolbarGlobalHotkeys);
 

	
 

	
 
static const NWidgetPart _nested_build_road_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
@@ -1588,15 +1580,11 @@ public:
 
		this->InvalidateData();
 
	}};
 

	
 
	static HotkeyList hotkeys;
 
	static inline HotkeyList hotkeys{"buildroadstop", {
 
		Hotkey('F', "focus_filter_box", BROSHK_FOCUS_FILTER_BOX),
 
	}};
 
};
 

	
 
static Hotkey buildroadstop_hotkeys[] = {
 
	Hotkey('F', "focus_filter_box", BROSHK_FOCUS_FILTER_BOX),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList BuildRoadStationWindow::hotkeys("buildroadstop", buildroadstop_hotkeys);
 

	
 
Listing BuildRoadStationWindow::last_sorting = { false, 0 };
 
Filtering BuildRoadStationWindow::last_filtering = { false, 0 };
 

	
src/script/script_gui.cpp
Show inline comments
 
@@ -1094,7 +1094,43 @@ struct ScriptDebugWindow : public Window
 
		this->vscroll->SetCapacityFromWidget(this, WID_SCRD_LOG_PANEL, WidgetDimensions::scaled.framerect.Vertical());
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	/**
 
	 * Handler for global hotkeys of the ScriptDebugWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState ScriptDebugGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
		Window *w = ShowScriptDebugWindow(INVALID_COMPANY);
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
	static inline HotkeyList hotkeys{"aidebug", {
 
		Hotkey('1', "company_1", WID_SCRD_COMPANY_BUTTON_START),
 
		Hotkey('2', "company_2", WID_SCRD_COMPANY_BUTTON_START + 1),
 
		Hotkey('3', "company_3", WID_SCRD_COMPANY_BUTTON_START + 2),
 
		Hotkey('4', "company_4", WID_SCRD_COMPANY_BUTTON_START + 3),
 
		Hotkey('5', "company_5", WID_SCRD_COMPANY_BUTTON_START + 4),
 
		Hotkey('6', "company_6", WID_SCRD_COMPANY_BUTTON_START + 5),
 
		Hotkey('7', "company_7", WID_SCRD_COMPANY_BUTTON_START + 6),
 
		Hotkey('8', "company_8", WID_SCRD_COMPANY_BUTTON_START + 7),
 
		Hotkey('9', "company_9", WID_SCRD_COMPANY_BUTTON_START + 8),
 
		Hotkey(0, "company_10", WID_SCRD_COMPANY_BUTTON_START + 9),
 
		Hotkey(0, "company_11", WID_SCRD_COMPANY_BUTTON_START + 10),
 
		Hotkey(0, "company_12", WID_SCRD_COMPANY_BUTTON_START + 11),
 
		Hotkey(0, "company_13", WID_SCRD_COMPANY_BUTTON_START + 12),
 
		Hotkey(0, "company_14", WID_SCRD_COMPANY_BUTTON_START + 13),
 
		Hotkey(0, "company_15", WID_SCRD_COMPANY_BUTTON_START + 14),
 
		Hotkey('S', "settings", WID_SCRD_SETTINGS),
 
		Hotkey('0', "game_script", WID_SCRD_SCRIPT_GAME),
 
		Hotkey(0, "reload", WID_SCRD_RELOAD_TOGGLE),
 
		Hotkey('B', "break_toggle", WID_SCRD_BREAK_STR_ON_OFF_BTN),
 
		Hotkey('F', "break_string", WID_SCRD_BREAK_STR_EDIT_BOX),
 
		Hotkey('C', "match_case", WID_SCRD_MATCH_CASE_BTN),
 
		Hotkey(WKC_RETURN, "continue", WID_SCRD_CONTINUE_BTN),
 
	}, ScriptDebugGlobalHotkeys};
 
};
 

	
 
CompanyID ScriptDebugWindow::script_debug_company = INVALID_COMPANY;
 
@@ -1109,46 +1145,6 @@ NWidgetBase *MakeCompanyButtonRowsScript
 
	return MakeCompanyButtonRows(biggest_index, WID_SCRD_COMPANY_BUTTON_START, WID_SCRD_COMPANY_BUTTON_END, COLOUR_GREY, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
 
}
 

	
 
/**
 
 * Handler for global hotkeys of the ScriptDebugWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState ScriptDebugGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
	Window *w = ShowScriptDebugWindow(INVALID_COMPANY);
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey scriptdebug_hotkeys[] = {
 
	Hotkey('1', "company_1", WID_SCRD_COMPANY_BUTTON_START),
 
	Hotkey('2', "company_2", WID_SCRD_COMPANY_BUTTON_START + 1),
 
	Hotkey('3', "company_3", WID_SCRD_COMPANY_BUTTON_START + 2),
 
	Hotkey('4', "company_4", WID_SCRD_COMPANY_BUTTON_START + 3),
 
	Hotkey('5', "company_5", WID_SCRD_COMPANY_BUTTON_START + 4),
 
	Hotkey('6', "company_6", WID_SCRD_COMPANY_BUTTON_START + 5),
 
	Hotkey('7', "company_7", WID_SCRD_COMPANY_BUTTON_START + 6),
 
	Hotkey('8', "company_8", WID_SCRD_COMPANY_BUTTON_START + 7),
 
	Hotkey('9', "company_9", WID_SCRD_COMPANY_BUTTON_START + 8),
 
	Hotkey((uint16)0, "company_10", WID_SCRD_COMPANY_BUTTON_START + 9),
 
	Hotkey((uint16)0, "company_11", WID_SCRD_COMPANY_BUTTON_START + 10),
 
	Hotkey((uint16)0, "company_12", WID_SCRD_COMPANY_BUTTON_START + 11),
 
	Hotkey((uint16)0, "company_13", WID_SCRD_COMPANY_BUTTON_START + 12),
 
	Hotkey((uint16)0, "company_14", WID_SCRD_COMPANY_BUTTON_START + 13),
 
	Hotkey((uint16)0, "company_15", WID_SCRD_COMPANY_BUTTON_START + 14),
 
	Hotkey('S', "settings", WID_SCRD_SETTINGS),
 
	Hotkey('0', "game_script", WID_SCRD_SCRIPT_GAME),
 
	Hotkey((uint16)0, "reload", WID_SCRD_RELOAD_TOGGLE),
 
	Hotkey('B', "break_toggle", WID_SCRD_BREAK_STR_ON_OFF_BTN),
 
	Hotkey('F', "break_string", WID_SCRD_BREAK_STR_EDIT_BOX),
 
	Hotkey('C', "match_case", WID_SCRD_MATCH_CASE_BTN),
 
	Hotkey(WKC_RETURN, "continue", WID_SCRD_CONTINUE_BTN),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList ScriptDebugWindow::hotkeys("aidebug", scriptdebug_hotkeys, ScriptDebugGlobalHotkeys);
 

	
 
/** Widgets for the Script debug window. */
 
static const NWidgetPart _nested_script_debug_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/signs_gui.cpp
Show inline comments
 
@@ -338,27 +338,23 @@ struct SignListWindow : Window, SignList
 
		}
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the SignListWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState SignListGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
 
		Window *w = ShowSignList();
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
/**
 
 * Handler for global hotkeys of the SignListWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState SignListGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode == GM_MENU) return ES_NOT_HANDLED;
 
	Window *w = ShowSignList();
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey signlist_hotkeys[] = {
 
	Hotkey('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"signlist", {
 
		Hotkey('F', "focus_filter_box", SLHK_FOCUS_FILTER_BOX),
 
	}, SignListGlobalHotkeys};
 
};
 
HotkeyList SignListWindow::hotkeys("signlist", signlist_hotkeys, SignListGlobalHotkeys);
 

	
 
static const NWidgetPart _nested_sign_list_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
src/terraform_gui.cpp
Show inline comments
 
@@ -295,34 +295,30 @@ struct TerraformToolbarWindow : Window {
 
		this->RaiseButtons();
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the TerraformToolbarWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState TerraformToolbarGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
		Window *w = ShowTerraformToolbar(nullptr);
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
/**
 
 * Handler for global hotkeys of the TerraformToolbarWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState TerraformToolbarGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED;
 
	Window *w = ShowTerraformToolbar(nullptr);
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey terraform_hotkeys[] = {
 
	Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND),
 
	Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND),
 
	Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND),
 
	Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH),
 
	Hotkey('U', "buyland", WID_TT_BUY_LAND),
 
	Hotkey('I', "trees", WID_TT_PLANT_TREES),
 
	Hotkey('O', "placesign", WID_TT_PLACE_SIGN),
 
	Hotkey('P', "placeobject", WID_TT_PLACE_OBJECT),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"terraform", {
 
		Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_TT_LOWER_LAND),
 
		Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_TT_RAISE_LAND),
 
		Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_TT_LEVEL_LAND),
 
		Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_TT_DEMOLISH),
 
		Hotkey('U', "buyland", WID_TT_BUY_LAND),
 
		Hotkey('I', "trees", WID_TT_PLANT_TREES),
 
		Hotkey('O', "placesign", WID_TT_PLACE_SIGN),
 
		Hotkey('P', "placeobject", WID_TT_PLACE_OBJECT),
 
	}, TerraformToolbarGlobalHotkeys};
 
};
 
HotkeyList TerraformToolbarWindow::hotkeys("terraform", terraform_hotkeys, TerraformToolbarGlobalHotkeys);
 

	
 
static const NWidgetPart _nested_terraform_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
@@ -719,35 +715,30 @@ struct ScenarioEditorLandscapeGeneration
 
		this->SetDirty();
 
	}
 

	
 
	static HotkeyList hotkeys;
 
};
 
	/**
 
	 * Handler for global hotkeys of the ScenarioEditorLandscapeGenerationWindow.
 
	 * @param hotkey Hotkey
 
	 * @return ES_HANDLED if hotkey was accepted.
 
	 */
 
	static EventState TerraformToolbarEditorGlobalHotkeys(int hotkey)
 
	{
 
		if (_game_mode != GM_EDITOR) return ES_NOT_HANDLED;
 
		Window *w = ShowEditorTerraformToolbar();
 
		if (w == nullptr) return ES_NOT_HANDLED;
 
		return w->OnHotkey(hotkey);
 
	}
 

	
 
/**
 
 * Handler for global hotkeys of the ScenarioEditorLandscapeGenerationWindow.
 
 * @param hotkey Hotkey
 
 * @return ES_HANDLED if hotkey was accepted.
 
 */
 
static EventState TerraformToolbarEditorGlobalHotkeys(int hotkey)
 
{
 
	if (_game_mode != GM_EDITOR) return ES_NOT_HANDLED;
 
	Window *w = ShowEditorTerraformToolbar();
 
	if (w == nullptr) return ES_NOT_HANDLED;
 
	return w->OnHotkey(hotkey);
 
}
 

	
 
static Hotkey terraform_editor_hotkeys[] = {
 
	Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH),
 
	Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_ETT_LOWER_LAND),
 
	Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_ETT_RAISE_LAND),
 
	Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_ETT_LEVEL_LAND),
 
	Hotkey('R', "rocky", WID_ETT_PLACE_ROCKS),
 
	Hotkey('T', "desert", WID_ETT_PLACE_DESERT),
 
	Hotkey('O', "object", WID_ETT_PLACE_OBJECT),
 
	HOTKEY_LIST_END
 
	static inline HotkeyList hotkeys{"terraform_editor", {
 
		Hotkey('D' | WKC_GLOBAL_HOTKEY, "dynamite", WID_ETT_DEMOLISH),
 
		Hotkey('Q' | WKC_GLOBAL_HOTKEY, "lower", WID_ETT_LOWER_LAND),
 
		Hotkey('W' | WKC_GLOBAL_HOTKEY, "raise", WID_ETT_RAISE_LAND),
 
		Hotkey('E' | WKC_GLOBAL_HOTKEY, "level", WID_ETT_LEVEL_LAND),
 
		Hotkey('R', "rocky", WID_ETT_PLACE_ROCKS),
 
		Hotkey('T', "desert", WID_ETT_PLACE_DESERT),
 
		Hotkey('O', "object", WID_ETT_PLACE_OBJECT),
 
	}, TerraformToolbarEditorGlobalHotkeys};
 
};
 

	
 
HotkeyList ScenarioEditorLandscapeGenerationWindow::hotkeys("terraform_editor", terraform_editor_hotkeys, TerraformToolbarEditorGlobalHotkeys);
 

	
 
static WindowDesc _scen_edit_land_gen_desc(
 
	WDP_AUTO, "toolbar_landscape_scen", 0, 0,
 
	WC_SCEN_LAND_GEN, WC_NONE,
src/toolbar_gui.cpp
Show inline comments
 
@@ -2142,59 +2142,50 @@ struct MainToolbarWindow : Window {
 
		HandleZoomMessage(this, GetMainWindow()->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	static inline HotkeyList hotkeys{"maintoolbar", {
 
		Hotkey({WKC_F1, WKC_PAUSE}, "pause", MTHK_PAUSE),
 
		Hotkey(0, "fastforward", MTHK_FASTFORWARD),
 
		Hotkey(WKC_F2, "settings", MTHK_SETTINGS),
 
		Hotkey(WKC_F3, "saveload", MTHK_SAVEGAME),
 
		Hotkey(0, "load_game", MTHK_LOADGAME),
 
		Hotkey({WKC_F4, 'M'}, "smallmap", MTHK_SMALLMAP),
 
		Hotkey(WKC_F5, "town_list", MTHK_TOWNDIRECTORY),
 
		Hotkey(WKC_F6, "subsidies", MTHK_SUBSIDIES),
 
		Hotkey(WKC_F7, "station_list", MTHK_STATIONS),
 
		Hotkey(WKC_F8, "finances", MTHK_FINANCES),
 
		Hotkey(WKC_F9, "companies", MTHK_COMPANIES),
 
		Hotkey(0, "story_book", MTHK_STORY),
 
		Hotkey(0, "goal_list", MTHK_GOAL),
 
		Hotkey(WKC_F10, "graphs", MTHK_GRAPHS),
 
		Hotkey(WKC_F11, "league", MTHK_LEAGUE),
 
		Hotkey(WKC_F12, "industry_list", MTHK_INDUSTRIES),
 
		Hotkey(WKC_SHIFT | WKC_F1, "train_list", MTHK_TRAIN_LIST),
 
		Hotkey(WKC_SHIFT | WKC_F2, "roadveh_list", MTHK_ROADVEH_LIST),
 
		Hotkey(WKC_SHIFT | WKC_F3, "ship_list", MTHK_SHIP_LIST),
 
		Hotkey(WKC_SHIFT | WKC_F4, "aircraft_list", MTHK_AIRCRAFT_LIST),
 
		Hotkey({WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT | WKC_EQUALS, WKC_SHIFT | WKC_F5}, "zoomin", MTHK_ZOOM_IN),
 
		Hotkey({WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6}, "zoomout", MTHK_ZOOM_OUT),
 
		Hotkey(WKC_SHIFT | WKC_F7, "build_rail", MTHK_BUILD_RAIL),
 
		Hotkey(WKC_SHIFT | WKC_F8, "build_road", MTHK_BUILD_ROAD),
 
		Hotkey(0, "build_tram", MTHK_BUILD_TRAM),
 
		Hotkey(WKC_SHIFT | WKC_F9, "build_docks", MTHK_BUILD_DOCKS),
 
		Hotkey(WKC_SHIFT | WKC_F10, "build_airport", MTHK_BUILD_AIRPORT),
 
		Hotkey(WKC_SHIFT | WKC_F11, "build_trees", MTHK_BUILD_TREES),
 
		Hotkey(WKC_SHIFT | WKC_F12, "music", MTHK_MUSIC),
 
		Hotkey(0, "ai_debug", MTHK_SCRIPT_DEBUG),
 
		Hotkey(WKC_CTRL  | 'S', "small_screenshot", MTHK_SMALL_SCREENSHOT),
 
		Hotkey(WKC_CTRL  | 'P', "zoomedin_screenshot", MTHK_ZOOMEDIN_SCREENSHOT),
 
		Hotkey(WKC_CTRL  | 'D', "defaultzoom_screenshot", MTHK_DEFAULTZOOM_SCREENSHOT),
 
		Hotkey(0, "giant_screenshot", MTHK_GIANT_SCREENSHOT),
 
		Hotkey(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS),
 
		Hotkey('L', "terraform", MTHK_TERRAFORM),
 
		Hotkey('V', "extra_viewport", MTHK_EXTRA_VIEWPORT),
 
		Hotkey(0, "client_list", MTHK_CLIENT_LIST),
 
		Hotkey(0, "sign_list", MTHK_SIGN_LIST),
 
		Hotkey(0, "land_info", MTHK_LANDINFO),
 
	}};
 
};
 

	
 
const uint16 _maintoolbar_pause_keys[] = {WKC_F1, WKC_PAUSE, 0};
 
const uint16 _maintoolbar_zoomin_keys[] = {WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT | WKC_EQUALS, WKC_SHIFT | WKC_F5, 0};
 
const uint16 _maintoolbar_zoomout_keys[] = {WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6, 0};
 
const uint16 _maintoolbar_smallmap_keys[] = {WKC_F4, 'M', 0};
 

	
 
static Hotkey maintoolbar_hotkeys[] = {
 
	Hotkey(_maintoolbar_pause_keys, "pause", MTHK_PAUSE),
 
	Hotkey((uint16)0, "fastforward", MTHK_FASTFORWARD),
 
	Hotkey(WKC_F2, "settings", MTHK_SETTINGS),
 
	Hotkey(WKC_F3, "saveload", MTHK_SAVEGAME),
 
	Hotkey((uint16)0, "load_game", MTHK_LOADGAME),
 
	Hotkey(_maintoolbar_smallmap_keys, "smallmap", MTHK_SMALLMAP),
 
	Hotkey(WKC_F5, "town_list", MTHK_TOWNDIRECTORY),
 
	Hotkey(WKC_F6, "subsidies", MTHK_SUBSIDIES),
 
	Hotkey(WKC_F7, "station_list", MTHK_STATIONS),
 
	Hotkey(WKC_F8, "finances", MTHK_FINANCES),
 
	Hotkey(WKC_F9, "companies", MTHK_COMPANIES),
 
	Hotkey((uint16)0, "story_book", MTHK_STORY),
 
	Hotkey((uint16)0, "goal_list", MTHK_GOAL),
 
	Hotkey(WKC_F10, "graphs", MTHK_GRAPHS),
 
	Hotkey(WKC_F11, "league", MTHK_LEAGUE),
 
	Hotkey(WKC_F12, "industry_list", MTHK_INDUSTRIES),
 
	Hotkey(WKC_SHIFT | WKC_F1, "train_list", MTHK_TRAIN_LIST),
 
	Hotkey(WKC_SHIFT | WKC_F2, "roadveh_list", MTHK_ROADVEH_LIST),
 
	Hotkey(WKC_SHIFT | WKC_F3, "ship_list", MTHK_SHIP_LIST),
 
	Hotkey(WKC_SHIFT | WKC_F4, "aircraft_list", MTHK_AIRCRAFT_LIST),
 
	Hotkey(_maintoolbar_zoomin_keys, "zoomin", MTHK_ZOOM_IN),
 
	Hotkey(_maintoolbar_zoomout_keys, "zoomout", MTHK_ZOOM_OUT),
 
	Hotkey(WKC_SHIFT | WKC_F7, "build_rail", MTHK_BUILD_RAIL),
 
	Hotkey(WKC_SHIFT | WKC_F8, "build_road", MTHK_BUILD_ROAD),
 
	Hotkey((uint16)0, "build_tram", MTHK_BUILD_TRAM),
 
	Hotkey(WKC_SHIFT | WKC_F9, "build_docks", MTHK_BUILD_DOCKS),
 
	Hotkey(WKC_SHIFT | WKC_F10, "build_airport", MTHK_BUILD_AIRPORT),
 
	Hotkey(WKC_SHIFT | WKC_F11, "build_trees", MTHK_BUILD_TREES),
 
	Hotkey(WKC_SHIFT | WKC_F12, "music", MTHK_MUSIC),
 
	Hotkey((uint16)0, "ai_debug", MTHK_SCRIPT_DEBUG),
 
	Hotkey(WKC_CTRL  | 'S', "small_screenshot", MTHK_SMALL_SCREENSHOT),
 
	Hotkey(WKC_CTRL  | 'P', "zoomedin_screenshot", MTHK_ZOOMEDIN_SCREENSHOT),
 
	Hotkey(WKC_CTRL  | 'D', "defaultzoom_screenshot", MTHK_DEFAULTZOOM_SCREENSHOT),
 
	Hotkey((uint16)0, "giant_screenshot", MTHK_GIANT_SCREENSHOT),
 
	Hotkey(WKC_CTRL | WKC_ALT | 'C', "cheats", MTHK_CHEATS),
 
	Hotkey('L', "terraform", MTHK_TERRAFORM),
 
	Hotkey('V', "extra_viewport", MTHK_EXTRA_VIEWPORT),
 
	Hotkey((uint16)0, "client_list", MTHK_CLIENT_LIST),
 
	Hotkey((uint16)0, "sign_list", MTHK_SIGN_LIST),
 
	Hotkey((uint16)0, "land_info", MTHK_LANDINFO),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList MainToolbarWindow::hotkeys("maintoolbar", maintoolbar_hotkeys);
 

	
 
static NWidgetBase *MakeMainToolbar(int *biggest_index)
 
{
 
	/** Sprites to use for the different toolbar buttons */
 
@@ -2526,37 +2517,33 @@ struct ScenarioEditorToolbarWindow : Win
 
		this->SetDirty();
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	static inline HotkeyList hotkeys{"scenedit_maintoolbar", {
 
		Hotkey({WKC_F1, WKC_PAUSE}, "pause", MTEHK_PAUSE),
 
		Hotkey(0, "fastforward", MTEHK_FASTFORWARD),
 
		Hotkey(WKC_F2, "settings", MTEHK_SETTINGS),
 
		Hotkey(WKC_F3, "saveload", MTEHK_SAVEGAME),
 
		Hotkey(WKC_F4, "gen_land", MTEHK_GENLAND),
 
		Hotkey(WKC_F5, "gen_town", MTEHK_GENTOWN),
 
		Hotkey(WKC_F6, "gen_industry", MTEHK_GENINDUSTRY),
 
		Hotkey(WKC_F7, "build_road", MTEHK_BUILD_ROAD),
 
		Hotkey(0, "build_tram", MTEHK_BUILD_TRAM),
 
		Hotkey(WKC_F8, "build_docks", MTEHK_BUILD_DOCKS),
 
		Hotkey(WKC_F9, "build_trees", MTEHK_BUILD_TREES),
 
		Hotkey(WKC_F10, "build_sign", MTEHK_SIGN),
 
		Hotkey(WKC_F11, "music", MTEHK_MUSIC),
 
		Hotkey(WKC_F12, "land_info", MTEHK_LANDINFO),
 
		Hotkey(WKC_CTRL  | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT),
 
		Hotkey(WKC_CTRL  | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT),
 
		Hotkey(WKC_CTRL  | 'D', "defaultzoom_screenshot", MTEHK_DEFAULTZOOM_SCREENSHOT),
 
		Hotkey(0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT),
 
		Hotkey({WKC_NUM_PLUS, WKC_EQUALS, WKC_SHIFT | WKC_EQUALS, WKC_SHIFT | WKC_F5}, "zoomin", MTEHK_ZOOM_IN),
 
		Hotkey({WKC_NUM_MINUS, WKC_MINUS, WKC_SHIFT | WKC_MINUS, WKC_SHIFT | WKC_F6}, "zoomout", MTEHK_ZOOM_OUT),
 
		Hotkey('L', "terraform", MTEHK_TERRAFORM),
 
		Hotkey('M', "smallmap", MTEHK_SMALLMAP),
 
		Hotkey('V', "extra_viewport", MTEHK_EXTRA_VIEWPORT),
 
	}};
 
};
 

	
 
static Hotkey scenedit_maintoolbar_hotkeys[] = {
 
	Hotkey(_maintoolbar_pause_keys, "pause", MTEHK_PAUSE),
 
	Hotkey((uint16)0, "fastforward", MTEHK_FASTFORWARD),
 
	Hotkey(WKC_F2, "settings", MTEHK_SETTINGS),
 
	Hotkey(WKC_F3, "saveload", MTEHK_SAVEGAME),
 
	Hotkey(WKC_F4, "gen_land", MTEHK_GENLAND),
 
	Hotkey(WKC_F5, "gen_town", MTEHK_GENTOWN),
 
	Hotkey(WKC_F6, "gen_industry", MTEHK_GENINDUSTRY),
 
	Hotkey(WKC_F7, "build_road", MTEHK_BUILD_ROAD),
 
	Hotkey((uint16)0, "build_tram", MTEHK_BUILD_TRAM),
 
	Hotkey(WKC_F8, "build_docks", MTEHK_BUILD_DOCKS),
 
	Hotkey(WKC_F9, "build_trees", MTEHK_BUILD_TREES),
 
	Hotkey(WKC_F10, "build_sign", MTEHK_SIGN),
 
	Hotkey(WKC_F11, "music", MTEHK_MUSIC),
 
	Hotkey(WKC_F12, "land_info", MTEHK_LANDINFO),
 
	Hotkey(WKC_CTRL  | 'S', "small_screenshot", MTEHK_SMALL_SCREENSHOT),
 
	Hotkey(WKC_CTRL  | 'P', "zoomedin_screenshot", MTEHK_ZOOMEDIN_SCREENSHOT),
 
	Hotkey(WKC_CTRL  | 'D', "defaultzoom_screenshot", MTEHK_DEFAULTZOOM_SCREENSHOT),
 
	Hotkey((uint16)0, "giant_screenshot", MTEHK_GIANT_SCREENSHOT),
 
	Hotkey(_maintoolbar_zoomin_keys, "zoomin", MTEHK_ZOOM_IN),
 
	Hotkey(_maintoolbar_zoomout_keys, "zoomout", MTEHK_ZOOM_OUT),
 
	Hotkey('L', "terraform", MTEHK_TERRAFORM),
 
	Hotkey('M', "smallmap", MTEHK_SMALLMAP),
 
	Hotkey('V', "extra_viewport", MTEHK_EXTRA_VIEWPORT),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList ScenarioEditorToolbarWindow::hotkeys("scenedit_maintoolbar", scenedit_maintoolbar_hotkeys);
 

	
 
static const NWidgetPart _nested_toolb_scen_inner_widgets[] = {
 
	NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_PAUSE), SetDataTip(SPR_IMG_PAUSE, STR_TOOLBAR_TOOLTIP_PAUSE_GAME),
 
	NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_FAST_FORWARD), SetDataTip(SPR_IMG_FASTFORWARD, STR_TOOLBAR_TOOLTIP_FORWARD),
src/vehicle_gui.cpp
Show inline comments
 
@@ -3264,15 +3264,11 @@ public:
 
		::ShowNewGRFInspectWindow(GetGrfSpecFeature(Vehicle::Get(this->window_number)->type), this->window_number);
 
	}
 

	
 
	static HotkeyList hotkeys;
 
	static inline HotkeyList hotkeys{"vehicleview", {
 
		Hotkey('H', "honk", WID_VV_HONK_HORN),
 
	}};
 
};
 

	
 
static Hotkey vehicleview_hotkeys[] = {
 
	Hotkey('H', "honk", WID_VV_HONK_HORN),
 
	HOTKEY_LIST_END
 
};
 
HotkeyList VehicleViewWindow::hotkeys("vehicleview", vehicleview_hotkeys);
 

	
 
/** Vehicle view window descriptor for all vehicles but trains. */
 
static WindowDesc _vehicle_view_desc(
 
	WDP_AUTO, "view_vehicle", 250, 116,
0 comments (0 inline, 0 general)