From c03cb2c8dbc83119dc811f65ed2a48cdeb3e6f2b Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 27 Jul 2007 12:49:04 +0000 Subject: (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size. --- src/aircraft_gui.cpp | 4 ++-- src/airport_gui.cpp | 4 ++-- src/autoreplace_gui.cpp | 6 ++--- src/bridge_gui.cpp | 4 ++-- src/build_vehicle_gui.cpp | 2 +- src/console.cpp | 2 +- src/depot_gui.cpp | 8 +++---- src/dock_gui.cpp | 6 ++--- src/engine_gui.cpp | 2 +- src/genworld_gui.cpp | 8 +++---- src/graph_gui.cpp | 18 +++++++-------- src/group_gui.cpp | 2 +- src/industry_gui.cpp | 6 ++--- src/intro_gui.cpp | 2 +- src/main_gui.cpp | 10 ++++----- src/misc_gui.cpp | 18 +++++++-------- src/music_gui.cpp | 4 ++-- src/network/network_gui.cpp | 12 +++++----- src/newgrf_gui.cpp | 18 +++++++-------- src/news_gui.cpp | 10 ++++----- src/order_gui.cpp | 6 ++--- src/player_gui.cpp | 22 +++++++++--------- src/rail_gui.cpp | 10 ++++----- src/road_gui.cpp | 12 +++++----- src/roadveh_gui.cpp | 4 ++-- src/settings_gui.cpp | 8 +++---- src/ship_gui.cpp | 4 ++-- src/signs_gui.cpp | 4 ++-- src/smallmap_gui.cpp | 4 ++-- src/station_gui.cpp | 4 ++-- src/subsidy_gui.cpp | 2 +- src/terraform_gui.cpp | 2 +- src/timetable_gui.cpp | 2 +- src/town_gui.cpp | 8 +++---- src/train_gui.cpp | 4 ++-- src/transparency_gui.cpp | 2 +- src/vehicle_gui.cpp | 10 ++++----- src/window.cpp | 55 ++++++++++++++++++++++++++++++++------------- src/window.h | 2 +- 39 files changed, 168 insertions(+), 143 deletions(-) diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp index c3c1c2bdd..c6903e93d 100644 --- a/src/aircraft_gui.cpp +++ b/src/aircraft_gui.cpp @@ -216,7 +216,7 @@ static const Widget _aircraft_details_widgets[] = { }; static const WindowDesc _aircraft_details_desc = { - WDP_AUTO, WDP_AUTO, 390, 126, + WDP_AUTO, WDP_AUTO, 390, 126, 390, 126, WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _aircraft_details_widgets, @@ -380,7 +380,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) static const WindowDesc _aircraft_view_desc = { - WDP_AUTO, WDP_AUTO, 250, 116, + WDP_AUTO, WDP_AUTO, 250, 116, 250, 116, WC_VEHICLE_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _aircraft_view_widgets, diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index bdbdcc401..33721fec8 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -125,7 +125,7 @@ static const Widget _air_toolbar_widgets[] = { static const WindowDesc _air_toolbar_desc = { - WDP_ALIGN_TBR, 22, 64, 36, + WDP_ALIGN_TBR, 22, 64, 36, 64, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _air_toolbar_widgets, @@ -249,7 +249,7 @@ static const Widget _build_airport_picker_widgets[] = { }; static const WindowDesc _build_airport_desc = { - WDP_AUTO, WDP_AUTO, 148, 240, + WDP_AUTO, WDP_AUTO, 148, 240, 148, 240, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_airport_picker_widgets, diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 8db0c0475..062d951ef 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -467,7 +467,7 @@ static const Widget _replace_ship_aircraft_vehicle_widgets[] = { }; static const WindowDesc _replace_rail_vehicle_desc = { - WDP_AUTO, WDP_AUTO, 456, 252, + WDP_AUTO, WDP_AUTO, 456, 252, 456, 252, WC_REPLACE_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _replace_rail_vehicle_widgets, @@ -475,7 +475,7 @@ static const WindowDesc _replace_rail_vehicle_desc = { }; static const WindowDesc _replace_road_vehicle_desc = { - WDP_AUTO, WDP_AUTO, 456, 230, + WDP_AUTO, WDP_AUTO, 456, 230, 456, 230, WC_REPLACE_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _replace_road_vehicle_widgets, @@ -483,7 +483,7 @@ static const WindowDesc _replace_road_vehicle_desc = { }; static const WindowDesc _replace_ship_aircraft_vehicle_desc = { - WDP_AUTO, WDP_AUTO, 456, 214, + WDP_AUTO, WDP_AUTO, 456, 214, 456, 214, WC_REPLACE_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _replace_ship_aircraft_vehicle_widgets, diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 6bc8b94a3..3a2fdb6e2 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -86,7 +86,7 @@ static const Widget _build_bridge_widgets[] = { }; static const WindowDesc _build_bridge_desc = { - WDP_AUTO, WDP_AUTO, 200, 102, + WDP_AUTO, WDP_AUTO, 200, 102, 200, 102, WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_bridge_widgets, @@ -103,7 +103,7 @@ static const Widget _build_road_bridge_widgets[] = { }; static const WindowDesc _build_road_bridge_desc = { - WDP_AUTO, WDP_AUTO, 200, 102, + WDP_AUTO, WDP_AUTO, 200, 102, 200, 102, WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_road_bridge_widgets, diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index c3bcde0ed..4f3cf8a66 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1044,7 +1044,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e) } static const WindowDesc _build_vehicle_desc = { - WDP_AUTO, WDP_AUTO, 240, 256, + WDP_AUTO, WDP_AUTO, 240, 256, 240, 256, WC_BUILD_VEHICLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _build_vehicle_widgets, diff --git a/src/console.cpp b/src/console.cpp index cdb8f4bf7..f487ff021 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -200,7 +200,7 @@ static const Widget _iconsole_window_widgets[] = { }; static const WindowDesc _iconsole_window_desc = { - 0, 0, 2, 2, + 0, 0, 2, 2, 2, 2, WC_CONSOLE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _iconsole_window_widgets, diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index d5a86fe09..fda51d5a8 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -97,7 +97,7 @@ static const Widget _depot_widgets[] = { static void DepotWndProc(Window *w, WindowEvent *e); static const WindowDesc _train_depot_desc = { - WDP_AUTO, WDP_AUTO, 36, 27, + WDP_AUTO, WDP_AUTO, 36, 27, 36, 27, WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, @@ -105,7 +105,7 @@ static const WindowDesc _train_depot_desc = { }; static const WindowDesc _road_depot_desc = { - WDP_AUTO, WDP_AUTO, 36, 27, + WDP_AUTO, WDP_AUTO, 36, 27, 36, 27, WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, @@ -113,7 +113,7 @@ static const WindowDesc _road_depot_desc = { }; static const WindowDesc _ship_depot_desc = { - WDP_AUTO, WDP_AUTO, 36, 27, + WDP_AUTO, WDP_AUTO, 36, 27, 36, 27, WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, @@ -121,7 +121,7 @@ static const WindowDesc _ship_depot_desc = { }; static const WindowDesc _aircraft_depot_desc = { - WDP_AUTO, WDP_AUTO, 36, 27, + WDP_AUTO, WDP_AUTO, 36, 27, 36, 27, WC_VEHICLE_DEPOT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _depot_widgets, diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index ffb8a7975..135f1f166 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -217,7 +217,7 @@ static const Widget _build_docks_toolb_widgets[] = { }; static const WindowDesc _build_docks_toolbar_desc = { - WDP_ALIGN_TBR, 22, 136, 36, + WDP_ALIGN_TBR, 22, 136, 36, 136, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_docks_toolb_widgets, @@ -293,7 +293,7 @@ static const Widget _build_dock_station_widgets[] = { }; static const WindowDesc _build_dock_station_desc = { - WDP_AUTO, WDP_AUTO, 148, 75, + WDP_AUTO, WDP_AUTO, 148, 75, 148, 75, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_dock_station_widgets, @@ -362,7 +362,7 @@ static const Widget _build_docks_depot_widgets[] = { }; static const WindowDesc _build_docks_depot_desc = { - WDP_AUTO, WDP_AUTO, 204, 86, + WDP_AUTO, WDP_AUTO, 204, 86, 204, 86, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_docks_depot_widgets, diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index fa29fc0df..efe3b1c8b 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -104,7 +104,7 @@ static void EnginePreviewWndProc(Window *w, WindowEvent *e) } static const WindowDesc _engine_preview_desc = { - WDP_CENTER, WDP_CENTER, 300, 192, + WDP_CENTER, WDP_CENTER, 300, 192, 300, 192, WC_ENGINE_PREVIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _engine_preview_widgets, diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 9763967dc..874db1900 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -510,7 +510,7 @@ static void GenerateLandscapeWndProc(Window *w, WindowEvent *e) } static const WindowDesc _generate_landscape_desc = { - WDP_CENTER, WDP_CENTER, 338, 268, + WDP_CENTER, WDP_CENTER, 338, 268, 338, 268, WC_GENERATE_LANDSCAPE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _generate_landscape_widgets, @@ -518,7 +518,7 @@ static const WindowDesc _generate_landscape_desc = { }; static const WindowDesc _heightmap_load_desc = { - WDP_CENTER, WDP_CENTER, 338, 236, + WDP_CENTER, WDP_CENTER, 338, 236, 338, 236, WC_GENERATE_LANDSCAPE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _heightmap_load_widgets, @@ -743,7 +743,7 @@ static const Widget _create_scenario_widgets[] = { }; static const WindowDesc _create_scenario_desc = { - WDP_CENTER, WDP_CENTER, 338, 170, + WDP_CENTER, WDP_CENTER, 338, 170, 338, 170, WC_GENERATE_LANDSCAPE, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS, _create_scenario_widgets, @@ -823,7 +823,7 @@ static void ShowTerrainProgressProc(Window* w, WindowEvent* e) } static const WindowDesc _show_terrain_progress_desc = { - WDP_CENTER, WDP_CENTER, 181, 97, + WDP_CENTER, WDP_CENTER, 181, 97, 181, 97, WC_GENERATE_PROGRESS_WINDOW, WC_NONE, WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _show_terrain_progress_widgets, diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 6a50aae18..9599d1fef 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -309,7 +309,7 @@ static const Widget _graph_legend_widgets[] = { }; static const WindowDesc _graph_legend_desc = { - WDP_AUTO, WDP_AUTO, 250, 114, + WDP_AUTO, WDP_AUTO, 250, 114, 250, 114, WC_GRAPH_LEGEND, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _graph_legend_widgets, @@ -407,7 +407,7 @@ static const Widget _operating_profit_widgets[] = { }; static const WindowDesc _operating_profit_desc = { - WDP_AUTO, WDP_AUTO, 576, 174, + WDP_AUTO, WDP_AUTO, 576, 174, 576, 174, WC_OPERATING_PROFIT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _operating_profit_widgets, @@ -476,7 +476,7 @@ static const Widget _income_graph_widgets[] = { }; static const WindowDesc _income_graph_desc = { - WDP_AUTO, WDP_AUTO, 576, 142, + WDP_AUTO, WDP_AUTO, 576, 142, 576, 142, WC_INCOME_GRAPH, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _income_graph_widgets, @@ -543,7 +543,7 @@ static const Widget _delivered_cargo_graph_widgets[] = { }; static const WindowDesc _delivered_cargo_graph_desc = { - WDP_AUTO, WDP_AUTO, 576, 142, + WDP_AUTO, WDP_AUTO, 576, 142, 576, 142, WC_DELIVERED_CARGO, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _delivered_cargo_graph_widgets, @@ -612,7 +612,7 @@ static const Widget _performance_history_widgets[] = { }; static const WindowDesc _performance_history_desc = { - WDP_AUTO, WDP_AUTO, 576, 238, + WDP_AUTO, WDP_AUTO, 576, 238, 576, 238, WC_PERFORMANCE_HISTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _performance_history_widgets, @@ -679,7 +679,7 @@ static const Widget _company_value_graph_widgets[] = { }; static const WindowDesc _company_value_graph_desc = { - WDP_AUTO, WDP_AUTO, 576, 238, + WDP_AUTO, WDP_AUTO, 576, 238, 576, 238, WC_COMPANY_VALUE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _company_value_graph_widgets, @@ -776,7 +776,7 @@ static const Widget _cargo_payment_rates_widgets[] = { }; static const WindowDesc _cargo_payment_rates_desc = { - WDP_AUTO, WDP_AUTO, 568, 46, + WDP_AUTO, WDP_AUTO, 568, 46, 568, 46, WC_PAYMENT_RATES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _cargo_payment_rates_widgets, @@ -898,7 +898,7 @@ static const Widget _company_league_widgets[] = { }; static const WindowDesc _company_league_desc = { - WDP_AUTO, WDP_AUTO, 400, 97, + WDP_AUTO, WDP_AUTO, 400, 97, 400, 97, WC_COMPANY_LEAGUE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _company_league_widgets, @@ -1137,7 +1137,7 @@ static const Widget _performance_rating_detail_widgets[] = { }; static const WindowDesc _performance_rating_detail_desc = { - WDP_AUTO, WDP_AUTO, 299, 228, + WDP_AUTO, WDP_AUTO, 299, 228, 299, 228, WC_PERFORMANCE_DETAIL, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _performance_rating_detail_widgets, diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 62a1a4d42..62922ed9a 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -771,7 +771,7 @@ static void GroupWndProc(Window *w, WindowEvent *e) static const WindowDesc _group_desc = { - WDP_AUTO, WDP_AUTO, 526, 246, + WDP_AUTO, WDP_AUTO, 526, 246, 526, 246, WC_TRAINS_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _group_widgets, diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 7b98af0be..12f985457 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -363,7 +363,7 @@ static const Widget _build_dynamic_industry_widgets[] = { }; static const WindowDesc _build_industry_dynamic_desc = { - WDP_AUTO, WDP_AUTO, 170, 212, + WDP_AUTO, WDP_AUTO, 170, 212, 170, 212, WC_BUILD_INDUSTRY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _build_dynamic_industry_widgets, @@ -598,7 +598,7 @@ static const Widget _industry_view_widgets[] = { }; static const WindowDesc _industry_view_desc = { - WDP_AUTO, WDP_AUTO, 260, 160, + WDP_AUTO, WDP_AUTO, 260, 160, 260, 160, WC_INDUSTRY_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _industry_view_widgets, @@ -855,7 +855,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e) /* Industry List */ static const WindowDesc _industry_directory_desc = { - WDP_AUTO, WDP_AUTO, 508, 190, + WDP_AUTO, WDP_AUTO, 508, 190, 508, 190, WC_INDUSTRY_DIRECTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _industry_directory_widgets, diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 21fc0dba7..2961dc801 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -99,7 +99,7 @@ static void SelectGameWndProc(Window *w, WindowEvent *e) } static const WindowDesc _select_game_desc = { - WDP_CENTER, WDP_CENTER, 336, 195, + WDP_CENTER, WDP_CENTER, 336, 195, 336, 195, WC_SELECT_GAME, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _select_game_widgets, diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 5644323c4..d323495f8 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -1404,7 +1404,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e) } static const WindowDesc _scen_edit_land_gen_desc = { - WDP_AUTO, WDP_AUTO, 182, 103, + WDP_AUTO, WDP_AUTO, 182, 103, 182, 103, WC_SCEN_LAND_GEN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _scen_edit_land_gen_widgets, @@ -1525,7 +1525,7 @@ static void ScenEditTownGenWndProc(Window *w, WindowEvent *e) } static const WindowDesc _scen_edit_town_gen_desc = { - WDP_AUTO, WDP_AUTO, 160, 95, + WDP_AUTO, WDP_AUTO, 160, 95, 160, 95, WC_SCEN_TOWN_GEN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _scen_edit_town_gen_widgets, @@ -1751,7 +1751,7 @@ static const Widget _toolb_normal_widgets[] = { }; static const WindowDesc _toolb_normal_desc = { - 0, 0, 640, 22, + 0, 0, 640, 22, 640, 22, WC_MAIN_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, _toolb_normal_widgets, @@ -1902,7 +1902,7 @@ static void ScenEditToolbarWndProc(Window *w, WindowEvent *e) } static const WindowDesc _toolb_scen_desc = { - 0, 0, 640, 22, + 0, 0, 640, 22, 640, 22, WC_MAIN_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _toolb_scen_widgets, @@ -2039,7 +2039,7 @@ static const Widget _main_status_widgets[] = { }; static WindowDesc _main_status_desc = { - WDP_CENTER, 0, 640, 12, + WDP_CENTER, 0, 640, 12, 640, 12, WC_STATUS_BAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _main_status_widgets, diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 2925821c2..a80e0ea67 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -77,7 +77,7 @@ static const Widget _land_info_widgets[] = { }; static const WindowDesc _land_info_desc = { - WDP_AUTO, WDP_AUTO, 280, 93, + WDP_AUTO, WDP_AUTO, 280, 93, 280, 93, WC_LAND_INFO, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _land_info_widgets, @@ -298,7 +298,7 @@ static const Widget _about_widgets[] = { }; static const WindowDesc _about_desc = { - WDP_CENTER, WDP_CENTER, 420, 272, + WDP_CENTER, WDP_CENTER, 420, 272, 420, 272, WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _about_widgets, @@ -430,7 +430,7 @@ static const Widget _build_trees_widgets[] = { }; static const WindowDesc _build_trees_desc = { - 497, 22, 143, 171, + 497, 22, 143, 171, 143, 171, WC_BUILD_TREES, WC_SCEN_LAND_GEN, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_trees_widgets, @@ -459,7 +459,7 @@ static const Widget _build_trees_scen_widgets[] = { }; static const WindowDesc _build_trees_scen_desc = { - WDP_AUTO, WDP_AUTO, 143, 184, + WDP_AUTO, WDP_AUTO, 143, 184, 143, 184, WC_BUILD_TREES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_trees_scen_widgets, @@ -1166,7 +1166,7 @@ static const Widget _query_string_widgets[] = { }; static const WindowDesc _query_string_desc = { - 190, 219, 260, 42, + 190, 219, 260, 42, 260, 42, WC_QUERY_STRING, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _query_string_widgets, @@ -1290,7 +1290,7 @@ static const Widget _query_widgets[] = { }; static const WindowDesc _query_desc = { - WDP_CENTER, WDP_CENTER, 210, 82, + WDP_CENTER, WDP_CENTER, 210, 82, 210, 82, WC_CONFIRM_POPUP_QUERY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_DEF_WIDGET | WDF_MODAL, _query_widgets, @@ -1627,7 +1627,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e) } static const WindowDesc _load_dialog_desc = { - WDP_CENTER, WDP_CENTER, 257, 294, + WDP_CENTER, WDP_CENTER, 257, 294, 257, 294, WC_SAVELOAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _load_dialog_widgets, @@ -1635,7 +1635,7 @@ static const WindowDesc _load_dialog_desc = { }; static const WindowDesc _save_dialog_desc = { - WDP_CENTER, WDP_CENTER, 257, 320, + WDP_CENTER, WDP_CENTER, 257, 320, 257, 320, WC_SAVELOAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _save_dialog_widgets, @@ -1952,7 +1952,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e) } static const WindowDesc _cheats_desc = { - 240, 22, 400, 170, + 240, 22, 400, 170, 400, 170, WC_CHEATS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _cheat_widgets, diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 9bce16090..2e6889f07 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -322,7 +322,7 @@ static const Widget _music_track_selection_widgets[] = { }; static const WindowDesc _music_track_selection_desc = { - 104, 131, 432, 218, + 104, 131, 432, 218, 432, 218, WC_MUSIC_TRACK_SELECTION, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _music_track_selection_widgets, @@ -490,7 +490,7 @@ static const Widget _music_window_widgets[] = { }; static const WindowDesc _music_window_desc = { - 0, 22, 300, 66, + 0, 22, 300, 66, 300, 66, WC_MUSIC_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _music_window_widgets, diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 113d50c9b..7d90bf9f0 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -550,7 +550,7 @@ static const Widget _network_game_window_widgets[] = { }; static const WindowDesc _network_game_window_desc = { - WDP_CENTER, WDP_CENTER, 550, 264, + WDP_CENTER, WDP_CENTER, 550, 264, 550, 264, WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _network_game_window_widgets, @@ -786,7 +786,7 @@ static const Widget _network_start_server_window_widgets[] = { }; static const WindowDesc _network_start_server_window_desc = { - WDP_CENTER, WDP_CENTER, 420, 244, + WDP_CENTER, WDP_CENTER, 420, 244, 420, 244, WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _network_start_server_window_widgets, @@ -995,7 +995,7 @@ static const Widget _network_lobby_window_widgets[] = { }; static const WindowDesc _network_lobby_window_desc = { - WDP_CENTER, WDP_CENTER, 420, 235, + WDP_CENTER, WDP_CENTER, 420, 235, 420, 235, WC_NETWORK_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _network_lobby_window_widgets, @@ -1060,7 +1060,7 @@ static const Widget _client_list_popup_widgets[] = { }; static WindowDesc _client_list_desc = { - WDP_AUTO, WDP_AUTO, 250, 1, + WDP_AUTO, WDP_AUTO, 250, 1, 250, 1, WC_CLIENT_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _client_list_widgets, @@ -1471,7 +1471,7 @@ static const Widget _network_join_status_window_widget[] = { }; static const WindowDesc _network_join_status_window_desc = { - WDP_CENTER, WDP_CENTER, 250, 85, + WDP_CENTER, WDP_CENTER, 250, 85, 250, 85, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL, _network_join_status_window_widget, @@ -1705,7 +1705,7 @@ static const Widget _chat_window_widgets[] = { }; static const WindowDesc _chat_window_desc = { - WDP_CENTER, -26, 640, 14, // x, y, width, height + WDP_CENTER, -26, 640, 14, 640, 14, // x, y, width, height WC_SEND_NETWORK_MSG, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET, _chat_window_widgets, diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index d9dd12173..224236a0a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -219,22 +219,22 @@ static const Widget _newgrf_add_dlg_widgets[] = { { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 306, 0, 13, STR_NEWGRF_ADD_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS }, /* List of files */ -{ WWT_PANEL, RESIZE_RB, 14, 0, 294, 14, 221, 0x0, STR_NULL }, -{ WWT_INSET, RESIZE_RB, 14, 2, 292, 16, 219, 0x0, STR_NULL }, -{ WWT_SCROLLBAR, RESIZE_LRB, 14, 295, 306, 14, 221, 0x0, STR_NULL }, +{ WWT_PANEL, RESIZE_RB, 14, 0, 294, 14, 121, 0x0, STR_NULL }, +{ WWT_INSET, RESIZE_RB, 14, 2, 292, 16, 119, 0x0, STR_NULL }, +{ WWT_SCROLLBAR, RESIZE_LRB, 14, 295, 306, 14, 121, 0x0, STR_NULL }, /* NewGRF file info */ -{ WWT_PANEL, RESIZE_RTB, 14, 0, 306, 222, 324, 0x0, STR_NULL }, +{ WWT_PANEL, RESIZE_RTB, 14, 0, 306, 122, 224, 0x0, STR_NULL }, -{ WWT_PUSHTXTBTN, RESIZE_RTB, 14, 0, 146, 325, 336, STR_NEWGRF_ADD_FILE, STR_NEWGRF_ADD_FILE_TIP }, -{ WWT_PUSHTXTBTN, RESIZE_LRTB, 14, 147, 294, 325, 336, STR_NEWGRF_RESCAN_FILES, STR_NEWGRF_RESCAN_FILES_TIP }, -{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 295, 306, 325, 336, 0x0, STR_RESIZE_BUTTON }, +{ WWT_PUSHTXTBTN, RESIZE_RTB, 14, 0, 146, 225, 236, STR_NEWGRF_ADD_FILE, STR_NEWGRF_ADD_FILE_TIP }, +{ WWT_PUSHTXTBTN, RESIZE_LRTB, 14, 147, 294, 225, 236, STR_NEWGRF_RESCAN_FILES, STR_NEWGRF_RESCAN_FILES_TIP }, +{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 295, 306, 225, 236, 0x0, STR_RESIZE_BUTTON }, { WIDGETS_END }, }; static const WindowDesc _newgrf_add_dlg_desc = { - WDP_CENTER, WDP_CENTER, 307, 337, + WDP_CENTER, WDP_CENTER, 307, 237, 307, 337, WC_SAVELOAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _newgrf_add_dlg_widgets, @@ -549,7 +549,7 @@ static const Widget _newgrf_widgets[] = { static const WindowDesc _newgrf_desc = { - WDP_CENTER, WDP_CENTER, 300, 225, + WDP_CENTER, WDP_CENTER, 300, 225, 300, 225, WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _newgrf_widgets, diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 27ec0a1e7..b3fed8bdb 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -320,7 +320,7 @@ static const Widget _news_type13_widgets[] = { }; static WindowDesc _news_type13_desc = { - WDP_CENTER, 476, 430, 170, + WDP_CENTER, 476, 430, 170, 430, 170, WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, _news_type13_widgets, @@ -334,7 +334,7 @@ static const Widget _news_type2_widgets[] = { }; static WindowDesc _news_type2_desc = { - WDP_CENTER, 476, 430, 130, + WDP_CENTER, 476, 430, 130, 430, 130, WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, _news_type2_widgets, @@ -350,7 +350,7 @@ static const Widget _news_type0_widgets[] = { }; static WindowDesc _news_type0_desc = { - WDP_CENTER, 476, 280, 87, + WDP_CENTER, 476, 280, 87, 280, 87, WC_NEWS_WINDOW, WC_NONE, WDF_DEF_WIDGET, _news_type0_widgets, @@ -700,7 +700,7 @@ static const Widget _message_history_widgets[] = { }; static const WindowDesc _message_history_desc = { - 240, 22, 400, 140, + 240, 22, 400, 140, 400, 140, WC_MESSAGE_HISTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _message_history_widgets, @@ -910,7 +910,7 @@ static const Widget _message_options_widgets[] = { }; static const WindowDesc _message_options_desc = { - 270, 22, 410, 197, + 270, 22, 410, 197, 410, 197, WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _message_options_widgets, diff --git a/src/order_gui.cpp b/src/order_gui.cpp index b3a5b08d1..1bebf1bd5 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -770,7 +770,7 @@ static const Widget _orders_train_widgets[] = { }; static const WindowDesc _orders_train_desc = { - WDP_AUTO, WDP_AUTO, 399, 88, + WDP_AUTO, WDP_AUTO, 399, 88, 399, 88, WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _orders_train_widgets, @@ -807,7 +807,7 @@ static const Widget _orders_widgets[] = { }; static const WindowDesc _orders_desc = { - WDP_AUTO, WDP_AUTO, 410, 88, + WDP_AUTO, WDP_AUTO, 410, 88, 410, 88, WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, _orders_widgets, @@ -844,7 +844,7 @@ static const Widget _other_orders_widgets[] = { }; static const WindowDesc _other_orders_desc = { - WDP_AUTO, WDP_AUTO, 332, 88, + WDP_AUTO, WDP_AUTO, 332, 88, 332, 88, WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _other_orders_widgets, diff --git a/src/player_gui.cpp b/src/player_gui.cpp index ae9e60259..6bc8064d6 100644 --- a/src/player_gui.cpp +++ b/src/player_gui.cpp @@ -197,7 +197,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e) } static const WindowDesc _player_finances_desc = { - WDP_AUTO, WDP_AUTO, 407, 216, + WDP_AUTO, WDP_AUTO, 407, 216, 407, 216, WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_widgets, @@ -205,7 +205,7 @@ static const WindowDesc _player_finances_desc = { }; static const WindowDesc _player_finances_small_desc = { - WDP_AUTO, WDP_AUTO, 280, 60, + WDP_AUTO, WDP_AUTO, 280, 60, 280, 60, WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _player_finances_small_widgets, @@ -213,7 +213,7 @@ static const WindowDesc _player_finances_small_desc = { }; static const WindowDesc _other_player_finances_desc = { - WDP_AUTO, WDP_AUTO, 407, 204, + WDP_AUTO, WDP_AUTO, 407, 204, 407, 204, WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _other_player_finances_widgets, @@ -221,7 +221,7 @@ static const WindowDesc _other_player_finances_desc = { }; static const WindowDesc _other_player_finances_small_desc = { - WDP_AUTO, WDP_AUTO, 280, 48, + WDP_AUTO, WDP_AUTO, 280, 48, 280, 48, WC_FINANCES, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _other_player_finances_small_widgets, @@ -480,7 +480,7 @@ static const Widget _select_player_livery_2cc_widgets[] = { }; static const WindowDesc _select_player_livery_2cc_desc = { - WDP_AUTO, WDP_AUTO, 400, 49 + 1 * 14, + WDP_AUTO, WDP_AUTO, 400, 49 + 1 * 14, 400, 49 + 1 * 14, WC_PLAYER_COLOR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _select_player_livery_2cc_widgets, @@ -507,7 +507,7 @@ static const Widget _select_player_livery_widgets[] = { }; static const WindowDesc _select_player_livery_desc = { - WDP_AUTO, WDP_AUTO, 275, 49 + 1 * 14, + WDP_AUTO, WDP_AUTO, 275, 49 + 1 * 14, 275, 49 + 1 * 14, WC_PLAYER_COLOR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _select_player_livery_widgets, @@ -599,7 +599,7 @@ static const Widget _select_player_face_widgets[] = { }; static const WindowDesc _select_player_face_desc = { - WDP_AUTO, WDP_AUTO, 190, 149, + WDP_AUTO, WDP_AUTO, 190, 149, 190, 149, WC_PLAYER_FACE, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _select_player_face_widgets, @@ -912,7 +912,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e) static const WindowDesc _player_company_desc = { - WDP_AUTO, WDP_AUTO, 360, 170, + WDP_AUTO, WDP_AUTO, 360, 170, 360, 170, WC_COMPANY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _player_company_widgets, @@ -972,7 +972,7 @@ static const Widget _buy_company_widgets[] = { }; static const WindowDesc _buy_company_desc = { - 153, 171, 334, 137, + 153, 171, 334, 137, 334, 137, WC_BUY_COMPANY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _buy_company_widgets, @@ -1092,7 +1092,7 @@ static const Widget _highscore_widgets[] = { }; static const WindowDesc _highscore_desc = { - 0, 0, 641, 481, + 0, 0, 641, 481, 641, 481, WC_HIGHSCORE, WC_NONE, 0, _highscore_widgets, @@ -1100,7 +1100,7 @@ static const WindowDesc _highscore_desc = { }; static const WindowDesc _endgame_desc = { - 0, 0, 641, 481, + 0, 0, 641, 481, 641, 481, WC_ENDSCREEN, WC_NONE, 0, _highscore_widgets, diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index d5bc70fa1..dddd0061c 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -600,7 +600,7 @@ static const Widget _build_rail_widgets[] = { }; static const WindowDesc _build_rail_desc = { - WDP_ALIGN_TBR, 22, 350, 36, + WDP_ALIGN_TBR, 22, 350, 36, 350, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_rail_widgets, @@ -1021,7 +1021,7 @@ static const Widget _newstation_builder_widgets[] = { }; static const WindowDesc _station_builder_desc = { - WDP_AUTO, WDP_AUTO, 148, 200, + WDP_AUTO, WDP_AUTO, 148, 200, 148, 200, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _station_builder_widgets, @@ -1029,7 +1029,7 @@ static const WindowDesc _station_builder_desc = { }; static const WindowDesc _newstation_builder_desc = { - WDP_AUTO, WDP_AUTO, 148, 290, + WDP_AUTO, WDP_AUTO, 148, 290, 148, 290, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _newstation_builder_widgets, @@ -1108,7 +1108,7 @@ static const Widget _build_depot_widgets[] = { }; static const WindowDesc _build_depot_desc = { - WDP_AUTO, WDP_AUTO, 140, 122, + WDP_AUTO, WDP_AUTO, 140, 122, 140, 122, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_depot_widgets, @@ -1194,7 +1194,7 @@ static const Widget _build_waypoint_widgets[] = { }; static const WindowDesc _build_waypoint_desc = { - WDP_AUTO, WDP_AUTO, 344, 92, + WDP_AUTO, WDP_AUTO, 344, 92, 344, 92, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_waypoint_widgets, diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 57e4db3fa..a4681b891 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -386,7 +386,7 @@ static const Widget _build_road_widgets[] = { }; static const WindowDesc _build_road_desc = { - WDP_ALIGN_TBR, 22, 218, 36, + WDP_ALIGN_TBR, 22, 218, 36, 218, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_road_widgets, @@ -412,7 +412,7 @@ static const Widget _build_tramway_widgets[] = { }; static const WindowDesc _build_tramway_desc = { - WDP_ALIGN_TBR, 22, 218, 36, + WDP_ALIGN_TBR, 22, 218, 36, 218, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_tramway_widgets, @@ -447,7 +447,7 @@ static const Widget _build_road_scen_widgets[] = { }; static const WindowDesc _build_road_scen_desc = { - WDP_AUTO, WDP_AUTO, 152, 36, + WDP_AUTO, WDP_AUTO, 152, 36, 152, 36, WC_SCEN_BUILD_ROAD, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _build_road_scen_widgets, @@ -519,7 +519,7 @@ static const Widget _build_tram_depot_widgets[] = { }; static const WindowDesc _build_road_depot_desc = { - WDP_AUTO, WDP_AUTO, 140, 122, + WDP_AUTO, WDP_AUTO, 140, 122, 140, 122, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_road_depot_widgets, @@ -527,7 +527,7 @@ static const WindowDesc _build_road_depot_desc = { }; static const WindowDesc _build_tram_depot_desc = { - WDP_AUTO, WDP_AUTO, 140, 122, + WDP_AUTO, WDP_AUTO, 140, 122, 140, 122, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _build_tram_depot_widgets, @@ -632,7 +632,7 @@ static const Widget _rv_station_picker_widgets[] = { }; static const WindowDesc _rv_station_picker_desc = { - WDP_AUTO, WDP_AUTO, 207, 177, + WDP_AUTO, WDP_AUTO, 207, 177, 207, 177, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _rv_station_picker_widgets, diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp index 6be119053..d4a634f95 100644 --- a/src/roadveh_gui.cpp +++ b/src/roadveh_gui.cpp @@ -242,7 +242,7 @@ static const Widget _roadveh_details_widgets[] = { }; static const WindowDesc _roadveh_details_desc = { - WDP_AUTO, WDP_AUTO, 380, 113, + WDP_AUTO, WDP_AUTO, 380, 113, 380, 113, WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _roadveh_details_widgets, @@ -416,7 +416,7 @@ static const Widget _roadveh_view_widgets[] = { }; static const WindowDesc _roadveh_view_desc = { - WDP_AUTO, WDP_AUTO, 250, 116, + WDP_AUTO, WDP_AUTO, 250, 116, 250, 116, WC_VEHICLE_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _roadveh_view_widgets, diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 09ad4221b..1802e2739 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -337,7 +337,7 @@ static const Widget _game_options_widgets[] = { }; static const WindowDesc _game_options_desc = { - WDP_CENTER, WDP_CENTER, 370, 239, + WDP_CENTER, WDP_CENTER, 370, 239, 370, 239, WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _game_options_widgets, @@ -613,7 +613,7 @@ static const Widget _game_difficulty_widgets[] = { }; static const WindowDesc _game_difficulty_desc = { - WDP_CENTER, WDP_CENTER, 370, 279, + WDP_CENTER, WDP_CENTER, 370, 279, 370, 279, WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _game_difficulty_widgets, @@ -994,7 +994,7 @@ static const Widget _patches_selection_widgets[] = { }; static const WindowDesc _patches_selection_desc = { - WDP_CENTER, WDP_CENTER, 370, 381, + WDP_CENTER, WDP_CENTER, 370, 381, 370, 381, WC_GAME_OPTIONS, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _patches_selection_widgets, @@ -1214,7 +1214,7 @@ static const Widget _cust_currency_widgets[] = { }; static const WindowDesc _cust_currency_desc = { - WDP_CENTER, WDP_CENTER, 230, 120, + WDP_CENTER, WDP_CENTER, 230, 120, 230, 120, WC_CUSTOM_CURRENCY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _cust_currency_widgets, diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp index ed9ca529d..fcdcfc24a 100644 --- a/src/ship_gui.cpp +++ b/src/ship_gui.cpp @@ -156,7 +156,7 @@ static const Widget _ship_details_widgets[] = { }; static const WindowDesc _ship_details_desc = { - WDP_AUTO, WDP_AUTO, 405, 113, + WDP_AUTO, WDP_AUTO, 405, 113, 405, 113, WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _ship_details_widgets, @@ -334,7 +334,7 @@ static const Widget _ship_view_widgets[] = { }; static const WindowDesc _ship_view_desc = { - WDP_AUTO, WDP_AUTO, 250, 116, + WDP_AUTO, WDP_AUTO, 250, 116, 250, 116, WC_VEHICLE_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _ship_view_widgets, diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 0495de127..e5c8dff78 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -133,7 +133,7 @@ static const Widget _sign_list_widget[] = { }; static const WindowDesc _sign_list_desc = { - WDP_AUTO, WDP_AUTO, 358, 138, + WDP_AUTO, WDP_AUTO, 358, 138, 358, 138, WC_SIGN_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _sign_list_widget, @@ -296,7 +296,7 @@ static const Widget _query_sign_edit_widgets[] = { }; static const WindowDesc _query_sign_edit_desc = { - 190, 170, 260, 42, + 190, 170, 260, 42, 260, 42, WC_QUERY_STRING, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, _query_sign_edit_widgets, diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 3a80677c0..2703dd67d 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -912,7 +912,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e) } static const WindowDesc _smallmap_desc = { - WDP_AUTO, WDP_AUTO, 446, 314, + WDP_AUTO, WDP_AUTO, 446, 314, 446, 314, WC_SMALLMAP, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _smallmap_widgets, @@ -1027,7 +1027,7 @@ static void ExtraViewPortWndProc(Window *w, WindowEvent *e) } static const WindowDesc _extra_view_port_desc = { - WDP_AUTO, WDP_AUTO, 300, 268, + WDP_AUTO, WDP_AUTO, 300, 268, 300, 268, WC_EXTRA_VIEW_PORT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _extra_view_port_widgets, diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 3c3d96f17..00f24ed36 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -569,7 +569,7 @@ static const Widget _player_stations_widgets[] = { }; static const WindowDesc _player_stations_desc = { - WDP_AUTO, WDP_AUTO, 358, 162, + WDP_AUTO, WDP_AUTO, 358, 162, 358, 162, WC_STATION_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _player_stations_widgets, @@ -895,7 +895,7 @@ static void StationViewWndProc(Window *w, WindowEvent *e) static const WindowDesc _station_view_desc = { - WDP_AUTO, WDP_AUTO, 249, 110, + WDP_AUTO, WDP_AUTO, 249, 110, 249, 110, WC_STATION_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _station_view_widgets, diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 8f1fe1e82..6af1e003e 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -166,7 +166,7 @@ static const Widget _subsidies_list_widgets[] = { }; static const WindowDesc _subsidies_list_desc = { - WDP_AUTO, WDP_AUTO, 630, 127, + WDP_AUTO, WDP_AUTO, 630, 127, 630, 127, WC_SUBSIDIES_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _subsidies_list_widgets, diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 75c46b68b..59d1b9ed0 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -278,7 +278,7 @@ static const Widget _terraform_widgets[] = { }; static const WindowDesc _terraform_desc = { - WDP_ALIGN_TBR, 22 + 36, 158, 36, + WDP_ALIGN_TBR, 22 + 36, 158, 36, 158, 36, WC_SCEN_LAND_GEN, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _terraform_widgets, diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 0c831692f..73292fcdb 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -314,7 +314,7 @@ static const Widget _timetable_widgets[] = { }; static const WindowDesc _timetable_desc = { - WDP_AUTO, WDP_AUTO, 400, 130, + WDP_AUTO, WDP_AUTO, 400, 130, 400, 130, WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _timetable_widgets, diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 7e927e55c..eb9410c20 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -214,7 +214,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e) } static const WindowDesc _town_authority_desc = { - WDP_AUTO, WDP_AUTO, 317, 222, + WDP_AUTO, WDP_AUTO, 317, 222, 317, 222, WC_TOWN_AUTHORITY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, _town_authority_widgets, @@ -308,7 +308,7 @@ static const Widget _town_view_widgets[] = { }; static const WindowDesc _town_view_desc = { - WDP_AUTO, WDP_AUTO, 260, 150, + WDP_AUTO, WDP_AUTO, 260, 150, 260, 150, WC_TOWN_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _town_view_widgets, @@ -331,7 +331,7 @@ static const Widget _town_view_scen_widgets[] = { }; static const WindowDesc _town_view_scen_desc = { - WDP_AUTO, WDP_AUTO, 260, 150, + WDP_AUTO, WDP_AUTO, 260, 150, 260, 150, WC_TOWN_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, _town_view_scen_widgets, @@ -508,7 +508,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e) } static const WindowDesc _town_directory_desc = { - WDP_AUTO, WDP_AUTO, 208, 202, + WDP_AUTO, WDP_AUTO, 208, 202, 208, 202, WC_TOWN_DIRECTORY, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _town_directory_widgets, diff --git a/src/train_gui.cpp b/src/train_gui.cpp index efdbcb186..1c1c731e0 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -309,7 +309,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e) } static const WindowDesc _train_view_desc = { - WDP_AUTO, WDP_AUTO, 250, 134, + WDP_AUTO, WDP_AUTO, 250, 134, 250, 134, WC_VEHICLE_VIEW, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _train_view_widgets, @@ -592,7 +592,7 @@ static const Widget _train_details_widgets[] = { static const WindowDesc _train_details_desc = { - WDP_AUTO, WDP_AUTO, 370, 164, + WDP_AUTO, WDP_AUTO, 370, 164, 370, 164, WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _train_details_widgets, diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 4fcf37f44..bebb18fa1 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -78,7 +78,7 @@ static const Widget _transparency_widgets[] = { }; static const WindowDesc _transparency_desc = { - WDP_ALIGN_TBR, 58+36, 197, 36, + WDP_ALIGN_TBR, 58+36, 197, 36, 197, 36, WC_TRANSPARENCY_TOOLBAR, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON, _transparency_widgets, diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index b340c9f88..73f142049 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -409,7 +409,7 @@ static const Widget _vehicle_refit_widgets[] = { }; static const WindowDesc _vehicle_refit_desc = { - WDP_AUTO, WDP_AUTO, 240, 174, + WDP_AUTO, WDP_AUTO, 240, 174, 240, 174, WC_VEHICLE_REFIT, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, _vehicle_refit_widgets, @@ -1184,7 +1184,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) } static const WindowDesc _player_vehicle_list_train_desc = { - WDP_AUTO, WDP_AUTO, 260, 182, + WDP_AUTO, WDP_AUTO, 260, 182, 260, 182, WC_TRAINS_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, @@ -1192,7 +1192,7 @@ static const WindowDesc _player_vehicle_list_train_desc = { }; static const WindowDesc _player_vehicle_list_road_veh_desc = { - WDP_AUTO, WDP_AUTO, 260, 182, + WDP_AUTO, WDP_AUTO, 260, 182, 260, 182, WC_ROADVEH_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, @@ -1200,7 +1200,7 @@ static const WindowDesc _player_vehicle_list_road_veh_desc = { }; static const WindowDesc _player_vehicle_list_ship_desc = { - WDP_AUTO, WDP_AUTO, 260, 182, + WDP_AUTO, WDP_AUTO, 260, 182, 260, 182, WC_SHIPS_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, @@ -1208,7 +1208,7 @@ static const WindowDesc _player_vehicle_list_ship_desc = { }; static const WindowDesc _player_vehicle_list_aircraft_desc = { - WDP_AUTO, WDP_AUTO, 260, 182, + WDP_AUTO, WDP_AUTO, 260, 182, 260, 182, WC_AIRCRAFT_LIST, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _vehicle_list_widgets, diff --git a/src/window.cpp b/src/window.cpp index 819c8ffc3..6fa049e0c 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -590,15 +590,17 @@ static Window *FindFreeWindow() * Only addition here is window_number, which is the window_number being assigned to the new window * @param x offset in pixels from the left of the screen * @param y offset in pixels from the top of the screen - * @param width width in pixels of the window - * @param height height in pixels of the window + * @param min_width minimum width in pixels of the window + * @param min_height minimum height in pixels of the window + * @param def_width default width in pixels of the window + * @param def_height default height in pixels of the window * @param *proc see WindowProc function to call when any messages/updates happen to the window * @param cls see WindowClass class of the window, used for identification and grouping * @param *widget see Widget pointer to the window layout and various elements * @param window_number number being assigned to the new window * @return Window pointer of the newly created window */ static Window *LocalAllocateWindow( - int x, int y, int width, int height, + int x, int y, int min_width, int min_height, int def_width, int def_height, WindowProc *proc, WindowClass cls, const Widget *widget, int window_number) { Window *w = FindFreeWindow(); @@ -617,12 +619,12 @@ static Window *LocalAllocateWindow( w->caption_color = 0xFF; w->left = x; w->top = y; - w->width = width; - w->height = height; + w->width = min_width; + w->height = min_height; w->wndproc = proc; AssignWidgetToWindow(w, widget); - w->resize.width = width; - w->resize.height = height; + w->resize.width = min_width; + w->resize.height = min_height; w->resize.step_width = 1; w->resize.step_height = 1; w->window_number = window_number; @@ -653,6 +655,23 @@ static Window *LocalAllocateWindow( } CallWindowEventNP(w, WE_CREATE); + + /* Try to make windows smaller when our window is too small */ + if (min_width != def_width || min_height != def_height) { + int enlarge_x = max(min(def_width - min_width, _screen.width - min_width), 0); + int enlarge_y = max(min(def_height - min_height, _screen.height - min_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 (w->resize.step_width > 1) enlarge_x -= enlarge_x % (int)w->resize.step_width; + if (w->resize.step_height > 1) enlarge_y -= enlarge_y % (int)w->resize.step_height; + + ResizeWindow(w, enlarge_x, enlarge_y); + if (w->left < 0) w->left = 0; + if (w->top < 0) w->top = 0; + } + SetWindowDirty(w); return w; @@ -675,7 +694,7 @@ Window *AllocateWindow( int x, int y, int width, int height, WindowProc *proc, WindowClass cls, const Widget *widget) { - return LocalAllocateWindow(x, y, width, height, proc, cls, widget, 0); + return LocalAllocateWindow(x, y, width, height, width, height, proc, cls, widget, 0); } struct SizeRect { @@ -800,24 +819,24 @@ static Window *LocalAllocateWindowDesc(const WindowDesc *desc, int window_number w->left < _screen.width - 20 && w->left > -60 && w->top < _screen.height - 20) { pt.x = w->left + 10; - if (pt.x > _screen.width + 10 - desc->width) { - pt.x = (_screen.width + 10 - desc->width) - 20; + if (pt.x > _screen.width + 10 - desc->default_width) { + pt.x = (_screen.width + 10 - desc->default_width) - 20; } pt.y = w->top + 10; } else { switch (desc->left) { case WDP_ALIGN_TBR: { /* Align the right side with the top toolbar */ w = FindWindowById(WC_MAIN_TOOLBAR, 0); - pt.x = (w->left + w->width) - desc->width; + pt.x = (w->left + w->width) - desc->default_width; } break; case WDP_ALIGN_TBL: /* Align the left side with the top toolbar */ pt.x = FindWindowById(WC_MAIN_TOOLBAR, 0)->left; break; case WDP_AUTO: /* Find a good automatic position for the window */ - pt = GetAutoPlacePosition(desc->width, desc->height); + pt = GetAutoPlacePosition(desc->default_width, desc->default_height); goto allocate_window; case WDP_CENTER: /* Centre the window horizontally */ - pt.x = (_screen.width - desc->width) / 2; + pt.x = (_screen.width - desc->default_width) / 2; break; default: pt.x = desc->left; @@ -826,7 +845,7 @@ static Window *LocalAllocateWindowDesc(const WindowDesc *desc, int window_number switch (desc->top) { case WDP_CENTER: /* Centre the window vertically */ - pt.y = (_screen.height - desc->height) / 2; + pt.y = (_screen.height - desc->default_height) / 2; break; /* WDP_AUTO sets the position at once and is controlled by desc->left. * Both left and top must be set to WDP_AUTO */ @@ -842,7 +861,7 @@ static Window *LocalAllocateWindowDesc(const WindowDesc *desc, int window_number } allocate_window: - w = LocalAllocateWindow(pt.x, pt.y, desc->width, desc->height, desc->proc, desc->cls, desc->widgets, window_number); + w = LocalAllocateWindow(pt.x, pt.y, desc->minimum_width, desc->minimum_height, desc->default_width, desc->default_height, desc->proc, desc->cls, desc->widgets, window_number); w->desc_flags = desc->flags; return w; } @@ -1074,6 +1093,12 @@ void ResizeWindow(Window *w, int x, int y) bool resize_height = false; bool resize_width = false; + /* 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; + if (x == 0 && y == 0) return; SetWindowDirty(w); diff --git a/src/window.h b/src/window.h index a30a0a34f..60173560c 100644 --- a/src/window.h +++ b/src/window.h @@ -191,7 +191,7 @@ struct WindowEvent { }; struct WindowDesc { - int16 left, top, width, height; + int16 left, top, minimum_width, minimum_height, default_width, default_height; WindowClass cls; WindowClass parent_cls; uint32 flags; -- cgit v1.2.3-54-g00ecf