diff --git a/src/script/api/game/game_window.hpp.sq b/src/script/api/game/game_window.hpp.sq
index 231e29b667..f25359e344 100644
--- a/src/script/api/game/game_window.hpp.sq
+++ b/src/script/api/game/game_window.hpp.sq
@@ -1208,6 +1208,7 @@ void SQGSWindow_Register(Squirrel *engine)
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_SHIFT, "WID_TT_SHIFT");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CTRL, "WID_TT_CTRL");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_MOVE, "WID_TT_MOVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CONFIRM, "WID_TT_CONFIRM");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_ORDER, "WID_TD_SORT_ORDER");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_CRITERIA, "WID_TD_SORT_CRITERIA");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_LIST, "WID_TD_LIST");
diff --git a/src/script/api/game/game_window.hpp.sq.orig b/src/script/api/game/game_window.hpp.sq.orig
new file mode 100644
index 0000000000..231e29b667
--- /dev/null
+++ b/src/script/api/game/game_window.hpp.sq.orig
@@ -0,0 +1,1334 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
+ */
+
+/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
+
+#include "../script_window.hpp"
+#include "../template/template_window.hpp.sq"
+
+
+template <> const char *GetClassName() { return "GSWindow"; }
+
+void SQGSWindow_Register(Squirrel *engine)
+{
+ DefSQClass SQGSWindow("GSWindow");
+ SQGSWindow.PreRegister(engine);
+ SQGSWindow.AddConstructor(engine, "x");
+
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_GAME_OPTIONS_AI, "WN_GAME_OPTIONS_AI");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_GAME_OPTIONS_ABOUT, "WN_GAME_OPTIONS_ABOUT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_GAME_OPTIONS_NEWGRF_STATE, "WN_GAME_OPTIONS_NEWGRF_STATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_GAME_OPTIONS_GAME_OPTIONS, "WN_GAME_OPTIONS_GAME_OPTIONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_GAME_OPTIONS_GAME_SETTINGS, "WN_GAME_OPTIONS_GAME_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_QUERY_STRING, "WN_QUERY_STRING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_QUERY_STRING_SIGN, "WN_QUERY_STRING_SIGN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_CONFIRM_POPUP_QUERY, "WN_CONFIRM_POPUP_QUERY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_CONFIRM_POPUP_QUERY_BOOTSTRAP, "WN_CONFIRM_POPUP_QUERY_BOOTSTRAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_NETWORK_WINDOW_GAME, "WN_NETWORK_WINDOW_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_NETWORK_WINDOW_LOBBY, "WN_NETWORK_WINDOW_LOBBY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_NETWORK_WINDOW_CONTENT_LIST, "WN_NETWORK_WINDOW_CONTENT_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_NETWORK_WINDOW_START, "WN_NETWORK_WINDOW_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_NETWORK_STATUS_WINDOW_JOIN, "WN_NETWORK_STATUS_WINDOW_JOIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD, "WN_NETWORK_STATUS_WINDOW_CONTENT_DOWNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_NONE, "WC_NONE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MAIN_WINDOW, "WC_MAIN_WINDOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MAIN_TOOLBAR, "WC_MAIN_TOOLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_STATUS_BAR, "WC_STATUS_BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TABLET_BAR, "WC_TABLET_BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_TOOLBAR, "WC_BUILD_TOOLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SCEN_BUILD_TOOLBAR, "WC_SCEN_BUILD_TOOLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_TREES, "WC_BUILD_TREES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TRANSPARENCY_TOOLBAR, "WC_TRANSPARENCY_TOOLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_SIGNAL, "WC_BUILD_SIGNAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SMALLMAP, "WC_SMALLMAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_ERRMSG, "WC_ERRMSG");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TOOLTIPS, "WC_TOOLTIPS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_QUERY_STRING, "WC_QUERY_STRING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_CONFIRM_POPUP_QUERY, "WC_CONFIRM_POPUP_QUERY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_GOAL_QUESTION, "WC_GOAL_QUESTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SAVELOAD, "WC_SAVELOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_LAND_INFO, "WC_LAND_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_DROPDOWN_MENU, "WC_DROPDOWN_MENU");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_OSK, "WC_OSK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SET_DATE, "WC_SET_DATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_AI_SETTINGS, "WC_AI_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_GRF_PARAMETERS, "WC_GRF_PARAMETERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TEXTFILE, "WC_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TOWN_AUTHORITY, "WC_TOWN_AUTHORITY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_VEHICLE_DETAILS, "WC_VEHICLE_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_VEHICLE_REFIT, "WC_VEHICLE_REFIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_VEHICLE_ORDERS, "WC_VEHICLE_ORDERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_REPLACE_VEHICLE, "WC_REPLACE_VEHICLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_VEHICLE_TIMETABLE, "WC_VEHICLE_TIMETABLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY_COLOUR, "WC_COMPANY_COLOUR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY_MANAGER_FACE, "WC_COMPANY_MANAGER_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SELECT_STATION, "WC_SELECT_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_NEWS_WINDOW, "WC_NEWS_WINDOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TOWN_DIRECTORY, "WC_TOWN_DIRECTORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SUBSIDIES_LIST, "WC_SUBSIDIES_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INDUSTRY_DIRECTORY, "WC_INDUSTRY_DIRECTORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MESSAGE_HISTORY, "WC_MESSAGE_HISTORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SIGN_LIST, "WC_SIGN_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_AI_LIST, "WC_AI_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_GOALS_LIST, "WC_GOALS_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_STORY_BOOK, "WC_STORY_BOOK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_STATION_LIST, "WC_STATION_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TRAINS_LIST, "WC_TRAINS_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_ROADVEH_LIST, "WC_ROADVEH_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SHIPS_LIST, "WC_SHIPS_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_AIRCRAFT_LIST, "WC_AIRCRAFT_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TOWN_VIEW, "WC_TOWN_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_VEHICLE_VIEW, "WC_VEHICLE_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_STATION_VIEW, "WC_STATION_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_VEHICLE_DEPOT, "WC_VEHICLE_DEPOT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_WAYPOINT_VIEW, "WC_WAYPOINT_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INDUSTRY_VIEW, "WC_INDUSTRY_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY, "WC_COMPANY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_OBJECT, "WC_BUILD_OBJECT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_VEHICLE, "WC_BUILD_VEHICLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_BRIDGE, "WC_BUILD_BRIDGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_STATION, "WC_BUILD_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUS_STATION, "WC_BUS_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_TRUCK_STATION, "WC_TRUCK_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_DEPOT, "WC_BUILD_DEPOT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_WAYPOINT, "WC_BUILD_WAYPOINT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FOUND_TOWN, "WC_FOUND_TOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUILD_INDUSTRY, "WC_BUILD_INDUSTRY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SELECT_GAME, "WC_SELECT_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SCEN_LAND_GEN, "WC_SCEN_LAND_GEN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_GENERATE_LANDSCAPE, "WC_GENERATE_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MODAL_PROGRESS, "WC_MODAL_PROGRESS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_NETWORK_WINDOW, "WC_NETWORK_WINDOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_CLIENT_LIST, "WC_CLIENT_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_CLIENT_LIST_POPUP, "WC_CLIENT_LIST_POPUP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_NETWORK_STATUS_WINDOW, "WC_NETWORK_STATUS_WINDOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SEND_NETWORK_MSG, "WC_SEND_NETWORK_MSG");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY_PASSWORD_WINDOW, "WC_COMPANY_PASSWORD_WINDOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INDUSTRY_CARGOES, "WC_INDUSTRY_CARGOES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_GRAPH_LEGEND, "WC_GRAPH_LEGEND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_FINANCES, "WC_FINANCES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INCOME_GRAPH, "WC_INCOME_GRAPH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_OPERATING_PROFIT, "WC_OPERATING_PROFIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_DELIVERED_CARGO, "WC_DELIVERED_CARGO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_PERFORMANCE_HISTORY, "WC_PERFORMANCE_HISTORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY_VALUE, "WC_COMPANY_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY_LEAGUE, "WC_COMPANY_LEAGUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_PAYMENT_RATES, "WC_PAYMENT_RATES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_PERFORMANCE_DETAIL, "WC_PERFORMANCE_DETAIL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_COMPANY_INFRASTRUCTURE, "WC_COMPANY_INFRASTRUCTURE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BUY_COMPANY, "WC_BUY_COMPANY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_ENGINE_PREVIEW, "WC_ENGINE_PREVIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MUSIC_WINDOW, "WC_MUSIC_WINDOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_MUSIC_TRACK_SELECTION, "WC_MUSIC_TRACK_SELECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_GAME_OPTIONS, "WC_GAME_OPTIONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_CUSTOM_CURRENCY, "WC_CUSTOM_CURRENCY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_CHEATS, "WC_CHEATS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_EXTRA_VIEW_PORT, "WC_EXTRA_VIEW_PORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_CONSOLE, "WC_CONSOLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_BOOTSTRAP, "WC_BOOTSTRAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_HIGHSCORE, "WC_HIGHSCORE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_ENDSCREEN, "WC_ENDSCREEN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_AI_DEBUG, "WC_AI_DEBUG");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_NEWGRF_INSPECT, "WC_NEWGRF_INSPECT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_SPRITE_ALIGNER, "WC_SPRITE_ALIGNER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_LINKGRAPH_LEGEND, "WC_LINKGRAPH_LEGEND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WC_INVALID, "WC_INVALID");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BLUE, "TC_BLUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_SILVER, "TC_SILVER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_GOLD, "TC_GOLD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_RED, "TC_RED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_PURPLE, "TC_PURPLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_LIGHT_BROWN, "TC_LIGHT_BROWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_ORANGE, "TC_ORANGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_GREEN, "TC_GREEN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_YELLOW, "TC_YELLOW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_DARK_GREEN, "TC_DARK_GREEN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_CREAM, "TC_CREAM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BROWN, "TC_BROWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_WHITE, "TC_WHITE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_LIGHT_BLUE, "TC_LIGHT_BLUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_GREY, "TC_GREY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_DARK_BLUE, "TC_DARK_BLUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_BLACK, "TC_BLACK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::TC_INVALID, "TC_INVALID");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::NUMBER_ALL, "NUMBER_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WIDGET_ALL, "WIDGET_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIL_CAPTION, "WID_AIL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIL_LIST, "WID_AIL_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIL_SCROLLBAR, "WID_AIL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIL_INFO_BG, "WID_AIL_INFO_BG");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIL_ACCEPT, "WID_AIL_ACCEPT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIL_CANCEL, "WID_AIL_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_CAPTION, "WID_AIS_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_BACKGROUND, "WID_AIS_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_SCROLLBAR, "WID_AIS_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_ACCEPT, "WID_AIS_ACCEPT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIS_RESET, "WID_AIS_RESET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_BACKGROUND, "WID_AIC_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_DECREASE, "WID_AIC_DECREASE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_INCREASE, "WID_AIC_INCREASE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_NUMBER, "WID_AIC_NUMBER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_GAMELIST, "WID_AIC_GAMELIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_LIST, "WID_AIC_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_SCROLLBAR, "WID_AIC_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_UP, "WID_AIC_MOVE_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_DOWN, "WID_AIC_MOVE_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CHANGE, "WID_AIC_CHANGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CONFIGURE, "WID_AIC_CONFIGURE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CLOSE, "WID_AIC_CLOSE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_TEXTFILE, "WID_AIC_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CONTENT_DOWNLOAD, "WID_AIC_CONTENT_DOWNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_VIEW, "WID_AID_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_NAME_TEXT, "WID_AID_NAME_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_SETTINGS, "WID_AID_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_SCRIPT_GAME, "WID_AID_SCRIPT_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_RELOAD_TOGGLE, "WID_AID_RELOAD_TOGGLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_LOG_PANEL, "WID_AID_LOG_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_SCROLLBAR, "WID_AID_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_COMPANY_BUTTON_START, "WID_AID_COMPANY_BUTTON_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_COMPANY_BUTTON_END, "WID_AID_COMPANY_BUTTON_END");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_BREAK_STRING_WIDGETS, "WID_AID_BREAK_STRING_WIDGETS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_BREAK_STR_ON_OFF_BTN, "WID_AID_BREAK_STR_ON_OFF_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_BREAK_STR_EDIT_BOX, "WID_AID_BREAK_STR_EDIT_BOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_MATCH_CASE_BTN, "WID_AID_MATCH_CASE_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AID_CONTINUE_BTN, "WID_AID_CONTINUE_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AT_AIRPORT, "WID_AT_AIRPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AT_DEMOLISH, "WID_AT_DEMOLISH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_CLASS_DROPDOWN, "WID_AP_CLASS_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_AIRPORT_LIST, "WID_AP_AIRPORT_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_SCROLLBAR, "WID_AP_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_LAYOUT_NUM, "WID_AP_LAYOUT_NUM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_LAYOUT_DECREASE, "WID_AP_LAYOUT_DECREASE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_LAYOUT_INCREASE, "WID_AP_LAYOUT_INCREASE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_AIRPORT_SPRITE, "WID_AP_AIRPORT_SPRITE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_EXTRA_TEXT, "WID_AP_EXTRA_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_BOTTOMPANEL, "WID_AP_BOTTOMPANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_COVERAGE_LABEL, "WID_AP_COVERAGE_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_BTN_DONTHILIGHT, "WID_AP_BTN_DONTHILIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AP_BTN_DOHILIGHT, "WID_AP_BTN_DOHILIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_CAPTION, "WID_RV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_LEFT_MATRIX, "WID_RV_LEFT_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_LEFT_SCROLLBAR, "WID_RV_LEFT_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_RIGHT_MATRIX, "WID_RV_RIGHT_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_RIGHT_SCROLLBAR, "WID_RV_RIGHT_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_LEFT_DETAILS, "WID_RV_LEFT_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_RIGHT_DETAILS, "WID_RV_RIGHT_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_START_REPLACE, "WID_RV_START_REPLACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_INFO_TAB, "WID_RV_INFO_TAB");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_STOP_REPLACE, "WID_RV_STOP_REPLACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_ENGINEWAGON_TOGGLE, "WID_RV_TRAIN_ENGINEWAGON_TOGGLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_FLUFF_LEFT, "WID_RV_TRAIN_FLUFF_LEFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_RAILTYPE_DROPDOWN, "WID_RV_TRAIN_RAILTYPE_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_FLUFF_RIGHT, "WID_RV_TRAIN_FLUFF_RIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RV_TRAIN_WAGONREMOVE_TOGGLE, "WID_RV_TRAIN_WAGONREMOVE_TOGGLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BB_BACKGROUND, "WID_BB_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BAFD_QUESTION, "WID_BAFD_QUESTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BAFD_YES, "WID_BAFD_YES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BAFD_NO, "WID_BAFD_NO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_CAPTION, "WID_BBS_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_DROPDOWN_ORDER, "WID_BBS_DROPDOWN_ORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_DROPDOWN_CRITERIA, "WID_BBS_DROPDOWN_CRITERIA");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_BRIDGE_LIST, "WID_BBS_BRIDGE_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BBS_SCROLLBAR, "WID_BBS_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_CAPTION, "WID_BV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SORT_ASSENDING_DESCENDING, "WID_BV_SORT_ASSENDING_DESCENDING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SORT_DROPDOWN, "WID_BV_SORT_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_CARGO_FILTER_DROPDOWN, "WID_BV_CARGO_FILTER_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_LIST, "WID_BV_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_SCROLLBAR, "WID_BV_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_PANEL, "WID_BV_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_BUILD, "WID_BV_BUILD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_BUILD_SEL, "WID_BV_BUILD_SEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BV_RENAME, "WID_BV_RENAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_PANEL, "WID_C_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_CAPTION, "WID_C_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_FACE, "WID_C_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_FACE_TITLE, "WID_C_FACE_TITLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_INAUGURATION, "WID_C_DESC_INAUGURATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_COLOUR_SCHEME, "WID_C_DESC_COLOUR_SCHEME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_COLOUR_SCHEME_EXAMPLE, "WID_C_DESC_COLOUR_SCHEME_EXAMPLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_VEHICLE, "WID_C_DESC_VEHICLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_VEHICLE_COUNTS, "WID_C_DESC_VEHICLE_COUNTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_COMPANY_VALUE, "WID_C_DESC_COMPANY_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_INFRASTRUCTURE, "WID_C_DESC_INFRASTRUCTURE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_INFRASTRUCTURE_COUNTS, "WID_C_DESC_INFRASTRUCTURE_COUNTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_SELECT_DESC_OWNERS, "WID_C_SELECT_DESC_OWNERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_DESC_OWNERS, "WID_C_DESC_OWNERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_SELECT_BUTTONS, "WID_C_SELECT_BUTTONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_NEW_FACE, "WID_C_NEW_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_COLOUR_SCHEME, "WID_C_COLOUR_SCHEME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_PRESIDENT_NAME, "WID_C_PRESIDENT_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_COMPANY_NAME, "WID_C_COMPANY_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_BUY_SHARE, "WID_C_BUY_SHARE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_SELL_SHARE, "WID_C_SELL_SHARE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_SELECT_VIEW_BUILD_HQ, "WID_C_SELECT_VIEW_BUILD_HQ");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_VIEW_HQ, "WID_C_VIEW_HQ");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_BUILD_HQ, "WID_C_BUILD_HQ");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_SELECT_RELOCATE, "WID_C_SELECT_RELOCATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_RELOCATE_HQ, "WID_C_RELOCATE_HQ");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_VIEW_INFRASTRUCTURE, "WID_C_VIEW_INFRASTRUCTURE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_HAS_PASSWORD, "WID_C_HAS_PASSWORD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_SELECT_MULTIPLAYER, "WID_C_SELECT_MULTIPLAYER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_COMPANY_PASSWORD, "WID_C_COMPANY_PASSWORD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_COMPANY_JOIN, "WID_C_COMPANY_JOIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_CAPTION, "WID_CF_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_TOGGLE_SIZE, "WID_CF_TOGGLE_SIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_SEL_PANEL, "WID_CF_SEL_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_EXPS_CATEGORY, "WID_CF_EXPS_CATEGORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_EXPS_PRICE1, "WID_CF_EXPS_PRICE1");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_EXPS_PRICE2, "WID_CF_EXPS_PRICE2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_EXPS_PRICE3, "WID_CF_EXPS_PRICE3");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_TOTAL_PANEL, "WID_CF_TOTAL_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_SEL_MAXLOAN, "WID_CF_SEL_MAXLOAN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_BALANCE_VALUE, "WID_CF_BALANCE_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_LOAN_VALUE, "WID_CF_LOAN_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_LOAN_LINE, "WID_CF_LOAN_LINE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_TOTAL_VALUE, "WID_CF_TOTAL_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_MAXLOAN_GAP, "WID_CF_MAXLOAN_GAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_MAXLOAN_VALUE, "WID_CF_MAXLOAN_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_SEL_BUTTONS, "WID_CF_SEL_BUTTONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_INCREASE_LOAN, "WID_CF_INCREASE_LOAN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_REPAY_LOAN, "WID_CF_REPAY_LOAN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CF_INFRASTRUCTURE, "WID_CF_INFRASTRUCTURE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_CAPTION, "WID_SCL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_CLASS_GENERAL, "WID_SCL_CLASS_GENERAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_CLASS_RAIL, "WID_SCL_CLASS_RAIL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_CLASS_ROAD, "WID_SCL_CLASS_ROAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_CLASS_SHIP, "WID_SCL_CLASS_SHIP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_CLASS_AIRCRAFT, "WID_SCL_CLASS_AIRCRAFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_SPACER_DROPDOWN, "WID_SCL_SPACER_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_PRI_COL_DROPDOWN, "WID_SCL_PRI_COL_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_SEC_COL_DROPDOWN, "WID_SCL_SEC_COL_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCL_MATRIX, "WID_SCL_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_CAPTION, "WID_SCMF_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_TOGGLE_LARGE_SMALL, "WID_SCMF_TOGGLE_LARGE_SMALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_SELECT_FACE, "WID_SCMF_SELECT_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_CANCEL, "WID_SCMF_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_ACCEPT, "WID_SCMF_ACCEPT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_MALE, "WID_SCMF_MALE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_FEMALE, "WID_SCMF_FEMALE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_MALE2, "WID_SCMF_MALE2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_FEMALE2, "WID_SCMF_FEMALE2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_SEL_LOADSAVE, "WID_SCMF_SEL_LOADSAVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_SEL_MALEFEMALE, "WID_SCMF_SEL_MALEFEMALE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_SEL_PARTS, "WID_SCMF_SEL_PARTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_RANDOM_NEW_FACE, "WID_SCMF_RANDOM_NEW_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON, "WID_SCMF_TOGGLE_LARGE_SMALL_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_FACE, "WID_SCMF_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_LOAD, "WID_SCMF_LOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_FACECODE, "WID_SCMF_FACECODE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_SAVE, "WID_SCMF_SAVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT, "WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_TIE_EARRING_TEXT, "WID_SCMF_TIE_EARRING_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_LIPS_MOUSTACHE_TEXT, "WID_SCMF_LIPS_MOUSTACHE_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAS_GLASSES_TEXT, "WID_SCMF_HAS_GLASSES_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAIR_TEXT, "WID_SCMF_HAIR_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYEBROWS_TEXT, "WID_SCMF_EYEBROWS_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYECOLOUR_TEXT, "WID_SCMF_EYECOLOUR_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_GLASSES_TEXT, "WID_SCMF_GLASSES_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_NOSE_TEXT, "WID_SCMF_NOSE_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_CHIN_TEXT, "WID_SCMF_CHIN_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_JACKET_TEXT, "WID_SCMF_JACKET_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_COLLAR_TEXT, "WID_SCMF_COLLAR_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_ETHNICITY_EUR, "WID_SCMF_ETHNICITY_EUR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_ETHNICITY_AFR, "WID_SCMF_ETHNICITY_AFR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAS_MOUSTACHE_EARRING, "WID_SCMF_HAS_MOUSTACHE_EARRING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAS_GLASSES, "WID_SCMF_HAS_GLASSES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYECOLOUR_L, "WID_SCMF_EYECOLOUR_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYECOLOUR, "WID_SCMF_EYECOLOUR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYECOLOUR_R, "WID_SCMF_EYECOLOUR_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_CHIN_L, "WID_SCMF_CHIN_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_CHIN, "WID_SCMF_CHIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_CHIN_R, "WID_SCMF_CHIN_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYEBROWS_L, "WID_SCMF_EYEBROWS_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYEBROWS, "WID_SCMF_EYEBROWS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_EYEBROWS_R, "WID_SCMF_EYEBROWS_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_LIPS_MOUSTACHE_L, "WID_SCMF_LIPS_MOUSTACHE_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_LIPS_MOUSTACHE, "WID_SCMF_LIPS_MOUSTACHE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_LIPS_MOUSTACHE_R, "WID_SCMF_LIPS_MOUSTACHE_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_NOSE_L, "WID_SCMF_NOSE_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_NOSE, "WID_SCMF_NOSE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_NOSE_R, "WID_SCMF_NOSE_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAIR_L, "WID_SCMF_HAIR_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAIR, "WID_SCMF_HAIR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_HAIR_R, "WID_SCMF_HAIR_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_JACKET_L, "WID_SCMF_JACKET_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_JACKET, "WID_SCMF_JACKET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_JACKET_R, "WID_SCMF_JACKET_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_COLLAR_L, "WID_SCMF_COLLAR_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_COLLAR, "WID_SCMF_COLLAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_COLLAR_R, "WID_SCMF_COLLAR_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_TIE_EARRING_L, "WID_SCMF_TIE_EARRING_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_TIE_EARRING, "WID_SCMF_TIE_EARRING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_TIE_EARRING_R, "WID_SCMF_TIE_EARRING_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_GLASSES_L, "WID_SCMF_GLASSES_L");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_GLASSES, "WID_SCMF_GLASSES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SCMF_GLASSES_R, "WID_SCMF_GLASSES_R");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_CAPTION, "WID_CI_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_RAIL_DESC, "WID_CI_RAIL_DESC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_RAIL_COUNT, "WID_CI_RAIL_COUNT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_ROAD_DESC, "WID_CI_ROAD_DESC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_ROAD_COUNT, "WID_CI_ROAD_COUNT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_WATER_DESC, "WID_CI_WATER_DESC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_WATER_COUNT, "WID_CI_WATER_COUNT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_STATION_DESC, "WID_CI_STATION_DESC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_STATION_COUNT, "WID_CI_STATION_COUNT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_TOTAL_DESC, "WID_CI_TOTAL_DESC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CI_TOTAL, "WID_CI_TOTAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BC_CAPTION, "WID_BC_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BC_FACE, "WID_BC_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BC_QUESTION, "WID_BC_QUESTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BC_NO, "WID_BC_NO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BC_YES, "WID_BC_YES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_C_BACKGROUND, "WID_C_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SD_DAY, "WID_SD_DAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SD_MONTH, "WID_SD_MONTH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SD_YEAR, "WID_SD_YEAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SD_SET_DATE, "WID_SD_SET_DATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_CAPTION, "WID_D_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_SELL, "WID_D_SELL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_SHOW_SELL_CHAIN, "WID_D_SHOW_SELL_CHAIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_SELL_CHAIN, "WID_D_SELL_CHAIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_SELL_ALL, "WID_D_SELL_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_AUTOREPLACE, "WID_D_AUTOREPLACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_MATRIX, "WID_D_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_V_SCROLL, "WID_D_V_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_SHOW_H_SCROLL, "WID_D_SHOW_H_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_H_SCROLL, "WID_D_H_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_BUILD, "WID_D_BUILD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_CLONE, "WID_D_CLONE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_LOCATION, "WID_D_LOCATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_SHOW_RENAME, "WID_D_SHOW_RENAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_RENAME, "WID_D_RENAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_VEHICLE_LIST, "WID_D_VEHICLE_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_STOP_ALL, "WID_D_STOP_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_D_START_ALL, "WID_D_START_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BDD_BACKGROUND, "WID_BDD_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BDD_X, "WID_BDD_X");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BDD_Y, "WID_BDD_Y");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_CANAL, "WID_DT_CANAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_LOCK, "WID_DT_LOCK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_DEMOLISH, "WID_DT_DEMOLISH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_DEPOT, "WID_DT_DEPOT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_STATION, "WID_DT_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_BUOY, "WID_DT_BUOY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_RIVER, "WID_DT_RIVER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_BUILD_AQUEDUCT, "WID_DT_BUILD_AQUEDUCT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DT_INVALID, "WID_DT_INVALID");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DM_ITEMS, "WID_DM_ITEMS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DM_SHOW_SCROLL, "WID_DM_SHOW_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DM_SCROLL, "WID_DM_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EP_QUESTION, "WID_EP_QUESTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EP_NO, "WID_EP_NO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EP_YES, "WID_EP_YES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EM_CAPTION, "WID_EM_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EM_FACE, "WID_EM_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EM_MESSAGE, "WID_EM_MESSAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_CAPTION, "WID_SL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_SORT_BYNAME, "WID_SL_SORT_BYNAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_SORT_BYDATE, "WID_SL_SORT_BYDATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_BACKGROUND, "WID_SL_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_FILE_BACKGROUND, "WID_SL_FILE_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_HOME_BUTTON, "WID_SL_HOME_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_DRIVES_DIRECTORIES_LIST, "WID_SL_DRIVES_DIRECTORIES_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_SCROLLBAR, "WID_SL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_CONTENT_DOWNLOAD, "WID_SL_CONTENT_DOWNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_SAVE_OSK_TITLE, "WID_SL_SAVE_OSK_TITLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_DELETE_SELECTION, "WID_SL_DELETE_SELECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_SAVE_GAME, "WID_SL_SAVE_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_CONTENT_DOWNLOAD_SEL, "WID_SL_CONTENT_DOWNLOAD_SEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_DETAILS, "WID_SL_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_NEWGRF_INFO, "WID_SL_NEWGRF_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_LOAD_BUTTON, "WID_SL_LOAD_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SL_MISSING_NEWGRFS, "WID_SL_MISSING_NEWGRFS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TEMPERATE, "WID_GL_TEMPERATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_ARCTIC, "WID_GL_ARCTIC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TROPICAL, "WID_GL_TROPICAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TOYLAND, "WID_GL_TOYLAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MAPSIZE_X_PULLDOWN, "WID_GL_MAPSIZE_X_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MAPSIZE_Y_PULLDOWN, "WID_GL_MAPSIZE_Y_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TOWN_PULLDOWN, "WID_GL_TOWN_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_INDUSTRY_PULLDOWN, "WID_GL_INDUSTRY_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_RANDOM_EDITBOX, "WID_GL_RANDOM_EDITBOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_RANDOM_BUTTON, "WID_GL_RANDOM_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_GENERATE_BUTTON, "WID_GL_GENERATE_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_DATE_DOWN, "WID_GL_START_DATE_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_DATE_TEXT, "WID_GL_START_DATE_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_DATE_UP, "WID_GL_START_DATE_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_SNOW_LEVEL_DOWN, "WID_GL_SNOW_LEVEL_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_SNOW_LEVEL_TEXT, "WID_GL_SNOW_LEVEL_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_SNOW_LEVEL_UP, "WID_GL_SNOW_LEVEL_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TREE_PULLDOWN, "WID_GL_TREE_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_LANDSCAPE_PULLDOWN, "WID_GL_LANDSCAPE_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_HEIGHTMAP_NAME_TEXT, "WID_GL_HEIGHTMAP_NAME_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_HEIGHTMAP_SIZE_TEXT, "WID_GL_HEIGHTMAP_SIZE_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_HEIGHTMAP_ROTATION_PULLDOWN, "WID_GL_HEIGHTMAP_ROTATION_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_TERRAIN_PULLDOWN, "WID_GL_TERRAIN_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_WATER_PULLDOWN, "WID_GL_WATER_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_RIVER_PULLDOWN, "WID_GL_RIVER_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_SMOOTHNESS_PULLDOWN, "WID_GL_SMOOTHNESS_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_VARIETY_PULLDOWN, "WID_GL_VARIETY_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_BORDERS_RANDOM, "WID_GL_BORDERS_RANDOM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_WATER_NW, "WID_GL_WATER_NW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_WATER_NE, "WID_GL_WATER_NE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_WATER_SE, "WID_GL_WATER_SE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_WATER_SW, "WID_GL_WATER_SW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_TEMPERATE, "WID_CS_TEMPERATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_ARCTIC, "WID_CS_ARCTIC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_TROPICAL, "WID_CS_TROPICAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_TOYLAND, "WID_CS_TOYLAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_EMPTY_WORLD, "WID_CS_EMPTY_WORLD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_RANDOM_WORLD, "WID_CS_RANDOM_WORLD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_MAPSIZE_X_PULLDOWN, "WID_CS_MAPSIZE_X_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_MAPSIZE_Y_PULLDOWN, "WID_CS_MAPSIZE_Y_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_START_DATE_DOWN, "WID_CS_START_DATE_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_START_DATE_TEXT, "WID_CS_START_DATE_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_START_DATE_UP, "WID_CS_START_DATE_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_FLAT_LAND_HEIGHT_DOWN, "WID_CS_FLAT_LAND_HEIGHT_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_FLAT_LAND_HEIGHT_TEXT, "WID_CS_FLAT_LAND_HEIGHT_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CS_FLAT_LAND_HEIGHT_UP, "WID_CS_FLAT_LAND_HEIGHT_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GP_PROGRESS_BAR, "WID_GP_PROGRESS_BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GP_PROGRESS_TEXT, "WID_GP_PROGRESS_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GP_ABORT, "WID_GP_ABORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GOAL_CAPTION, "WID_GOAL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GOAL_LIST, "WID_GOAL_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GOAL_SCROLLBAR, "WID_GOAL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GQ_CAPTION, "WID_GQ_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GQ_QUESTION, "WID_GQ_QUESTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GQ_BUTTONS, "WID_GQ_BUTTONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GQ_BUTTON_1, "WID_GQ_BUTTON_1");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GQ_BUTTON_2, "WID_GQ_BUTTON_2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GQ_BUTTON_3, "WID_GQ_BUTTON_3");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_BACKGROUND, "WID_GL_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_FIRST_COMPANY, "WID_GL_FIRST_COMPANY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_LAST_COMPANY, "WID_GL_LAST_COMPANY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CV_KEY_BUTTON, "WID_CV_KEY_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CV_BACKGROUND, "WID_CV_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CV_GRAPH, "WID_CV_GRAPH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CV_RESIZE, "WID_CV_RESIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PHG_KEY, "WID_PHG_KEY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PHG_DETAILED_PERFORMANCE, "WID_PHG_DETAILED_PERFORMANCE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PHG_BACKGROUND, "WID_PHG_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PHG_GRAPH, "WID_PHG_GRAPH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PHG_RESIZE, "WID_PHG_RESIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_BACKGROUND, "WID_CPR_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_HEADER, "WID_CPR_HEADER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_GRAPH, "WID_CPR_GRAPH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_RESIZE, "WID_CPR_RESIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_FOOTER, "WID_CPR_FOOTER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_ENABLE_CARGOES, "WID_CPR_ENABLE_CARGOES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_DISABLE_CARGOES, "WID_CPR_DISABLE_CARGOES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CPR_CARGO_FIRST, "WID_CPR_CARGO_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CL_BACKGROUND, "WID_CL_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PRD_SCORE_FIRST, "WID_PRD_SCORE_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PRD_SCORE_LAST, "WID_PRD_SCORE_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PRD_COMPANY_FIRST, "WID_PRD_COMPANY_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_PRD_COMPANY_LAST, "WID_PRD_COMPANY_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_CAPTION, "WID_GL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_SORT_BY_ORDER, "WID_GL_SORT_BY_ORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_SORT_BY_DROPDOWN, "WID_GL_SORT_BY_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_LIST_VEHICLE, "WID_GL_LIST_VEHICLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_LIST_VEHICLE_SCROLLBAR, "WID_GL_LIST_VEHICLE_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_AVAILABLE_VEHICLES, "WID_GL_AVAILABLE_VEHICLES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_MANAGE_VEHICLES_DROPDOWN, "WID_GL_MANAGE_VEHICLES_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_STOP_ALL, "WID_GL_STOP_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_START_ALL, "WID_GL_START_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_ALL_VEHICLES, "WID_GL_ALL_VEHICLES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_DEFAULT_VEHICLES, "WID_GL_DEFAULT_VEHICLES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_LIST_GROUP, "WID_GL_LIST_GROUP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_LIST_GROUP_SCROLLBAR, "WID_GL_LIST_GROUP_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_CREATE_GROUP, "WID_GL_CREATE_GROUP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_DELETE_GROUP, "WID_GL_DELETE_GROUP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_RENAME_GROUP, "WID_GL_RENAME_GROUP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GL_REPLACE_PROTECTION, "WID_GL_REPLACE_PROTECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_H_BACKGROUND, "WID_H_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DPI_MATRIX_WIDGET, "WID_DPI_MATRIX_WIDGET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DPI_SCROLLBAR, "WID_DPI_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DPI_INFOPANEL, "WID_DPI_INFOPANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DPI_DISPLAY_WIDGET, "WID_DPI_DISPLAY_WIDGET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_DPI_FUND_WIDGET, "WID_DPI_FUND_WIDGET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_CAPTION, "WID_IV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_VIEWPORT, "WID_IV_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_INFO, "WID_IV_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_GOTO, "WID_IV_GOTO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IV_DISPLAY, "WID_IV_DISPLAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_DROPDOWN_ORDER, "WID_ID_DROPDOWN_ORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_DROPDOWN_CRITERIA, "WID_ID_DROPDOWN_CRITERIA");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_INDUSTRY_LIST, "WID_ID_INDUSTRY_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ID_SCROLLBAR, "WID_ID_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_CAPTION, "WID_IC_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_NOTIFY, "WID_IC_NOTIFY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_PANEL, "WID_IC_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_SCROLLBAR, "WID_IC_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_CARGO_DROPDOWN, "WID_IC_CARGO_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_IC_IND_DROPDOWN, "WID_IC_IND_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_GENERATE_GAME, "WID_SGI_GENERATE_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_LOAD_GAME, "WID_SGI_LOAD_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_PLAY_SCENARIO, "WID_SGI_PLAY_SCENARIO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_PLAY_HEIGHTMAP, "WID_SGI_PLAY_HEIGHTMAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_EDIT_SCENARIO, "WID_SGI_EDIT_SCENARIO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_PLAY_NETWORK, "WID_SGI_PLAY_NETWORK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TEMPERATE_LANDSCAPE, "WID_SGI_TEMPERATE_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_ARCTIC_LANDSCAPE, "WID_SGI_ARCTIC_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TROPIC_LANDSCAPE, "WID_SGI_TROPIC_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TOYLAND_LANDSCAPE, "WID_SGI_TOYLAND_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TRANSLATION_SELECTION, "WID_SGI_TRANSLATION_SELECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_TRANSLATION, "WID_SGI_TRANSLATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_OPTIONS, "WID_SGI_OPTIONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_HIGHSCORE, "WID_SGI_HIGHSCORE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_SETTINGS_OPTIONS, "WID_SGI_SETTINGS_OPTIONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_GRF_SETTINGS, "WID_SGI_GRF_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_CONTENT_DOWNLOAD, "WID_SGI_CONTENT_DOWNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_AI_SETTINGS, "WID_SGI_AI_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SGI_EXIT, "WID_SGI_EXIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_CAPTION, "WID_LGL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_SATURATION, "WID_LGL_SATURATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_SATURATION_FIRST, "WID_LGL_SATURATION_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_SATURATION_LAST, "WID_LGL_SATURATION_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_COMPANIES, "WID_LGL_COMPANIES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_COMPANY_FIRST, "WID_LGL_COMPANY_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_COMPANY_LAST, "WID_LGL_COMPANY_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_COMPANIES_ALL, "WID_LGL_COMPANIES_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_COMPANIES_NONE, "WID_LGL_COMPANIES_NONE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_CARGOES, "WID_LGL_CARGOES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_CARGO_FIRST, "WID_LGL_CARGO_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_CARGO_LAST, "WID_LGL_CARGO_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_CARGOES_ALL, "WID_LGL_CARGOES_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LGL_CARGOES_NONE, "WID_LGL_CARGOES_NONE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_VIEWPORT, "WID_M_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_LI_BACKGROUND, "WID_LI_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BACKGROUND, "WID_TT_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_SCROLLING_TEXT, "WID_A_SCROLLING_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_WEBSITE, "WID_A_WEBSITE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_CAPTION, "WID_QS_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_TEXT, "WID_QS_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_DEFAULT, "WID_QS_DEFAULT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_CANCEL, "WID_QS_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_OK, "WID_QS_OK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_Q_CAPTION, "WID_Q_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_Q_TEXT, "WID_Q_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_Q_NO, "WID_Q_NO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_Q_YES, "WID_Q_YES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_CAPTION, "WID_TF_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_WRAPTEXT, "WID_TF_WRAPTEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_BACKGROUND, "WID_TF_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_VSCROLLBAR, "WID_TF_VSCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_HSCROLLBAR, "WID_TF_HSCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_LIST_LEFT, "WID_MTS_LIST_LEFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_LEFT_SCROLLBAR, "WID_MTS_LEFT_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_PLAYLIST, "WID_MTS_PLAYLIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_LIST_RIGHT, "WID_MTS_LIST_RIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_RIGHT_SCROLLBAR, "WID_MTS_RIGHT_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_ALL, "WID_MTS_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_OLD, "WID_MTS_OLD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_NEW, "WID_MTS_NEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_EZY, "WID_MTS_EZY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_CUSTOM1, "WID_MTS_CUSTOM1");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_CUSTOM2, "WID_MTS_CUSTOM2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MTS_CLEAR, "WID_MTS_CLEAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_PREV, "WID_M_PREV");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_NEXT, "WID_M_NEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_STOP, "WID_M_STOP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_PLAY, "WID_M_PLAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_SLIDERS, "WID_M_SLIDERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_MUSIC_VOL, "WID_M_MUSIC_VOL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_EFFECT_VOL, "WID_M_EFFECT_VOL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_BACKGROUND, "WID_M_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_TRACK, "WID_M_TRACK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_TRACK_NR, "WID_M_TRACK_NR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_TRACK_TITLE, "WID_M_TRACK_TITLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_TRACK_NAME, "WID_M_TRACK_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_SHUFFLE, "WID_M_SHUFFLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_PROGRAMME, "WID_M_PROGRAMME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_ALL, "WID_M_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_OLD, "WID_M_OLD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_NEW, "WID_M_NEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_EZY, "WID_M_EZY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_CUSTOM1, "WID_M_CUSTOM1");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_M_CUSTOM2, "WID_M_CUSTOM2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NC_CLOSE, "WID_NC_CLOSE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NC_BACKGROUND, "WID_NC_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NC_DESTINATION, "WID_NC_DESTINATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NC_TEXTBOX, "WID_NC_TEXTBOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NC_SENDBUTTON, "WID_NC_SENDBUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCDS_BACKGROUND, "WID_NCDS_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCDS_CANCELOK, "WID_NCDS_CANCELOK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_BACKGROUND, "WID_NCL_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_FILTER_CAPT, "WID_NCL_FILTER_CAPT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_FILTER, "WID_NCL_FILTER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_CHECKBOX, "WID_NCL_CHECKBOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_TYPE, "WID_NCL_TYPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_NAME, "WID_NCL_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_MATRIX, "WID_NCL_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SCROLLBAR, "WID_NCL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_DETAILS, "WID_NCL_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_TEXTFILE, "WID_NCL_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SELECT_ALL, "WID_NCL_SELECT_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SELECT_UPDATE, "WID_NCL_SELECT_UPDATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_UNSELECT, "WID_NCL_UNSELECT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_OPEN_URL, "WID_NCL_OPEN_URL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_CANCEL, "WID_NCL_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_DOWNLOAD, "WID_NCL_DOWNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SEL_ALL_UPDATE, "WID_NCL_SEL_ALL_UPDATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCL_SEARCH_EXTERNAL, "WID_NCL_SEARCH_EXTERNAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_MAIN, "WID_NG_MAIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CONNECTION, "WID_NG_CONNECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CONN_BTN, "WID_NG_CONN_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CLIENT_LABEL, "WID_NG_CLIENT_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CLIENT, "WID_NG_CLIENT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_FILTER_LABEL, "WID_NG_FILTER_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_FILTER, "WID_NG_FILTER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_HEADER, "WID_NG_HEADER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_NAME, "WID_NG_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CLIENTS, "WID_NG_CLIENTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_MAPSIZE, "WID_NG_MAPSIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_DATE, "WID_NG_DATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_YEARS, "WID_NG_YEARS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_INFO, "WID_NG_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_MATRIX, "WID_NG_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_SCROLLBAR, "WID_NG_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_LASTJOINED_LABEL, "WID_NG_LASTJOINED_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_LASTJOINED, "WID_NG_LASTJOINED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_LASTJOINED_SPACER, "WID_NG_LASTJOINED_SPACER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_DETAILS, "WID_NG_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_DETAILS_SPACER, "WID_NG_DETAILS_SPACER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_JOIN, "WID_NG_JOIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_REFRESH, "WID_NG_REFRESH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_NEWGRF, "WID_NG_NEWGRF");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_NEWGRF_SEL, "WID_NG_NEWGRF_SEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_NEWGRF_MISSING, "WID_NG_NEWGRF_MISSING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_NEWGRF_MISSING_SEL, "WID_NG_NEWGRF_MISSING_SEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_FIND, "WID_NG_FIND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_ADD, "WID_NG_ADD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_START, "WID_NG_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NG_CANCEL, "WID_NG_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_BACKGROUND, "WID_NSS_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_GAMENAME_LABEL, "WID_NSS_GAMENAME_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_GAMENAME, "WID_NSS_GAMENAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_SETPWD, "WID_NSS_SETPWD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CONNTYPE_LABEL, "WID_NSS_CONNTYPE_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CONNTYPE_BTN, "WID_NSS_CONNTYPE_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CLIENTS_LABEL, "WID_NSS_CLIENTS_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CLIENTS_BTND, "WID_NSS_CLIENTS_BTND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CLIENTS_TXT, "WID_NSS_CLIENTS_TXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CLIENTS_BTNU, "WID_NSS_CLIENTS_BTNU");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_COMPANIES_LABEL, "WID_NSS_COMPANIES_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_COMPANIES_BTND, "WID_NSS_COMPANIES_BTND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_COMPANIES_TXT, "WID_NSS_COMPANIES_TXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_COMPANIES_BTNU, "WID_NSS_COMPANIES_BTNU");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_SPECTATORS_LABEL, "WID_NSS_SPECTATORS_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_SPECTATORS_BTND, "WID_NSS_SPECTATORS_BTND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_SPECTATORS_TXT, "WID_NSS_SPECTATORS_TXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_SPECTATORS_BTNU, "WID_NSS_SPECTATORS_BTNU");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_LANGUAGE_LABEL, "WID_NSS_LANGUAGE_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_LANGUAGE_BTN, "WID_NSS_LANGUAGE_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_GENERATE_GAME, "WID_NSS_GENERATE_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_LOAD_GAME, "WID_NSS_LOAD_GAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_PLAY_SCENARIO, "WID_NSS_PLAY_SCENARIO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_PLAY_HEIGHTMAP, "WID_NSS_PLAY_HEIGHTMAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NSS_CANCEL, "WID_NSS_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_BACKGROUND, "WID_NL_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_TEXT, "WID_NL_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_HEADER, "WID_NL_HEADER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_MATRIX, "WID_NL_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_SCROLLBAR, "WID_NL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_DETAILS, "WID_NL_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_JOIN, "WID_NL_JOIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_NEW, "WID_NL_NEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_SPECTATE, "WID_NL_SPECTATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_REFRESH, "WID_NL_REFRESH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NL_CANCEL, "WID_NL_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CL_PANEL, "WID_CL_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CLP_PANEL, "WID_CLP_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NJS_BACKGROUND, "WID_NJS_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NJS_CANCELOK, "WID_NJS_CANCELOK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_BACKGROUND, "WID_NCP_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_LABEL, "WID_NCP_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_PASSWORD, "WID_NCP_PASSWORD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_SAVE_AS_DEFAULT_PASSWORD, "WID_NCP_SAVE_AS_DEFAULT_PASSWORD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_CANCEL, "WID_NCP_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NCP_OK, "WID_NCP_OK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_CAPTION, "WID_NGRFI_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_PARENT, "WID_NGRFI_PARENT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_VEH_PREV, "WID_NGRFI_VEH_PREV");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_VEH_NEXT, "WID_NGRFI_VEH_NEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_VEH_CHAIN, "WID_NGRFI_VEH_CHAIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_MAINPANEL, "WID_NGRFI_MAINPANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NGRFI_SCROLLBAR, "WID_NGRFI_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_CAPTION, "WID_SA_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_PREVIOUS, "WID_SA_PREVIOUS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_GOTO, "WID_SA_GOTO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_NEXT, "WID_SA_NEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_UP, "WID_SA_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_LEFT, "WID_SA_LEFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_RIGHT, "WID_SA_RIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_DOWN, "WID_SA_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_SPRITE, "WID_SA_SPRITE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_OFFSETS, "WID_SA_OFFSETS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_PICKER, "WID_SA_PICKER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_LIST, "WID_SA_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SA_SCROLLBAR, "WID_SA_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_SHOW_NUMPAR, "WID_NP_SHOW_NUMPAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_NUMPAR_DEC, "WID_NP_NUMPAR_DEC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_NUMPAR_INC, "WID_NP_NUMPAR_INC");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_NUMPAR, "WID_NP_NUMPAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_NUMPAR_TEXT, "WID_NP_NUMPAR_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_BACKGROUND, "WID_NP_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_SCROLLBAR, "WID_NP_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_ACCEPT, "WID_NP_ACCEPT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_RESET, "WID_NP_RESET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_SHOW_DESCRIPTION, "WID_NP_SHOW_DESCRIPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NP_DESCRIPTION, "WID_NP_DESCRIPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_PRESET_LIST, "WID_NS_PRESET_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_PRESET_SAVE, "WID_NS_PRESET_SAVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_PRESET_DELETE, "WID_NS_PRESET_DELETE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_ADD, "WID_NS_ADD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_REMOVE, "WID_NS_REMOVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_MOVE_UP, "WID_NS_MOVE_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_MOVE_DOWN, "WID_NS_MOVE_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_FILTER, "WID_NS_FILTER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_FILE_LIST, "WID_NS_FILE_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SCROLLBAR, "WID_NS_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_AVAIL_LIST, "WID_NS_AVAIL_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SCROLL2BAR, "WID_NS_SCROLL2BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_NEWGRF_INFO_TITLE, "WID_NS_NEWGRF_INFO_TITLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_NEWGRF_INFO, "WID_NS_NEWGRF_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_OPEN_URL, "WID_NS_OPEN_URL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_NEWGRF_TEXTFILE, "WID_NS_NEWGRF_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SET_PARAMETERS, "WID_NS_SET_PARAMETERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_VIEW_PARAMETERS, "WID_NS_VIEW_PARAMETERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_TOGGLE_PALETTE, "WID_NS_TOGGLE_PALETTE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_APPLY_CHANGES, "WID_NS_APPLY_CHANGES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_RESCAN_FILES, "WID_NS_RESCAN_FILES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_RESCAN_FILES2, "WID_NS_RESCAN_FILES2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_CONTENT_DOWNLOAD, "WID_NS_CONTENT_DOWNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_CONTENT_DOWNLOAD2, "WID_NS_CONTENT_DOWNLOAD2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SHOW_REMOVE, "WID_NS_SHOW_REMOVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_NS_SHOW_APPLY, "WID_NS_SHOW_APPLY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SP_PROGRESS_BAR, "WID_SP_PROGRESS_BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SP_PROGRESS_TEXT, "WID_SP_PROGRESS_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_PANEL, "WID_N_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_TITLE, "WID_N_TITLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_HEADLINE, "WID_N_HEADLINE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_CLOSEBOX, "WID_N_CLOSEBOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_DATE, "WID_N_DATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_CAPTION, "WID_N_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_INSET, "WID_N_INSET");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_VIEWPORT, "WID_N_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_COMPANY_MSG, "WID_N_COMPANY_MSG");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_MESSAGE, "WID_N_MESSAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_MGR_FACE, "WID_N_MGR_FACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_MGR_NAME, "WID_N_MGR_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_VEH_TITLE, "WID_N_VEH_TITLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_VEH_BKGND, "WID_N_VEH_BKGND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_VEH_NAME, "WID_N_VEH_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_VEH_SPR, "WID_N_VEH_SPR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_N_VEH_INFO, "WID_N_VEH_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MH_STICKYBOX, "WID_MH_STICKYBOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MH_BACKGROUND, "WID_MH_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_MH_SCROLLBAR, "WID_MH_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_CLASS_LIST, "WID_BO_CLASS_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_SCROLLBAR, "WID_BO_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_OBJECT_MATRIX, "WID_BO_OBJECT_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_OBJECT_SPRITE, "WID_BO_OBJECT_SPRITE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_OBJECT_NAME, "WID_BO_OBJECT_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_OBJECT_SIZE, "WID_BO_OBJECT_SIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_INFO, "WID_BO_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_SELECT_MATRIX, "WID_BO_SELECT_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_SELECT_IMAGE, "WID_BO_SELECT_IMAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BO_SELECT_SCROLL, "WID_BO_SELECT_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_CAPTION, "WID_O_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_TIMETABLE_VIEW, "WID_O_TIMETABLE_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_ORDER_LIST, "WID_O_ORDER_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SCROLLBAR, "WID_O_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SKIP, "WID_O_SKIP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_DELETE, "WID_O_DELETE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_STOP_SHARING, "WID_O_STOP_SHARING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_NON_STOP, "WID_O_NON_STOP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_GOTO, "WID_O_GOTO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_FULL_LOAD, "WID_O_FULL_LOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_UNLOAD, "WID_O_UNLOAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_REFIT, "WID_O_REFIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SERVICE, "WID_O_SERVICE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_EMPTY, "WID_O_EMPTY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_REFIT_DROPDOWN, "WID_O_REFIT_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_COND_VARIABLE, "WID_O_COND_VARIABLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_COND_COMPARATOR, "WID_O_COND_COMPARATOR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_COND_VALUE, "WID_O_COND_VALUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SEL_TOP_LEFT, "WID_O_SEL_TOP_LEFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SEL_TOP_MIDDLE, "WID_O_SEL_TOP_MIDDLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SEL_TOP_RIGHT, "WID_O_SEL_TOP_RIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SEL_TOP_ROW_GROUNDVEHICLE, "WID_O_SEL_TOP_ROW_GROUNDVEHICLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SEL_TOP_ROW, "WID_O_SEL_TOP_ROW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SEL_BOTTOM_MIDDLE, "WID_O_SEL_BOTTOM_MIDDLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_O_SHARED_ORDER_LIST, "WID_O_SHARED_ORDER_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_CAPTION, "WID_OSK_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_TEXT, "WID_OSK_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_CANCEL, "WID_OSK_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_OK, "WID_OSK_OK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_BACKSPACE, "WID_OSK_BACKSPACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_SPECIAL, "WID_OSK_SPECIAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_CAPS, "WID_OSK_CAPS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_SHIFT, "WID_OSK_SHIFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_SPACE, "WID_OSK_SPACE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_LEFT, "WID_OSK_LEFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_RIGHT, "WID_OSK_RIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_LETTERS, "WID_OSK_LETTERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_NUMBERS_FIRST, "WID_OSK_NUMBERS_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_NUMBERS_LAST, "WID_OSK_NUMBERS_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_QWERTY_FIRST, "WID_OSK_QWERTY_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_QWERTY_LAST, "WID_OSK_QWERTY_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_ASDFG_FIRST, "WID_OSK_ASDFG_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_ASDFG_LAST, "WID_OSK_ASDFG_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_ZXCVB_FIRST, "WID_OSK_ZXCVB_FIRST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_OSK_ZXCVB_LAST, "WID_OSK_ZXCVB_LAST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_CAPTION, "WID_RAT_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_NS, "WID_RAT_BUILD_NS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_X, "WID_RAT_BUILD_X");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_EW, "WID_RAT_BUILD_EW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_Y, "WID_RAT_BUILD_Y");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_AUTORAIL, "WID_RAT_AUTORAIL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_DEMOLISH, "WID_RAT_DEMOLISH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_DEPOT, "WID_RAT_BUILD_DEPOT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_WAYPOINT, "WID_RAT_BUILD_WAYPOINT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_STATION, "WID_RAT_BUILD_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_SIGNALS, "WID_RAT_BUILD_SIGNALS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_BRIDGE, "WID_RAT_BUILD_BRIDGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_BUILD_TUNNEL, "WID_RAT_BUILD_TUNNEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_REMOVE, "WID_RAT_REMOVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_RAT_CONVERT_RAIL, "WID_RAT_CONVERT_RAIL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_DIR_X, "WID_BRAS_PLATFORM_DIR_X");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_DIR_Y, "WID_BRAS_PLATFORM_DIR_Y");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_1, "WID_BRAS_PLATFORM_NUM_1");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_2, "WID_BRAS_PLATFORM_NUM_2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_3, "WID_BRAS_PLATFORM_NUM_3");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_4, "WID_BRAS_PLATFORM_NUM_4");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_5, "WID_BRAS_PLATFORM_NUM_5");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_6, "WID_BRAS_PLATFORM_NUM_6");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_7, "WID_BRAS_PLATFORM_NUM_7");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_1, "WID_BRAS_PLATFORM_LEN_1");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_2, "WID_BRAS_PLATFORM_LEN_2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_3, "WID_BRAS_PLATFORM_LEN_3");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_4, "WID_BRAS_PLATFORM_LEN_4");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_5, "WID_BRAS_PLATFORM_LEN_5");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_6, "WID_BRAS_PLATFORM_LEN_6");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_7, "WID_BRAS_PLATFORM_LEN_7");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_DRAG_N_DROP, "WID_BRAS_PLATFORM_DRAG_N_DROP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_HIGHLIGHT_OFF, "WID_BRAS_HIGHLIGHT_OFF");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_HIGHLIGHT_ON, "WID_BRAS_HIGHLIGHT_ON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_COVERAGE_TEXTS, "WID_BRAS_COVERAGE_TEXTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_MATRIX, "WID_BRAS_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_IMAGE, "WID_BRAS_IMAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_MATRIX_SCROLL, "WID_BRAS_MATRIX_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_SHOW_NEWST_DEFSIZE, "WID_BRAS_SHOW_NEWST_DEFSIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_SHOW_NEWST_ADDITIONS, "WID_BRAS_SHOW_NEWST_ADDITIONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_SHOW_NEWST_MATRIX, "WID_BRAS_SHOW_NEWST_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_SHOW_NEWST_RESIZE, "WID_BRAS_SHOW_NEWST_RESIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_SHOW_NEWST_TYPE, "WID_BRAS_SHOW_NEWST_TYPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_NEWST_LIST, "WID_BRAS_NEWST_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_NEWST_SCROLL, "WID_BRAS_NEWST_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_NUM_BEGIN, "WID_BRAS_PLATFORM_NUM_BEGIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAS_PLATFORM_LEN_BEGIN, "WID_BRAS_PLATFORM_LEN_BEGIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_SEMAPHORE_NORM, "WID_BS_SEMAPHORE_NORM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_SEMAPHORE_ENTRY, "WID_BS_SEMAPHORE_ENTRY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_SEMAPHORE_EXIT, "WID_BS_SEMAPHORE_EXIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_SEMAPHORE_COMBO, "WID_BS_SEMAPHORE_COMBO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_SEMAPHORE_PBS, "WID_BS_SEMAPHORE_PBS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_SEMAPHORE_PBS_OWAY, "WID_BS_SEMAPHORE_PBS_OWAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_ELECTRIC_NORM, "WID_BS_ELECTRIC_NORM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_ELECTRIC_ENTRY, "WID_BS_ELECTRIC_ENTRY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_ELECTRIC_EXIT, "WID_BS_ELECTRIC_EXIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_ELECTRIC_COMBO, "WID_BS_ELECTRIC_COMBO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_ELECTRIC_PBS, "WID_BS_ELECTRIC_PBS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_ELECTRIC_PBS_OWAY, "WID_BS_ELECTRIC_PBS_OWAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_CONVERT, "WID_BS_CONVERT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_DRAG_SIGNALS_DENSITY_LABEL, "WID_BS_DRAG_SIGNALS_DENSITY_LABEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_DRAG_SIGNALS_DENSITY_DECREASE, "WID_BS_DRAG_SIGNALS_DENSITY_DECREASE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BS_DRAG_SIGNALS_DENSITY_INCREASE, "WID_BS_DRAG_SIGNALS_DENSITY_INCREASE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAD_DEPOT_NE, "WID_BRAD_DEPOT_NE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAD_DEPOT_SE, "WID_BRAD_DEPOT_SE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAD_DEPOT_SW, "WID_BRAD_DEPOT_SW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRAD_DEPOT_NW, "WID_BRAD_DEPOT_NW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRW_WAYPOINT_MATRIX, "WID_BRW_WAYPOINT_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRW_WAYPOINT, "WID_BRW_WAYPOINT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BRW_SCROLL, "WID_BRW_SCROLL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_ROAD_X, "WID_ROT_ROAD_X");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_ROAD_Y, "WID_ROT_ROAD_Y");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_AUTOROAD, "WID_ROT_AUTOROAD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_DEMOLISH, "WID_ROT_DEMOLISH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_DEPOT, "WID_ROT_DEPOT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_BUS_STATION, "WID_ROT_BUS_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_TRUCK_STATION, "WID_ROT_TRUCK_STATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_ONE_WAY, "WID_ROT_ONE_WAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_BUILD_BRIDGE, "WID_ROT_BUILD_BRIDGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_BUILD_TUNNEL, "WID_ROT_BUILD_TUNNEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ROT_REMOVE, "WID_ROT_REMOVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROD_CAPTION, "WID_BROD_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROD_DEPOT_NE, "WID_BROD_DEPOT_NE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROD_DEPOT_SE, "WID_BROD_DEPOT_SE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROD_DEPOT_SW, "WID_BROD_DEPOT_SW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROD_DEPOT_NW, "WID_BROD_DEPOT_NW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_CAPTION, "WID_BROS_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_BACKGROUND, "WID_BROS_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_STATION_NE, "WID_BROS_STATION_NE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_STATION_SE, "WID_BROS_STATION_SE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_STATION_SW, "WID_BROS_STATION_SW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_STATION_NW, "WID_BROS_STATION_NW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_STATION_X, "WID_BROS_STATION_X");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_STATION_Y, "WID_BROS_STATION_Y");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_LT_OFF, "WID_BROS_LT_OFF");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_LT_ON, "WID_BROS_LT_ON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BROS_INFO, "WID_BROS_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BACKGROUND, "WID_GO_BACKGROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_CURRENCY_DROPDOWN, "WID_GO_CURRENCY_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_DISTANCE_DROPDOWN, "WID_GO_DISTANCE_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_ROADSIDE_DROPDOWN, "WID_GO_ROADSIDE_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_TOWNNAME_DROPDOWN, "WID_GO_TOWNNAME_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_AUTOSAVE_DROPDOWN, "WID_GO_AUTOSAVE_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_LANG_DROPDOWN, "WID_GO_LANG_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_RESOLUTION_DROPDOWN, "WID_GO_RESOLUTION_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_FULLSCREEN_BUTTON, "WID_GO_FULLSCREEN_BUTTON");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_SCREENSHOT_DROPDOWN, "WID_GO_SCREENSHOT_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_DROPDOWN, "WID_GO_BASE_GRF_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_STATUS, "WID_GO_BASE_GRF_STATUS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_TEXTFILE, "WID_GO_BASE_GRF_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_GRF_DESCRIPTION, "WID_GO_BASE_GRF_DESCRIPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_SFX_DROPDOWN, "WID_GO_BASE_SFX_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_SFX_TEXTFILE, "WID_GO_BASE_SFX_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_SFX_DESCRIPTION, "WID_GO_BASE_SFX_DESCRIPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_MUSIC_DROPDOWN, "WID_GO_BASE_MUSIC_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_MUSIC_STATUS, "WID_GO_BASE_MUSIC_STATUS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_MUSIC_TEXTFILE, "WID_GO_BASE_MUSIC_TEXTFILE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GO_BASE_MUSIC_DESCRIPTION, "WID_GO_BASE_MUSIC_DESCRIPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_FILTER, "WID_GS_FILTER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_OPTIONSPANEL, "WID_GS_OPTIONSPANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_SCROLLBAR, "WID_GS_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_HELP_TEXT, "WID_GS_HELP_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_EXPAND_ALL, "WID_GS_EXPAND_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_COLLAPSE_ALL, "WID_GS_COLLAPSE_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_RESTRICT_CATEGORY, "WID_GS_RESTRICT_CATEGORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_RESTRICT_TYPE, "WID_GS_RESTRICT_TYPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_RESTRICT_DROPDOWN, "WID_GS_RESTRICT_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_GS_TYPE_DROPDOWN, "WID_GS_TYPE_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_RATE_DOWN, "WID_CC_RATE_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_RATE_UP, "WID_CC_RATE_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_RATE, "WID_CC_RATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_SEPARATOR_EDIT, "WID_CC_SEPARATOR_EDIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_SEPARATOR, "WID_CC_SEPARATOR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_PREFIX_EDIT, "WID_CC_PREFIX_EDIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_PREFIX, "WID_CC_PREFIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_SUFFIX_EDIT, "WID_CC_SUFFIX_EDIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_SUFFIX, "WID_CC_SUFFIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_YEAR_DOWN, "WID_CC_YEAR_DOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_YEAR_UP, "WID_CC_YEAR_UP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_YEAR, "WID_CC_YEAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_CC_PREVIEW, "WID_CC_PREVIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SIL_CAPTION, "WID_SIL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SIL_LIST, "WID_SIL_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SIL_SCROLLBAR, "WID_SIL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SIL_FILTER_TEXT, "WID_SIL_FILTER_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SIL_FILTER_MATCH_CASE_BTN, "WID_SIL_FILTER_MATCH_CASE_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SIL_FILTER_ENTER_BTN, "WID_SIL_FILTER_ENTER_BTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_CAPTION, "WID_QES_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_TEXT, "WID_QES_TEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_OK, "WID_QES_OK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_CANCEL, "WID_QES_CANCEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_DELETE, "WID_QES_DELETE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_PREVIOUS, "WID_QES_PREVIOUS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QES_NEXT, "WID_QES_NEXT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_CAPTION, "WID_SM_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_MAP_BORDER, "WID_SM_MAP_BORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_MAP, "WID_SM_MAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_LEGEND, "WID_SM_LEGEND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_BLANK, "WID_SM_BLANK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_ZOOM_IN, "WID_SM_ZOOM_IN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_ZOOM_OUT, "WID_SM_ZOOM_OUT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_CONTOUR, "WID_SM_CONTOUR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_VEHICLES, "WID_SM_VEHICLES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_INDUSTRIES, "WID_SM_INDUSTRIES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_LINKSTATS, "WID_SM_LINKSTATS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_ROUTES, "WID_SM_ROUTES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_VEGETATION, "WID_SM_VEGETATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_OWNERS, "WID_SM_OWNERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_CENTERMAP, "WID_SM_CENTERMAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_TOGGLETOWNNAME, "WID_SM_TOGGLETOWNNAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_SELECT_BUTTONS, "WID_SM_SELECT_BUTTONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_ENABLE_ALL, "WID_SM_ENABLE_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_DISABLE_ALL, "WID_SM_DISABLE_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SM_SHOW_HEIGHT, "WID_SM_SHOW_HEIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_CAPTION, "WID_SV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_SORT_ORDER, "WID_SV_SORT_ORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_SORT_BY, "WID_SV_SORT_BY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_GROUP, "WID_SV_GROUP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_GROUP_BY, "WID_SV_GROUP_BY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_WAITING, "WID_SV_WAITING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_SCROLLBAR, "WID_SV_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_ACCEPT_RATING_LIST, "WID_SV_ACCEPT_RATING_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_LOCATION, "WID_SV_LOCATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_ACCEPTS_RATINGS, "WID_SV_ACCEPTS_RATINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_RENAME, "WID_SV_RENAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_CLOSE_AIRPORT, "WID_SV_CLOSE_AIRPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_TRAINS, "WID_SV_TRAINS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_ROADVEHS, "WID_SV_ROADVEHS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_SHIPS, "WID_SV_SHIPS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SV_PLANES, "WID_SV_PLANES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_CAPTION, "WID_STL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_LIST, "WID_STL_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_SCROLLBAR, "WID_STL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_TRAIN, "WID_STL_TRAIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_TRUCK, "WID_STL_TRUCK");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_BUS, "WID_STL_BUS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_AIRPLANE, "WID_STL_AIRPLANE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_SHIP, "WID_STL_SHIP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_FACILALL, "WID_STL_FACILALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_NOCARGOWAITING, "WID_STL_NOCARGOWAITING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_CARGOALL, "WID_STL_CARGOALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_SORTBY, "WID_STL_SORTBY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_SORTDROPBTN, "WID_STL_SORTDROPBTN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_STL_CARGOSTART, "WID_STL_CARGOSTART");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_JS_CAPTION, "WID_JS_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_JS_PANEL, "WID_JS_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_JS_SCROLLBAR, "WID_JS_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_S_LEFT, "WID_S_LEFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_S_MIDDLE, "WID_S_MIDDLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_S_RIGHT, "WID_S_RIGHT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SB_CAPTION, "WID_SB_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SB_SEL_PAGE, "WID_SB_SEL_PAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SB_PAGE_PANEL, "WID_SB_PAGE_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SB_SCROLLBAR, "WID_SB_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SB_PREV_PAGE, "WID_SB_PREV_PAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SB_NEXT_PAGE, "WID_SB_NEXT_PAGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SUL_PANEL, "WID_SUL_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_SUL_SCROLLBAR, "WID_SUL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_SHOW_PLACE_OBJECT, "WID_TT_SHOW_PLACE_OBJECT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BUTTONS_START, "WID_TT_BUTTONS_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_LOWER_LAND, "WID_TT_LOWER_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_RAISE_LAND, "WID_TT_RAISE_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_LEVEL_LAND, "WID_TT_LEVEL_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_DEMOLISH, "WID_TT_DEMOLISH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BUY_LAND, "WID_TT_BUY_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_PLANT_TREES, "WID_TT_PLANT_TREES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_PLACE_SIGN, "WID_TT_PLACE_SIGN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_PLACE_OBJECT, "WID_TT_PLACE_OBJECT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_SHOW_PLACE_DESERT, "WID_ETT_SHOW_PLACE_DESERT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_START, "WID_ETT_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_DOTS, "WID_ETT_DOTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_BUTTONS_START, "WID_ETT_BUTTONS_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_DEMOLISH, "WID_ETT_DEMOLISH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_LOWER_LAND, "WID_ETT_LOWER_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_RAISE_LAND, "WID_ETT_RAISE_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_LEVEL_LAND, "WID_ETT_LEVEL_LAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_PLACE_ROCKS, "WID_ETT_PLACE_ROCKS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_PLACE_DESERT, "WID_ETT_PLACE_DESERT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_PLACE_OBJECT, "WID_ETT_PLACE_OBJECT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_BUTTONS_END, "WID_ETT_BUTTONS_END");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_INCREASE_SIZE, "WID_ETT_INCREASE_SIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_DECREASE_SIZE, "WID_ETT_DECREASE_SIZE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_NEW_SCENARIO, "WID_ETT_NEW_SCENARIO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_ETT_RESET_LANDSCAPE, "WID_ETT_RESET_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_CAPTION, "WID_VT_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_ORDER_VIEW, "WID_VT_ORDER_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_TIMETABLE_PANEL, "WID_VT_TIMETABLE_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_ARRIVAL_DEPARTURE_PANEL, "WID_VT_ARRIVAL_DEPARTURE_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_SCROLLBAR, "WID_VT_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_SUMMARY_PANEL, "WID_VT_SUMMARY_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_START_DATE, "WID_VT_START_DATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_CHANGE_TIME, "WID_VT_CHANGE_TIME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_CLEAR_TIME, "WID_VT_CLEAR_TIME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_RESET_LATENESS, "WID_VT_RESET_LATENESS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_AUTOFILL, "WID_VT_AUTOFILL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_EXPECTED, "WID_VT_EXPECTED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_SHARED_ORDER_LIST, "WID_VT_SHARED_ORDER_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_ARRIVAL_DEPARTURE_SELECTION, "WID_VT_ARRIVAL_DEPARTURE_SELECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_EXPECTED_SELECTION, "WID_VT_EXPECTED_SELECTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_CHANGE_SPEED, "WID_VT_CHANGE_SPEED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VT_CLEAR_SPEED, "WID_VT_CLEAR_SPEED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_PAUSE, "WID_TN_PAUSE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_FAST_FORWARD, "WID_TN_FAST_FORWARD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_SETTINGS, "WID_TN_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_SAVE, "WID_TN_SAVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_SMALL_MAP, "WID_TN_SMALL_MAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_TOWNS, "WID_TN_TOWNS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_SUBSIDIES, "WID_TN_SUBSIDIES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_STATIONS, "WID_TN_STATIONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_FINANCES, "WID_TN_FINANCES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_COMPANIES, "WID_TN_COMPANIES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_STORY, "WID_TN_STORY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_GOAL, "WID_TN_GOAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_GRAPHS, "WID_TN_GRAPHS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_LEAGUE, "WID_TN_LEAGUE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_INDUSTRIES, "WID_TN_INDUSTRIES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_VEHICLE_START, "WID_TN_VEHICLE_START");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_TRAINS, "WID_TN_TRAINS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ROADVEHS, "WID_TN_ROADVEHS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_SHIPS, "WID_TN_SHIPS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_AIRCRAFTS, "WID_TN_AIRCRAFTS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ZOOM_IN, "WID_TN_ZOOM_IN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ZOOM_OUT, "WID_TN_ZOOM_OUT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_RAILS, "WID_TN_RAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_ROADS, "WID_TN_ROADS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_WATER, "WID_TN_WATER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_AIR, "WID_TN_AIR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_LANDSCAPE, "WID_TN_LANDSCAPE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_MUSIC_SOUND, "WID_TN_MUSIC_SOUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_MESSAGES, "WID_TN_MESSAGES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_HELP, "WID_TN_HELP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_SWITCH_BAR, "WID_TN_SWITCH_BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TN_END, "WID_TN_END");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_PAUSE, "WID_TE_PAUSE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_FAST_FORWARD, "WID_TE_FAST_FORWARD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SETTINGS, "WID_TE_SETTINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SAVE, "WID_TE_SAVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SPACER, "WID_TE_SPACER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_DATE, "WID_TE_DATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_DATE_BACKWARD, "WID_TE_DATE_BACKWARD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_DATE_FORWARD, "WID_TE_DATE_FORWARD");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SMALL_MAP, "WID_TE_SMALL_MAP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_ZOOM_IN, "WID_TE_ZOOM_IN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_ZOOM_OUT, "WID_TE_ZOOM_OUT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_LAND_GENERATE, "WID_TE_LAND_GENERATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_TOWN_GENERATE, "WID_TE_TOWN_GENERATE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_INDUSTRY, "WID_TE_INDUSTRY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_ROADS, "WID_TE_ROADS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_WATER, "WID_TE_WATER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_TREES, "WID_TE_TREES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SIGNS, "WID_TE_SIGNS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_DATE_PANEL, "WID_TE_DATE_PANEL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_MUSIC_SOUND, "WID_TE_MUSIC_SOUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_HELP, "WID_TE_HELP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TE_SWITCH_BAR, "WID_TE_SWITCH_BAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_X, "WID_TT_X");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_DELETE, "WID_TT_DELETE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_SHIFT, "WID_TT_SHIFT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CTRL, "WID_TT_CTRL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_MOVE, "WID_TT_MOVE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_ORDER, "WID_TD_SORT_ORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SORT_CRITERIA, "WID_TD_SORT_CRITERIA");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_LIST, "WID_TD_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_SCROLLBAR, "WID_TD_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TD_WORLD_POPULATION, "WID_TD_WORLD_POPULATION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TA_CAPTION, "WID_TA_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TA_RATING_INFO, "WID_TA_RATING_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TA_COMMAND_LIST, "WID_TA_COMMAND_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TA_SCROLLBAR, "WID_TA_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TA_ACTION_INFO, "WID_TA_ACTION_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TA_EXECUTE, "WID_TA_EXECUTE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_CAPTION, "WID_TV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_VIEWPORT, "WID_TV_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_INFO, "WID_TV_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_CENTER_VIEW, "WID_TV_CENTER_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_SHOW_AUTHORITY, "WID_TV_SHOW_AUTHORITY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_CHANGE_NAME, "WID_TV_CHANGE_NAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_EXPAND, "WID_TV_EXPAND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TV_DELETE, "WID_TV_DELETE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_NEW_TOWN, "WID_TF_NEW_TOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_RANDOM_TOWN, "WID_TF_RANDOM_TOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_MANY_RANDOM_TOWNS, "WID_TF_MANY_RANDOM_TOWNS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_TOWN_NAME_EDITBOX, "WID_TF_TOWN_NAME_EDITBOX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_TOWN_NAME_RANDOM, "WID_TF_TOWN_NAME_RANDOM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_SIZE_SMALL, "WID_TF_SIZE_SMALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_SIZE_MEDIUM, "WID_TF_SIZE_MEDIUM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_SIZE_LARGE, "WID_TF_SIZE_LARGE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_SIZE_RANDOM, "WID_TF_SIZE_RANDOM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_CITY, "WID_TF_CITY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_LAYOUT_ORIGINAL, "WID_TF_LAYOUT_ORIGINAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_LAYOUT_BETTER, "WID_TF_LAYOUT_BETTER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_LAYOUT_GRID2, "WID_TF_LAYOUT_GRID2");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_LAYOUT_GRID3, "WID_TF_LAYOUT_GRID3");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TF_LAYOUT_RANDOM, "WID_TF_LAYOUT_RANDOM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BEGIN, "WID_TT_BEGIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_SIGNS, "WID_TT_SIGNS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_TREES, "WID_TT_TREES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_HOUSES, "WID_TT_HOUSES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_INDUSTRIES, "WID_TT_INDUSTRIES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BUILDINGS, "WID_TT_BUILDINGS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BRIDGES, "WID_TT_BRIDGES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_STRUCTURES, "WID_TT_STRUCTURES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_CATENARY, "WID_TT_CATENARY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_LOADING, "WID_TT_LOADING");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_END, "WID_TT_END");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BUTTONS, "WID_TT_BUTTONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_11, "WID_BT_TYPE_11");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_12, "WID_BT_TYPE_12");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_13, "WID_BT_TYPE_13");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_14, "WID_BT_TYPE_14");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_21, "WID_BT_TYPE_21");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_22, "WID_BT_TYPE_22");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_23, "WID_BT_TYPE_23");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_24, "WID_BT_TYPE_24");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_31, "WID_BT_TYPE_31");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_32, "WID_BT_TYPE_32");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_33, "WID_BT_TYPE_33");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_34, "WID_BT_TYPE_34");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_TYPE_RANDOM, "WID_BT_TYPE_RANDOM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_BT_MANY_RANDOM, "WID_BT_MANY_RANDOM");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_CAPTION, "WID_VV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_VIEWPORT, "WID_VV_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_START_STOP, "WID_VV_START_STOP");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_CENTER_MAIN_VIEW, "WID_VV_CENTER_MAIN_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_GOTO_DEPOT, "WID_VV_GOTO_DEPOT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_REFIT, "WID_VV_REFIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_SHOW_ORDERS, "WID_VV_SHOW_ORDERS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_SHOW_DETAILS, "WID_VV_SHOW_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_CLONE, "WID_VV_CLONE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_SELECT_DEPOT_CLONE, "WID_VV_SELECT_DEPOT_CLONE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_SELECT_REFIT_TURN, "WID_VV_SELECT_REFIT_TURN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_TURN_AROUND, "WID_VV_TURN_AROUND");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VV_FORCE_PROCEED, "WID_VV_FORCE_PROCEED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_CAPTION, "WID_VR_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_VEHICLE_PANEL_DISPLAY, "WID_VR_VEHICLE_PANEL_DISPLAY");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_SHOW_HSCROLLBAR, "WID_VR_SHOW_HSCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_HSCROLLBAR, "WID_VR_HSCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_SELECT_HEADER, "WID_VR_SELECT_HEADER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_MATRIX, "WID_VR_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_SCROLLBAR, "WID_VR_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_INFO, "WID_VR_INFO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VR_REFIT, "WID_VR_REFIT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_CAPTION, "WID_VD_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_RENAME_VEHICLE, "WID_VD_RENAME_VEHICLE");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_TOP_DETAILS, "WID_VD_TOP_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_INCREASE_SERVICING_INTERVAL, "WID_VD_INCREASE_SERVICING_INTERVAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_DECREASE_SERVICING_INTERVAL, "WID_VD_DECREASE_SERVICING_INTERVAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_SERVICE_INTERVAL_DROPDOWN, "WID_VD_SERVICE_INTERVAL_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_SERVICING_INTERVAL, "WID_VD_SERVICING_INTERVAL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_MIDDLE_DETAILS, "WID_VD_MIDDLE_DETAILS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_MATRIX, "WID_VD_MATRIX");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_SCROLLBAR, "WID_VD_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_DETAILS_CARGO_CARRIED, "WID_VD_DETAILS_CARGO_CARRIED");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_DETAILS_TRAIN_VEHICLES, "WID_VD_DETAILS_TRAIN_VEHICLES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_DETAILS_CAPACITY_OF_EACH, "WID_VD_DETAILS_CAPACITY_OF_EACH");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VD_DETAILS_TOTAL_CARGO, "WID_VD_DETAILS_TOTAL_CARGO");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_CAPTION, "WID_VL_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_SORT_ORDER, "WID_VL_SORT_ORDER");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_SORT_BY_PULLDOWN, "WID_VL_SORT_BY_PULLDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_LIST, "WID_VL_LIST");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_SCROLLBAR, "WID_VL_SCROLLBAR");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_HIDE_BUTTONS, "WID_VL_HIDE_BUTTONS");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_AVAILABLE_VEHICLES, "WID_VL_AVAILABLE_VEHICLES");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_MANAGE_VEHICLES_DROPDOWN, "WID_VL_MANAGE_VEHICLES_DROPDOWN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_STOP_ALL, "WID_VL_STOP_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_VL_START_ALL, "WID_VL_START_ALL");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EV_CAPTION, "WID_EV_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EV_VIEWPORT, "WID_EV_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EV_ZOOM_IN, "WID_EV_ZOOM_IN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EV_ZOOM_OUT, "WID_EV_ZOOM_OUT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EV_MAIN_TO_VIEW, "WID_EV_MAIN_TO_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_EV_VIEW_TO_MAIN, "WID_EV_VIEW_TO_MAIN");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_W_CAPTION, "WID_W_CAPTION");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_W_VIEWPORT, "WID_W_VIEWPORT");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_W_CENTER_VIEW, "WID_W_CENTER_VIEW");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_W_RENAME, "WID_W_RENAME");
+ SQGSWindow.DefSQConst(engine, ScriptWindow::WID_W_SHOW_VEHICLES, "WID_W_SHOW_VEHICLES");
+
+ SQGSWindow.DefSQStaticMethod(engine, &ScriptWindow::Close, "Close", 3, ".ii");
+ SQGSWindow.DefSQStaticMethod(engine, &ScriptWindow::IsOpen, "IsOpen", 3, ".ii");
+ SQGSWindow.DefSQStaticMethod(engine, &ScriptWindow::Highlight, "Highlight", 5, ".iiii");
+
+ SQGSWindow.PostRegister(engine);
+}
diff --git a/src/window.cpp b/src/window.cpp
index b9a9651491..cad3e3ca31 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2841,9 +2841,18 @@ static void MouseLoop(MouseClick click, int mousewheel)
Window *w = FindWindowFromPt(x, y);
if (w == NULL) return;
ViewPort *vp = IsPtInWindowViewport(w, x, y);
+ bool confirm = (_settings_client.gui.touchscreen_mode == TSC_CONFIRM);
- HandlePlacePresize();
- UpdateTileSelection();
+ /* Don't allow any action in a viewport if either in menu or when having a modal progress window */
+ if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return;
+
+ /* On confirm mode do not update tile selection unless we are clicking on a viewport. */
+ if (!confirm || (vp != NULL && _left_button_down && !_move_pressed)) {
+ HandlePlacePresize();
+ UpdateTileSelection();
+ } else {
+ //if presize, show tooltip if needed
+ }
if (VpHandlePlaceSizingDrag() == ES_HANDLED) return;
if (HandleMouseDragDrop() == ES_HANDLED) return;
@@ -2860,9 +2869,6 @@ static void MouseLoop(MouseClick click, int mousewheel)
if (click != MC_NONE && click != MC_HOVER && !MaybeBringWindowToFront(w)) return;
- /* Don't allow any action in a viewport if either in menu or when having a modal progress window */
- if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return;
-
if (mousewheel != 0) {
/* Send mousewheel event to window */
w->OnMouseWheel(mousewheel);
diff --git a/src/window.cpp.orig b/src/window.cpp.orig
new file mode 100644
index 0000000000..b9a9651491
--- /dev/null
+++ b/src/window.cpp.orig
@@ -0,0 +1,3527 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
+ */
+
+/** @file window.cpp Windowing system, widgets and events */
+
+#include "stdafx.h"
+#include
+#include "company_func.h"
+#include "gfx_func.h"
+#include "console_func.h"
+#include "console_gui.h"
+#include "viewport_func.h"
+#include "progress.h"
+#include "blitter/factory.hpp"
+#include "zoom_func.h"
+#include "vehicle_base.h"
+#include "window_func.h"
+#include "tilehighlight_func.h"
+#include "network/network.h"
+#include "querystring_gui.h"
+#include "widgets/dropdown_func.h"
+#include "strings_func.h"
+#include "settings_type.h"
+#include "settings_func.h"
+#include "ini_type.h"
+#include "newgrf_debug.h"
+#include "hotkeys.h"
+#include "toolbar_gui.h"
+#include "statusbar_gui.h"
+#include "error.h"
+#include "game/game.hpp"
+#include "video/video_driver.hpp"
+#include "settings_gui.h"
+#include "fontcache.h"
+#include "error.h"
+#include "station_base.h"
+#include "waypoint_base.h"
+#include "command_func.h"
+
+#include "table/strings.h"
+
+/** Values for _settings_client.gui.auto_scrolling */
+enum ViewportAutoscrolling {
+ VA_DISABLED, //!< Do not autoscroll when mouse is at edge of viewport.
+ VA_MAIN_VIEWPORT_FULLSCREEN, //!< Scroll main viewport at edge when using fullscreen.
+ VA_MAIN_VIEWPORT, //!< Scroll main viewport at edge.
+ VA_EVERY_VIEWPORT, //!< Scroll all viewports at their edges.
+};
+
+static Point _drag_delta; ///< delta between mouse cursor and upper left corner of dragged window
+static Window *_mouseover_last_w = NULL; ///< Window of the last #MOUSEOVER event.
+static Window *_last_scroll_window = NULL; ///< Window of the last scroll event.
+
+/** List of windows opened at the screen sorted from the front. */
+Window *_z_front_window = NULL;
+/** List of windows opened at the screen sorted from the back. */
+Window *_z_back_window = NULL;
+
+/** If false, highlight is white, otherwise the by the widget defined colour. */
+bool _window_highlight_colour = false;
+
+/*
+ * Window that currently has focus. - The main purpose is to generate
+ * #FocusLost events, not to give next window in z-order focus when a
+ * window is closed.
+ */
+Window *_focused_window;
+
+Point _cursorpos_drag_start;
+
+int _scrollbar_start_pos;
+int _scrollbar_size;
+byte _scroller_click_timeout = 0;
+
+bool _scrolling_viewport; ///< A viewport is being scrolled with the mouse.
+bool _mouse_hovering; ///< The mouse is hovering over the same point.
+
+SpecialMouseMode _special_mouse_mode; ///< Mode of the mouse.
+
+/**
+ * List of all WindowDescs.
+ * This is a pointer to ensure initialisation order with the various static WindowDesc instances.
+ */
+static SmallVector *_window_descs = NULL;
+
+/** Config file to store WindowDesc */
+char *_windows_file;
+
+/** Window description constructor. */
+WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16 def_width, int16 def_height,
+ WindowClass window_class, WindowClass parent_class, uint32 flags,
+ const NWidgetPart *nwid_parts, int16 nwid_length, HotkeyList *hotkeys) :
+ default_pos(def_pos),
+ default_width(def_width),
+ default_height(def_height),
+ cls(window_class),
+ parent_cls(parent_class),
+ ini_key(ini_key),
+ flags(flags),
+ nwid_parts(nwid_parts),
+ nwid_length(nwid_length),
+ hotkeys(hotkeys),
+ pref_sticky(false),
+ pref_width(0),
+ pref_height(0)
+{
+ if (_window_descs == NULL) _window_descs = new SmallVector();
+ *_window_descs->Append() = this;
+}
+
+WindowDesc::~WindowDesc()
+{
+ _window_descs->Erase(_window_descs->Find(this));
+}
+
+/**
+ * Load all WindowDesc settings from _windows_file.
+ */
+void WindowDesc::LoadFromConfig()
+{
+ IniFile *ini = new IniFile();
+ ini->LoadFromDisk(_windows_file, BASE_DIR);
+ for (WindowDesc **it = _window_descs->Begin(); it != _window_descs->End(); ++it) {
+ if ((*it)->ini_key == NULL) continue;
+ IniLoadWindowSettings(ini, (*it)->ini_key, *it);
+ }
+ delete ini;
+}
+
+/**
+ * Sort WindowDesc by ini_key.
+ */
+static int CDECL DescSorter(WindowDesc * const *a, WindowDesc * const *b)
+{
+ if ((*a)->ini_key != NULL && (*b)->ini_key != NULL) return strcmp((*a)->ini_key, (*b)->ini_key);
+ return ((*b)->ini_key != NULL ? 1 : 0) - ((*a)->ini_key != NULL ? 1 : 0);
+}
+
+/**
+ * Save all WindowDesc settings to _windows_file.
+ */
+void WindowDesc::SaveToConfig()
+{
+ /* Sort the stuff to get a nice ini file on first write */
+ QSortT(_window_descs->Begin(), _window_descs->Length(), DescSorter);
+
+ IniFile *ini = new IniFile();
+ ini->LoadFromDisk(_windows_file, BASE_DIR);
+ for (WindowDesc **it = _window_descs->Begin(); it != _window_descs->End(); ++it) {
+ if ((*it)->ini_key == NULL) continue;
+ IniSaveWindowSettings(ini, (*it)->ini_key, *it);
+ }
+ ini->SaveToDisk(_windows_file);
+ delete ini;
+}
+
+/**
+ * Read default values from WindowDesc configuration an apply them to the window.
+ */
+void Window::ApplyDefaults()
+{
+ if (this->nested_root != NULL && this->nested_root->GetWidgetOfType(WWT_STICKYBOX) != NULL) {
+ if (this->window_desc->pref_sticky) this->flags |= WF_STICKY;
+ } else {
+ /* There is no stickybox; clear the preference in case someone tried to be funny */
+ this->window_desc->pref_sticky = false;
+ }
+}
+
+/**
+ * Compute the row of a widget that a user clicked in.
+ * @param clickpos Vertical position of the mouse click.
+ * @param widget Widget number of the widget clicked in.
+ * @param padding Amount of empty space between the widget edge and the top of the first row.
+ * @param line_height Height of a single row. A negative value means using the vertical resize step of the widget.
+ * @return Row number clicked at. If clicked at a wrong position, #INT_MAX is returned.
+ * @note The widget does not know where a list printed at the widget ends, so below a list is not a wrong position.
+ */
+int Window::GetRowFromWidget(int clickpos, int widget, int padding, int line_height) const
+{
+ const NWidgetBase *wid = this->GetWidget(widget);
+ if (line_height < 0) line_height = wid->resize_y;
+ if (clickpos < (int)wid->pos_y + padding) return INT_MAX;
+ return (clickpos - (int)wid->pos_y - padding) / line_height;
+}
+
+/**
+ * Disable the highlighted status of all widgets.
+ */
+void Window::DisableAllWidgetHighlight()
+{
+ for (uint i = 0; i < this->nested_array_size; i++) {
+ NWidgetBase *nwid = this->GetWidget(i);
+ if (nwid == NULL) continue;
+
+ if (nwid->IsHighlighted()) {
+ nwid->SetHighlighted(TC_INVALID);
+ this->SetWidgetDirty(i);
+ }
+ }
+
+ CLRBITS(this->flags, WF_HIGHLIGHTED);
+}
+
+/**
+ * Sets the highlighted status of a widget.
+ * @param widget_index index of this widget in the window
+ * @param highlighted_colour Colour of highlight, or TC_INVALID to disable.
+ */
+void Window::SetWidgetHighlight(byte widget_index, TextColour highlighted_colour)
+{
+ assert(widget_index < this->nested_array_size);
+
+ NWidgetBase *nwid = this->GetWidget(widget_index);
+ if (nwid == NULL) return;
+
+ nwid->SetHighlighted(highlighted_colour);
+ this->SetWidgetDirty(widget_index);
+
+ if (highlighted_colour != TC_INVALID) {
+ /* If we set a highlight, the window has a highlight */
+ this->flags |= WF_HIGHLIGHTED;
+ } else {
+ /* If we disable a highlight, check all widgets if anyone still has a highlight */
+ bool valid = false;
+ for (uint i = 0; i < this->nested_array_size; i++) {
+ NWidgetBase *nwid = this->GetWidget(i);
+ if (nwid == NULL) continue;
+ if (!nwid->IsHighlighted()) continue;
+
+ valid = true;
+ }
+ /* If nobody has a highlight, disable the flag on the window */
+ if (!valid) CLRBITS(this->flags, WF_HIGHLIGHTED);
+ }
+}
+
+/**
+ * Gets the highlighted status of a widget.
+ * @param widget_index index of this widget in the window
+ * @return status of the widget ie: highlighted = true, not highlighted = false
+ */
+bool Window::IsWidgetHighlighted(byte widget_index) const
+{
+ assert(widget_index < this->nested_array_size);
+
+ const NWidgetBase *nwid = this->GetWidget(widget_index);
+ if (nwid == NULL) return false;
+
+ return nwid->IsHighlighted();
+}
+
+/**
+ * A dropdown window associated to this window has been closed.
+ * @param pt the point inside the window the mouse resides on after closure.
+ * @param widget the widget (button) that the dropdown is associated with.
+ * @param index the element in the dropdown that is selected.
+ * @param instant_close whether the dropdown was configured to close on mouse up.
+ */
+void Window::OnDropdownClose(Point pt, int widget, int index, bool instant_close)
+{
+ if (widget < 0) return;
+
+ if (instant_close) {
+ /* Send event for selected option if we're still
+ * on the parent button of the dropdown (behaviour of the dropdowns in the main toolbar). */
+ if (GetWidgetFromPos(this, pt.x, pt.y) == widget) {
+ this->OnDropdownSelect(widget, index);
+ }
+ }
+
+ /* Raise the dropdown button */
+ NWidgetCore *nwi2 = this->GetWidget(widget);
+ if ((nwi2->type & WWT_MASK) == NWID_BUTTON_DROPDOWN) {
+ nwi2->disp_flags &= ~ND_DROPDOWN_ACTIVE;
+ } else {
+ this->RaiseWidget(widget);
+ }
+ this->SetWidgetDirty(widget);
+}
+
+/**
+ * Return the Scrollbar to a widget index.
+ * @param widnum Scrollbar widget index
+ * @return Scrollbar to the widget
+ */
+const Scrollbar *Window::GetScrollbar(uint widnum) const
+{
+ return this->GetWidget(widnum);
+}
+
+/**
+ * Return the Scrollbar to a widget index.
+ * @param widnum Scrollbar widget index
+ * @return Scrollbar to the widget
+ */
+Scrollbar *Window::GetScrollbar(uint widnum)
+{
+ return this->GetWidget(widnum);
+}
+
+/**
+ * Return the querystring associated to a editbox.
+ * @param widnum Editbox widget index
+ * @return QueryString or NULL.
+ */
+const QueryString *Window::GetQueryString(uint widnum) const
+{
+ const SmallMap::Pair *query = this->querystrings.Find(widnum);
+ return query != this->querystrings.End() ? query->second : NULL;
+}
+
+/**
+ * Return the querystring associated to a editbox.
+ * @param widnum Editbox widget index
+ * @return QueryString or NULL.
+ */
+QueryString *Window::GetQueryString(uint widnum)
+{
+ SmallMap::Pair *query = this->querystrings.Find(widnum);
+ return query != this->querystrings.End() ? query->second : NULL;
+}
+
+/**
+ * Get the current input text if an edit box has the focus.
+ * @return The currently focused input text or NULL if no input focused.
+ */
+/* virtual */ const char *Window::GetFocusedText() const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetText();
+ }
+
+ return NULL;
+}
+
+/**
+ * Get the string at the caret if an edit box has the focus.
+ * @return The text at the caret or NULL if no edit box is focused.
+ */
+/* virtual */ const char *Window::GetCaret() const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetCaret();
+ }
+
+ return NULL;
+}
+
+/**
+ * Get the range of the currently marked input text.
+ * @param[out] length Length of the marked text.
+ * @return Pointer to the start of the marked text or NULL if no text is marked.
+ */
+/* virtual */ const char *Window::GetMarkedText(size_t *length) const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetMarkedText(length);
+ }
+
+ return NULL;
+}
+
+/**
+ * Get the current caret position if an edit box has the focus.
+ * @return Top-left location of the caret, relative to the window.
+ */
+/* virtual */ Point Window::GetCaretPosition() const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetCaretPosition(this, this->nested_focus->index);
+ }
+
+ Point pt = {0, 0};
+ return pt;
+}
+
+/**
+ * Get the bounding rectangle for a text range if an edit box has the focus.
+ * @param from Start of the string range.
+ * @param to End of the string range.
+ * @return Rectangle encompassing the string range, relative to the window.
+ */
+/* virtual */ Rect Window::GetTextBoundingRect(const char *from, const char *to) const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetBoundingRect(this, this->nested_focus->index, from, to);
+ }
+
+ Rect r = {0, 0, 0, 0};
+ return r;
+}
+
+/**
+ * Get the character that is rendered at a position by the focused edit box.
+ * @param pt The position to test.
+ * @return Pointer to the character at the position or NULL if no character is at the position.
+ */
+/* virtual */ const char *Window::GetTextCharacterAtPosition(const Point &pt) const
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) {
+ return this->GetQueryString(this->nested_focus->index)->GetCharAtPosition(this, this->nested_focus->index, pt);
+ }
+
+ return NULL;
+}
+
+/**
+ * Set the window that has the focus
+ * @param w The window to set the focus on
+ */
+void SetFocusedWindow(Window *w)
+{
+ if (_focused_window == w) return;
+
+ /* Invalidate focused widget */
+ if (_focused_window != NULL) {
+ if (_focused_window->nested_focus != NULL) _focused_window->nested_focus->SetDirty(_focused_window);
+ }
+
+ /* Remember which window was previously focused */
+ Window *old_focused = _focused_window;
+ _focused_window = w;
+
+ /* So we can inform it that it lost focus */
+ if (old_focused != NULL) old_focused->OnFocusLost();
+ if (_focused_window != NULL) _focused_window->OnFocus();
+}
+
+/**
+ * Check if an edit box is in global focus. That is if focused window
+ * has a edit box as focused widget, or if a console is focused.
+ * @return returns true if an edit box is in global focus or if the focused window is a console, else false
+ */
+bool EditBoxInGlobalFocus()
+{
+ if (_focused_window == NULL) return false;
+
+ /* The console does not have an edit box so a special case is needed. */
+ if (_focused_window->window_class == WC_CONSOLE) return true;
+
+ return _focused_window->nested_focus != NULL && _focused_window->nested_focus->type == WWT_EDITBOX;
+}
+
+/**
+ * Makes no widget on this window have focus. The function however doesn't change which window has focus.
+ */
+void Window::UnfocusFocusedWidget()
+{
+ if (this->nested_focus != NULL) {
+ if (this->nested_focus->type == WWT_EDITBOX) _video_driver->EditBoxLostFocus();
+
+ /* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
+ this->nested_focus->SetDirty(this);
+ this->nested_focus = NULL;
+ }
+}
+
+/**
+ * Set focus within this window to the given widget. The function however doesn't change which window has focus.
+ * @param widget_index Index of the widget in the window to set the focus to.
+ * @return Focus has changed.
+ */
+bool Window::SetFocusedWidget(int widget_index)
+{
+ /* Do nothing if widget_index is already focused, or if it wasn't a valid widget. */
+ if ((uint)widget_index >= this->nested_array_size) return false;
+
+ assert(this->nested_array[widget_index] != NULL); // Setting focus to a non-existing widget is a bad idea.
+ if (this->nested_focus != NULL) {
+ if (this->GetWidget(widget_index) == this->nested_focus) return false;
+
+ /* Repaint the widget that lost focus. A focused edit box may else leave the caret on the screen. */
+ this->nested_focus->SetDirty(this);
+ if (this->nested_focus->type == WWT_EDITBOX) _video_driver->EditBoxLostFocus();
+ }
+ this->nested_focus = this->GetWidget(widget_index);
+ return true;
+}
+
+/**
+ * Called when window looses focus
+ */
+void Window::OnFocusLost()
+{
+ if (this->nested_focus != NULL && this->nested_focus->type == WWT_EDITBOX) _video_driver->EditBoxLostFocus();
+}
+
+/**
+ * Sets the enabled/disabled status of a list of widgets.
+ * By default, widgets are enabled.
+ * On certain conditions, they have to be disabled.
+ * @param disab_stat status to use ie: disabled = true, enabled = false
+ * @param widgets list of widgets ended by WIDGET_LIST_END
+ */
+void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...)
+{
+ va_list wdg_list;
+
+ va_start(wdg_list, widgets);
+
+ while (widgets != WIDGET_LIST_END) {
+ SetWidgetDisabledState(widgets, disab_stat);
+ widgets = va_arg(wdg_list, int);
+ }
+
+ va_end(wdg_list);
+}
+
+/**
+ * Sets the lowered/raised status of a list of widgets.
+ * @param lowered_stat status to use ie: lowered = true, raised = false
+ * @param widgets list of widgets ended by WIDGET_LIST_END
+ */
+void CDECL Window::SetWidgetsLoweredState(bool lowered_stat, int widgets, ...)
+{
+ va_list wdg_list;
+
+ va_start(wdg_list, widgets);
+
+ while (widgets != WIDGET_LIST_END) {
+ SetWidgetLoweredState(widgets, lowered_stat);
+ widgets = va_arg(wdg_list, int);
+ }
+
+ va_end(wdg_list);
+}
+
+/**
+ * Raise the buttons of the window.
+ * @param autoraise Raise only the push buttons of the window.
+ */
+void Window::RaiseButtons(bool autoraise)
+{
+ for (uint i = 0; i < this->nested_array_size; i++) {
+ if (this->nested_array[i] == NULL) continue;
+ WidgetType type = this->nested_array[i]->type;
+ if (((type & ~WWB_PUSHBUTTON) < WWT_LAST || type == NWID_PUSHBUTTON_DROPDOWN) &&
+ (!autoraise || (type & WWB_PUSHBUTTON) || type == WWT_EDITBOX) && this->IsWidgetLowered(i)) {
+ this->RaiseWidget(i);
+ this->SetWidgetDirty(i);
+ }
+ }
+
+ /* Special widgets without widget index */
+ NWidgetCore *wid = this->nested_root != NULL ? (NWidgetCore*)this->nested_root->GetWidgetOfType(WWT_DEFSIZEBOX) : NULL;
+ if (wid != NULL) {
+ wid->SetLowered(false);
+ wid->SetDirty(this);
+ }
+}
+
+/**
+ * Invalidate a widget, i.e. mark it as being changed and in need of redraw.
+ * @param widget_index the widget to redraw.
+ */
+void Window::SetWidgetDirty(byte widget_index) const
+{
+ /* Sometimes this function is called before the window is even fully initialized */
+ if (this->nested_array == NULL) return;
+
+ this->nested_array[widget_index]->SetDirty(this);
+}
+
+/**
+ * A hotkey has been pressed.
+ * @param hotkey Hotkey index, by default a widget index of a button or editbox.
+ * @return #ES_HANDLED if the key press has been handled, and the hotkey is not unavailable for some reason.
+ */
+EventState Window::OnHotkey(int hotkey)
+{
+ if (hotkey < 0) return ES_NOT_HANDLED;
+
+ NWidgetCore *nw = this->GetWidget(hotkey);
+ if (nw == NULL || nw->IsDisabled()) return ES_NOT_HANDLED;
+
+ if (nw->type == WWT_EDITBOX) {
+ if (this->IsShaded()) return ES_NOT_HANDLED;
+
+ /* Focus editbox */
+ this->SetFocusedWidget(hotkey);
+ SetFocusedWindow(this);
+ } else {
+ /* Click button */
+ this->OnClick(Point(), hotkey, 1);
+ }
+ return ES_HANDLED;
+}
+
+/**
+ * Do all things to make a button look clicked and mark it to be
+ * unclicked in a few ticks.
+ * @param widget the widget to "click"
+ */
+void Window::HandleButtonClick(byte widget)
+{
+ this->LowerWidget(widget);
+ this->SetTimeout();
+ this->SetWidgetDirty(widget);
+}
+
+static void StartWindowDrag(Window *w);
+static void StartWindowSizing(Window *w, bool to_left);
+
+/**
+ * Dispatch left mouse-button (possibly double) click in window.
+ * @param w Window to dispatch event in
+ * @param x X coordinate of the click
+ * @param y Y coordinate of the click
+ * @param click_count Number of fast consecutive clicks at same position
+ */
+static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count)
+{
+ NWidgetCore *nw = w->nested_root->GetWidgetFromPos(x, y);
+ WidgetType widget_type = (nw != NULL) ? nw->type : WWT_EMPTY;
+
+ bool focused_widget_changed = false;
+ /* If clicked on a window that previously did dot have focus */
+ if (_focused_window != w && // We already have focus, right?
+ (w->window_desc->flags & WDF_NO_FOCUS) == 0 && // Don't lose focus to toolbars
+ widget_type != WWT_CLOSEBOX) { // Don't change focused window if 'X' (close button) was clicked
+ focused_widget_changed = true;
+ SetFocusedWindow(w);
+ }
+
+ if (nw == NULL) return; // exit if clicked outside of widgets
+
+ /* don't allow any interaction if the button has been disabled */
+ if (nw->IsDisabled()) return;
+
+ int widget_index = nw->index; ///< Index of the widget
+
+ /* Clicked on a widget that is not disabled.
+ * So unless the clicked widget is the caption bar, change focus to this widget.
+ * Exception: In the OSK we always want the editbox to stay focussed. */
+ if (widget_type != WWT_CAPTION && w->window_class != WC_OSK) {
+ /* focused_widget_changed is 'now' only true if the window this widget
+ * is in gained focus. In that case it must remain true, also if the
+ * local widget focus did not change. As such it's the logical-or of
+ * both changed states.
+ *
+ * If this is not preserved, then the OSK window would be opened when
+ * a user has the edit box focused and then click on another window and
+ * then back again on the edit box (to type some text).
+ */
+ focused_widget_changed |= w->SetFocusedWidget(widget_index);
+ }
+
+ /* Close any child drop down menus. If the button pressed was the drop down
+ * list's own button, then we should not process the click any further. */
+ if (HideDropDownMenu(w) == widget_index && widget_index >= 0) return;
+
+ if ((widget_type & ~WWB_PUSHBUTTON) < WWT_LAST && (widget_type & WWB_PUSHBUTTON)) w->HandleButtonClick(widget_index);
+
+ Point pt = { x, y };
+
+ switch (widget_type) {
+ case NWID_VSCROLLBAR:
+ case NWID_HSCROLLBAR:
+ ScrollbarClickHandler(w, nw, x, y);
+ break;
+
+ case WWT_EDITBOX: {
+ QueryString *query = w->GetQueryString(widget_index);
+ if (query != NULL) query->ClickEditBox(w, pt, widget_index, click_count, focused_widget_changed);
+ break;
+ }
+
+ case WWT_CLOSEBOX: // 'X'
+ delete w;
+ return;
+
+ case WWT_CAPTION: // 'Title bar'
+ StartWindowDrag(w);
+ return;
+
+ case WWT_RESIZEBOX:
+ /* When the resize widget is on the left size of the window
+ * we assume that that button is used to resize to the left. */
+ StartWindowSizing(w, (int)nw->pos_x < (w->width / 2));
+ nw->SetDirty(w);
+ return;
+
+ case WWT_DEFSIZEBOX: {
+ if (_ctrl_pressed) {
+ w->window_desc->pref_width = w->width;
+ w->window_desc->pref_height = w->height;
+ } else {
+ int16 def_width = max(min(w->window_desc->GetDefaultWidth(), _screen.width), w->nested_root->smallest_x);
+ int16 def_height = max(min(w->window_desc->GetDefaultHeight(), _screen.height - 50), w->nested_root->smallest_y);
+
+ int dx = (w->resize.step_width == 0) ? 0 : def_width - w->width;
+ int dy = (w->resize.step_height == 0) ? 0 : def_height - w->height;
+ /* dx and dy has to go by step.. calculate it.
+ * The cast to int is necessary else dx/dy are implicitly casted to unsigned int, which won't work. */
+ if (w->resize.step_width > 1) dx -= dx % (int)w->resize.step_width;
+ if (w->resize.step_height > 1) dy -= dy % (int)w->resize.step_height;
+ ResizeWindow(w, dx, dy, false);
+ }
+
+ nw->SetLowered(true);
+ nw->SetDirty(w);
+ w->SetTimeout();
+ break;
+ }
+
+ case WWT_DEBUGBOX:
+ w->ShowNewGRFInspectWindow();
+ break;
+
+ case WWT_SHADEBOX:
+ nw->SetDirty(w);
+ w->SetShaded(!w->IsShaded());
+ return;
+
+ case WWT_STICKYBOX:
+ w->flags ^= WF_STICKY;
+ nw->SetDirty(w);
+ if (_ctrl_pressed) w->window_desc->pref_sticky = (w->flags & WF_STICKY) != 0;
+ return;
+
+ default:
+ break;
+ }
+
+ /* Widget has no index, so the window is not interested in it. */
+ if (widget_index < 0) return;
+
+ /* Check if the widget is highlighted; if so, disable highlight and dispatch an event to the GameScript */
+ if (w->IsWidgetHighlighted(widget_index)) {
+ w->SetWidgetHighlight(widget_index, TC_INVALID);
+ Game::NewEvent(new ScriptEventWindowWidgetClick((ScriptWindow::WindowClass)w->window_class, w->window_number, widget_index));
+ }
+
+ w->OnClick(pt, widget_index, click_count);
+}
+
+/**
+ * Dispatch right mouse-button click in window.
+ * @param w Window to dispatch event in
+ * @param x X coordinate of the click
+ * @param y Y coordinate of the click
+ */
+static void DispatchRightClickEvent(Window *w, int x, int y)
+{
+ NWidgetCore *wid = w->nested_root->GetWidgetFromPos(x, y);
+ if (wid == NULL) return;
+
+ /* No widget to handle, or the window is not interested in it. */
+ if (wid->index >= 0) {
+ Point pt = { x, y };
+ if (w->OnRightClick(pt, wid->index)) return;
+ }
+
+ if (_settings_client.gui.hover_delay == 0 && wid->tool_tip != 0) GuiShowTooltips(w, wid->tool_tip, 0, NULL, TCC_RIGHT_CLICK);
+}
+
+/**
+ * Dispatch hover of the mouse over a window.
+ * @param w Window to dispatch event in.
+ * @param x X coordinate of the click.
+ * @param y Y coordinate of the click.
+ */
+static void DispatchHoverEvent(Window *w, int x, int y)
+{
+ NWidgetCore *wid = w->nested_root->GetWidgetFromPos(x, y);
+
+ /* No widget to handle */
+ if (wid == NULL) return;
+
+ /* Show the tooltip if there is any */
+ if (wid->tool_tip != 0) {
+ GuiShowTooltips(w, wid->tool_tip);
+ return;
+ }
+
+ /* Widget has no index, so the window is not interested in it. */
+ if (wid->index < 0) return;
+
+ Point pt = { x, y };
+ w->OnHover(pt, wid->index);
+}
+
+/**
+ * Dispatch the mousewheel-action to the window.
+ * The window will scroll any compatible scrollbars if the mouse is pointed over the bar or its contents
+ * @param w Window
+ * @param nwid the widget where the scrollwheel was used
+ * @param wheel scroll up or down
+ */
+static void DispatchMouseWheelEvent(Window *w, NWidgetCore *nwid, int wheel)
+{
+ if (nwid == NULL) return;
+
+ /* Using wheel on caption/shade-box shades or unshades the window. */
+ if (nwid->type == WWT_CAPTION || nwid->type == WWT_SHADEBOX) {
+ w->SetShaded(wheel < 0);
+ return;
+ }
+
+ /* Wheeling a vertical scrollbar. */
+ if (nwid->type == NWID_VSCROLLBAR) {
+ NWidgetScrollbar *sb = static_cast(nwid);
+ if (sb->GetCount() > sb->GetCapacity()) {
+ sb->UpdatePosition(wheel);
+ w->SetDirty();
+ }
+ return;
+ }
+
+ /* Scroll the widget attached to the scrollbar. */
+ Scrollbar *sb = (nwid->scrollbar_index >= 0 ? w->GetScrollbar(nwid->scrollbar_index) : NULL);
+ if (sb != NULL && sb->GetCount() > sb->GetCapacity()) {
+ sb->UpdatePosition(wheel);
+ w->SetDirty();
+ }
+}
+
+/**
+ * Returns whether a window may be shown or not.
+ * @param w The window to consider.
+ * @return True iff it may be shown, otherwise false.
+ */
+static bool MayBeShown(const Window *w)
+{
+ /* If we're not modal, everything is okay. */
+ if (!HasModalProgress()) return true;
+
+ switch (w->window_class) {
+ case WC_MAIN_WINDOW: ///< The background, i.e. the game.
+ case WC_MODAL_PROGRESS: ///< The actual progress window.
+ case WC_CONFIRM_POPUP_QUERY: ///< The abort window.
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/**
+ * Generate repaint events for the visible part of window w within the rectangle.
+ *
+ * The function goes recursively upwards in the window stack, and splits the rectangle
+ * into multiple pieces at the window edges, so obscured parts are not redrawn.
+ *
+ * @param w Window that needs to be repainted
+ * @param left Left edge of the rectangle that should be repainted
+ * @param top Top edge of the rectangle that should be repainted
+ * @param right Right edge of the rectangle that should be repainted
+ * @param bottom Bottom edge of the rectangle that should be repainted
+ */
+static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bottom)
+{
+ const Window *v;
+ FOR_ALL_WINDOWS_FROM_BACK_FROM(v, w->z_front) {
+ if (MayBeShown(v) &&
+ right > v->left &&
+ bottom > v->top &&
+ left < v->left + v->width &&
+ top < v->top + v->height) {
+ /* v and rectangle intersect with each other */
+ int x;
+
+ if (left < (x = v->left)) {
+ DrawOverlappedWindow(w, left, top, x, bottom);
+ DrawOverlappedWindow(w, x, top, right, bottom);
+ return;
+ }
+
+ if (right > (x = v->left + v->width)) {
+ DrawOverlappedWindow(w, left, top, x, bottom);
+ DrawOverlappedWindow(w, x, top, right, bottom);
+ return;
+ }
+
+ if (top < (x = v->top)) {
+ DrawOverlappedWindow(w, left, top, right, x);
+ DrawOverlappedWindow(w, left, x, right, bottom);
+ return;
+ }
+
+ if (bottom > (x = v->top + v->height)) {
+ DrawOverlappedWindow(w, left, top, right, x);
+ DrawOverlappedWindow(w, left, x, right, bottom);
+ return;
+ }
+
+ return;
+ }
+ }
+
+ /* Setup blitter, and dispatch a repaint event to window *wz */
+ DrawPixelInfo *dp = _cur_dpi;
+ dp->width = right - left;
+ dp->height = bottom - top;
+ dp->left = left - w->left;
+ dp->top = top - w->top;
+ dp->pitch = _screen.pitch;
+ dp->dst_ptr = BlitterFactory::GetCurrentBlitter()->MoveTo(_screen.dst_ptr, left, top);
+ dp->zoom = ZOOM_LVL_NORMAL;
+ w->OnPaint();
+}
+
+/**
+ * From a rectangle that needs redrawing, find the windows that intersect with the rectangle.
+ * These windows should be re-painted.
+ * @param left Left edge of the rectangle that should be repainted
+ * @param top Top edge of the rectangle that should be repainted
+ * @param right Right edge of the rectangle that should be repainted
+ * @param bottom Bottom edge of the rectangle that should be repainted
+ */
+void DrawOverlappedWindowForAll(int left, int top, int right, int bottom)
+{
+ Window *w;
+ DrawPixelInfo bk;
+ _cur_dpi = &bk;
+
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (MayBeShown(w) &&
+ right > w->left &&
+ bottom > w->top &&
+ left < w->left + w->width &&
+ top < w->top + w->height) {
+ /* Window w intersects with the rectangle => needs repaint */
+ DrawOverlappedWindow(w, left, top, right, bottom);
+ }
+ }
+}
+
+/**
+ * Mark entire window as dirty (in need of re-paint)
+ * @ingroup dirty
+ */
+void Window::SetDirty() const
+{
+ SetDirtyBlocks(this->left, this->top, this->left + this->width, this->top + this->height);
+}
+
+/**
+ * Re-initialize a window, and optionally change its size.
+ * @param rx Horizontal resize of the window.
+ * @param ry Vertical resize of the window.
+ * @note For just resizing the window, use #ResizeWindow instead.
+ */
+void Window::ReInit(int rx, int ry)
+{
+ this->SetDirty(); // Mark whole current window as dirty.
+
+ /* Save current size. */
+ int window_width = this->width;
+ int window_height = this->height;
+
+ this->OnInit();
+ /* Re-initialize the window from the ground up. No need to change the nested_array, as all widgets stay where they are. */
+ this->nested_root->SetupSmallestSize(this, false);
+ this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
+ this->width = this->nested_root->smallest_x;
+ this->height = this->nested_root->smallest_y;
+ this->resize.step_width = this->nested_root->resize_x;
+ this->resize.step_height = this->nested_root->resize_y;
+
+ /* Resize as close to the original size + requested resize as possible. */
+ window_width = max(window_width + rx, this->width);
+ window_height = max(window_height + ry, this->height);
+ int dx = (this->resize.step_width == 0) ? 0 : window_width - this->width;
+ int dy = (this->resize.step_height == 0) ? 0 : window_height - this->height;
+ /* dx and dy has to go by step.. calculate it.
+ * The cast to int is necessary else dx/dy are implicitly casted to unsigned int, which won't work. */
+ if (this->resize.step_width > 1) dx -= dx % (int)this->resize.step_width;
+ if (this->resize.step_height > 1) dy -= dy % (int)this->resize.step_height;
+
+ ResizeWindow(this, dx, dy);
+ /* ResizeWindow() does this->SetDirty() already, no need to do it again here. */
+}
+
+/**
+ * Set the shaded state of the window to \a make_shaded.
+ * @param make_shaded If \c true, shade the window (roll up until just the title bar is visible), else unshade/unroll the window to its original size.
+ * @note The method uses #Window::ReInit(), thus after the call, the whole window should be considered changed.
+ */
+void Window::SetShaded(bool make_shaded)
+{
+ if (this->shade_select == NULL) return;
+
+ int desired = make_shaded ? SZSP_HORIZONTAL : 0;
+ if (this->shade_select->shown_plane != desired) {
+ if (make_shaded) {
+ if (this->nested_focus != NULL) this->UnfocusFocusedWidget();
+ this->unshaded_size.width = this->width;
+ this->unshaded_size.height = this->height;
+ this->shade_select->SetDisplayedPlane(desired);
+ this->ReInit(0, -this->height);
+ } else {
+ this->shade_select->SetDisplayedPlane(desired);
+ int dx = ((int)this->unshaded_size.width > this->width) ? (int)this->unshaded_size.width - this->width : 0;
+ int dy = ((int)this->unshaded_size.height > this->height) ? (int)this->unshaded_size.height - this->height : 0;
+ this->ReInit(dx, dy);
+ }
+ }
+}
+
+/**
+ * Find the Window whose parent pointer points to this window
+ * @param w parent Window to find child of
+ * @param wc Window class of the window to remove; #WC_INVALID if class does not matter
+ * @return a Window pointer that is the child of \a w, or \c NULL otherwise
+ */
+static Window *FindChildWindow(const Window *w, WindowClass wc)
+{
+ Window *v;
+ FOR_ALL_WINDOWS_FROM_BACK(v) {
+ if ((wc == WC_INVALID || wc == v->window_class) && v->parent == w) return v;
+ }
+
+ return NULL;
+}
+
+/**
+ * Delete all children a window might have in a head-recursive manner
+ * @param wc Window class of the window to remove; #WC_INVALID if class does not matter
+ */
+void Window::DeleteChildWindows(WindowClass wc) const
+{
+ Window *child = FindChildWindow(this, wc);
+ while (child != NULL) {
+ delete child;
+ child = FindChildWindow(this, wc);
+ }
+}
+
+/**
+ * Remove window and all its child windows from the window stack.
+ */
+Window::~Window()
+{
+ if (_thd.window_class == this->window_class &&
+ _thd.window_number == this->window_number) {
+ ResetObjectToPlace();
+ }
+
+ /* Prevent Mouseover() from resetting mouse-over coordinates on a non-existing window */
+ if (_mouseover_last_w == this) _mouseover_last_w = NULL;
+
+ /* We can't scroll the window when it's closed. */
+ if (_last_scroll_window == this) _last_scroll_window = NULL;
+
+ /* Make sure we don't try to access this window as the focused window when it doesn't exist anymore. */
+ if (_focused_window == this) {
+ this->OnFocusLost();
+ _focused_window = NULL;
+ }
+
+ this->DeleteChildWindows();
+
+ if (this->viewport != NULL) DeleteWindowViewport(this);
+
+ this->SetDirty();
+
+ free(this->nested_array); // Contents is released through deletion of #nested_root.
+ delete this->nested_root;
+
+ this->window_class = WC_INVALID;
+}
+
+/**
+ * Find a window by its class and window number
+ * @param cls Window class
+ * @param number Number of the window within the window class
+ * @return Pointer to the found window, or \c NULL if not available
+ */
+Window *FindWindowById(WindowClass cls, WindowNumber number)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls && w->window_number == number) return w;
+ }
+
+ return NULL;
+}
+
+/**
+ * Find any window by its class. Useful when searching for a window that uses
+ * the window number as a #WindowType, like #WC_SEND_NETWORK_MSG.
+ * @param cls Window class
+ * @return Pointer to the found window, or \c NULL if not available
+ */
+Window *FindWindowByClass(WindowClass cls)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls) return w;
+ }
+
+ return NULL;
+}
+
+/**
+ * Delete a window by its class and window number (if it is open).
+ * @param cls Window class
+ * @param number Number of the window within the window class
+ * @param force force deletion; if false don't delete when stickied
+ */
+void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
+{
+ Window *w = FindWindowById(cls, number);
+ if (force || w == NULL ||
+ (w->flags & WF_STICKY) == 0) {
+ delete w;
+ }
+}
+
+/**
+ * Delete all windows of a given class
+ * @param cls Window class of windows to delete
+ */
+void DeleteWindowByClass(WindowClass cls)
+{
+ Window *w;
+
+restart_search:
+ /* When we find the window to delete, we need to restart the search
+ * as deleting this window could cascade in deleting (many) others
+ * anywhere in the z-array */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls) {
+ delete w;
+ goto restart_search;
+ }
+ }
+}
+
+/**
+ * Delete all windows of a company. We identify windows of a company
+ * by looking at the caption colour. If it is equal to the company ID
+ * then we say the window belongs to the company and should be deleted
+ * @param id company identifier
+ */
+void DeleteCompanyWindows(CompanyID id)
+{
+ Window *w;
+
+restart_search:
+ /* When we find the window to delete, we need to restart the search
+ * as deleting this window could cascade in deleting (many) others
+ * anywhere in the z-array */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->owner == id) {
+ delete w;
+ goto restart_search;
+ }
+ }
+
+ /* Also delete the company specific windows that don't have a company-colour. */
+ DeleteWindowById(WC_BUY_COMPANY, id);
+}
+
+/**
+ * Change the owner of all the windows one company can take over from another
+ * company in the case of a company merger. Do not change ownership of windows
+ * that need to be deleted once takeover is complete
+ * @param old_owner original owner of the window
+ * @param new_owner the new owner of the window
+ */
+void ChangeWindowOwner(Owner old_owner, Owner new_owner)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->owner != old_owner) continue;
+
+ switch (w->window_class) {
+ case WC_COMPANY_COLOUR:
+ case WC_FINANCES:
+ case WC_STATION_LIST:
+ case WC_TRAINS_LIST:
+ case WC_ROADVEH_LIST:
+ case WC_SHIPS_LIST:
+ case WC_AIRCRAFT_LIST:
+ case WC_BUY_COMPANY:
+ case WC_COMPANY:
+ case WC_COMPANY_INFRASTRUCTURE:
+ continue;
+
+ default:
+ w->owner = new_owner;
+ break;
+ }
+ }
+}
+
+static void BringWindowToFront(Window *w);
+
+/**
+ * Find a window and make it the relative top-window on the screen.
+ * The window gets unshaded if it was shaded, and a white border is drawn at its edges for a brief period of time to visualize its "activation".
+ * @param cls WindowClass of the window to activate
+ * @param number WindowNumber of the window to activate
+ * @return a pointer to the window thus activated
+ */
+Window *BringWindowToFrontById(WindowClass cls, WindowNumber number)
+{
+ Window *w = FindWindowById(cls, number);
+
+ if (w != NULL) {
+ if (w->IsShaded()) w->SetShaded(false); // Restore original window size if it was shaded.
+
+ w->SetWhiteBorder();
+ BringWindowToFront(w);
+ w->SetDirty();
+ }
+
+ return w;
+}
+
+static inline bool IsVitalWindow(const Window *w)
+{
+ switch (w->window_class) {
+ case WC_MAIN_TOOLBAR:
+ case WC_STATUS_BAR:
+ case WC_NEWS_WINDOW:
+ case WC_SEND_NETWORK_MSG:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+/**
+ * Get the z-priority for a given window. This is used in comparison with other z-priority values;
+ * a window with a given z-priority will appear above other windows with a lower value, and below
+ * those with a higher one (the ordering within z-priorities is arbitrary).
+ * @param w The window to get the z-priority for
+ * @pre w->window_class != WC_INVALID
+ * @return The window's z-priority
+ */
+static uint GetWindowZPriority(const Window *w)
+{
+ assert(w->window_class != WC_INVALID);
+
+ uint z_priority = 0;
+
+ switch (w->window_class) {
+ case WC_ENDSCREEN:
+ ++z_priority;
+
+ case WC_HIGHSCORE:
+ ++z_priority;
+
+ case WC_TOOLTIPS:
+ ++z_priority;
+
+ case WC_DROPDOWN_MENU:
+ ++z_priority;
+
+ case WC_MAIN_TOOLBAR:
+ case WC_STATUS_BAR:
+ ++z_priority;
+
+ case WC_OSK:
+ ++z_priority;
+
+ case WC_QUERY_STRING:
+ case WC_SEND_NETWORK_MSG:
+ ++z_priority;
+
+ case WC_ERRMSG:
+ case WC_CONFIRM_POPUP_QUERY:
+ case WC_MODAL_PROGRESS:
+ case WC_NETWORK_STATUS_WINDOW:
+ ++z_priority;
+
+ case WC_GENERATE_LANDSCAPE:
+ case WC_SAVELOAD:
+ case WC_GAME_OPTIONS:
+ case WC_CUSTOM_CURRENCY:
+ case WC_NETWORK_WINDOW:
+ case WC_GRF_PARAMETERS:
+ case WC_AI_LIST:
+ case WC_AI_SETTINGS:
+ case WC_TEXTFILE:
+ ++z_priority;
+
+ case WC_CONSOLE:
+ ++z_priority;
+
+ case WC_NEWS_WINDOW:
+ case WC_TABLET_BAR:
+ ++z_priority;
+
+ default:
+ ++z_priority;
+
+ case WC_MAIN_WINDOW:
+ return z_priority;
+ }
+}
+
+/**
+ * Adds a window to the z-ordering, according to its z-priority.
+ * @param w Window to add
+ */
+static void AddWindowToZOrdering(Window *w)
+{
+ assert(w->z_front == NULL && w->z_back == NULL);
+
+ if (_z_front_window == NULL) {
+ /* It's the only window. */
+ _z_front_window = _z_back_window = w;
+ w->z_front = w->z_back = NULL;
+ } else {
+ /* Search down the z-ordering for its location. */
+ Window *v = _z_front_window;
+ uint last_z_priority = UINT_MAX;
+ while (v != NULL && (v->window_class == WC_INVALID || GetWindowZPriority(v) > GetWindowZPriority(w))) {
+ if (v->window_class != WC_INVALID) {
+ /* Sanity check z-ordering, while we're at it. */
+ assert(last_z_priority >= GetWindowZPriority(v));
+ last_z_priority = GetWindowZPriority(v);
+ }
+
+ v = v->z_back;
+ }
+
+ if (v == NULL) {
+ /* It's the new back window. */
+ w->z_front = _z_back_window;
+ w->z_back = NULL;
+ _z_back_window->z_back = w;
+ _z_back_window = w;
+ } else if (v == _z_front_window) {
+ /* It's the new front window. */
+ w->z_front = NULL;
+ w->z_back = _z_front_window;
+ _z_front_window->z_front = w;
+ _z_front_window = w;
+ } else {
+ /* It's somewhere else in the z-ordering. */
+ w->z_front = v->z_front;
+ w->z_back = v;
+ v->z_front->z_back = w;
+ v->z_front = w;
+ }
+ }
+}
+
+
+/**
+ * Removes a window from the z-ordering.
+ * @param w Window to remove
+ */
+static void RemoveWindowFromZOrdering(Window *w)
+{
+ if (w->z_front == NULL) {
+ assert(_z_front_window == w);
+ _z_front_window = w->z_back;
+ } else {
+ w->z_front->z_back = w->z_back;
+ }
+
+ if (w->z_back == NULL) {
+ assert(_z_back_window == w);
+ _z_back_window = w->z_front;
+ } else {
+ w->z_back->z_front = w->z_front;
+ }
+
+ w->z_front = w->z_back = NULL;
+}
+
+/**
+ * On clicking on a window, make it the frontmost window of all windows with an equal
+ * or lower z-priority. The window is marked dirty for a repaint
+ * @param w window that is put into the relative foreground
+ */
+static void BringWindowToFront(Window *w)
+{
+ RemoveWindowFromZOrdering(w);
+ AddWindowToZOrdering(w);
+
+ w->SetDirty();
+}
+
+/**
+ * Initializes the data (except the position and initial size) of a new Window.
+ * @param desc Window description.
+ * @param window_number Number being assigned to the new window
+ * @return Window pointer of the newly created window
+ * @pre If nested widgets are used (\a widget is \c NULL), #nested_root and #nested_array_size must be initialized.
+ * In addition, #nested_array is either \c NULL, or already initialized.
+ */
+void Window::InitializeData(WindowNumber window_number)
+{
+ /* Set up window properties; some of them are needed to set up smallest size below */
+ this->window_class = this->window_desc->cls;
+ this->SetWhiteBorder();
+ if (this->window_desc->default_pos == WDP_CENTER) this->flags |= WF_CENTERED;
+ this->owner = INVALID_OWNER;
+ this->nested_focus = NULL;
+ this->window_number = window_number;
+
+ this->OnInit();
+ /* Initialize nested widget tree. */
+ if (this->nested_array == NULL) {
+ this->nested_array = CallocT(this->nested_array_size);
+ this->nested_root->SetupSmallestSize(this, true);
+ } else {
+ this->nested_root->SetupSmallestSize(this, false);
+ }
+ /* Initialize to smallest size. */
+ this->nested_root->AssignSizePosition(ST_SMALLEST, 0, 0, this->nested_root->smallest_x, this->nested_root->smallest_y, _current_text_dir == TD_RTL);
+
+ /* Further set up window properties,
+ * this->left, this->top, this->width, this->height, this->resize.width, and this->resize.height are initialized later. */
+ this->resize.step_width = this->nested_root->resize_x;
+ this->resize.step_height = this->nested_root->resize_y;
+
+ /* Give focus to the opened window unless a text box
+ * of focused window has focus (so we don't interrupt typing). But if the new
+ * window has a text box, then take focus anyway. */
+ if (!EditBoxInGlobalFocus() || this->nested_root->GetWidgetOfType(WWT_EDITBOX) != NULL) SetFocusedWindow(this);
+
+ /* Insert the window into the correct location in the z-ordering. */
+ AddWindowToZOrdering(this);
+}
+
+/**
+ * Set the position and smallest size of the window.
+ * @param x Offset in pixels from the left of the screen of the new window.
+ * @param y Offset in pixels from the top of the screen of the new window.
+ * @param sm_width Smallest width in pixels of the window.
+ * @param sm_height Smallest height in pixels of the window.
+ */
+void Window::InitializePositionSize(int x, int y, int sm_width, int sm_height)
+{
+ this->left = x;
+ this->top = y;
+ this->width = sm_width;
+ this->height = sm_height;
+}
+
+/**
+ * Resize window towards the default size.
+ * Prior to construction, a position for the new window (for its default size)
+ * has been found with LocalGetWindowPlacement(). Initially, the window is
+ * constructed with minimal size. Resizing the window to its default size is
+ * done here.
+ * @param def_width default width in pixels of the window
+ * @param def_height default height in pixels of the window
+ * @see Window::Window(), Window::InitializeData(), Window::InitializePositionSize()
+ */
+void Window::FindWindowPlacementAndResize(int def_width, int def_height)
+{
+ def_width = max(def_width, this->width); // Don't allow default size to be smaller than smallest size
+ def_height = max(def_height, this->height);
+ /* Try to make windows smaller when our window is too small.
+ * w->(width|height) is normally the same as min_(width|height),
+ * but this way the GUIs can be made a little more dynamic;
+ * one can use the same spec for multiple windows and those
+ * can then determine the real minimum size of the window. */
+ if (this->width != def_width || this->height != def_height) {
+ /* Think about the overlapping toolbars when determining the minimum window size */
+ int free_height = _screen.height;
+ const Window *wt = FindWindowById(WC_STATUS_BAR, 0);
+ if (wt != NULL) free_height -= wt->height;
+ wt = FindWindowById(WC_MAIN_TOOLBAR, 0);
+ if (wt != NULL) free_height -= wt->height;
+
+ int enlarge_x = max(min(def_width - this->width, _screen.width - this->width), 0);
+ int enlarge_y = max(min(def_height - this->height, free_height - this->height), 0);
+
+ /* X and Y has to go by step.. calculate it.
+ * The cast to int is necessary else x/y are implicitly casted to
+ * unsigned int, which won't work. */
+ if (this->resize.step_width > 1) enlarge_x -= enlarge_x % (int)this->resize.step_width;
+ if (this->resize.step_height > 1) enlarge_y -= enlarge_y % (int)this->resize.step_height;
+
+ ResizeWindow(this, enlarge_x, enlarge_y);
+ /* ResizeWindow() calls this->OnResize(). */
+ } else {
+ /* Always call OnResize; that way the scrollbars and matrices get initialized. */
+ this->OnResize();
+ }
+
+ int nx = this->left;
+ int ny = this->top;
+
+ if (nx + this->width > _screen.width) nx -= (nx + this->width - _screen.width);
+
+ const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0);
+ ny = max(ny, (wt == NULL || this == wt || this->top == 0) ? 0 : wt->height);
+ nx = max(nx, 0);
+
+ if (this->viewport != NULL) {
+ this->viewport->left += nx - this->left;
+ this->viewport->top += ny - this->top;
+ }
+ this->left = nx;
+ this->top = ny;
+
+ this->SetDirty();
+}
+
+/**
+ * Decide whether a given rectangle is a good place to open a completely visible new window.
+ * The new window should be within screen borders, and not overlap with another already
+ * existing window (except for the main window in the background).
+ * @param left Left edge of the rectangle
+ * @param top Top edge of the rectangle
+ * @param width Width of the rectangle
+ * @param height Height of the rectangle
+ * @param pos If rectangle is good, use this parameter to return the top-left corner of the new window
+ * @return Boolean indication that the rectangle is a good place for the new window
+ */
+static bool IsGoodAutoPlace1(int left, int top, int width, int height, Point &pos)
+{
+ int right = width + left;
+ int bottom = height + top;
+
+ const Window *main_toolbar = FindWindowByClass(WC_MAIN_TOOLBAR);
+ if (left < 0 || (main_toolbar != NULL && top < main_toolbar->height) || right > _screen.width || bottom > _screen.height) return false;
+
+ /* Make sure it is not obscured by any window. */
+ const Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == WC_MAIN_WINDOW) continue;
+
+ if (right > w->left &&
+ w->left + w->width > left &&
+ bottom > w->top &&
+ w->top + w->height > top) {
+ return false;
+ }
+ }
+
+ pos.x = left;
+ pos.y = top;
+ return true;
+}
+
+/**
+ * Decide whether a given rectangle is a good place to open a mostly visible new window.
+ * The new window should be mostly within screen borders, and not overlap with another already
+ * existing window (except for the main window in the background).
+ * @param left Left edge of the rectangle
+ * @param top Top edge of the rectangle
+ * @param width Width of the rectangle
+ * @param height Height of the rectangle
+ * @param pos If rectangle is good, use this parameter to return the top-left corner of the new window
+ * @return Boolean indication that the rectangle is a good place for the new window
+ */
+static bool IsGoodAutoPlace2(int left, int top, int width, int height, Point &pos)
+{
+ /* Left part of the rectangle may be at most 1/4 off-screen,
+ * right part of the rectangle may be at most 1/2 off-screen
+ */
+ if (left < -(width >> 2) || left > _screen.width - (width >> 1)) return false;
+ /* Bottom part of the rectangle may be at most 1/4 off-screen */
+ if (top < 22 || top > _screen.height - (height >> 2)) return false;
+
+ /* Make sure it is not obscured by any window. */
+ const Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == WC_MAIN_WINDOW) continue;
+
+ if (left + width > w->left &&
+ w->left + w->width > left &&
+ top + height > w->top &&
+ w->top + w->height > top) {
+ return false;
+ }
+ }
+
+ pos.x = left;
+ pos.y = top;
+ return true;
+}
+
+/**
+ * Find a good place for opening a new window of a given width and height.
+ * @param width Width of the new window
+ * @param height Height of the new window
+ * @return Top-left coordinate of the new window
+ */
+static Point GetAutoPlacePosition(int width, int height)
+{
+ Point pt;
+
+ /* First attempt, try top-left of the screen */
+ const Window *main_toolbar = FindWindowByClass(WC_MAIN_TOOLBAR);
+ if (IsGoodAutoPlace1(0, main_toolbar != NULL ? main_toolbar->height + 2 : 2, width, height, pt)) return pt;
+
+ /* Second attempt, try around all existing windows with a distance of 2 pixels.
+ * The new window must be entirely on-screen, and not overlap with an existing window.
+ * Eight starting points are tried, two at each corner.
+ */
+ const Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == WC_MAIN_WINDOW) continue;
+
+ if (IsGoodAutoPlace1(w->left + w->width + 2, w->top, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left - width - 2, w->top, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left, w->top + w->height + 2, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left, w->top - height - 2, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left + w->width + 2, w->top + w->height - height, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left - width - 2, w->top + w->height - height, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left + w->width - width, w->top + w->height + 2, width, height, pt)) return pt;
+ if (IsGoodAutoPlace1(w->left + w->width - width, w->top - height - 2, width, height, pt)) return pt;
+ }
+
+ /* Third attempt, try around all existing windows with a distance of 2 pixels.
+ * The new window may be partly off-screen, and must not overlap with an existing window.
+ * Only four starting points are tried.
+ */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == WC_MAIN_WINDOW) continue;
+
+ if (IsGoodAutoPlace2(w->left + w->width + 2, w->top, width, height, pt)) return pt;
+ if (IsGoodAutoPlace2(w->left - width - 2, w->top, width, height, pt)) return pt;
+ if (IsGoodAutoPlace2(w->left, w->top + w->height + 2, width, height, pt)) return pt;
+ if (IsGoodAutoPlace2(w->left, w->top - height - 2, width, height, pt)) return pt;
+ }
+
+ /* Fourth and final attempt, put window at diagonal starting from (0, 24), try multiples
+ * of (+5, +5)
+ */
+ int left = 0, top = 24;
+
+restart:
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->left == left && w->top == top) {
+ left += 5;
+ top += 5;
+ goto restart;
+ }
+ }
+
+ pt.x = left;
+ pt.y = top;
+ return pt;
+}
+
+/**
+ * Computer the position of the top-left corner of a window to be opened right
+ * under the toolbar.
+ * @param window_width the width of the window to get the position for
+ * @return Coordinate of the top-left corner of the new window.
+ */
+Point GetToolbarAlignedWindowPosition(int window_width)
+{
+ const Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
+ assert(w != NULL);
+ Point pt = { _current_text_dir == TD_RTL ? w->left : (w->left + w->width) - window_width, w->top + w->height };
+ return pt;
+}
+
+/**
+ * Compute the position of the top-left corner of a new window that is opened.
+ *
+ * By default position a child window at an offset of 10/10 of its parent.
+ * With the exception of WC_BUILD_TOOLBAR (build railway/roads/ship docks/airports)
+ * and WC_SCEN_LAND_GEN (landscaping). Whose child window has an offset of 0/toolbar-height of
+ * its parent. So it's exactly under the parent toolbar and no buttons will be covered.
+ * However if it falls too extremely outside window positions, reposition
+ * it to an automatic place.
+ *
+ * @param *desc The pointer to the WindowDesc to be created.
+ * @param sm_width Smallest width of the window.
+ * @param sm_height Smallest height of the window.
+ * @param window_number The window number of the new window.
+ *
+ * @return Coordinate of the top-left corner of the new window.
+ */
+static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
+{
+ Point pt;
+ const Window *w;
+
+ int16 default_width = max(desc->GetDefaultWidth(), sm_width);
+ int16 default_height = max(desc->GetDefaultHeight(), sm_height);
+
+ if (desc->parent_cls != WC_NONE &&
+ (w = FindWindowById(desc->parent_cls, window_number)) != NULL &&
+ w->left < _screen.width - 20 && w->left > -60 && w->top < _screen.height - 20) {
+
+ if (_settings_client.gui.touchscreen_mode != TSC_NONE) {
+ pt.x = _current_text_dir == TD_RTL ? 0 : (_screen.width - default_width);
+ } else {
+ pt.x = w->left + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? 0 : 10);
+ if (pt.x > _screen.width + 10 - default_width) {
+ pt.x = (_screen.width + 10 - default_width) - 20;
+ }
+ }
+
+ pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? w->height : 10);
+ return pt;
+ }
+
+ switch (desc->default_pos) {
+ case WDP_ALIGN_TOOLBAR: // Align to the toolbar
+ return GetToolbarAlignedWindowPosition(default_width);
+
+ case WDP_AUTO: // Find a good automatic position for the window
+ return GetAutoPlacePosition(default_width, default_height);
+
+ case WDP_CENTER: // Centre the window horizontally
+ pt.x = (_screen.width - default_width) / 2;
+ pt.y = (_screen.height - default_height) / 2;
+ break;
+
+ case WDP_MANUAL:
+ pt.x = 0;
+ pt.y = 0;
+ break;
+
+ default:
+ NOT_REACHED();
+ }
+
+ // try to put it to
+
+ return pt;
+}
+
+/* virtual */ Point Window::OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
+{
+ return LocalGetWindowPlacement(this->window_desc, sm_width, sm_height, window_number);
+}
+
+/**
+ * Perform the first part of the initialization of a nested widget tree.
+ * Construct a nested widget tree in #nested_root, and optionally fill the #nested_array array to provide quick access to the uninitialized widgets.
+ * This is mainly useful for setting very basic properties.
+ * @param fill_nested Fill the #nested_array (enabling is expensive!).
+ * @note Filling the nested array requires an additional traversal through the nested widget tree, and is best performed by #FinishInitNested rather than here.
+ */
+void Window::CreateNestedTree(bool fill_nested)
+{
+ int biggest_index = -1;
+ this->nested_root = MakeWindowNWidgetTree(this->window_desc->nwid_parts, this->window_desc->nwid_length, &biggest_index, &this->shade_select);
+ this->nested_array_size = (uint)(biggest_index + 1);
+
+ if (fill_nested) {
+ this->nested_array = CallocT(this->nested_array_size);
+ this->nested_root->FillNestedArray(this->nested_array, this->nested_array_size);
+ }
+}
+
+/**
+ * Perform the second part of the initialization of a nested widget tree.
+ * @param window_number Number of the new window.
+ */
+void Window::FinishInitNested(WindowNumber window_number)
+{
+ this->InitializeData(window_number);
+ this->ApplyDefaults();
+ Point pt = this->OnInitialPosition(this->nested_root->smallest_x, this->nested_root->smallest_y, window_number);
+ this->InitializePositionSize(pt.x, pt.y, this->nested_root->smallest_x, this->nested_root->smallest_y);
+ this->FindWindowPlacementAndResize(this->window_desc->GetDefaultWidth(), this->window_desc->GetDefaultHeight());
+}
+
+/**
+ * Perform complete initialization of the #Window with nested widgets, to allow use.
+ * @param window_number Number of the new window.
+ */
+void Window::InitNested(WindowNumber window_number)
+{
+ this->CreateNestedTree(false);
+ this->FinishInitNested(window_number);
+}
+
+/**
+ * Empty constructor, initialization has been moved to #InitNested() called from the constructor of the derived class.
+ * @param desc The description of the window.
+ */
+Window::Window(WindowDesc *desc) : window_desc(desc), scrolling_scrollbar(-1)
+{
+}
+
+/**
+ * Do a search for a window at specific coordinates. For this we start
+ * at the topmost window, obviously and work our way down to the bottom
+ * @param x position x to query
+ * @param y position y to query
+ * @return a pointer to the found window if any, NULL otherwise
+ */
+Window *FindWindowFromPt(int x, int y)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if (MayBeShown(w) && IsInsideBS(x, w->left, w->width) && IsInsideBS(y, w->top, w->height)) {
+ return w;
+ }
+ }
+
+ return NULL;
+}
+
+int SETTING_BUTTON_WIDTH = 20;
+int SETTING_BUTTON_HEIGHT = 10;
+
+/**
+ * Set button size of settings. If automatic sizing is also enabled, it also sets
+ * the sizing of buttons, scrollbars and font size (recommend restart).
+ * @todo Check if it can be moved to another file, so we do not need to include error, string and fontcache headers.
+ * @todo Fix magic numbers 16/18/20/30/32
+ */
+void CheckWindowMinSizings()
+{
+ if (_settings_client.gui.manage_min_sizing) {
+ /* Fill the min sizing values for the current resolution. */
+ uint swap_x = 32; // in longest border, let main toolbar to have 30 buttons.
+ uint swap_y = 16; // if short border, let main toolbar have 16/18/20 buttons..)
+ if (_cur_resolution.width < _cur_resolution.height) Swap(swap_x, swap_y);
+ _settings_client.gui.min_button = min(_cur_resolution.width / swap_x, _cur_resolution.height / swap_y);
+ _settings_client.gui.min_step = _settings_client.gui.min_button * 3 / 4;
+ }
+
+ SETTING_BUTTON_HEIGHT = max(GetMinSizing(NWST_STEP) - 10, 10);
+ SETTING_BUTTON_WIDTH = 2 * SETTING_BUTTON_HEIGHT;
+
+ extern uint _tooltip_width;
+ _tooltip_width = max(194, 10 * _settings_client.gui.min_button);
+
+ if (!_settings_client.gui.manage_min_sizing) return;
+
+ _freetype.large.size = _settings_client.gui.min_button;
+ _freetype.medium.size = max(_settings_client.gui.min_step * 2 / 3, 10U);
+ _freetype.mono.size = _freetype.medium.size;
+ _freetype.small.size = max(_freetype.medium.size * 2 / 3, 8U);
+
+ InitFreeType(true);
+ CheckForMissingGlyphs();
+
+ if (_z_front_window == NULL) return;
+
+ DeleteAllNonVitalWindows();
+
+ switch (_game_mode) {
+ default: break;
+ case GM_MENU:
+ DeleteWindowById(WC_SELECT_GAME, 0);
+ extern void ShowSelectGameWindow();
+ ShowSelectGameWindow();
+ break;
+
+ case GM_NORMAL:
+ case GM_EDITOR: {
+ Station *st;
+ FOR_ALL_STATIONS(st) { st->UpdateVirtCoord(); }
+ Waypoint *wp;
+ FOR_ALL_WAYPOINTS(wp) { wp->UpdateVirtCoord(); }
+
+ HideVitalWindows();
+ ShowVitalWindows();
+ break;
+ }
+ }
+
+ ShowErrorMessage(STR_ERROR_RESET_WINDOWS, STR_ERROR_AUTOMATIC_SIZING, WL_WARNING);
+}
+
+/**
+ * (re)initialize the windowing system
+ */
+void InitWindowSystem()
+{
+ IConsoleClose();
+
+ _z_back_window = NULL;
+ _z_front_window = NULL;
+ _focused_window = NULL;
+ _mouseover_last_w = NULL;
+ _last_scroll_window = NULL;
+ _scrolling_viewport = false;
+ _mouse_hovering = false;
+
+ NWidgetLeaf::InvalidateDimensionCache(); // Reset cached sizes of several widgets.
+ NWidgetScrollbar::InvalidateDimensionCache();
+
+ ShowFirstError();
+}
+
+/**
+ * Close down the windowing system
+ */
+void UnInitWindowSystem()
+{
+ UnshowCriticalError();
+
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) delete w;
+
+ for (w = _z_front_window; w != NULL; /* nothing */) {
+ Window *to_del = w;
+ w = w->z_back;
+ free(to_del);
+ }
+
+ _z_front_window = NULL;
+ _z_back_window = NULL;
+}
+
+/**
+ * Reset the windowing system, by means of shutting it down followed by re-initialization
+ */
+void ResetWindowSystem()
+{
+ UnInitWindowSystem();
+ InitWindowSystem();
+ _thd.Reset();
+}
+
+static void DecreaseWindowCounters()
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if (_scroller_click_timeout == 0) {
+ /* Unclick scrollbar buttons if they are pressed. */
+ for (uint i = 0; i < w->nested_array_size; i++) {
+ NWidgetBase *nwid = w->nested_array[i];
+ if (nwid != NULL && (nwid->type == NWID_HSCROLLBAR || nwid->type == NWID_VSCROLLBAR)) {
+ NWidgetScrollbar *sb = static_cast(nwid);
+ if (sb->disp_flags & (ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN)) {
+ sb->disp_flags &= ~(ND_SCROLLBAR_UP | ND_SCROLLBAR_DOWN);
+ w->scrolling_scrollbar = -1;
+ sb->SetDirty(w);
+ }
+ }
+ }
+ }
+
+ /* Handle editboxes */
+ for (SmallMap::Pair *it = w->querystrings.Begin(); it != w->querystrings.End(); ++it) {
+ it->second->HandleEditBox(w, it->first);
+ }
+
+ w->OnMouseLoop();
+ }
+
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if ((w->flags & WF_TIMEOUT) && --w->timeout_timer == 0) {
+ CLRBITS(w->flags, WF_TIMEOUT);
+
+ w->OnTimeout();
+ w->RaiseButtons(true);
+ }
+ }
+}
+
+static void HandlePlacePresize()
+{
+ if (_special_mouse_mode != WSM_PRESIZE) return;
+
+ Window *w = _thd.GetCallbackWnd();
+ if (w == NULL) return;
+
+ Point pt = GetTileBelowCursor();
+ if (pt.x == -1) {
+ _thd.selend.x = -1;
+ return;
+ }
+
+ w->OnPlacePresize(pt, TileVirtXY(pt.x, pt.y));
+}
+
+/**
+ * Handle dragging and dropping in mouse dragging mode (#WSM_DRAGDROP).
+ * @return State of handling the event.
+ */
+static EventState HandleMouseDragDrop()
+{
+ if (_special_mouse_mode != WSM_DRAGDROP) return ES_NOT_HANDLED;
+
+ if (_left_button_down && _cursor.delta.x == 0 && _cursor.delta.y == 0) return ES_HANDLED; // Dragging, but the mouse did not move.
+
+ Window *w = _thd.GetCallbackWnd();
+ if (w != NULL) {
+ /* Send an event in client coordinates. */
+ Point pt;
+ pt.x = _cursor.pos.x - w->left;
+ pt.y = _cursor.pos.y - w->top;
+ if (_left_button_down) {
+ w->OnMouseDrag(pt, GetWidgetFromPos(w, pt.x, pt.y));
+ } else {
+ w->OnDragDrop(pt, GetWidgetFromPos(w, pt.x, pt.y));
+ }
+ }
+
+ if (!_left_button_down) ResetObjectToPlace(); // Button released, finished dragging.
+ return ES_HANDLED;
+}
+
+/** Report position of the mouse to the underlying window. */
+static void HandleMouseOver()
+{
+ Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
+
+ /* We changed window, put a MOUSEOVER event to the last window */
+ if (_mouseover_last_w != NULL && _mouseover_last_w != w) {
+ /* Reset mouse-over coordinates of previous window */
+ Point pt = { -1, -1 };
+ _mouseover_last_w->OnMouseOver(pt, 0);
+ }
+
+ /* _mouseover_last_w will get reset when the window is deleted, see DeleteWindow() */
+ _mouseover_last_w = w;
+
+ if (w != NULL) {
+ /* send an event in client coordinates. */
+ Point pt = { _cursor.pos.x - w->left, _cursor.pos.y - w->top };
+ const NWidgetCore *widget = w->nested_root->GetWidgetFromPos(pt.x, pt.y);
+ if (widget != NULL) w->OnMouseOver(pt, widget->index);
+ }
+}
+
+/** The minimum number of pixels of the title bar must be visible in both the X or Y direction */
+static const int MIN_VISIBLE_TITLE_BAR = 13;
+
+/** Direction for moving the window. */
+enum PreventHideDirection {
+ PHD_UP, ///< Above v is a safe position.
+ PHD_DOWN, ///< Below v is a safe position.
+};
+
+/**
+ * Do not allow hiding of the rectangle with base coordinates \a nx and \a ny behind window \a v.
+ * If needed, move the window base coordinates to keep it visible.
+ * @param nx Base horizontal coordinate of the rectangle.
+ * @param ny Base vertical coordinate of the rectangle.
+ * @param rect Rectangle that must stay visible for #MIN_VISIBLE_TITLE_BAR pixels (horizontally, vertically, or both)
+ * @param v Window lying in front of the rectangle.
+ * @param px Previous horizontal base coordinate.
+ * @param dir If no room horizontally, move the rectangle to the indicated position.
+ */
+static void PreventHiding(int *nx, int *ny, const Rect &rect, const Window *v, int px, PreventHideDirection dir)
+{
+ if (v == NULL) return;
+
+ int v_bottom = v->top + v->height;
+ int v_right = v->left + v->width;
+ int safe_y = (dir == PHD_UP) ? (v->top - MIN_VISIBLE_TITLE_BAR - rect.top) : (v_bottom + MIN_VISIBLE_TITLE_BAR - rect.bottom); // Compute safe vertical position.
+
+ if (*ny + rect.top <= v->top - MIN_VISIBLE_TITLE_BAR) return; // Above v is enough space
+ if (*ny + rect.bottom >= v_bottom + MIN_VISIBLE_TITLE_BAR) return; // Below v is enough space
+
+ /* Vertically, the rectangle is hidden behind v. */
+ if (*nx + rect.left + MIN_VISIBLE_TITLE_BAR < v->left) { // At left of v.
+ if (v->left < MIN_VISIBLE_TITLE_BAR) *ny = safe_y; // But enough room, force it to a safe position.
+ return;
+ }
+ if (*nx + rect.right - MIN_VISIBLE_TITLE_BAR > v_right) { // At right of v.
+ if (v_right > _screen.width - MIN_VISIBLE_TITLE_BAR) *ny = safe_y; // Not enough room, force it to a safe position.
+ return;
+ }
+
+ /* Horizontally also hidden, force movement to a safe area. */
+ if (px + rect.left < v->left && v->left >= MIN_VISIBLE_TITLE_BAR) { // Coming from the left, and enough room there.
+ *nx = v->left - MIN_VISIBLE_TITLE_BAR - rect.left;
+ } else if (px + rect.right > v_right && v_right <= _screen.width - MIN_VISIBLE_TITLE_BAR) { // Coming from the right, and enough room there.
+ *nx = v_right + MIN_VISIBLE_TITLE_BAR - rect.right;
+ } else {
+ *ny = safe_y;
+ }
+}
+
+/**
+ * Make sure at least a part of the caption bar is still visible by moving
+ * the window if necessary.
+ * @param w The window to check.
+ * @param nx The proposed new x-location of the window.
+ * @param ny The proposed new y-location of the window.
+ */
+static void EnsureVisibleCaption(Window *w, int nx, int ny)
+{
+ /* Search for the title bar rectangle. */
+ Rect caption_rect;
+ const NWidgetBase *caption = w->nested_root->GetWidgetOfType(WWT_CAPTION);
+ if (caption != NULL) {
+ caption_rect.left = caption->pos_x;
+ caption_rect.right = caption->pos_x + caption->current_x;
+ caption_rect.top = caption->pos_y;
+ caption_rect.bottom = caption->pos_y + caption->current_y;
+
+ /* Make sure the window doesn't leave the screen */
+ nx = Clamp(nx, MIN_VISIBLE_TITLE_BAR - caption_rect.right, _screen.width - MIN_VISIBLE_TITLE_BAR - caption_rect.left);
+ ny = Clamp(ny, 0, _screen.height - MIN_VISIBLE_TITLE_BAR);
+
+ /* Make sure the title bar isn't hidden behind the main tool bar or the status bar. */
+ PreventHiding(&nx, &ny, caption_rect, FindWindowById(WC_MAIN_TOOLBAR, 0), w->left, PHD_DOWN);
+ PreventHiding(&nx, &ny, caption_rect, FindWindowById(WC_STATUS_BAR, 0), w->left, PHD_UP);
+ }
+
+ if (w->viewport != NULL) {
+ w->viewport->left += nx - w->left;
+ w->viewport->top += ny - w->top;
+ }
+
+ w->left = nx;
+ w->top = ny;
+}
+
+/**
+ * Resize the window.
+ * Update all the widgets of a window based on their resize flags
+ * Both the areas of the old window and the new sized window are set dirty
+ * ensuring proper redrawal.
+ * @param w Window to resize
+ * @param delta_x Delta x-size of changed window (positive if larger, etc.)
+ * @param delta_y Delta y-size of changed window
+ * @param clamp_to_screen Whether to make sure the whole window stays visible
+ */
+void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen)
+{
+ if (delta_x != 0 || delta_y != 0) {
+ if (clamp_to_screen) {
+ /* Determine the new right/bottom position. If that is outside of the bounds of
+ * the resolution clamp it in such a manner that it stays within the bounds. */
+ int new_right = w->left + w->width + delta_x;
+ int new_bottom = w->top + w->height + delta_y;
+ if (new_right >= (int)_cur_resolution.width) delta_x -= Ceil(new_right - _cur_resolution.width, max(1U, w->nested_root->resize_x));
+ if (new_bottom >= (int)_cur_resolution.height) delta_y -= Ceil(new_bottom - _cur_resolution.height, max(1U, w->nested_root->resize_y));
+ }
+
+ w->SetDirty();
+
+ uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
+ uint new_yinc = max(0, (w->nested_root->resize_y == 0) ? 0 : (int)(w->nested_root->current_y - w->nested_root->smallest_y) + delta_y);
+ assert(w->nested_root->resize_x == 0 || new_xinc % w->nested_root->resize_x == 0);
+ assert(w->nested_root->resize_y == 0 || new_yinc % w->nested_root->resize_y == 0);
+
+ w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _current_text_dir == TD_RTL);
+ w->width = w->nested_root->current_x;
+ w->height = w->nested_root->current_y;
+ }
+
+ EnsureVisibleCaption(w, w->left, w->top);
+
+ /* Always call OnResize to make sure everything is initialised correctly if it needs to be. */
+ w->OnResize();
+ w->SetDirty();
+}
+
+/**
+ * Return the top of the main view available for general use.
+ * @return Uppermost vertical coordinate available.
+ * @note Above the upper y coordinate is often the main toolbar.
+ */
+int GetMainViewTop()
+{
+ Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
+ return (w == NULL) ? 0 : w->top + w->height;
+}
+
+/**
+ * Return the bottom of the main view available for general use.
+ * @return The vertical coordinate of the first unusable row, so 'top + height <= bottom' gives the correct result.
+ * @note At and below the bottom y coordinate is often the status bar.
+ */
+int GetMainViewBottom()
+{
+ Window *w = FindWindowById(WC_STATUS_BAR, 0);
+ return (w == NULL) ? _screen.height : w->top;
+}
+
+static bool _dragging_window; ///< A window is being dragged or resized.
+
+/**
+ * Handle dragging/resizing of a window.
+ * @return State of handling the event.
+ */
+static EventState HandleWindowDragging()
+{
+ /* Get out immediately if no window is being dragged at all. */
+ if (!_dragging_window) return ES_NOT_HANDLED;
+
+ /* If button still down, but cursor hasn't moved, there is nothing to do. */
+ if (_left_button_down && _cursor.delta.x == 0 && _cursor.delta.y == 0) return ES_HANDLED;
+
+ /* Otherwise find the window... */
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->flags & WF_DRAGGING) {
+ /* Stop the dragging if the left mouse button was released */
+ if (!_left_button_down) {
+ w->flags &= ~WF_DRAGGING;
+ break;
+ }
+
+ w->SetDirty();
+
+ int x = _cursor.pos.x + _drag_delta.x;
+ int y = _cursor.pos.y + _drag_delta.y;
+ int nx = x;
+ int ny = y;
+
+ if (_settings_client.gui.window_snap_radius != 0) {
+ const Window *v;
+
+ int hsnap = _settings_client.gui.window_snap_radius;
+ int vsnap = _settings_client.gui.window_snap_radius;
+ int delta;
+
+ FOR_ALL_WINDOWS_FROM_BACK(v) {
+ if (v == w) continue; // Don't snap at yourself
+
+ if (y + w->height > v->top && y < v->top + v->height) {
+ /* Your left border <-> other right border */
+ delta = abs(v->left + v->width - x);
+ if (delta <= hsnap) {
+ nx = v->left + v->width;
+ hsnap = delta;
+ }
+
+ /* Your right border <-> other left border */
+ delta = abs(v->left - x - w->width);
+ if (delta <= hsnap) {
+ nx = v->left - w->width;
+ hsnap = delta;
+ }
+ }
+
+ if (w->top + w->height >= v->top && w->top <= v->top + v->height) {
+ /* Your left border <-> other left border */
+ delta = abs(v->left - x);
+ if (delta <= hsnap) {
+ nx = v->left;
+ hsnap = delta;
+ }
+
+ /* Your right border <-> other right border */
+ delta = abs(v->left + v->width - x - w->width);
+ if (delta <= hsnap) {
+ nx = v->left + v->width - w->width;
+ hsnap = delta;
+ }
+ }
+
+ if (x + w->width > v->left && x < v->left + v->width) {
+ /* Your top border <-> other bottom border */
+ delta = abs(v->top + v->height - y);
+ if (delta <= vsnap) {
+ ny = v->top + v->height;
+ vsnap = delta;
+ }
+
+ /* Your bottom border <-> other top border */
+ delta = abs(v->top - y - w->height);
+ if (delta <= vsnap) {
+ ny = v->top - w->height;
+ vsnap = delta;
+ }
+ }
+
+ if (w->left + w->width >= v->left && w->left <= v->left + v->width) {
+ /* Your top border <-> other top border */
+ delta = abs(v->top - y);
+ if (delta <= vsnap) {
+ ny = v->top;
+ vsnap = delta;
+ }
+
+ /* Your bottom border <-> other bottom border */
+ delta = abs(v->top + v->height - y - w->height);
+ if (delta <= vsnap) {
+ ny = v->top + v->height - w->height;
+ vsnap = delta;
+ }
+ }
+ }
+ }
+
+ EnsureVisibleCaption(w, nx, ny);
+
+ w->SetDirty();
+ return ES_HANDLED;
+ } else if (w->flags & WF_SIZING) {
+ /* Stop the sizing if the left mouse button was released */
+ if (!_left_button_down) {
+ w->flags &= ~WF_SIZING;
+ w->SetDirty();
+ break;
+ }
+
+ /* Compute difference in pixels between cursor position and reference point in the window.
+ * If resizing the left edge of the window, moving to the left makes the window bigger not smaller.
+ */
+ int x, y = _cursor.pos.y - _drag_delta.y;
+ if (w->flags & WF_SIZING_LEFT) {
+ x = _drag_delta.x - _cursor.pos.x;
+ } else {
+ x = _cursor.pos.x - _drag_delta.x;
+ }
+
+ /* resize.step_width and/or resize.step_height may be 0, which means no resize is possible. */
+ if (w->resize.step_width == 0) x = 0;
+ if (w->resize.step_height == 0) y = 0;
+
+ /* Check the resize button won't go past the bottom of the screen */
+ if (w->top + w->height + y > _screen.height) {
+ y = _screen.height - w->height - w->top;
+ }
+
+ /* X and Y has to go by step.. calculate it.
+ * The cast to int is necessary else x/y are implicitly casted to
+ * unsigned int, which won't work. */
+ if (w->resize.step_width > 1) x -= x % (int)w->resize.step_width;
+ if (w->resize.step_height > 1) y -= y % (int)w->resize.step_height;
+
+ /* Check that we don't go below the minimum set size */
+ if ((int)w->width + x < (int)w->nested_root->smallest_x) {
+ x = w->nested_root->smallest_x - w->width;
+ }
+ if ((int)w->height + y < (int)w->nested_root->smallest_y) {
+ y = w->nested_root->smallest_y - w->height;
+ }
+
+ /* Window already on size */
+ if (x == 0 && y == 0) return ES_HANDLED;
+
+ /* Now find the new cursor pos.. this is NOT _cursor, because we move in steps. */
+ _drag_delta.y += y;
+ if ((w->flags & WF_SIZING_LEFT) && x != 0) {
+ _drag_delta.x -= x; // x > 0 -> window gets longer -> left-edge moves to left -> subtract x to get new position.
+ w->SetDirty();
+ w->left -= x; // If dragging left edge, move left window edge in opposite direction by the same amount.
+ /* ResizeWindow() below ensures marking new position as dirty. */
+ } else {
+ _drag_delta.x += x;
+ }
+
+ /* ResizeWindow sets both pre- and after-size to dirty for redrawal */
+ ResizeWindow(w, x, y);
+ return ES_HANDLED;
+ }
+ }
+
+ _dragging_window = false;
+ return ES_HANDLED;
+}
+
+/**
+ * Start window dragging
+ * @param w Window to start dragging
+ */
+static void StartWindowDrag(Window *w)
+{
+ w->flags |= WF_DRAGGING;
+ w->flags &= ~WF_CENTERED;
+ _dragging_window = true;
+
+ _drag_delta.x = w->left - _cursor.pos.x;
+ _drag_delta.y = w->top - _cursor.pos.y;
+
+ BringWindowToFront(w);
+ DeleteWindowById(WC_DROPDOWN_MENU, 0);
+}
+
+/**
+ * Start resizing a window.
+ * @param w Window to start resizing.
+ * @param to_left Whether to drag towards the left or not
+ */
+static void StartWindowSizing(Window *w, bool to_left)
+{
+ w->flags |= to_left ? WF_SIZING_LEFT : WF_SIZING_RIGHT;
+ w->flags &= ~WF_CENTERED;
+ _dragging_window = true;
+
+ _drag_delta.x = _cursor.pos.x;
+ _drag_delta.y = _cursor.pos.y;
+
+ BringWindowToFront(w);
+ DeleteWindowById(WC_DROPDOWN_MENU, 0);
+}
+
+/**
+ * handle scrollbar scrolling with the mouse.
+ * @return State of handling the event.
+ */
+static EventState HandleScrollbarScrolling()
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->scrolling_scrollbar >= 0) {
+ /* Abort if no button is clicked any more. */
+ if (!_left_button_down) {
+ w->scrolling_scrollbar = -1;
+ w->SetDirty();
+ return ES_HANDLED;
+ }
+
+ int i;
+ NWidgetScrollbar *sb = w->GetWidget(w->scrolling_scrollbar);
+ bool rtl = false;
+
+ if (sb->type == NWID_HSCROLLBAR) {
+ i = _cursor.pos.x - _cursorpos_drag_start.x;
+ rtl = _current_text_dir == TD_RTL;
+ } else {
+ i = _cursor.pos.y - _cursorpos_drag_start.y;
+ }
+
+ if (sb->disp_flags & ND_SCROLLBAR_BTN) {
+ if (_scroller_click_timeout == 1) {
+ _scroller_click_timeout = 3;
+ sb->UpdatePosition(rtl == HasBit(sb->disp_flags, NDB_SCROLLBAR_UP) ? 1 : -1);
+ w->SetDirty();
+ }
+ return ES_HANDLED;
+ }
+
+ /* Find the item we want to move to and make sure it's inside bounds. */
+ int pos = min(max(0, i + _scrollbar_start_pos) * sb->GetCount() / _scrollbar_size, max(0, sb->GetCount() - sb->GetCapacity()));
+ if (rtl) pos = max(0, sb->GetCount() - sb->GetCapacity() - pos);
+ if (pos != sb->GetPosition()) {
+ sb->SetPosition(pos);
+ w->SetDirty();
+ }
+ return ES_HANDLED;
+ }
+ }
+
+ return ES_NOT_HANDLED;
+}
+
+/**
+ * Handle viewport scrolling with the mouse.
+ * @return State of handling the event.
+ */
+static EventState HandleViewportScroll()
+{
+ bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
+
+ if (!_scrolling_viewport) return ES_NOT_HANDLED;
+
+ /* When we don't have a last scroll window we are starting to scroll.
+ * When the last scroll window and this are not the same we went
+ * outside of the window and should not left-mouse scroll anymore. */
+ if (_last_scroll_window == NULL) _last_scroll_window = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
+
+
+ if (_last_scroll_window == NULL || !(_right_button_down || scrollwheel_scrolling ||
+ (_left_button_down && (_move_pressed || _settings_client.gui.left_mouse_btn_scrolling)))) {
+ _cursor.fix_at = false;
+ _scrolling_viewport = false;
+ _last_scroll_window = NULL;
+ return ES_NOT_HANDLED;
+ }
+
+ if (_last_scroll_window == FindWindowById(WC_MAIN_WINDOW, 0) && _last_scroll_window->viewport->follow_vehicle != INVALID_VEHICLE) {
+ /* If the main window is following a vehicle, then first let go of it! */
+ const Vehicle *veh = Vehicle::Get(_last_scroll_window->viewport->follow_vehicle);
+ ScrollMainWindowTo(veh->x_pos, veh->y_pos, veh->z_pos, true); // This also resets follow_vehicle
+ return ES_NOT_HANDLED;
+ }
+
+ Point delta;
+ if (_settings_client.gui.reverse_scroll || (_settings_client.gui.left_mouse_btn_scrolling && _left_button_down)) {
+ delta.x = -_cursor.delta.x;
+ delta.y = -_cursor.delta.y;
+ } else {
+ delta.x = _cursor.delta.x;
+ delta.y = _cursor.delta.y;
+ }
+
+ if (scrollwheel_scrolling) {
+ /* We are using scrollwheels for scrolling */
+ delta.x = _cursor.h_wheel;
+ delta.y = _cursor.v_wheel;
+ _cursor.v_wheel = 0;
+ _cursor.h_wheel = 0;
+ }
+
+ /* Create a scroll-event and send it to the window */
+ if (delta.x != 0 || delta.y != 0) _last_scroll_window->OnScroll(delta);
+
+ _cursor.delta.x = 0;
+ _cursor.delta.y = 0;
+ return ES_HANDLED;
+}
+
+/**
+ * Check if a window can be made relative top-most window, and if so do
+ * it. If a window does not obscure any other windows, it will not
+ * be brought to the foreground. Also if the only obscuring windows
+ * are so-called system-windows, the window will not be moved.
+ * The function will return false when a child window of this window is a
+ * modal-popup; function returns a false and child window gets a white border
+ * @param w Window to bring relatively on-top
+ * @return false if the window has an active modal child, true otherwise
+ */
+static bool MaybeBringWindowToFront(Window *w)
+{
+ bool bring_to_front = false;
+
+ if (w->window_class == WC_MAIN_WINDOW ||
+ IsVitalWindow(w) ||
+ w->window_class == WC_TOOLTIPS ||
+ w->window_class == WC_DROPDOWN_MENU) {
+ return true;
+ }
+
+ /* Use unshaded window size rather than current size for shaded windows. */
+ int w_width = w->width;
+ int w_height = w->height;
+ if (w->IsShaded()) {
+ w_width = w->unshaded_size.width;
+ w_height = w->unshaded_size.height;
+ }
+
+ Window *u;
+ FOR_ALL_WINDOWS_FROM_BACK_FROM(u, w->z_front) {
+ /* A modal child will prevent the activation of the parent window */
+ if (u->parent == w && (u->window_desc->flags & WDF_MODAL)) {
+ u->SetWhiteBorder();
+ u->SetDirty();
+ return false;
+ }
+
+ if (u->window_class == WC_MAIN_WINDOW ||
+ IsVitalWindow(u) ||
+ u->window_class == WC_TOOLTIPS ||
+ u->window_class == WC_DROPDOWN_MENU) {
+ continue;
+ }
+
+ /* Window sizes don't interfere, leave z-order alone */
+ if (w->left + w_width <= u->left ||
+ u->left + u->width <= w->left ||
+ w->top + w_height <= u->top ||
+ u->top + u->height <= w->top) {
+ continue;
+ }
+
+ bring_to_front = true;
+ }
+
+ if (bring_to_front) BringWindowToFront(w);
+ return true;
+}
+
+/**
+ * Process keypress for editbox widget.
+ * @param wid Editbox widget.
+ * @param key the Unicode value of the key.
+ * @param keycode the untranslated key code including shift state.
+ * @return #ES_HANDLED if the key press has been handled and no other
+ * window should receive the event.
+ */
+EventState Window::HandleEditBoxKey(int wid, WChar key, uint16 keycode)
+{
+ QueryString *query = this->GetQueryString(wid);
+ if (query == NULL) return ES_NOT_HANDLED;
+
+ int action = QueryString::ACTION_NOTHING;
+
+ switch (query->text.HandleKeyPress(key, keycode)) {
+ case HKPR_EDITING:
+ this->SetWidgetDirty(wid);
+ this->OnEditboxChanged(wid);
+ break;
+
+ case HKPR_CURSOR:
+ this->SetWidgetDirty(wid);
+ /* For the OSK also invalidate the parent window */
+ if (this->window_class == WC_OSK) this->InvalidateData();
+ break;
+
+ case HKPR_CONFIRM:
+ if (this->window_class == WC_OSK) {
+ this->OnClick(Point(), WID_OSK_OK, 1);
+ } else if (query->ok_button >= 0) {
+ this->OnClick(Point(), query->ok_button, 1);
+ } else {
+ action = query->ok_button;
+ }
+ break;
+
+ case HKPR_CANCEL:
+ if (this->window_class == WC_OSK) {
+ this->OnClick(Point(), WID_OSK_CANCEL, 1);
+ } else if (query->cancel_button >= 0) {
+ this->OnClick(Point(), query->cancel_button, 1);
+ } else {
+ action = query->cancel_button;
+ }
+ break;
+
+ case HKPR_NOT_HANDLED:
+ return ES_NOT_HANDLED;
+
+ default: break;
+ }
+
+ switch (action) {
+ case QueryString::ACTION_DESELECT:
+ this->UnfocusFocusedWidget();
+ break;
+
+ case QueryString::ACTION_CLEAR:
+ if (query->text.bytes <= 1) {
+ /* If already empty, unfocus instead */
+ this->UnfocusFocusedWidget();
+ } else {
+ query->text.DeleteAll();
+ this->SetWidgetDirty(wid);
+ this->OnEditboxChanged(wid);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return ES_HANDLED;
+}
+
+/**
+ * Handle keyboard input.
+ * @param keycode Virtual keycode of the key.
+ * @param key Unicode character of the key.
+ */
+void HandleKeypress(uint keycode, WChar key)
+{
+ /* World generation is multithreaded and messes with companies.
+ * But there is no company related window open anyway, so _current_company is not used. */
+ assert(HasModalProgress() || IsLocalCompany());
+
+ /*
+ * The Unicode standard defines an area called the private use area. Code points in this
+ * area are reserved for private use and thus not portable between systems. For instance,
+ * Apple defines code points for the arrow keys in this area, but these are only printable
+ * on a system running OS X. We don't want these keys to show up in text fields and such,
+ * and thus we have to clear the unicode character when we encounter such a key.
+ */
+ if (key >= 0xE000 && key <= 0xF8FF) key = 0;
+
+ /*
+ * If both key and keycode is zero, we don't bother to process the event.
+ */
+ if (key == 0 && keycode == 0) return;
+
+ /* Check if the focused window has a focused editbox */
+ if (EditBoxInGlobalFocus()) {
+ /* All input will in this case go to the focused editbox */
+ if (_focused_window->window_class == WC_CONSOLE) {
+ if (_focused_window->OnKeyPress(key, keycode) == ES_HANDLED) return;
+ } else {
+ if (_focused_window->HandleEditBoxKey(_focused_window->nested_focus->index, key, keycode) == ES_HANDLED) return;
+ }
+ }
+
+ /* Call the event, start with the uppermost window, but ignore the toolbar. */
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if (w->window_class == WC_MAIN_TOOLBAR) continue;
+ if (w->window_desc->hotkeys != NULL) {
+ int hotkey = w->window_desc->hotkeys->CheckMatch(keycode);
+ if (hotkey >= 0 && w->OnHotkey(hotkey) == ES_HANDLED) return;
+ }
+ if (w->OnKeyPress(key, keycode) == ES_HANDLED) return;
+ }
+
+ w = FindWindowById(WC_MAIN_TOOLBAR, 0);
+ /* When there is no toolbar w is null, check for that */
+ if (w != NULL) {
+ if (w->window_desc->hotkeys != NULL) {
+ int hotkey = w->window_desc->hotkeys->CheckMatch(keycode);
+ if (hotkey >= 0 && w->OnHotkey(hotkey) == ES_HANDLED) return;
+ }
+ if (w->OnKeyPress(key, keycode) == ES_HANDLED) return;
+ }
+
+ HandleGlobalHotkeys(key, keycode);
+}
+
+/**
+ * State of CONTROL key has changed
+ */
+void HandleCtrlChanged()
+{
+ /* Call the event, start with the uppermost window. */
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if (w->OnCTRLStateChange() == ES_HANDLED) return;
+ }
+}
+
+/**
+ * Insert a text string at the cursor position into the edit box widget.
+ * @param wid Edit box widget.
+ * @param str Text string to insert.
+ */
+/* virtual */ void Window::InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end)
+{
+ QueryString *query = this->GetQueryString(wid);
+ if (query == NULL) return;
+
+ if (query->text.InsertString(str, marked, caret, insert_location, replacement_end) || marked) {
+ this->SetWidgetDirty(wid);
+ this->OnEditboxChanged(wid);
+ }
+}
+
+/**
+ * Handle text input.
+ * @param str Text string to input.
+ * @param marked Is the input a marked composition string from an IME?
+ * @param caret Move the caret to this point in the insertion string.
+ */
+void HandleTextInput(const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end)
+{
+ if (!EditBoxInGlobalFocus()) return;
+
+ _focused_window->InsertTextString(_focused_window->window_class == WC_CONSOLE ? 0 : _focused_window->nested_focus->index, str, marked, caret, insert_location, replacement_end);
+}
+
+/**
+ * Local counter that is incremented each time an mouse input event is detected.
+ * The counter is used to stop auto-scrolling.
+ * @see HandleAutoscroll()
+ * @see HandleMouseEvents()
+ */
+static int _input_events_this_tick = 0;
+
+/**
+ * If needed and switched on, perform auto scrolling (automatically
+ * moving window contents when mouse is near edge of the window).
+ */
+static void HandleAutoscroll()
+{
+ if (_game_mode == GM_MENU || HasModalProgress()) return;
+ if (_settings_client.gui.auto_scrolling == VA_DISABLED) return;
+ if (_settings_client.gui.auto_scrolling == VA_MAIN_VIEWPORT_FULLSCREEN && !_fullscreen) return;
+
+ int x = _cursor.pos.x;
+ int y = _cursor.pos.y;
+ Window *w = FindWindowFromPt(x, y);
+ if (w == NULL || w->flags & WF_DISABLE_VP_SCROLL) return;
+ if (_settings_client.gui.auto_scrolling != VA_EVERY_VIEWPORT && w->window_class != WC_MAIN_WINDOW) return;
+
+ ViewPort *vp = IsPtInWindowViewport(w, x, y);
+ if (vp == NULL) return;
+
+ x -= vp->left;
+ y -= vp->top;
+
+ /* here allows scrolling in both x and y axis */
+#define scrollspeed 3
+ if (x - 15 < 0) {
+ w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * scrollspeed, vp->zoom);
+ } else if (15 - (vp->width - x) > 0) {
+ w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * scrollspeed, vp->zoom);
+ }
+ if (y - 15 < 0) {
+ w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * scrollspeed, vp->zoom);
+ } else if (15 - (vp->height - y) > 0) {
+ w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * scrollspeed, vp->zoom);
+ }
+#undef scrollspeed
+}
+
+enum MouseClick {
+ MC_NONE = 0,
+ MC_LEFT,
+ MC_RIGHT,
+ MC_DOUBLE_LEFT,
+ MC_HOVER,
+
+ MAX_OFFSET_DOUBLE_CLICK = 5, ///< How much the mouse is allowed to move to call it a double click
+ TIME_BETWEEN_DOUBLE_CLICK = 500, ///< Time between 2 left clicks before it becoming a double click, in ms
+ MAX_OFFSET_HOVER = 5, ///< Maximum mouse movement before stopping a hover event.
+};
+extern EventState VpHandlePlaceSizingDrag();
+
+static void ScrollMainViewport(int x, int y)
+{
+ if (_game_mode != GM_MENU) {
+ Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
+ assert(w);
+
+ w->viewport->dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
+ w->viewport->dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
+ }
+}
+
+/**
+ * Describes all the different arrow key combinations the game allows
+ * when it is in scrolling mode.
+ * The real arrow keys are bitwise numbered as
+ * 1 = left
+ * 2 = up
+ * 4 = right
+ * 8 = down
+ */
+static const int8 scrollamt[16][2] = {
+ { 0, 0}, ///< no key specified
+ {-2, 0}, ///< 1 : left
+ { 0, -2}, ///< 2 : up
+ {-2, -1}, ///< 3 : left + up
+ { 2, 0}, ///< 4 : right
+ { 0, 0}, ///< 5 : left + right = nothing
+ { 2, -1}, ///< 6 : right + up
+ { 0, -2}, ///< 7 : right + left + up = up
+ { 0, 2}, ///< 8 : down
+ {-2, 1}, ///< 9 : down + left
+ { 0, 0}, ///< 10 : down + up = nothing
+ {-2, 0}, ///< 11 : left + up + down = left
+ { 2, 1}, ///< 12 : down + right
+ { 0, 2}, ///< 13 : left + right + down = down
+ { 2, 0}, ///< 14 : right + up + down = right
+ { 0, 0}, ///< 15 : left + up + right + down = nothing
+};
+
+static void HandleKeyScrolling()
+{
+ /*
+ * Check that any of the dirkeys is pressed and that the focused window
+ * doesn't have an edit-box as focused widget.
+ */
+ if (_dirkeys && !EditBoxInGlobalFocus()) {
+ int factor = _shift_pressed ? 50 : 10;
+ ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor);
+ }
+}
+
+static void MouseLoop(MouseClick click, int mousewheel)
+{
+ /* World generation is multithreaded and messes with companies.
+ * But there is no company related window open anyway, so _current_company is not used. */
+ assert(HasModalProgress() || IsLocalCompany());
+
+ int x = _cursor.pos.x;
+ int y = _cursor.pos.y;
+ Window *w = FindWindowFromPt(x, y);
+ if (w == NULL) return;
+ ViewPort *vp = IsPtInWindowViewport(w, x, y);
+
+ HandlePlacePresize();
+ UpdateTileSelection();
+
+ if (VpHandlePlaceSizingDrag() == ES_HANDLED) return;
+ if (HandleMouseDragDrop() == ES_HANDLED) return;
+ if (HandleWindowDragging() == ES_HANDLED) return;
+ if (HandleScrollbarScrolling() == ES_HANDLED) return;
+ if (HandleViewportScroll() == ES_HANDLED) return;
+
+ HandleMouseOver();
+
+ bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
+ if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return;
+
+ if (w == NULL) return;
+
+ if (click != MC_NONE && click != MC_HOVER && !MaybeBringWindowToFront(w)) return;
+
+ /* Don't allow any action in a viewport if either in menu or when having a modal progress window */
+ if (vp != NULL && (_game_mode == GM_MENU || HasModalProgress())) return;
+
+ if (mousewheel != 0) {
+ /* Send mousewheel event to window */
+ w->OnMouseWheel(mousewheel);
+
+ /* Dispatch a MouseWheelEvent for widgets if it is not a viewport */
+ if (vp == NULL) DispatchMouseWheelEvent(w, w->nested_root->GetWidgetFromPos(x - w->left, y - w->top), mousewheel);
+ }
+
+ if (vp != NULL) {
+ if (scrollwheel_scrolling) click = MC_RIGHT; // we are using the scrollwheel in a viewport, so we emulate right mouse button
+ switch (click) {
+ case MC_DOUBLE_LEFT:
+ case MC_LEFT:
+ DEBUG(misc, 2, "Cursor: 0x%X (%d)", _cursor.sprite, _cursor.sprite);
+ if (!HandleViewportClicked(vp, x, y) &&
+ !(w->flags & WF_DISABLE_VP_SCROLL) &&
+ (_settings_client.gui.left_mouse_btn_scrolling || _move_pressed)) {
+ _scrolling_viewport = true;
+ _cursor.fix_at = false;
+ }
+ break;
+
+ case MC_RIGHT:
+ if (!(w->flags & WF_DISABLE_VP_SCROLL)) {
+ _scrolling_viewport = true;
+ _cursor.fix_at = true;
+
+ /* clear 2D scrolling caches before we start a 2D scroll */
+ _cursor.h_wheel = 0;
+ _cursor.v_wheel = 0;
+ }
+ break;
+
+ default:
+ break;
+ }
+ } else {
+ switch (click) {
+ case MC_LEFT:
+ case MC_DOUBLE_LEFT:
+ DispatchLeftClickEvent(w, x - w->left, y - w->top, click == MC_DOUBLE_LEFT ? 2 : 1);
+ break;
+
+ default:
+ if (!scrollwheel_scrolling || w == NULL || w->window_class != WC_SMALLMAP) break;
+ /* We try to use the scrollwheel to scroll since we didn't touch any of the buttons.
+ * Simulate a right button click so we can get started. */
+ /* FALL THROUGH */
+
+ case MC_RIGHT: DispatchRightClickEvent(w, x - w->left, y - w->top); break;
+
+ case MC_HOVER: DispatchHoverEvent(w, x - w->left, y - w->top); break;
+ }
+ }
+}
+
+/**
+ * Handle a mouse event from the video driver
+ */
+void HandleMouseEvents()
+{
+ /* World generation is multithreaded and messes with companies.
+ * But there is no company related window open anyway, so _current_company is not used. */
+ assert(HasModalProgress() || IsLocalCompany());
+
+ static int double_click_time = 0;
+ static Point double_click_pos = {0, 0};
+
+ /* Mouse event? */
+ MouseClick click = MC_NONE;
+ if (_left_button_down && !_left_button_clicked) {
+ click = MC_LEFT;
+ if (double_click_time != 0 && _realtime_tick - double_click_time < TIME_BETWEEN_DOUBLE_CLICK &&
+ double_click_pos.x != 0 && abs(_cursor.pos.x - double_click_pos.x) < MAX_OFFSET_DOUBLE_CLICK &&
+ double_click_pos.y != 0 && abs(_cursor.pos.y - double_click_pos.y) < MAX_OFFSET_DOUBLE_CLICK) {
+ click = MC_DOUBLE_LEFT;
+ }
+ double_click_time = _realtime_tick;
+ double_click_pos = _cursor.pos;
+ _left_button_clicked = true;
+ _input_events_this_tick++;
+ } else if (_right_button_clicked) {
+ _right_button_clicked = false;
+ click = MC_RIGHT;
+ _input_events_this_tick++;
+ }
+
+ int mousewheel = 0;
+ if (_cursor.wheel) {
+ mousewheel = _cursor.wheel;
+ _cursor.wheel = 0;
+ _input_events_this_tick++;
+ }
+
+ static uint32 hover_time = 0;
+ static Point hover_pos = {0, 0};
+
+ if (_settings_client.gui.hover_delay > 0) {
+ if (!_cursor.in_window || click != MC_NONE || mousewheel != 0 || _left_button_down || _right_button_down ||
+ hover_pos.x == 0 || abs(_cursor.pos.x - hover_pos.x) >= MAX_OFFSET_HOVER ||
+ hover_pos.y == 0 || abs(_cursor.pos.y - hover_pos.y) >= MAX_OFFSET_HOVER) {
+ hover_pos = _cursor.pos;
+ hover_time = _realtime_tick;
+ _mouse_hovering = false;
+ } else {
+ if (hover_time != 0 && _realtime_tick > hover_time + _settings_client.gui.hover_delay * 1000) {
+ click = MC_HOVER;
+ _input_events_this_tick++;
+ _mouse_hovering = true;
+ }
+ }
+ }
+
+ /* Handle sprite picker before any GUI interaction */
+ if (_newgrf_debug_sprite_picker.mode == SPM_REDRAW && _newgrf_debug_sprite_picker.click_time != _realtime_tick) {
+ /* Next realtime tick? Then redraw has finished */
+ _newgrf_debug_sprite_picker.mode = SPM_NONE;
+ InvalidateWindowData(WC_SPRITE_ALIGNER, 0, 1);
+ }
+
+ if (click == MC_LEFT && _newgrf_debug_sprite_picker.mode == SPM_WAIT_CLICK) {
+ /* Mark whole screen dirty, and wait for the next realtime tick, when drawing is finished. */
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
+ _newgrf_debug_sprite_picker.clicked_pixel = blitter->MoveTo(_screen.dst_ptr, _cursor.pos.x, _cursor.pos.y);
+ _newgrf_debug_sprite_picker.click_time = _realtime_tick;
+ _newgrf_debug_sprite_picker.sprites.Clear();
+ _newgrf_debug_sprite_picker.mode = SPM_REDRAW;
+ MarkWholeScreenDirty();
+ } else {
+ MouseLoop(click, mousewheel);
+ }
+
+ /* We have moved the mouse the required distance,
+ * no need to move it at any later time. */
+ _cursor.delta.x = 0;
+ _cursor.delta.y = 0;
+}
+
+/**
+ * Check the soft limit of deletable (non vital, non sticky) windows.
+ */
+static void CheckSoftLimit()
+{
+ if (_settings_client.gui.window_soft_limit == 0) return;
+
+ for (;;) {
+ uint deletable_count = 0;
+ Window *w, *last_deletable = NULL;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if (w->window_class == WC_MAIN_WINDOW || IsVitalWindow(w) || (w->flags & WF_STICKY)) continue;
+
+ last_deletable = w;
+ deletable_count++;
+ }
+
+ /* We've not reached the soft limit yet. */
+ if (deletable_count <= _settings_client.gui.window_soft_limit) break;
+
+ assert(last_deletable != NULL);
+ delete last_deletable;
+ }
+}
+
+/**
+ * Regular call from the global game loop
+ */
+void InputLoop()
+{
+ /* World generation is multithreaded and messes with companies.
+ * But there is no company related window open anyway, so _current_company is not used. */
+ assert(HasModalProgress() || IsLocalCompany());
+
+ CheckSoftLimit();
+ HandleKeyScrolling();
+
+ /* Do the actual free of the deleted windows. */
+ for (Window *v = _z_front_window; v != NULL; /* nothing */) {
+ Window *w = v;
+ v = v->z_back;
+
+ if (w->window_class != WC_INVALID) continue;
+
+ RemoveWindowFromZOrdering(w);
+ free(w);
+ }
+
+ if (_scroller_click_timeout != 0) _scroller_click_timeout--;
+ DecreaseWindowCounters();
+
+ if (_input_events_this_tick != 0) {
+ /* The input loop is called only once per GameLoop() - so we can clear the counter here */
+ _input_events_this_tick = 0;
+ /* there were some inputs this tick, don't scroll ??? */
+ return;
+ }
+
+ /* HandleMouseEvents was already called for this tick */
+ HandleMouseEvents();
+ HandleAutoscroll();
+}
+
+/**
+ * Update the continuously changing contents of the windows, such as the viewports
+ */
+void UpdateWindows()
+{
+ Window *w;
+
+ static int highlight_timer = 1;
+ if (--highlight_timer == 0) {
+ highlight_timer = 15;
+ _window_highlight_colour = !_window_highlight_colour;
+ }
+
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ w->ProcessScheduledInvalidations();
+ w->ProcessHighlightedInvalidations();
+ }
+
+ static int we4_timer = 0;
+ int t = we4_timer + 1;
+
+ if (t >= 100) {
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ w->OnHundredthTick();
+ }
+ t = 0;
+ }
+ we4_timer = t;
+
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ if ((w->flags & WF_WHITE_BORDER) && --w->white_border_timer == 0) {
+ CLRBITS(w->flags, WF_WHITE_BORDER);
+ w->SetDirty();
+ }
+ }
+
+ DrawDirtyBlocks();
+
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ /* Update viewport only if window is not shaded. */
+ if (w->viewport != NULL && !w->IsShaded()) UpdateViewportPosition(w);
+ }
+ NetworkDrawChatMessage();
+ /* Redraw mouse cursor in case it was hidden */
+ DrawMouseCursor();
+}
+
+/**
+ * Mark window as dirty (in need of repainting)
+ * @param cls Window class
+ * @param number Window number in that class
+ */
+void SetWindowDirty(WindowClass cls, WindowNumber number)
+{
+ const Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls && w->window_number == number) w->SetDirty();
+ }
+}
+
+/**
+ * Mark a particular widget in a particular window as dirty (in need of repainting)
+ * @param cls Window class
+ * @param number Window number in that class
+ * @param widget_index Index number of the widget that needs repainting
+ */
+void SetWindowWidgetDirty(WindowClass cls, WindowNumber number, byte widget_index)
+{
+ const Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls && w->window_number == number) {
+ w->SetWidgetDirty(widget_index);
+ }
+ }
+}
+
+/**
+ * Mark all windows of a particular class as dirty (in need of repainting)
+ * @param cls Window class
+ */
+void SetWindowClassesDirty(WindowClass cls)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls) w->SetDirty();
+ }
+}
+
+/**
+ * Mark this window's data as invalid (in need of re-computing)
+ * @param data The data to invalidate with
+ * @param gui_scope Whether the function is called from GUI scope.
+ */
+void Window::InvalidateData(int data, bool gui_scope)
+{
+ this->SetDirty();
+ if (!gui_scope) {
+ /* Schedule GUI-scope invalidation for next redraw. */
+ *this->scheduled_invalidation_data.Append() = data;
+ }
+ this->OnInvalidateData(data, gui_scope);
+}
+
+/**
+ * Process all scheduled invalidations.
+ */
+void Window::ProcessScheduledInvalidations()
+{
+ for (int *data = this->scheduled_invalidation_data.Begin(); this->window_class != WC_INVALID && data != this->scheduled_invalidation_data.End(); data++) {
+ this->OnInvalidateData(*data, true);
+ }
+ this->scheduled_invalidation_data.Clear();
+}
+
+/**
+ * Process all invalidation of highlighted widgets.
+ */
+void Window::ProcessHighlightedInvalidations()
+{
+ if ((this->flags & WF_HIGHLIGHTED) == 0) return;
+
+ for (uint i = 0; i < this->nested_array_size; i++) {
+ if (this->IsWidgetHighlighted(i)) this->SetWidgetDirty(i);
+ }
+}
+
+/**
+ * Mark window data of the window of a given class and specific window number as invalid (in need of re-computing)
+ *
+ * Note that by default the invalidation is not considered to be called from GUI scope.
+ * That means only a part of invalidation is executed immediately. The rest is scheduled for the next redraw.
+ * The asynchronous execution is important to prevent GUI code being executed from command scope.
+ * When not in GUI-scope:
+ * - OnInvalidateData() may not do test-runs on commands, as they might affect the execution of
+ * the command which triggered the invalidation. (town rating and such)
+ * - OnInvalidateData() may not rely on _current_company == _local_company.
+ * This implies that no NewGRF callbacks may be run.
+ *
+ * However, when invalidations are scheduled, then multiple calls may be scheduled before execution starts. Earlier scheduled
+ * invalidations may be called with invalidation-data, which is already invalid at the point of execution.
+ * That means some stuff requires to be executed immediately in command scope, while not everything may be executed in command
+ * scope. While GUI-scope calls have no restrictions on what they may do, they cannot assume the game to still be in the state
+ * when the invalidation was scheduled; passed IDs may have got invalid in the mean time.
+ *
+ * Finally, note that invalidations triggered from commands or the game loop result in OnInvalidateData() being called twice.
+ * Once in command-scope, once in GUI-scope. So make sure to not process differential-changes twice.
+ *
+ * @param cls Window class
+ * @param number Window number within the class
+ * @param data The data to invalidate with
+ * @param gui_scope Whether the call is done from GUI scope
+ */
+void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls && w->window_number == number) {
+ w->InvalidateData(data, gui_scope);
+ }
+ }
+}
+
+/**
+ * Mark window data of all windows of a given class as invalid (in need of re-computing)
+ * Note that by default the invalidation is not considered to be called from GUI scope.
+ * See InvalidateWindowData() for details on GUI-scope vs. command-scope.
+ * @param cls Window class
+ * @param data The data to invalidate with
+ * @param gui_scope Whether the call is done from GUI scope
+ */
+void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
+{
+ Window *w;
+
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class == cls) {
+ w->InvalidateData(data, gui_scope);
+ }
+ }
+}
+
+/**
+ * Dispatch WE_TICK event over all windows
+ */
+void CallWindowTickEvent()
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_FRONT(w) {
+ w->OnTick();
+ }
+}
+
+/**
+ * Try to delete a non-vital window.
+ * Non-vital windows are windows other than the game selection, main toolbar,
+ * status bar, toolbar menu, and tooltip windows. Stickied windows are also
+ * considered vital.
+ */
+void DeleteNonVitalWindows()
+{
+ Window *w;
+
+restart_search:
+ /* When we find the window to delete, we need to restart the search
+ * as deleting this window could cascade in deleting (many) others
+ * anywhere in the z-array */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_class != WC_MAIN_WINDOW &&
+ w->window_class != WC_SELECT_GAME &&
+ w->window_class != WC_MAIN_TOOLBAR &&
+ w->window_class != WC_STATUS_BAR &&
+ w->window_class != WC_TOOLTIPS &&
+ (w->flags & WF_STICKY) == 0) { // do not delete windows which are 'pinned'
+
+ delete w;
+ goto restart_search;
+ }
+ }
+}
+
+/**
+ * It is possible that a stickied window gets to a position where the
+ * 'close' button is outside the gaming area. You cannot close it then; except
+ * with this function. It closes all windows calling the standard function,
+ * then, does a little hacked loop of closing all stickied windows. Note
+ * that standard windows (status bar, etc.) are not stickied, so these aren't affected
+ */
+void DeleteAllNonVitalWindows()
+{
+ Window *w;
+
+ /* Delete every window except for stickied ones, then sticky ones as well */
+ DeleteNonVitalWindows();
+
+restart_search:
+ /* When we find the window to delete, we need to restart the search
+ * as deleting this window could cascade in deleting (many) others
+ * anywhere in the z-array */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->flags & WF_STICKY) {
+ delete w;
+ goto restart_search;
+ }
+ }
+}
+
+/**
+ * Delete all windows that are used for construction of vehicle etc.
+ * Once done with that invalidate the others to ensure they get refreshed too.
+ */
+void DeleteConstructionWindows()
+{
+ Window *w;
+
+restart_search:
+ /* When we find the window to delete, we need to restart the search
+ * as deleting this window could cascade in deleting (many) others
+ * anywhere in the z-array */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->window_desc->flags & WDF_CONSTRUCTION) {
+ delete w;
+ goto restart_search;
+ }
+ }
+
+ FOR_ALL_WINDOWS_FROM_BACK(w) w->SetDirty();
+}
+
+/** Delete all always on-top windows to get an empty screen */
+void HideVitalWindows()
+{
+ DeleteWindowById(WC_MAIN_TOOLBAR, 0);
+ DeleteWindowById(WC_STATUS_BAR, 0);
+}
+
+/** Re-initialize all windows. */
+void ReInitAllWindows()
+{
+ NWidgetLeaf::InvalidateDimensionCache(); // Reset cached sizes of several widgets.
+ NWidgetScrollbar::InvalidateDimensionCache();
+
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ w->ReInit();
+ }
+#ifdef ENABLE_NETWORK
+ void NetworkReInitChatBoxSize();
+ NetworkReInitChatBoxSize();
+#endif
+
+ /* Make sure essential parts of all windows are visible */
+ RelocateAllWindows(_cur_resolution.width, _cur_resolution.height);
+ MarkWholeScreenDirty();
+}
+
+/**
+ * (Re)position a window at the screen.
+ * @param w Window structure of the window, may also be \c NULL.
+ * @param clss The class of the window to position.
+ * @param setting The actual setting used for the window's position.
+ * @return X coordinate of left edge of the repositioned window.
+ */
+static int PositionWindow(Window *w, WindowClass clss, int setting)
+{
+ if (w == NULL || w->window_class != clss) {
+ w = FindWindowById(clss, 0);
+ }
+ if (w == NULL) return 0;
+
+ int old_left = w->left;
+ switch (setting) {
+ case 1: w->left = (_screen.width - w->width) / 2; break;
+ case 2: w->left = _screen.width - w->width; break;
+ default: w->left = 0; break;
+ }
+ if (w->viewport != NULL) w->viewport->left += w->left - old_left;
+ SetDirtyBlocks(0, w->top, _screen.width, w->top + w->height); // invalidate the whole row
+ return w->left;
+}
+
+/**
+ * (Re)position main toolbar window at the screen.
+ * @param w Window structure of the main toolbar window, may also be \c NULL.
+ * @return X coordinate of left edge of the repositioned toolbar window.
+ */
+int PositionMainToolbar(Window *w)
+{
+ DEBUG(misc, 5, "Repositioning Main Toolbar...");
+ return PositionWindow(w, WC_MAIN_TOOLBAR, _settings_client.gui.toolbar_pos);
+}
+
+/**
+ * (Re)position statusbar window at the screen.
+ * @param w Window structure of the statusbar window, may also be \c NULL.
+ * @return X coordinate of left edge of the repositioned statusbar.
+ */
+int PositionStatusbar(Window *w)
+{
+ DEBUG(misc, 5, "Repositioning statusbar...");
+ return PositionWindow(w, WC_STATUS_BAR, _settings_client.gui.statusbar_pos);
+}
+
+/**
+ * (Re)position news message window at the screen.
+ * @param w Window structure of the news message window, may also be \c NULL.
+ * @return X coordinate of left edge of the repositioned news message.
+ */
+int PositionNewsMessage(Window *w)
+{
+ DEBUG(misc, 5, "Repositioning news message...");
+ return PositionWindow(w, WC_NEWS_WINDOW, _settings_client.gui.statusbar_pos);
+}
+
+/**
+ * (Re)position network chat window at the screen.
+ * @param w Window structure of the network chat window, may also be \c NULL.
+ * @return X coordinate of left edge of the repositioned network chat window.
+ */
+int PositionNetworkChatWindow(Window *w)
+{
+ DEBUG(misc, 5, "Repositioning network chat window...");
+ return PositionWindow(w, WC_SEND_NETWORK_MSG, _settings_client.gui.statusbar_pos);
+}
+
+
+/**
+ * Switches viewports following vehicles, which get autoreplaced
+ * @param from_index the old vehicle ID
+ * @param to_index the new vehicle ID
+ */
+void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index)
+{
+ Window *w;
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->viewport != NULL && w->viewport->follow_vehicle == from_index) {
+ w->viewport->follow_vehicle = to_index;
+ w->SetDirty();
+ }
+ }
+}
+
+
+/**
+ * Relocate all windows to fit the new size of the game application screen
+ * @param neww New width of the game application screen
+ * @param newh New height of the game application screen.
+ */
+void RelocateAllWindows(int neww, int newh)
+{
+ Window *w;
+
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ int left, top;
+ /* XXX - this probably needs something more sane. For example specifying
+ * in a 'backup'-desc that the window should always be centered. */
+ switch (w->window_class) {
+ case WC_MAIN_WINDOW:
+ case WC_BOOTSTRAP:
+ ResizeWindow(w, neww, newh);
+ continue;
+
+ case WC_MAIN_TOOLBAR:
+ ResizeWindow(w, min(neww, w->window_desc->default_width) - w->width, 0, false);
+
+ top = w->top;
+ left = PositionMainToolbar(w); // changes toolbar orientation
+ break;
+
+ case WC_NEWS_WINDOW:
+ top = newh - w->height;
+ left = PositionNewsMessage(w);
+ break;
+
+ case WC_STATUS_BAR:
+ ResizeWindow(w, min(neww, w->window_desc->default_width) - w->width, 0, false);
+
+ top = newh - w->height;
+ left = PositionStatusbar(w);
+ break;
+
+ case WC_SEND_NETWORK_MSG:
+ ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0, false);
+ top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
+ left = PositionNetworkChatWindow(w);
+ break;
+
+ case WC_CONSOLE:
+ IConsoleResize(w);
+ continue;
+
+ default: {
+ if (w->flags & WF_CENTERED) {
+ top = (newh - w->height) >> 1;
+ left = (neww - w->width) >> 1;
+ break;
+ }
+
+ left = w->left;
+ if (left + (w->width >> 1) >= neww) left = neww - w->width;
+ if (left < 0) left = 0;
+
+ top = w->top;
+ if (top + (w->height >> 1) >= newh) top = newh - w->height;
+ break;
+ }
+ }
+
+ EnsureVisibleCaption(w, left, top);
+ }
+}
+
+/**
+ * Destructor of the base class PickerWindowBase
+ * Main utility is to stop the base Window destructor from triggering
+ * a free while the child will already be free, in this case by the ResetObjectToPlace().
+ */
+PickerWindowBase::~PickerWindowBase()
+{
+ this->window_class = WC_INVALID; // stop the ancestor from freeing the already (to be) child
+ ResetObjectToPlace();
+}