Changeset - r13504:7faf7486ee85
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-11-09 17:20:48
rubidium@openttd.org
(svn r18033) -Codechange: make the padding for IMGBTN_2 the same as for IMGBTN; the image doesn't move, so the extra space at the right and bottom aren't needed
3 files changed with 6 insertions and 27 deletions:
0 comments (0 inline, 0 general)
src/toolbar_gui.cpp
Show inline comments
 
@@ -1452,7 +1452,7 @@ public:
 
			case TBSE_DATEPANEL:
 
				SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1));
 
				*size = GetStringBoundingBox(STR_WHITE_DATE_LONG);
 
				size->height = max(size->height, GetSpriteSize(SPR_IMG_SAVE).height + WD_IMGBTN2_TOP + WD_IMGBTN2_BOTTOM);
 
				size->height = max(size->height, GetSpriteSize(SPR_IMG_SAVE).height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM);
 
				break;
 
		}
 
	}
src/widget.cpp
Show inline comments
 
@@ -286,16 +286,8 @@ static inline void DrawImageButtons(cons
 
	assert(img != 0);
 
	DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
 

	
 
	int left, top;
 
	if ((type & WWT_MASK) == WWT_IMGBTN_2) {
 
		if (clicked) img++; // Show different image when clicked for #WWT_IMGBTN_2.
 
		left = WD_IMGBTN2_LEFT;
 
		top  = WD_IMGBTN2_TOP;
 
	} else {
 
		left = WD_IMGBTN_LEFT;
 
		top  = WD_IMGBTN_TOP;
 
	}
 
	DrawSprite(img, PAL_NONE, r.left + left + clicked, r.top + top + clicked);
 
	if ((type & WWT_MASK) == WWT_IMGBTN_2 && clicked) img++; // Show different image when clicked for #WWT_IMGBTN_2.
 
	DrawSprite(img, PAL_NONE, r.left + WD_IMGBTN_LEFT + clicked, r.top + WD_IMGBTN_TOP + clicked);
 
}
 

	
 
/**
 
@@ -2077,19 +2069,12 @@ void NWidgetLeaf::SetupSmallestSize(Wind
 
			break;
 
		}
 
		case WWT_IMGBTN:
 
		case WWT_IMGBTN_2:
 
		case WWT_PUSHIMGBTN: {
 
			static const Dimension extra = {WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT,  WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM};
 
			padding = &extra;
 
			Dimension d2 = GetSpriteSize(this->widget_data);
 
			d2.width += extra.width;
 
			d2.height += extra.height;
 
			size = maxdim(size, d2);
 
			break;
 
		}
 
		case WWT_IMGBTN_2: {
 
			static const Dimension extra = {WD_IMGBTN2_LEFT + WD_IMGBTN2_RIGHT,  WD_IMGBTN2_TOP + WD_IMGBTN2_BOTTOM};
 
			padding = &extra;
 
			Dimension d2 = maxdim(GetSpriteSize(this->widget_data), GetSpriteSize(this->widget_data + 1));
 
			if (this->type == WWT_IMGBTN_2) d2 = maxdim(d2, GetSpriteSize(this->widget_data + 1));
 
			d2.width += extra.width;
 
			d2.height += extra.height;
 
			size = maxdim(size, d2);
src/window_gui.h
Show inline comments
 
@@ -37,18 +37,12 @@ DECLARE_ENUM_AS_BIT_SET(FrameFlags);
 

	
 
/** Distances used in drawing widgets. */
 
enum WidgetDrawDistances {
 
	/* WWT_IMGBTN */
 
	/* WWT_IMGBTN(_2) */
 
	WD_IMGBTN_LEFT    = 1,      ///< Left offset of the image in the button.
 
	WD_IMGBTN_RIGHT   = 2,      ///< Right offset of the image in the button.
 
	WD_IMGBTN_TOP     = 1,      ///< Top offset of image in the button.
 
	WD_IMGBTN_BOTTOM  = 2,      ///< Bottom offset of image in the button.
 

	
 
	/* WWT_IMGBTN_2 */
 
	WD_IMGBTN2_LEFT   = 1,      ///< Left offset of the images in the button.
 
	WD_IMGBTN2_RIGHT  = 3,      ///< Right offset of the images in the button.
 
	WD_IMGBTN2_TOP    = 1,      ///< Top offset of images in the button.
 
	WD_IMGBTN2_BOTTOM = 3,      ///< Bottom offset of images in the button.
 

	
 
	/* WWT_INSET */
 
	WD_INSET_LEFT  = 2,         ///< Left offset of string.
 
	WD_INSET_RIGHT = 2,         ///< Right offset of string.
0 comments (0 inline, 0 general)