mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r18321) -Fix [FS#3331]: make the toolbars also calculate their top location based on the main toolbar's height instead of hardcoding that
This commit is contained in:
parent
6a367fda8a
commit
b58b058e2b
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue