From c9d801a98df5ea19ef8aa12b0f3f798729d6a1f1 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 2 Feb 2019 14:44:02 +0000 Subject: Fix: Make livery window resize properly if GUI scale changes whilst open. --- src/company_gui.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3-70-g09d2