Changeset - r21871:ee16616a6217
[Not reviewed]
master
0 1 0
peter1138 - 10 years ago 2014-10-18 16:11:40
peter1138@openttd.org
(svn r27023) -Codechange: Scale tooltip size by UI scale.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/misc_gui.cpp
Show inline comments
 
@@ -16,24 +16,25 @@
 
#include "gui.h"
 
#include "command_func.h"
 
#include "company_func.h"
 
#include "town.h"
 
#include "string_func.h"
 
#include "company_base.h"
 
#include "texteff.hpp"
 
#include "strings_func.h"
 
#include "window_func.h"
 
#include "querystring_gui.h"
 
#include "core/geometry_func.hpp"
 
#include "newgrf_debug.h"
 
#include "zoom_func.h"
 

	
 
#include "widgets/misc_widget.h"
 

	
 
#include "table/strings.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Method to open the OSK. */
 
enum OskActivation {
 
	OSKA_DISABLED,           ///< The OSK shall not be activated at all.
 
	OSKA_DOUBLE_CLICK,       ///< Double click on the edit box opens OSK.
 
	OSKA_SINGLE_CLICK,       ///< Single click after focus click opens OSK.
 
@@ -674,25 +675,25 @@ struct TooltipsWindow : public Window
 
		pt.y = Clamp(_cursor.pos.y + _cursor.size.y + _cursor.offs.y + 5, scr_top, scr_bot);
 
		if (pt.y + sm_height > scr_bot) pt.y = min(_cursor.pos.y + _cursor.offs.y - 5, scr_bot) - sm_height;
 
		pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width);
 

	
 
		return pt;
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
	{
 
		/* There is only one widget. */
 
		for (uint i = 0; i != this->paramcount; i++) SetDParam(i, this->params[i]);
 

	
 
		size->width  = min(GetStringBoundingBox(this->string_id).width, 194);
 
		size->width  = min(GetStringBoundingBox(this->string_id).width, UnScaleByZoom(4 * 194, ZOOM_LVL_GUI));
 
		size->height = GetStringHeight(this->string_id, size->width);
 

	
 
		/* Increase slightly to have some space around the box. */
 
		size->width  += 2 + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT;
 
		size->height += 2 + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
 
	}
 

	
 
	virtual void DrawWidget(const Rect &r, int widget) const
 
	{
 
		/* There is only one widget. */
 
		GfxFillRect(r.left, r.top, r.right, r.bottom, PC_BLACK);
 
		GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, PC_LIGHT_YELLOW);
0 comments (0 inline, 0 general)