summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-01-28 10:09:40 +0000
committertron <tron@openttd.org>2007-01-28 10:09:40 +0000
commit508dc154df8d845d84a2ed24ff801fc760cfe577 (patch)
tree11b4deb3cc72ca5ee663ed421d3b106ebd62c35a /src
parentb6186cf39cb558df6422fd530c1f7fd7120d5bfb (diff)
downloadopenttd-508dc154df8d845d84a2ed24ff801fc760cfe577.tar.xz
(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
Diffstat (limited to 'src')
-rw-r--r--src/airport_gui.cpp4
-rw-r--r--src/dock_gui.cpp4
-rw-r--r--src/gui.h2
-rw-r--r--src/rail_gui.cpp2
-rw-r--r--src/road_gui.cpp4
-rw-r--r--src/terraform_gui.cpp11
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;
+ }
}