diff options
author | rubidium <rubidium@openttd.org> | 2009-11-28 14:36:43 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-28 14:36:43 +0000 |
commit | b58b058e2b254cb375ebc2ec67c1ac307e6aeb87 (patch) | |
tree | 5e021c897eeb9101c4dd0048be16d860fd9cf14d | |
parent | 6a367fda8a7f8e563310f7254d612dbb0010d919 (diff) | |
download | openttd-b58b058e2b254cb375ebc2ec67c1ac307e6aeb87.tar.xz |
(svn r18321) -Fix [FS#3331]: make the toolbars also calculate their top location based on the main toolbar's height instead of hardcoding that
-rw-r--r-- | src/airport_gui.cpp | 2 | ||||
-rw-r--r-- | src/dock_gui.cpp | 2 | ||||
-rw-r--r-- | src/rail_gui.cpp | 2 | ||||
-rw-r--r-- | src/road_gui.cpp | 4 | ||||
-rw-r--r-- | src/widgets/dropdown.cpp | 2 | ||||
-rw-r--r-- | src/window.cpp | 15 | ||||
-rw-r--r-- | src/window_gui.h | 9 |
7 files changed, 14 insertions, 22 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index b2f28976b..03b90cdc2 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -147,7 +147,7 @@ static const NWidgetPart _nested_air_toolbar_widgets[] = { }; static const WindowDesc _air_toolbar_desc( - WDP_ALIGN_TBR, 22, 64, 36, + WDP_ALIGN_TOOLBAR, WDP_ALIGN_TOOLBAR, 64, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets) diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index b6c6ebf98..234e520a6 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -279,7 +279,7 @@ static const NWidgetPart _nested_build_docks_toolbar_widgets[] = { }; static const WindowDesc _build_docks_toolbar_desc( - WDP_ALIGN_TBR, 22, 160, 36, + WDP_ALIGN_TOOLBAR, WDP_ALIGN_TOOLBAR, 160, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets) diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 932d4ea61..a540bb352 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -856,7 +856,7 @@ static const NWidgetPart _nested_build_rail_widgets[] = { }; static const WindowDesc _build_rail_desc( - WDP_ALIGN_TBR, 22, 350, 36, + WDP_ALIGN_TOOLBAR, WDP_ALIGN_TOOLBAR, 350, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_rail_widgets, lengthof(_nested_build_rail_widgets) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index c2a1ad8d4..743c88904 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -661,7 +661,7 @@ static const NWidgetPart _nested_build_road_widgets[] = { }; static const WindowDesc _build_road_desc( - WDP_ALIGN_TBR, 22, 263, 36, + WDP_ALIGN_TOOLBAR, WDP_ALIGN_TOOLBAR, 263, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_road_widgets, lengthof(_nested_build_road_widgets) @@ -700,7 +700,7 @@ static const NWidgetPart _nested_build_tramway_widgets[] = { }; static const WindowDesc _build_tramway_desc( - WDP_ALIGN_TBR, 22, 241, 36, + WDP_ALIGN_TOOLBAR, WDP_ALIGN_TOOLBAR, 241, 36, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, _nested_build_tramway_widgets, lengthof(_nested_build_tramway_widgets) diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 80959f155..d42c54386 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -83,7 +83,7 @@ static const NWidgetPart _nested_dropdown_menu_widgets[] = { }; const WindowDesc _dropdown_desc( - 0, 0, 0, 0, // x/y position not used. + WDP_MANUAL, WDP_MANUAL, 0, 0, // x/y position not used. WC_DROPDOWN_MENU, WC_NONE, 0, _nested_dropdown_menu_widgets, lengthof(_nested_dropdown_menu_widgets) diff --git a/src/window.cpp b/src/window.cpp index 28f6fddf5..fdaee4819 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1101,14 +1101,8 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int pt.y = w->top + ((desc->parent_cls == WC_BUILD_TOOLBAR || desc->parent_cls == WC_SCEN_LAND_GEN) ? w->height : 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) - 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_ALIGN_TOOLBAR: // Align to the toolbar + return GetToolbarAlignedWindowPosition(default_width); case WDP_AUTO: // Find a good automatic position for the window return GetAutoPlacePosition(default_width, default_height); @@ -1128,11 +1122,10 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int break; /* WDP_AUTO sets the position at once and is controlled by desc->left. - * Both left and top must be set to WDP_AUTO */ + * Both left and top must be set to WDP_AUTO. Same for toolbar alignment. */ case WDP_AUTO: + case WDP_ALIGN_TOOLBAR: NOT_REACHED(); - assert(desc->left == WDP_AUTO && desc->top != WDP_AUTO); - /* fallthrough */ default: pt.y = desc->top; diff --git a/src/window_gui.h b/src/window_gui.h index 5eb2bf4ef..0495bcd8f 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -159,11 +159,10 @@ enum WindowDefaultFlag { * Special values for 'left' and 'top' to cause a specific placement */ enum WindowDefaultPosition { - WDP_MANUAL, ///< Manually align the window (so no automatic location finding) - WDP_AUTO = -1, ///< Find a place automatically - WDP_CENTER = -2, ///< Center the window (left/right or top/bottom) - WDP_ALIGN_TBR = -3, ///< Align the right side of the window with the right side of the main toolbar - WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar + WDP_MANUAL, ///< Manually align the window (so no automatic location finding) + WDP_AUTO = -1, ///< Find a place automatically + WDP_CENTER = -2, ///< Center the window (left/right or top/bottom) + WDP_ALIGN_TOOLBAR = -3, ///< Align to the main toolbar }; Point GetToolbarAlignedWindowPosition(int window_width); |