Changeset - r21790:431300cb5696
[Not reviewed]
master
0 1 0
peter1138 - 10 years ago 2014-09-28 19:19:47
peter1138@openttd.org
(svn r26935) -Codechange: Fit company colour selection drop down list to UI scale.
1 file changed with 7 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -32,12 +32,13 @@
 
#include "rail.h"
 
#include "engine_base.h"
 
#include "window_func.h"
 
#include "road_func.h"
 
#include "water.h"
 
#include "station_func.h"
 
#include "zoom_func.h"
 

	
 
#include "widgets/company_widget.h"
 

	
 
#include "safeguards.h"
 

	
 

	
 
@@ -525,25 +526,28 @@ public:
 
	{
 
		return _colour_dropdown[this->result];
 
	}
 

	
 
	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
 
	{
 
		return true;
 
	}
 

	
 
	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);
 
	}
 
};
 

	
 
/** Company livery colour scheme window. */
 
struct SelectCompanyLiveryWindow : public Window {
 
private:
0 comments (0 inline, 0 general)