diff options
author | rubidium <rubidium@openttd.org> | 2009-11-28 14:30:00 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-28 14:30:00 +0000 |
commit | 6a367fda8a7f8e563310f7254d612dbb0010d919 (patch) | |
tree | b4ce5effc9523320c78bde57d6ab55eefd2c2f16 /src/terraform_gui.cpp | |
parent | a825349bf108aa99b6080c3bceb35e8b3c75cc97 (diff) | |
download | openttd-6a367fda8a7f8e563310f7254d612dbb0010d919.tar.xz |
(svn r18320) -Codechange: make the terraform and transparency window not use absolute location but manually calculate based on toolbar size etc.
Diffstat (limited to 'src/terraform_gui.cpp')
-rw-r--r-- | src/terraform_gui.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index c869a2bef..fb9b09b2a 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -31,6 +31,7 @@ #include "tree_map.h" #include "landscape_type.h" #include "tilehighlight_func.h" +#include "strings_func.h" #include "table/sprites.h" #include "table/strings.h" @@ -288,6 +289,13 @@ struct TerraformToolbarWindow : Window { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } + virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) + { + Point pt = GetToolbarAlignedWindowPosition(sm_width); + pt.y += sm_height; + return pt; + } + virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) { if (pt.x != -1) { @@ -337,7 +345,7 @@ static const NWidgetPart _nested_terraform_widgets[] = { }; static const WindowDesc _terraform_desc( - WDP_ALIGN_TBR, 22 + 36, 158, 36, + WDP_MANUAL, WDP_MANUAL, 158, 36, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, _nested_terraform_widgets, lengthof(_nested_terraform_widgets) @@ -354,15 +362,14 @@ Window *ShowTerraformToolbar(Window *link) w = FindWindowById(WC_SCEN_LAND_GEN, 0); if (w == NULL) return NULL; } else { - w->top = 22; + w->top -= w->height; w->SetDirty(); } /* Align the terraform toolbar under the main toolbar and put the linked - * toolbar to left of it - */ + * toolbar to left/right of it */ + link->left = w->left + (_dynlang.text_dir == TD_RTL ? w->width : -link->width); link->top = w->top; - link->left = w->left - link->width; link->SetDirty(); return w; |