mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r27146) -Fix: Make statusbar and chat-entry window use the same width as the toolbar. Otherwise they lack a size definition.
This commit is contained in:
parent
1ebd85c1cc
commit
e113f5e4a1
|
@ -21,6 +21,7 @@
|
||||||
#include "../querystring_gui.h"
|
#include "../querystring_gui.h"
|
||||||
#include "../town.h"
|
#include "../town.h"
|
||||||
#include "../window_func.h"
|
#include "../window_func.h"
|
||||||
|
#include "../toolbar_gui.h"
|
||||||
#include "../core/geometry_func.hpp"
|
#include "../core/geometry_func.hpp"
|
||||||
#include "network.h"
|
#include "network.h"
|
||||||
#include "network_client.h"
|
#include "network_client.h"
|
||||||
|
@ -321,6 +322,11 @@ struct NetworkChatWindow : public Window {
|
||||||
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
|
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
|
||||||
|
{
|
||||||
|
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the next item of the list of things that can be auto-completed.
|
* Find the next item of the list of things that can be auto-completed.
|
||||||
* @param item The current indexed item to return. This function can, and most
|
* @param item The current indexed item to return. This function can, and most
|
||||||
|
@ -536,7 +542,7 @@ static const NWidgetPart _nested_chat_window_widgets[] = {
|
||||||
|
|
||||||
/** The description of the chat window. */
|
/** The description of the chat window. */
|
||||||
static WindowDesc _chat_window_desc(
|
static WindowDesc _chat_window_desc(
|
||||||
WDP_MANUAL, NULL, 640, 14, // x, y, width, height
|
WDP_MANUAL, NULL, 0, 0,
|
||||||
WC_SEND_NETWORK_MSG, WC_NONE,
|
WC_SEND_NETWORK_MSG, WC_NONE,
|
||||||
0,
|
0,
|
||||||
_nested_chat_window_widgets, lengthof(_nested_chat_window_widgets)
|
_nested_chat_window_widgets, lengthof(_nested_chat_window_widgets)
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "saveload/saveload.h"
|
#include "saveload/saveload.h"
|
||||||
#include "window_func.h"
|
#include "window_func.h"
|
||||||
#include "statusbar_gui.h"
|
#include "statusbar_gui.h"
|
||||||
|
#include "toolbar_gui.h"
|
||||||
#include "core/geometry_func.hpp"
|
#include "core/geometry_func.hpp"
|
||||||
|
|
||||||
#include "widgets/statusbar_widget.h"
|
#include "widgets/statusbar_widget.h"
|
||||||
|
@ -101,6 +102,11 @@ struct StatusBarWindow : Window {
|
||||||
return pt;
|
return pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
|
||||||
|
{
|
||||||
|
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
|
||||||
{
|
{
|
||||||
Dimension d;
|
Dimension d;
|
||||||
|
@ -238,7 +244,7 @@ static const NWidgetPart _nested_main_status_widgets[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static WindowDesc _main_status_desc(
|
static WindowDesc _main_status_desc(
|
||||||
WDP_MANUAL, NULL, 640, 12,
|
WDP_MANUAL, NULL, 0, 0,
|
||||||
WC_STATUS_BAR, WC_NONE,
|
WC_STATUS_BAR, WC_NONE,
|
||||||
WDF_NO_FOCUS,
|
WDF_NO_FOCUS,
|
||||||
_nested_main_status_widgets, lengthof(_nested_main_status_widgets)
|
_nested_main_status_widgets, lengthof(_nested_main_status_widgets)
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
#include "goal_base.h"
|
#include "goal_base.h"
|
||||||
#include "story_base.h"
|
#include "story_base.h"
|
||||||
|
#include "toolbar_gui.h"
|
||||||
|
|
||||||
#include "widgets/toolbar_widget.h"
|
#include "widgets/toolbar_widget.h"
|
||||||
|
|
||||||
|
@ -56,6 +57,9 @@
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
|
|
||||||
|
/** Width of the toolbar, shared by statusbar. */
|
||||||
|
uint _toolbar_width = 0;
|
||||||
|
|
||||||
RailType _last_built_railtype;
|
RailType _last_built_railtype;
|
||||||
RoadType _last_built_roadtype;
|
RoadType _last_built_roadtype;
|
||||||
|
|
||||||
|
@ -1350,7 +1354,7 @@ public:
|
||||||
child_wid->current_x = child_wid->smallest_x;
|
child_wid->current_x = child_wid->smallest_x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w->window_desc->default_width = nbuttons * this->smallest_x;
|
_toolbar_width = nbuttons * this->smallest_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
|
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl)
|
||||||
|
@ -1526,7 +1530,7 @@ class NWidgetScenarioToolbarContainer : public NWidgetToolbarContainer {
|
||||||
|
|
||||||
assert(i < lengthof(this->panel_widths));
|
assert(i < lengthof(this->panel_widths));
|
||||||
this->panel_widths[i++] = child_wid->current_x;
|
this->panel_widths[i++] = child_wid->current_x;
|
||||||
w->window_desc->default_width += child_wid->current_x;
|
_toolbar_width += child_wid->current_x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1666,6 +1670,11 @@ struct MainToolbarWindow : Window {
|
||||||
DoZoomInOutWindow(ZOOM_NONE, this);
|
DoZoomInOutWindow(ZOOM_NONE, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void FindWindowPlacementAndResize(int def_width, int def_height)
|
||||||
|
{
|
||||||
|
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void OnPaint()
|
virtual void OnPaint()
|
||||||
{
|
{
|
||||||
/* If spectator, disable all construction buttons
|
/* If spectator, disable all construction buttons
|
||||||
|
@ -1900,7 +1909,7 @@ static const NWidgetPart _nested_toolbar_normal_widgets[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static WindowDesc _toolb_normal_desc(
|
static WindowDesc _toolb_normal_desc(
|
||||||
WDP_MANUAL, NULL, 640, 22,
|
WDP_MANUAL, NULL, 0, 0,
|
||||||
WC_MAIN_TOOLBAR, WC_NONE,
|
WC_MAIN_TOOLBAR, WC_NONE,
|
||||||
WDF_NO_FOCUS,
|
WDF_NO_FOCUS,
|
||||||
_nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets),
|
_nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets),
|
||||||
|
@ -2211,7 +2220,7 @@ static const NWidgetPart _nested_toolb_scen_widgets[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static WindowDesc _toolb_scen_desc(
|
static WindowDesc _toolb_scen_desc(
|
||||||
WDP_MANUAL, NULL, 640, 22,
|
WDP_MANUAL, NULL, 0, 0,
|
||||||
WC_MAIN_TOOLBAR, WC_NONE,
|
WC_MAIN_TOOLBAR, WC_NONE,
|
||||||
WDF_NO_FOCUS,
|
WDF_NO_FOCUS,
|
||||||
_nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets),
|
_nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets),
|
||||||
|
|
|
@ -16,4 +16,6 @@ void AllocateToolbar();
|
||||||
void ToggleBoundingBoxes();
|
void ToggleBoundingBoxes();
|
||||||
void ToggleDirtyBlocks();
|
void ToggleDirtyBlocks();
|
||||||
|
|
||||||
|
extern uint _toolbar_width;
|
||||||
|
|
||||||
#endif /* TOOLBAR_GUI_H */
|
#endif /* TOOLBAR_GUI_H */
|
||||||
|
|
|
@ -3388,7 +3388,7 @@ void RelocateAllWindows(int neww, int newh)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case WC_MAIN_TOOLBAR:
|
case WC_MAIN_TOOLBAR:
|
||||||
ResizeWindow(w, min(neww, w->window_desc->default_width) - w->width, 0, false);
|
ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false);
|
||||||
|
|
||||||
top = w->top;
|
top = w->top;
|
||||||
left = PositionMainToolbar(w); // changes toolbar orientation
|
left = PositionMainToolbar(w); // changes toolbar orientation
|
||||||
|
@ -3400,14 +3400,15 @@ void RelocateAllWindows(int neww, int newh)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WC_STATUS_BAR:
|
case WC_STATUS_BAR:
|
||||||
ResizeWindow(w, min(neww, w->window_desc->default_width) - w->width, 0, false);
|
ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false);
|
||||||
|
|
||||||
top = newh - w->height;
|
top = newh - w->height;
|
||||||
left = PositionStatusbar(w);
|
left = PositionStatusbar(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WC_SEND_NETWORK_MSG:
|
case WC_SEND_NETWORK_MSG:
|
||||||
ResizeWindow(w, Clamp(neww, 320, 640) - w->width, 0, false);
|
ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false);
|
||||||
|
|
||||||
top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
|
top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height;
|
||||||
left = PositionNetworkChatWindow(w);
|
left = PositionNetworkChatWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -271,7 +271,7 @@ struct Window : ZeroedMemoryAllocator {
|
||||||
protected:
|
protected:
|
||||||
void InitializeData(WindowNumber window_number);
|
void InitializeData(WindowNumber window_number);
|
||||||
void InitializePositionSize(int x, int y, int min_width, int min_height);
|
void InitializePositionSize(int x, int y, int min_width, int min_height);
|
||||||
void FindWindowPlacementAndResize(int def_width, int def_height);
|
virtual void FindWindowPlacementAndResize(int def_width, int def_height);
|
||||||
|
|
||||||
SmallVector<int, 4> scheduled_invalidation_data; ///< Data of scheduled OnInvalidateData() calls.
|
SmallVector<int, 4> scheduled_invalidation_data; ///< Data of scheduled OnInvalidateData() calls.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue