From 508dc154df8d845d84a2ed24ff801fc760cfe577 Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 28 Jan 2007 10:09:40 +0000 Subject: (svn r8436) -Fix -Feature: When linking the terraform toolbar to the build toolbars place them side by side instead of on top of each other --- src/airport_gui.cpp | 4 ++-- src/dock_gui.cpp | 4 ++-- src/gui.h | 2 +- src/rail_gui.cpp | 2 +- src/road_gui.cpp | 4 ++-- src/terraform_gui.cpp | 11 +++++++++-- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index be9a8223c..bebb62183 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -135,8 +135,8 @@ void ShowBuildAirToolbar(void) if (!IsValidPlayer(_current_player)) return; DeleteWindowById(WC_BUILD_TOOLBAR, 0); - AllocateWindowDescFront(&_air_toolbar_desc, 0); - if (_patches.link_terraform_toolbar) ShowTerraformToolbar(); + Window *w = AllocateWindowDescFront(&_air_toolbar_desc, 0); + if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); } static void BuildAirportPickerWndProc(Window *w, WindowEvent *e) diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 1997a5a3d..9930b89ae 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -219,8 +219,8 @@ void ShowBuildDocksToolbar(void) if (!IsValidPlayer(_current_player)) return; DeleteWindowById(WC_BUILD_TOOLBAR, 0); - AllocateWindowDesc(&_build_docks_toolbar_desc); - if (_patches.link_terraform_toolbar) ShowTerraformToolbar(); + Window *w = AllocateWindowDesc(&_build_docks_toolbar_desc); + if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); } static void BuildDockStationWndProc(Window *w, WindowEvent *e) diff --git a/src/gui.h b/src/gui.h index f91ea849e..96660bb09 100644 --- a/src/gui.h +++ b/src/gui.h @@ -57,7 +57,7 @@ void ShowShipViewWindow(const Vehicle *v); void ShowBuildAirToolbar(void); /* terraform_gui.c */ -void ShowTerraformToolbar(void); +void ShowTerraformToolbar(Window *link = NULL); /* tgp_gui.c */ void ShowGenerateLandscape(void); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 1fe4691b3..10cbbab84 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -624,7 +624,7 @@ void ShowBuildRailToolbar(RailType railtype, int button) _build_railroad_button_proc[button](w); UpdateRemoveWidgetStatus(w, button + 4); } - if (_patches.link_terraform_toolbar) ShowTerraformToolbar(); + if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); } /* TODO: For custom stations, respect their allowed platforms/lengths bitmasks! diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 3b8437c34..6b9806033 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -329,8 +329,8 @@ void ShowBuildRoadToolbar(void) if (!IsValidPlayer(_current_player)) return; DeleteWindowById(WC_BUILD_TOOLBAR, 0); - AllocateWindowDesc(&_build_road_desc); - if (_patches.link_terraform_toolbar) ShowTerraformToolbar(); + Window *w = AllocateWindowDesc(&_build_road_desc); + if (_patches.link_terraform_toolbar) ShowTerraformToolbar(w); } static const Widget _build_road_scen_widgets[] = { diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 8d6e1276a..a71cb3cd5 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -278,8 +278,15 @@ static const WindowDesc _terraform_desc = { TerraformToolbWndProc }; -void ShowTerraformToolbar(void) +void ShowTerraformToolbar(Window *link) { if (!IsValidPlayer(_current_player)) return; - AllocateWindowDescFront(&_terraform_desc, 0); + Window *w = AllocateWindowDescFront(&_terraform_desc, 0); + if (w != NULL && link != NULL) { + /* Align the terraform toolbar under the main toolbar and put the linked + * toolbar to left of it + */ + w->top = 22; + link->left = w->left - link->width; + } } -- cgit v1.2.3-70-g09d2