summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2014-09-28 19:19:47 +0000
committerpeter1138 <peter1138@openttd.org>2014-09-28 19:19:47 +0000
commit58458c66528b2e4134121ccbc4ee450a96ab2528 (patch)
treef98819d8092fff92f4ca7059b0c3e42fdb01aacd /src
parent1748d7ad6b6b5f30039200c7fc42f178d3d84e3d (diff)
downloadopenttd-58458c66528b2e4134121ccbc4ee450a96ab2528.tar.xz
(svn r26935) -Codechange: Fit company colour selection drop down list to UI scale.
Diffstat (limited to 'src')
-rw-r--r--src/company_gui.cpp10
1 files changed, 7 insertions, 3 deletions
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);
}
};