summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2019-02-02 14:44:02 +0000
committerPeterN <peter@fuzzle.org>2019-02-02 16:57:47 +0000
commitc9d801a98df5ea19ef8aa12b0f3f798729d6a1f1 (patch)
tree8b83a5c5974c6a95c4e9ca0820a1aa6d3991fec4 /src
parent011257dc8804175dd7d1e839e97e796c0a88aee6 (diff)
downloadopenttd-c9d801a98df5ea19ef8aa12b0f3f798729d6a1f1.tar.xz
Fix: Make livery window resize properly if GUI scale changes whilst open.
Diffstat (limited to 'src')
-rw-r--r--src/company_gui.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 5317d7089..5a751a363 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -700,9 +700,6 @@ public:
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_SCL_MATRIX_SCROLLBAR);
- this->square = GetSpriteSize(SPR_SQUARE);
- this->line_height = max(this->square.height, (uint)FONT_HEIGHT_NORMAL) + 4;
-
if (group == INVALID_GROUP) {
this->livery_class = LC_OTHER;
this->sel = 1;
@@ -770,6 +767,9 @@ public:
case WID_SCL_MATRIX: {
/* 11 items in the default rail class */
+ this->square = GetSpriteSize(SPR_SQUARE);
+ this->line_height = max(this->square.height, (uint)FONT_HEIGHT_NORMAL) + 4;
+
size->height = 11 * this->line_height;
resize->width = 1;
resize->height = this->line_height;
@@ -784,6 +784,7 @@ public:
FALLTHROUGH;
case WID_SCL_PRI_COL_DROPDOWN: {
+ this->square = GetSpriteSize(SPR_SQUARE);
int padding = this->square.width + NWidgetScrollbar::GetVerticalDimension().width + 10;
for (const StringID *id = _colour_dropdown; id != endof(_colour_dropdown); id++) {
size->width = max(size->width, GetStringBoundingBox(*id).width + padding);