changeset 5860:dc5ff33e8dda draft

(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
author tron <tron@openttd.org>
date Sun, 28 Jan 2007 10:09:40 +0000
parents ef2df98c7964
children f075db30c06a
files src/airport_gui.cpp src/dock_gui.cpp src/gui.h src/rail_gui.cpp src/road_gui.cpp src/terraform_gui.cpp
diffstat 6 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -135,8 +135,8 @@
 	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)
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -219,8 +219,8 @@
 	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)
--- a/src/gui.h
+++ b/src/gui.h
@@ -57,7 +57,7 @@
 void ShowBuildAirToolbar(void);
 
 /* terraform_gui.c */
-void ShowTerraformToolbar(void);
+void ShowTerraformToolbar(Window *link = NULL);
 
 /* tgp_gui.c */
 void ShowGenerateLandscape(void);
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -624,7 +624,7 @@
 		_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!
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -329,8 +329,8 @@
 	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[] = {
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -278,8 +278,15 @@
 	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;
+	}
 }