From 58458c66528b2e4134121ccbc4ee450a96ab2528 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sun, 28 Sep 2014 19:19:47 +0000 Subject: (svn r26935) -Codechange: Fit company colour selection drop down list to UI scale. --- src/company_gui.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 9b0d7e63a..31c5ed368 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -35,6 +35,7 @@ #include "road_func.h" #include "water.h" #include "station_func.h" +#include "zoom_func.h" #include "widgets/company_widget.h" @@ -528,7 +529,7 @@ public: uint Height(uint width) const { - return max(FONT_HEIGHT_NORMAL, 14); + return max(FONT_HEIGHT_NORMAL, UnScaleByZoom(4 * 12, ZOOM_LVL_GUI) + 2); } bool Selectable() const @@ -539,8 +540,11 @@ public: void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const { bool rtl = _current_text_dir == TD_RTL; - DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, rtl ? right - 16 : left + 16, top + 7); - DrawString(rtl ? left + 2 : left + 32, rtl ? right - 32 : right - 2, top + max(0, 13 - FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK); + int height = bottom - top; + int icon_y_offset = height / 2; + int text_y_offset = (height - FONT_HEIGHT_NORMAL) / 2 + 1; + DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, rtl ? right - 2 - UnScaleByZoom(4 * 14, ZOOM_LVL_GUI) : left + UnScaleByZoom(4 * 14, ZOOM_LVL_GUI) + 2, top + icon_y_offset); + DrawString(rtl ? left + 2 : left + UnScaleByZoom(4 * 28, ZOOM_LVL_GUI) + 4, rtl ? right - UnScaleByZoom(4 * 28, ZOOM_LVL_GUI) - 4 : right - 2, top + text_y_offset, this->String(), sel ? TC_WHITE : TC_BLACK); } }; -- cgit v1.2.3-54-g00ecf