From c2a7b82a9f58511638883fedca21dad1e5bf4ab9 Mon Sep 17 00:00:00 2001 From: planetmaker Date: Tue, 19 Oct 2010 21:48:20 +0000 Subject: (svn r20997) -Fix: Size of sort buttons for order and vehicle list gui could be too small --- src/bridge_gui.cpp | 2 +- src/group_gui.cpp | 8 ++++++++ src/industry_gui.cpp | 2 +- src/station_gui.cpp | 2 +- src/town_gui.cpp | 2 +- src/vehicle_gui.cpp | 8 ++++++++ 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 303979754..e6d20f7a9 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -169,7 +169,7 @@ public: switch (widget) { case BBSW_DROPDOWN_ORDER: { Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); - d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the word is centered, also looks nice. + d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; *size = maxdim(*size, d); break; diff --git a/src/group_gui.cpp b/src/group_gui.cpp index bae682c9e..62401cac4 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -231,6 +231,14 @@ public: size->width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT + 8 + 8; break; + case GRP_WIDGET_SORT_BY_ORDER: { + Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); + d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. + d.height += padding.height; + *size = maxdim(*size, d); + break; + } + case GRP_WIDGET_LIST_VEHICLE: resize->height = GetVehicleListHeight(this->vli.vtype, FONT_HEIGHT_NORMAL + WD_MATRIX_TOP); size->height = 4 * resize->height; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index b4ec15216..5cdc04136 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1267,7 +1267,7 @@ public: switch (widget) { case IDW_DROPDOWN_ORDER: { Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); - d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the word is centered, also looks nice. + d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; *size = maxdim(*size, d); break; diff --git a/src/station_gui.cpp b/src/station_gui.cpp index c3d3d87fe..9b8e8f7ed 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -379,7 +379,7 @@ public: switch (widget) { case SLW_SORTBY: { Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); - d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the word is centered, also looks nice. + d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; *size = maxdim(*size, d); break; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 5978d2bbe..1cd7c3193 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -784,7 +784,7 @@ public: case TDW_SORTNAME: case TDW_SORTPOPULATION: { Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); - d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the word is centered, also looks nice. + d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. d.height += padding.height; *size = maxdim(*size, d); break; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 743a0cd27..56d1c4903 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1171,6 +1171,14 @@ public: } break; + case VLW_WIDGET_SORT_ORDER: { + Dimension d = GetStringBoundingBox(this->GetWidget(widget)->widget_data); + d.width += padding.width + WD_SORTBUTTON_ARROW_WIDTH * 2; // Doubled since the string is centred and it also looks better. + d.height += padding.height; + *size = maxdim(*size, d); + break; + } + case VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN: { Dimension d = this->GetActionDropdownSize(this->vli.type == VL_STANDARD, false); d.height += padding.height; -- cgit v1.2.3-54-g00ecf