Changeset - r20397:b739fdacd6f4
[Not reviewed]
master
0 12 0
frosch - 11 years ago 2013-06-15 15:28:09
frosch@openttd.org
(svn r25410) -Codechange: Put all hotkeys of a window into a static HotkeyList member.
12 files changed with 123 insertions and 99 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -1306,13 +1306,13 @@ struct AIDebugWindow : public Window {
 
		}
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		int num = CheckHotkeyMatch(aidebug_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num != -1) {
 
			if (this->show_break_box && num == WID_AID_BREAK_STR_EDIT_BOX) {
 
				this->SetFocusedWidget(WID_AID_BREAK_STR_EDIT_BOX);
 
				SetFocusedWindow(this);
 
				state = ES_HANDLED;
 
			} else if (this->show_break_box || num < WID_AID_BREAK_STRING_WIDGETS) {
 
@@ -1397,13 +1397,13 @@ struct AIDebugWindow : public Window {
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, WID_AID_LOG_PANEL);
 
	}
 

	
 
	static Hotkey aidebug_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
const int AIDebugWindow::top_offset = WD_FRAMERECT_TOP + 2;
 
const int AIDebugWindow::bottom_offset = WD_FRAMERECT_BOTTOM;
 
CompanyID AIDebugWindow::ai_debug_company = INVALID_COMPANY;
 
char AIDebugWindow::break_string[MAX_BREAK_STR_STRING_LENGTH] = "";
 
@@ -1414,13 +1414,13 @@ StringFilter AIDebugWindow::break_string
 
/** Make a number of rows with buttons for each company for the AI debug window. */
 
NWidgetBase *MakeCompanyButtonRowsAIDebug(int *biggest_index)
 
{
 
	return MakeCompanyButtonRows(biggest_index, WID_AID_COMPANY_BUTTON_START, WID_AID_COMPANY_BUTTON_END, 8, STR_AI_DEBUG_SELECT_AI_TOOLTIP);
 
}
 

	
 
Hotkey AIDebugWindow::aidebug_hotkeys[] = {
 
static Hotkey aidebug_hotkeys[] = {
 
	Hotkey('1', "company_1", WID_AID_COMPANY_BUTTON_START),
 
	Hotkey('2', "company_2", WID_AID_COMPANY_BUTTON_START + 1),
 
	Hotkey('3', "company_3", WID_AID_COMPANY_BUTTON_START + 2),
 
	Hotkey('4', "company_4", WID_AID_COMPANY_BUTTON_START + 3),
 
	Hotkey('5', "company_5", WID_AID_COMPANY_BUTTON_START + 4),
 
	Hotkey('6', "company_6", WID_AID_COMPANY_BUTTON_START + 5),
 
@@ -1439,13 +1439,13 @@ Hotkey AIDebugWindow::aidebug_hotkeys[] 
 
	Hotkey('B', "break_toggle", WID_AID_BREAK_STR_ON_OFF_BTN),
 
	Hotkey('F', "break_string", WID_AID_BREAK_STR_EDIT_BOX),
 
	Hotkey('C', "match_case", WID_AID_MATCH_CASE_BTN),
 
	Hotkey(WKC_RETURN, "continue", WID_AID_CONTINUE_BTN),
 
	HOTKEY_LIST_END
 
};
 
Hotkey *_aidebug_hotkeys = AIDebugWindow::aidebug_hotkeys;
 
HotkeyList AIDebugWindow::hotkeys("aidebug", aidebug_hotkeys);
 

	
 
/** Widgets for the AI debug window. */
 
static const NWidgetPart _nested_ai_debug_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_AI_DEBUG, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
@@ -1517,13 +1517,13 @@ Window *ShowAIDebugWindow(CompanyID show
 

	
 
/**
 
 * Handler for global AI debug window hotkeys.
 
 */
 
EventState AIDebugGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_aidebug_hotkeys, keycode, true);
 
	int num = AIDebugWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowAIDebugWindow(INVALID_COMPANY);
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
src/airport_gui.cpp
Show inline comments
 
@@ -99,13 +99,13 @@ struct BuildAirToolbarWindow : Window {
 
		}
 
	}
 

	
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(airtoolbar_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == -1) return ES_NOT_HANDLED;
 
		this->OnClick(Point(), num, 1);
 
		return ES_HANDLED;
 
	}
 

	
 
	virtual void OnPlaceObject(Point pt, TileIndex tile)
 
@@ -140,21 +140,21 @@ struct BuildAirToolbarWindow : Window {
 
		this->RaiseButtons();
 

	
 
		DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
 
		DeleteWindowById(WC_SELECT_STATION, 0);
 
	}
 

	
 
	static Hotkey airtoolbar_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

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

	
 
static const NWidgetPart _nested_air_toolbar_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_TOOLBAR_AIRCRAFT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
@@ -188,13 +188,13 @@ Window *ShowBuildAirToolbar()
 
	return AllocateWindowDescFront<BuildAirToolbarWindow>(&_air_toolbar_desc, TRANSPORT_AIR);
 
}
 

	
 
EventState AirportToolbarGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED;
 
	int num = CheckHotkeyMatch(_airtoolbar_hotkeys, keycode, true);
 
	int num = BuildAirToolbarWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildAirToolbar();
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
src/dock_gui.cpp
Show inline comments
 
@@ -163,13 +163,13 @@ struct BuildDocksToolbarWindow : Window 
 
		}
 
		this->last_clicked_widget = (DockToolbarWidgets)widget;
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(dockstoolbar_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == -1) return ES_NOT_HANDLED;
 
		this->OnClick(Point(), num, 1);
 
		return ES_HANDLED;
 
	}
 

	
 
	virtual void OnPlaceObject(Point pt, TileIndex tile)
 
@@ -271,29 +271,29 @@ struct BuildDocksToolbarWindow : Window 
 
			}
 
		}
 

	
 
		VpSetPresizeRange(tile_from, tile_to);
 
	}
 

	
 
	static Hotkey dockstoolbar_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

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

	
 
Hotkey BuildDocksToolbarWindow::dockstoolbar_hotkeys[] = {
 
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
 
};
 
Hotkey *_dockstoolbar_hotkeys = BuildDocksToolbarWindow::dockstoolbar_hotkeys;
 
HotkeyList BuildDocksToolbarWindow::hotkeys("dockstoolbar", dockstoolbar_hotkeys);
 

	
 
/**
 
 * Nested widget parts of docks toolbar, game version.
 
 * Position of #WID_DT_RIVER widget has changed.
 
 */
 
static const NWidgetPart _nested_build_docks_toolbar_widgets[] = {
 
@@ -335,13 +335,13 @@ Window *ShowBuildDocksToolbar()
 
	DeleteWindowByClass(WC_BUILD_TOOLBAR);
 
	return AllocateWindowDescFront<BuildDocksToolbarWindow>(&_build_docks_toolbar_desc, TRANSPORT_WATER);
 
}
 

	
 
EventState DockToolbarGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_dockstoolbar_hotkeys, keycode, true);
 
	int num = BuildDocksToolbarWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildDocksToolbar();
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
src/hotkeys.cpp
Show inline comments
 
@@ -15,12 +15,18 @@
 
#include "ini_type.h"
 
#include "string_func.h"
 
#include "window_gui.h"
 

	
 
char *_hotkeys_file;
 

	
 
/**
 
 * List of all HotkeyLists.
 
 * This is a pointer to ensure initialisation order with the various static HotkeyList instances.
 
 */
 
static SmallVector<HotkeyList*, 16> *_hotkey_lists = NULL;
 

	
 
/** String representation of a keycode */
 
struct KeycodeNames {
 
	const char *name;       ///< Name of the keycode
 
	WindowKeyCodes keycode; ///< The keycode
 
};
 

	
 
@@ -240,88 +246,83 @@ Hotkey::Hotkey(const uint16 *default_key
 
 */
 
void Hotkey::AddKeycode(uint16 keycode)
 
{
 
	this->keycodes.Include(keycode);
 
}
 

	
 
void LoadHotkeyGroup(IniGroup *group, Hotkey *hotkey_list)
 
HotkeyList::HotkeyList(const char *ini_group, Hotkey *items) :
 
	ini_group(ini_group), items(items)
 
{
 
	if (_hotkey_lists == NULL) _hotkey_lists = new SmallVector<HotkeyList*, 16>();
 
	*_hotkey_lists->Append() = this;
 
}
 

	
 
HotkeyList::~HotkeyList()
 
{
 
	for (uint i = 0; hotkey_list[i].num != -1; i++) {
 
		Hotkey *hotkey = &hotkey_list[i];
 
	_hotkey_lists->Erase(_hotkey_lists->Find(this));
 
}
 

	
 
/**
 
 * Load HotkeyList from IniFile.
 
 * @param ini IniFile to load from.
 
 */
 
void HotkeyList::Load(IniFile *ini)
 
{
 
	IniGroup *group = ini->GetGroup(this->ini_group);
 
	for (Hotkey *hotkey = this->items; hotkey->name != NULL; ++hotkey) {
 
		IniItem *item = group->GetItem(hotkey->name, false);
 
		if (item != NULL) {
 
			hotkey->keycodes.Clear();
 
			if (item->value != NULL) ParseHotkeys(hotkey, item->value);
 
		}
 
	}
 
}
 

	
 
void SaveHotkeyGroup(IniGroup *group, const Hotkey *hotkey_list)
 
/**
 
 * Save HotkeyList to IniFile.
 
 * @param ini IniFile to save to.
 
 */
 
void HotkeyList::Save(IniFile *ini) const
 
{
 
	for (uint i = 0; hotkey_list[i].num != -1; i++) {
 
		const Hotkey *hotkey = &hotkey_list[i];
 
	IniGroup *group = ini->GetGroup(this->ini_group);
 
	for (const Hotkey *hotkey = this->items; hotkey->name != NULL; ++hotkey) {
 
		IniItem *item = group->GetItem(hotkey->name, true);
 
		item->SetValue(SaveKeycodes(hotkey));
 
	}
 
}
 

	
 
void SaveLoadHotkeyGroup(IniGroup *group, Hotkey *hotkey_list, bool save)
 
{
 
	if (save) {
 
		SaveHotkeyGroup(group, hotkey_list);
 
	} else {
 
		LoadHotkeyGroup(group, hotkey_list);
 
	}
 
}
 

	
 
/**
 
 * Check if a keycode is bound to something.
 
 * @param list The list with hotkeys to check
 
 * @param keycode The keycode that was pressed
 
 * @param global_only Limit the search to hotkeys defined as 'global'.
 
 * @return The number of the matching hotkey or -1.
 
 */
 
int CheckHotkeyMatch(Hotkey *list, uint16 keycode, bool global_only)
 
int HotkeyList::CheckMatch(uint16 keycode, bool global_only) const
 
{
 
	while (list->num != -1) {
 
	for (const Hotkey *list = this->items; list->name != NULL; ++list) {
 
		if (list->keycodes.Contains(keycode | WKC_GLOBAL_HOTKEY) || (!global_only && list->keycodes.Contains(keycode))) {
 
			return list->num;
 
		}
 
		list++;
 
	}
 
	return -1;
 
}
 

	
 

	
 
static void SaveLoadHotkeys(bool save)
 
{
 
	IniFile *ini = new IniFile();
 
	ini->LoadFromDisk(_hotkeys_file, BASE_DIR);
 

	
 
	IniGroup *group;
 

	
 
#define SL_HOTKEYS(name) \
 
	extern Hotkey *_##name##_hotkeys;\
 
	group = ini->GetGroup(#name);\
 
	SaveLoadHotkeyGroup(group, _##name##_hotkeys, save);
 
	for (HotkeyList **list = _hotkey_lists->Begin(); list != _hotkey_lists->End(); ++list) {
 
		if (save) {
 
			(*list)->Save(ini);
 
		} else {
 
			(*list)->Load(ini);
 
		}
 
	}
 

	
 
	SL_HOTKEYS(global);
 
	SL_HOTKEYS(maintoolbar);
 
	SL_HOTKEYS(scenedit_maintoolbar);
 
	SL_HOTKEYS(terraform);
 
	SL_HOTKEYS(terraform_editor);
 
	SL_HOTKEYS(order);
 
	SL_HOTKEYS(airtoolbar);
 
	SL_HOTKEYS(dockstoolbar);
 
	SL_HOTKEYS(railtoolbar);
 
	SL_HOTKEYS(roadtoolbar);
 
	SL_HOTKEYS(signlist);
 
	SL_HOTKEYS(aidebug);
 

	
 

	
 
#undef SL_HOTKEYS
 
	if (save) ini->SaveToDisk(_hotkeys_file);
 
	delete ini;
 
}
 

	
 

	
 
/** Load the hotkeys from the config file */
src/hotkeys.h
Show inline comments
 
@@ -29,13 +29,36 @@ struct Hotkey {
 
	int num;
 
	SmallVector<uint16, 1> keycodes;
 
};
 

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

	
 
int CheckHotkeyMatch(Hotkey *list, uint16 keycode, bool global_only = false);
 
struct IniFile;
 

	
 
/**
 
 * List of hotkeys for a window.
 
 */
 
struct HotkeyList {
 
	HotkeyList(const char *ini_group, Hotkey *items);
 
	~HotkeyList();
 

	
 
	void Load(IniFile *ini);
 
	void Save(IniFile *ini) const;
 

	
 
	int CheckMatch(uint16 keycode, bool global_only = false) const;
 

	
 
private:
 
	const char *ini_group;
 
	Hotkey *items;
 

	
 
	/**
 
	 * Dummy private copy constructor to prevent compilers from
 
	 * copying the structure, which fails due to _hotkey_lists.
 
	 */
 
	HotkeyList(const HotkeyList &other);
 
};
 

	
 
bool IsQuitKey(uint16 keycode);
 

	
 
void LoadHotkeysFromConfig();
 
void SaveHotkeysToConfig();
 

	
src/main_gui.cpp
Show inline comments
 
@@ -286,13 +286,13 @@ struct MainWindow : Window
 
			}
 
		}
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(global_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == GHK_QUIT) {
 
			HandleExitGameRequest();
 
			return ES_HANDLED;
 
		}
 

	
 
		/* Disable all key shortcuts, except quit shortcuts when
 
@@ -462,23 +462,23 @@ struct MainWindow : Window
 
	{
 
		if (!gui_scope) return;
 
		/* Forward the message to the appropriate toolbar (ingame or scenario editor) */
 
		InvalidateWindowData(WC_MAIN_TOOLBAR, 0, data, true);
 
	}
 

	
 
	static Hotkey global_hotkeys[];
 
	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};
 

	
 
Hotkey MainWindow::global_hotkeys[] = {
 
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),
 
@@ -516,22 +516,22 @@ Hotkey MainWindow::global_hotkeys[] = {
 
	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),
 
#endif
 
	HOTKEY_LIST_END
 
};
 
Hotkey *_global_hotkeys = MainWindow::global_hotkeys;
 
HotkeyList MainWindow::hotkeys("global", global_hotkeys);
 

	
 
/**
 
 * Does the given keycode match one of the keycodes bound to 'quit game'?
 
 * @param keycode The keycode that was pressed by the user.
 
 * @return True iff the keycode matches one of the hotkeys for 'quit'.
 
 */
 
bool IsQuitKey(uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_global_hotkeys, keycode);
 
	int num = MainWindow::hotkeys.CheckMatch(keycode);
 
	return num == GHK_QUIT;
 
}
 

	
 

	
 
void ShowSelectGameWindow();
 

	
src/order_gui.cpp
Show inline comments
 
@@ -1437,13 +1437,13 @@ public:
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED;
 

	
 
		switch (CheckHotkeyMatch(order_hotkeys, keycode)) {
 
		switch (this->hotkeys.CheckMatch(keycode)) {
 
			case OHK_SKIP:           this->OrderClick_Skip();         break;
 
			case OHK_DELETE:         this->OrderClick_Delete();       break;
 
			case OHK_GOTO:           this->OrderClick_Goto();         break;
 
			case OHK_NONSTOP:        this->OrderClick_Nonstop(-1);    break;
 
			case OHK_FULLLOAD:       this->OrderClick_FullLoad(-1);   break;
 
			case OHK_UNLOAD:         this->OrderClick_Unload(-1);     break;
 
@@ -1523,16 +1523,16 @@ public:
 
	virtual void OnResize()
 
	{
 
		/* Update the scroll bar */
 
		this->vscroll->SetCapacityFromWidget(this, WID_O_ORDER_LIST);
 
	}
 

	
 
	static Hotkey order_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
Hotkey OrdersWindow::order_hotkeys[] = {
 
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),
 
@@ -1540,13 +1540,13 @@ Hotkey OrdersWindow::order_hotkeys[] = {
 
	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
 
};
 
Hotkey *_order_hotkeys = OrdersWindow::order_hotkeys;
 
HotkeyList OrdersWindow::hotkeys("order", order_hotkeys);
 

	
 
/** Nested widget definition for "your" train orders. */
 
static const NWidgetPart _nested_orders_train_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
src/rail_gui.cpp
Show inline comments
 
@@ -596,13 +596,13 @@ struct BuildRailToolbarWindow : Window {
 
		this->UpdateRemoveWidgetStatus(widget);
 
		if (_ctrl_pressed) RailToolbar_CtrlChanged(this);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(railtoolbar_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == -1) return ES_NOT_HANDLED;
 
		this->OnClick(Point(), num, 1);
 
		MarkTileDirtyByTile(TileVirtXY(_thd.pos.x, _thd.pos.y)); // redraw tile selection
 
		return ES_HANDLED;
 
	}
 

	
 
@@ -752,18 +752,18 @@ struct BuildRailToolbarWindow : Window {
 
	{
 
		/* do not toggle Remove button by Ctrl when placing station */
 
		if (!this->IsWidgetLowered(WID_RAT_BUILD_STATION) && !this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT) && RailToolbar_CtrlChanged(this)) return ES_HANDLED;
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	static Hotkey railtoolbar_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
const uint16 _railtoolbar_autorail_keys[] = {'5', 'A' | WKC_GLOBAL_HOTKEY, 0};
 

	
 
Hotkey BuildRailToolbarWindow::railtoolbar_hotkeys[] = {
 
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),
 
@@ -774,13 +774,13 @@ Hotkey BuildRailToolbarWindow::railtoolb
 
	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
 
};
 
Hotkey *_railtoolbar_hotkeys = BuildRailToolbarWindow::railtoolbar_hotkeys;
 
HotkeyList BuildRailToolbarWindow::hotkeys("railtoolbar", railtoolbar_hotkeys);
 

	
 
static const NWidgetPart _nested_build_rail_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_RAT_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
@@ -848,13 +848,13 @@ Window *ShowBuildRailToolbar(RailType ra
 
}
 

	
 
EventState RailToolbarGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED;
 
	extern RailType _last_built_railtype;
 
	int num = CheckHotkeyMatch(_railtoolbar_hotkeys, keycode, true);
 
	int num = BuildRailToolbarWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildRailToolbar(_last_built_railtype);
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
src/road_gui.cpp
Show inline comments
 
@@ -472,13 +472,13 @@ struct BuildRoadToolbarWindow : Window {
 
		this->UpdateOptionWidgetStatus((RoadToolbarWidgets)widget);
 
		if (_ctrl_pressed) RoadToolbar_CtrlChanged(this);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(roadtoolbar_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == -1 || this->GetWidget<NWidgetBase>(num) == NULL) return ES_NOT_HANDLED;
 
		this->OnClick(Point(), num, 1);
 
		MarkTileDirtyByTile(TileVirtXY(_thd.pos.x, _thd.pos.y)); // redraw tile selection
 
		return ES_HANDLED;
 
	}
 

	
 
@@ -657,16 +657,16 @@ struct BuildRoadToolbarWindow : Window {
 
	virtual EventState OnCTRLStateChange()
 
	{
 
		if (RoadToolbar_CtrlChanged(this)) return ES_HANDLED;
 
		return ES_NOT_HANDLED;
 
	}
 

	
 
	static Hotkey roadtoolbar_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
Hotkey BuildRoadToolbarWindow::roadtoolbar_hotkeys[] = {
 
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),
 
@@ -674,13 +674,13 @@ Hotkey BuildRoadToolbarWindow::roadtoolb
 
	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_LIST_END
 
};
 
Hotkey *_roadtoolbar_hotkeys = BuildRoadToolbarWindow::roadtoolbar_hotkeys;
 
HotkeyList BuildRoadToolbarWindow::hotkeys("roadtoolbar", roadtoolbar_hotkeys);
 

	
 

	
 
static const NWidgetPart _nested_build_road_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_ROAD_TOOLBAR_ROAD_CONSTRUCTION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
@@ -775,13 +775,13 @@ Window *ShowBuildRoadToolbar(RoadType ro
 
	return AllocateWindowDescFront<BuildRoadToolbarWindow>(roadtype == ROADTYPE_ROAD ? &_build_road_desc : &_build_tramway_desc, TRANSPORT_ROAD);
 
}
 

	
 
EventState RoadToolbarGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	extern RoadType _last_built_roadtype;
 
	int num = CheckHotkeyMatch(_roadtoolbar_hotkeys, keycode, true);
 
	int num = BuildRoadToolbarWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildRoadToolbar(_last_built_roadtype);
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
 
@@ -828,13 +828,13 @@ Window *ShowBuildRoadScenToolbar()
 
	_cur_roadtype = ROADTYPE_ROAD;
 
	return AllocateWindowDescFront<BuildRoadToolbarWindow>(&_build_road_scen_desc, TRANSPORT_ROAD);
 
}
 

	
 
EventState RoadToolbarEditorGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_roadtoolbar_hotkeys, keycode, true);
 
	int num = BuildRoadToolbarWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowBuildRoadScenToolbar();
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -281,13 +281,13 @@ struct SignListWindow : Window, SignList
 
		}
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		if (CheckHotkeyMatch(signlist_hotkeys, keycode) == SLHK_FOCUS_FILTER_BOX) {
 
		if (this->hotkeys.CheckMatch(keycode) == SLHK_FOCUS_FILTER_BOX) {
 
			this->SetFocusedWidget(WID_SIL_FILTER_TEXT);
 
			SetFocusedWindow(this); // The user has asked to give focus to the text box, so make sure this window is focused.
 
			state = ES_HANDLED;
 
		}
 

	
 
		return state;
 
@@ -329,20 +329,20 @@ struct SignListWindow : Window, SignList
 
			this->signs.ForceRebuild();
 
		} else { // Change of sign contents while there is no filter string
 
			this->signs.ForceResort();
 
		}
 
	}
 

	
 
	static Hotkey signlist_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

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

	
 
static const NWidgetPart _nested_sign_list_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_GREY),
 
		NWidget(WWT_CAPTION, COLOUR_GREY, WID_SIL_CAPTION), SetDataTip(STR_SIGN_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_SHADEBOX, COLOUR_GREY),
 
@@ -386,13 +386,13 @@ Window *ShowSignList()
 
{
 
	return AllocateWindowDescFront<SignListWindow>(&_sign_list_desc, 0);
 
}
 

	
 
EventState SignListGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_signlist_hotkeys, keycode, true);
 
	int num = SignListWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowSignList();
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
src/terraform_gui.cpp
Show inline comments
 
@@ -218,13 +218,13 @@ struct TerraformToolbarWindow : Window {
 
			default: NOT_REACHED();
 
		}
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(terraform_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == -1) return ES_NOT_HANDLED;
 
		this->OnClick(Point(), num, 1);
 
		return ES_HANDLED;
 
	}
 

	
 
	virtual void OnPlaceObject(Point pt, TileIndex tile)
 
@@ -292,27 +292,27 @@ struct TerraformToolbarWindow : Window {
 
	virtual void OnPlaceObjectAbort()
 
	{
 
		DeleteWindowById(WC_BUILD_OBJECT, 0);
 
		this->RaiseButtons();
 
	}
 

	
 
	static Hotkey terraform_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
Hotkey TerraformToolbarWindow::terraform_hotkeys[] = {
 
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
 
};
 
Hotkey *_terraform_hotkeys = TerraformToolbarWindow::terraform_hotkeys;
 
HotkeyList TerraformToolbarWindow::hotkeys("terraform", terraform_hotkeys);
 

	
 
static const NWidgetPart _nested_terraform_widgets[] = {
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
 
		NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetDataTip(STR_LANDSCAPING_TOOLBAR, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
		NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
 
@@ -377,13 +377,13 @@ Window *ShowTerraformToolbar(Window *lin
 

	
 
	return w;
 
}
 

	
 
EventState TerraformToolbarGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_terraform_hotkeys, keycode, true);
 
	int num = TerraformToolbarWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowTerraformToolbar(NULL);
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
 

	
 
@@ -571,13 +571,13 @@ struct ScenarioEditorLandscapeGeneration
 
			coords += 2;
 
		} while (--n);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		int num = CheckHotkeyMatch(terraform_editor_hotkeys, keycode);
 
		int num = this->hotkeys.CheckMatch(keycode);
 
		if (num == -1) return ES_NOT_HANDLED;
 
		this->OnClick(Point(), num, 1);
 
		return ES_HANDLED;
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget, int click_count)
 
@@ -721,27 +721,27 @@ struct ScenarioEditorLandscapeGeneration
 
	{
 
		this->RaiseButtons();
 
		this->SetDirty();
 
		DeleteWindowById(WC_BUILD_OBJECT, 0);
 
	}
 

	
 
	static Hotkey terraform_editor_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
Hotkey ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys[] = {
 
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
 
};
 

	
 
Hotkey *_terraform_editor_hotkeys = ScenarioEditorLandscapeGenerationWindow::terraform_editor_hotkeys;
 
HotkeyList ScenarioEditorLandscapeGenerationWindow::hotkeys("terraform_editor", terraform_editor_hotkeys);
 

	
 
static WindowDesc _scen_edit_land_gen_desc(
 
	WDP_AUTO, "toolbar_landscape_scen", 0, 0,
 
	WC_SCEN_LAND_GEN, WC_NONE,
 
	WDF_CONSTRUCTION,
 
	_nested_scen_edit_land_gen_widgets, lengthof(_nested_scen_edit_land_gen_widgets)
 
@@ -755,12 +755,12 @@ Window *ShowEditorTerraformToolbar()
 
{
 
	return AllocateWindowDescFront<ScenarioEditorLandscapeGenerationWindow>(&_scen_edit_land_gen_desc, 0);
 
}
 

	
 
EventState TerraformToolbarEditorGlobalHotkeys(uint16 key, uint16 keycode)
 
{
 
	int num = CheckHotkeyMatch(_terraform_editor_hotkeys, keycode, true);
 
	int num = ScenarioEditorLandscapeGenerationWindow::hotkeys.CheckMatch(keycode, true);
 
	if (num == -1) return ES_NOT_HANDLED;
 
	Window *w = ShowEditorTerraformToolbar();
 
	if (w == NULL) return ES_NOT_HANDLED;
 
	return w->OnKeyPress(key, keycode);
 
}
src/toolbar_gui.cpp
Show inline comments
 
@@ -1659,13 +1659,13 @@ struct MainToolbarWindow : Window {
 
		CallBackFunction cbf = _menu_clicked_procs[widget](index);
 
		if (cbf != CBF_NONE) this->last_started_action = cbf;
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		switch (CheckHotkeyMatch(maintoolbar_hotkeys, keycode)) {
 
		switch (this->hotkeys.CheckMatch(keycode)) {
 
			case MTHK_PAUSE: ToolbarPauseClick(this); break;
 
			case MTHK_FASTFORWARD: ToolbarFastForwardClick(this); break;
 
			case MTHK_SETTINGS: ShowGameOptions(); break;
 
			case MTHK_SAVEGAME: MenuClickSaveLoad(); break;
 
			case MTHK_LOADGAME: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
 
			case MTHK_SMALLMAP: ShowSmallMap(); break;
 
@@ -1756,21 +1756,21 @@ struct MainToolbarWindow : Window {
 
	virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
 
	{
 
		if (!gui_scope) return;
 
		if (FindWindowById(WC_MAIN_WINDOW, 0) != NULL) HandleZoomMessage(this, FindWindowById(WC_MAIN_WINDOW, 0)->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT);
 
	}
 

	
 
	static Hotkey maintoolbar_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
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};
 

	
 
Hotkey MainToolbarWindow::maintoolbar_hotkeys[] = {
 
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),
 
@@ -1807,13 +1807,13 @@ Hotkey MainToolbarWindow::maintoolbar_ho
 
#ifdef ENABLE_NETWORK
 
	Hotkey((uint16)0, "client_list", MTHK_CLIENT_LIST),
 
#endif
 
	Hotkey((uint16)0, "sign_list", MTHK_SIGN_LIST),
 
	HOTKEY_LIST_END
 
};
 
Hotkey *_maintoolbar_hotkeys = MainToolbarWindow::maintoolbar_hotkeys;
 
HotkeyList MainToolbarWindow::hotkeys("maintoolbar", maintoolbar_hotkeys);
 

	
 
static NWidgetBase *MakeMainToolbar(int *biggest_index)
 
{
 
	/** Sprites to use for the different toolbar buttons */
 
	static const SpriteID toolbar_button_sprites[] = {
 
		SPR_IMG_PAUSE,           // WID_TN_PAUSE
 
@@ -2006,13 +2006,13 @@ struct ScenarioEditorToolbarWindow : Win
 
		if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP);
 
	}
 

	
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		CallBackFunction cbf = CBF_NONE;
 
		switch (CheckHotkeyMatch(scenedit_maintoolbar_hotkeys, keycode)) {
 
		switch (this->hotkeys.CheckMatch(keycode)) {
 
			case MTEHK_PAUSE:                  ToolbarPauseClick(this); break;
 
			case MTEHK_FASTFORWARD:            ToolbarFastForwardClick(this); break;
 
			case MTEHK_SETTINGS:               ShowGameOptions(); break;
 
			case MTEHK_SAVEGAME:               MenuClickSaveLoad(); break;
 
			case MTEHK_GENLAND:                ToolbarScenGenLand(this); break;
 
			case MTEHK_GENTOWN:                ToolbarScenGenTown(this); break;
 
@@ -2099,16 +2099,16 @@ struct ScenarioEditorToolbarWindow : Win
 
		_settings_game.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
 
		SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0);
 

	
 
		this->SetDirty();
 
	}
 

	
 
	static Hotkey scenedit_maintoolbar_hotkeys[];
 
	static HotkeyList hotkeys;
 
};
 

	
 
Hotkey ScenarioEditorToolbarWindow::scenedit_maintoolbar_hotkeys[] = {
 
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),
 
@@ -2127,13 +2127,13 @@ Hotkey ScenarioEditorToolbarWindow::scen
 
	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
 
};
 
Hotkey *_scenedit_maintoolbar_hotkeys = ScenarioEditorToolbarWindow::scenedit_maintoolbar_hotkeys;
 
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),
 
	NWidget(WWT_IMGBTN, COLOUR_GREY, WID_TE_SETTINGS), SetDataTip(SPR_IMG_SETTINGS, STR_TOOLBAR_TOOLTIP_OPTIONS),
 
	NWidget(WWT_IMGBTN_2, COLOUR_GREY, WID_TE_SAVE), SetDataTip(SPR_IMG_SAVE, STR_SCENEDIT_TOOLBAR_TOOLTIP_SAVE_SCENARIO_LOAD_SCENARIO),
0 comments (0 inline, 0 general)