Changeset - r11422:1daa77b60959
[Not reviewed]
master
0 20 0
rubidium - 15 years ago 2009-03-21 20:12:12
rubidium@openttd.org
(svn r15785) -Codechange: remove the *Truncated part of the old text drawing API.
20 files changed with 67 insertions and 153 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -76,35 +76,35 @@ struct AIListWindow : public Window {
 
		this->DrawWidgets();
 

	
 
		/* Draw a list of all available AIs. */
 
		int y = this->widget[AIL_WIDGET_LIST].top;
 
		/* First AI in the list is hardcoded to random */
 
		if (this->vscroll.pos == 0) {
 
			DrawStringTruncated(4, y + 3, STR_AI_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_BLACK, this->width - 8);
 
			DrawString(4, this->widget[AIL_WIDGET_LIST].right - 4, y + 3, STR_AI_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_BLACK);
 
			y += 14;
 
		}
 
		AIInfo *selected_info = NULL;
 
		AIInfoList::const_iterator it = this->ai_info_list->begin();
 
		for (int i = 1; it != this->ai_info_list->end(); i++, it++) {
 
			if (this->selected == i - 1) selected_info = (*it).second;
 
			if (IsInsideBS(i, this->vscroll.pos, this->vscroll.cap)) {
 
				DoDrawStringTruncated((*it).second->GetName(), 4, y + 3, (this->selected == i - 1) ? TC_WHITE : TC_BLACK, this->width - 8);
 
				DrawString(4, this->widget[AIL_WIDGET_LIST].right - 4, y + 3, (*it).second->GetName(), (this->selected == i - 1) ? TC_WHITE : TC_BLACK);
 
				y += 14;
 
			}
 
		}
 

	
 
		/* Some info about the currently selected AI. */
 
		if (selected_info != NULL) {
 
			int y = this->widget[AIL_WIDGET_INFO_BG].top + 6;
 
			int x = DrawString(4, y, STR_AI_AUTHOR, TC_BLACK);
 
			DoDrawStringTruncated(selected_info->GetAuthor(), x + 5, y, TC_BLACK, this->width - x - 8);
 
			DrawString(x + 5, this->widget[AIL_WIDGET_LIST].right - 4, y, selected_info->GetAuthor(), TC_BLACK);
 
			y += 13;
 
			x = DrawString(4, y, STR_AI_VERSION, TC_BLACK);
 
			static char buf[8];
 
			sprintf(buf, "%d", selected_info->GetVersion());
 
			DoDrawStringTruncated(buf, x + 5, y, TC_BLACK, this->width - x - 8);
 
			DrawString(x + 5, this->widget[AIL_WIDGET_LIST].right - 4, y, buf, TC_BLACK);
 
			y += 13;
 
			SetDParamStr(0, selected_info->GetDescription());
 
			DrawStringMultiLine(4, y, STR_JUST_RAW_STRING, this->width - 8, this->widget[AIL_WIDGET_INFO_BG].bottom - y);
 
		}
 
	}
 

	
 
@@ -260,20 +260,20 @@ struct AISettingsWindow : public Window 
 
			int x = 0;
 
			if (((*it).flags & AICONFIG_BOOLEAN) != 0) {
 
				DrawFrameRect(4, y  + 2, 23, y + 10, (current_value != 0) ? COLOUR_GREEN : COLOUR_RED, (current_value != 0) ? FR_LOWERED : FR_NONE);
 
			} else {
 
				DrawArrowButtons(4, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + !!this->clicked_increase : 0, current_value > (*it).min_value, current_value < (*it).max_value);
 
				if (it->labels != NULL && it->labels->Find(current_value) != it->labels->End()) {
 
					x = DoDrawStringTruncated(it->labels->Find(current_value)->second, 28, y + 3, TC_ORANGE, this->width - 32);
 
					x = DrawString(28, this->widget[AIS_WIDGET_BACKGROUND].right - 4, y + 3, it->labels->Find(current_value)->second, TC_ORANGE);
 
				} else {
 
					SetDParam(0, current_value);
 
					x = DrawStringTruncated(28, y + 3, STR_JUST_INT, TC_ORANGE, this->width - 32);
 
					x = DrawString(28, this->widget[AIS_WIDGET_BACKGROUND].right - 4, y + 3, STR_JUST_INT, TC_ORANGE);
 
				}
 
			}
 

	
 
			DoDrawStringTruncated((*it).description, max(x + 3, 54), y + 3, TC_LIGHT_BLUE, this->width - (4 + max(x + 3, 54)));
 
			DrawString(max(x + 3, 54), this->widget[AIS_WIDGET_BACKGROUND].right - 4, y + 3, (*it).description, TC_LIGHT_BLUE);
 
			y += 14;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
@@ -472,13 +472,13 @@ struct AIConfigWindow : public Window {
 
				text = STR_JUST_RAW_STRING;
 
			} else if (i == 0) {
 
				text = STR_AI_HUMAN_PLAYER;
 
			} else {
 
				text = STR_AI_RANDOM_AI;
 
			}
 
			DrawStringTruncated(10, y + 3, text, (this->selected_slot == i) ? TC_WHITE : ((i > _settings_newgame.difficulty.max_no_competitors || i == 0) ? TC_SILVER : TC_ORANGE), this->width - 20);
 
			DrawString(10, this->widget[AIC_WIDGET_LIST].right - 10, y + 3, text, (this->selected_slot == i) ? TC_WHITE : ((i > _settings_newgame.difficulty.max_no_competitors || i == 0) ? TC_SILVER : TC_ORANGE));
 
			y += 14;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
@@ -654,13 +654,13 @@ struct AIDebugWindow : public Window {
 

	
 
		/* Draw the AI name */
 
		AIInfo *info = GetCompany(ai_debug_company)->ai_info;
 
		assert(info != NULL);
 
		char name[1024];
 
		snprintf(name, sizeof(name), "%s (v%d)", info->GetName(), info->GetVersion());
 
		DoDrawString(name, 7, 47, TC_BLACK);
 
		DrawString(7, this->widget[AID_WIDGET_VIEW].right, 47, name, TC_BLACK);
 

	
 
		CompanyID old_company = _current_company;
 
		_current_company = ai_debug_company;
 
		AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();
 
		_current_company = old_company;
 

	
 
@@ -680,13 +680,13 @@ struct AIDebugWindow : public Window {
 
				case AILog::LOG_INFO:     colour = TC_BLACK;  break;
 
				case AILog::LOG_WARNING:  colour = TC_YELLOW; break;
 
				case AILog::LOG_ERROR:    colour = TC_RED;    break;
 
				default:                  colour = TC_BLACK;  break;
 
			}
 

	
 
			DoDrawStringTruncated(log->lines[pos], 7, this->widget[AID_WIDGET_LOG_PANEL].top + y, colour, this->widget[AID_WIDGET_LOG_PANEL].right - this->widget[AID_WIDGET_LOG_PANEL].left - 14);
 
			DrawString(this->widget[AID_WIDGET_LOG_PANEL].right + 7, this->widget[AID_WIDGET_LOG_PANEL].left - 7, this->widget[AID_WIDGET_LOG_PANEL].top + y, log->lines[pos], colour);
 
			y += 12;
 
		}
 
	}
 

	
 
	void ChangeToAI(CompanyID show_ai)
 
	{
src/autoreplace_gui.cpp
Show inline comments
 
@@ -303,13 +303,13 @@ public:
 
				SetDParam(1, EngineReplacementForCompany(c, selected_id[0], selected_group));
 
			}
 
		} else {
 
			SetDParam(0, STR_NOT_REPLACING_VEHICLE_SELECTED);
 
		}
 

	
 
		DrawStringTruncated(this->widget[RVW_WIDGET_INFO_TAB].left + 6, this->widget[RVW_WIDGET_INFO_TAB].top + 1, STR_02BD, TC_BLACK, this->GetWidgetWidth(RVW_WIDGET_INFO_TAB) - 12);
 
		DrawString(this->widget[RVW_WIDGET_INFO_TAB].left + 6, this->widget[RVW_WIDGET_INFO_TAB].right - 6, this->widget[RVW_WIDGET_INFO_TAB].top + 1, STR_02BD, TC_BLACK);
 

	
 
		/* Draw the lists */
 
		for (byte i = 0; i < 2; i++) {
 
			uint widget     = (i == 0) ? RVW_WIDGET_LEFT_MATRIX : RVW_WIDGET_RIGHT_MATRIX;
 
			GUIEngineList *list = &this->list[i]; // which list to draw
 
			EngineID start  = i == 0 ? this->vscroll.pos : this->vscroll2.pos; // what is the offset for the start (scrolling)
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -665,25 +665,23 @@ void DrawEngineList(VehicleType type, in
 
			y += 7;
 
			y_offset = 3;
 
			break;
 
		default: NOT_REACHED();
 
	}
 

	
 
	uint maxw = r - x - x_offset;
 

	
 
	for (; min < max; min++, y += step_size) {
 
		const EngineID engine = (*eng_list)[min];
 
		/* Note: num_engines is only used in the autoreplace GUI, so it is correct to use _local_company here. */
 
		const uint num_engines = GetGroupNumEngines(_local_company, selected_group, engine);
 

	
 
		SetDParam(0, engine);
 
		DrawStringTruncated(x + x_offset, y, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK, maxw);
 
		DrawString(x + x_offset, r, y, STR_ENGINE_NAME, engine == selected_id ? TC_WHITE : TC_BLACK);
 
		DrawVehicleEngine(type, x, y + y_offset, engine, (count_location != 0 && num_engines == 0) ? PALETTE_CRASH : GetEnginePalette(engine, _local_company));
 
		if (count_location != 0) {
 
			SetDParam(0, num_engines);
 
			DrawStringRightAligned(count_location, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING);
 
			DrawString(x, count_location, y + (GetVehicleListHeight(type) == 14 ? 3 : 8), STR_TINY_BLACK, TC_FROMSTRING, SA_RIGHT);
 
		}
 
	}
 
}
 

	
 

	
 
struct BuildVehicleWindow : Window {
src/genworld_gui.cpp
Show inline comments
 
@@ -385,27 +385,24 @@ struct GenerateLandscapeWindow : public 
 

	
 
		this->DrawWidgets();
 

	
 
		this->DrawEditBox(GLAND_RANDOM_EDITBOX);
 

	
 
		if (mode != GLWP_GENERATE) {
 
			char buffer[512];
 

	
 
			if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
 
				SetDParam(0, this->y);
 
				SetDParam(1, this->x);
 
			} else {
 
				SetDParam(0, this->x);
 
				SetDParam(1, this->y);
 
			}
 
			GetString(buffer, STR_HEIGHTMAP_SIZE, lastof(buffer));
 
			DrawStringRightAligned(326, 91, STR_HEIGHTMAP_SIZE, TC_BLACK);
 
			int right = DrawString(0, 326, 91, STR_HEIGHTMAP_SIZE, TC_BLACK, SA_RIGHT);
 

	
 
			DrawString( 12,  91, STR_HEIGHTMAP_NAME, TC_BLACK);
 
			SetDParamStr(0, this->name);
 
			DrawStringTruncated(114,  91, STR_JUST_RAW_STRING, TC_ORANGE, 326 - 114 - GetStringBoundingBox(buffer).width - 5);
 
			DrawString(114, right - 5, 91, STR_JUST_RAW_STRING, TC_ORANGE);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
src/gfx.cpp
Show inline comments
 
@@ -481,26 +481,12 @@ int DrawString(int left, int right, int 
 
	char buffer[DRAW_STRING_BUFFER];
 
	GetString(buffer, str, lastof(buffer));
 
	return DrawString(left, right, top, buffer, lastof(buffer), colour, align, underline);
 
}
 

	
 
/**
 
 * Draw string, possibly truncated to make it fit in its allocated space
 
 *
 
 * @param x      X position to start drawing
 
 * @param y      Y position to start drawing
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
 * @param maxw   Maximal width of the string
 
 */
 
int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
 
{
 
	return DrawString(x, x + maxw, y, str, colour, SA_LEFT, false);
 
}
 

	
 
/**
 
 * Draw string right-aligned.
 
 *
 
 * @param x      Right-most x position of the string
 
 * @param y      Y position of the string
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
@@ -508,26 +494,12 @@ int DrawStringTruncated(int x, int y, St
 
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(0, x, y, str, colour, SA_RIGHT, false);
 
}
 

	
 
/**
 
 * Draw string right-aligned, possibly truncated to make it fit in its allocated space
 
 *
 
 * @param x      Right-most x position to start drawing
 
 * @param y      Y position to start drawing
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
 * @param maxw   Maximal width of the string
 
 */
 
int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw)
 
{
 
	return DrawString(x - maxw, x, y, str, colour, SA_RIGHT, false);
 
}
 

	
 
/**
 
 * Draw string right-aligned with a line underneath it.
 
 *
 
 * @param x      Right-most x position of the string
 
 * @param y      Y position of the string
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
@@ -551,28 +523,12 @@ int DrawStringCentered(int x, int y, Str
 
	GetString(buffer, str, lastof(buffer));
 
	int w = GetStringBoundingBox(buffer).width;
 
	return DrawString(x - w, x + w, y, buffer, lastof(buffer), colour, SA_CENTER);
 
}
 

	
 
/**
 
 * Draw string centered, possibly truncated to fit in the assigned space.
 
 *
 
 * @param xl     Left-most x position
 
 * @param xr     Right-most x position
 
 * @param y      Y position of the string
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
 *
 
 * @return Width of the drawn string in pixels
 
 */
 
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(xl, xr, y, str, colour, SA_CENTER, false);
 
}
 

	
 
/**
 
 * Draw string centered.
 
 *
 
 * @param x      X position of center of the string
 
 * @param y      Y position of center of the string
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
@@ -600,26 +556,12 @@ int DrawStringCenterUnderline(int x, int
 
	GetString(buffer, str, lastof(buffer));
 
	int w = GetStringBoundingBox(buffer).width;
 
	return DrawString(x - w, y + w, y, buffer, lastof(buffer), colour, SA_CENTER, true);
 
}
 

	
 
/**
 
 * Draw string centered possibly truncated, with additional line underneath it
 
 *
 
 * @param xl     Left x position of the string
 
 * @param xr     Right x position of the string
 
 * @param y      Y position of center of the string
 
 * @param str    String to draw
 
 * @param colour Colour used for drawing the string, see DoDrawString() for details
 
 */
 
int DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(xl, xr, y, str, colour, SA_CENTER, true);
 
}
 

	
 
/**
 
 * 'Correct' a string to a maximum length. Longer strings will be cut into
 
 * additional lines at whitespace characters if possible. The string parameter
 
 * is modified with terminating characters mid-string which are the
 
 * placeholders for the newlines.
 
 * The string WILL be truncated if there was no whitespace for the current
 
 * line's maximum width.
 
@@ -1005,32 +947,12 @@ skip_cont:;
 
			DEBUG(misc, 0, "[utf8] unknown string command character %d", c);
 
		}
 
	}
 
}
 

	
 
/**
 
 * Draw the string of the character buffer, starting at position (x,y) with a given maximal width.
 
 * String is truncated if it is too long.
 
 *
 
 * @param str  Character buffer containing the string
 
 * @param x    Left-most x coordinate to start drawing
 
 * @param y    Y coordinate to draw the string
 
 * @param colour Colour to use, see DoDrawString() for details.
 
 * @param maxw  Maximal width in pixels that may be used for drawing
 
 *
 
 * @return Right-most x position after drawing the (possibly truncated) string
 
 */
 
int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw)
 
{
 
	char buffer[DRAW_STRING_BUFFER];
 
	strecpy(buffer, str, lastof(buffer));
 
	TruncateString(buffer, maxw);
 
	return DoDrawString(buffer, x, y, colour);
 
}
 

	
 
/**
 
 * Draw a sprite.
 
 * @param img  Image number to draw
 
 * @param pal  Palette to use.
 
 * @param x    Left coordinate of image
 
 * @param y    Top coordinate of image
 
 * @param sub  If available, draw only specified part of the sprite
src/gfx_func.h
Show inline comments
 
@@ -96,21 +96,18 @@ int DrawString(int left, int right, int 
 
int DrawString(int left, int right, int top, StringID str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false);
 

	
 
int DrawStringCentered(int x, int y, StringID str, TextColour colour);
 
int DoDrawStringCentered(int x, int y, const char *str, TextColour colour);
 

	
 
int DrawString(int x, int y, StringID str, TextColour colour);
 
int DrawStringTruncated(int x, int y, StringID str, TextColour colour, uint maxw);
 

	
 
int DoDrawString(const char *string, int x, int y, TextColour colour, bool parse_string_also_when_clipped = false);
 
int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw);
 

	
 
int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour);
 

	
 
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour);
 
int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw);
 
int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour);
 

	
 
void DrawCharCentered(uint32 c, int x, int y, TextColour colour);
 

	
 
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode = FILLRECT_OPAQUE);
 
void GfxDrawLine(int left, int top, int right, int bottom, int colour);
src/industry_gui.cpp
Show inline comments
 
@@ -186,12 +186,13 @@ public:
 
	{
 
		const IndustrySpec *indsp = (this->selected_type == INVALID_INDUSTRYTYPE) ? NULL : GetIndustrySpec(this->selected_type);
 
		int x_str = this->widget[DPIW_INFOPANEL].left + 3;
 
		int y_str = this->widget[DPIW_INFOPANEL].top + 3;
 
		const Widget *wi = &this->widget[DPIW_INFOPANEL];
 
		int max_width = wi->right - wi->left - 4;
 
		int right = wi->right - 1;
 

	
 
		/* Raw industries might be prospected. Show this fact by changing the string
 
		 * In Editor, you just build, while ingame, or you fund or you prospect */
 
		if (_game_mode == GM_EDITOR) {
 
			/* We've chosen many random industries but no industries have been specified */
 
			if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.number_industries != 0;
 
@@ -210,31 +211,31 @@ public:
 
			int offset = i * 13;
 
			int x = 3;
 
			int y = 16;
 
			bool selected = this->selected_index == i + this->vscroll.pos;
 

	
 
			if (this->index[i + this->vscroll.pos] == INVALID_INDUSTRYTYPE) {
 
				DrawStringTruncated(20, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE, max_width - 25);
 
				DrawString(20, right, y + offset, STR_MANY_RANDOM_INDUSTRIES, selected ? TC_WHITE : TC_ORANGE);
 
				continue;
 
			}
 
			const IndustrySpec *indsp = GetIndustrySpec(this->index[i + this->vscroll.pos]);
 

	
 
			/* Draw the name of the industry in white is selected, otherwise, in orange */
 
			DrawStringTruncated(20, y + offset, indsp->name, selected ? TC_WHITE : TC_ORANGE, max_width - 25);
 
			DrawString(20, right, y + offset, indsp->name, selected ? TC_WHITE : TC_ORANGE);
 
			GfxFillRect(x,     y + 1 + offset,  x + 10, y + 7 + offset, selected ? 15 : 0);
 
			GfxFillRect(x + 1, y + 2 + offset,  x +  9, y + 6 + offset, indsp->map_colour);
 
		}
 

	
 
		if (this->selected_type == INVALID_INDUSTRYTYPE) {
 
			DrawStringMultiLine(x_str, y_str, STR_RANDOM_INDUSTRIES_TIP, max_width, wi->bottom - wi->top - 40);
 
			return;
 
		}
 

	
 
		if (_game_mode != GM_EDITOR) {
 
			SetDParam(0, indsp->GetConstructionCost());
 
			DrawStringTruncated(x_str, y_str, STR_482F_COST, TC_FROMSTRING, max_width);
 
			DrawString(x_str, right, y_str, STR_482F_COST, TC_FROMSTRING);
 
			y_str += 11;
 
		}
 

	
 
		/* Draw the accepted cargos, if any. Otherwhise, will print "Nothing" */
 
		StringID str = STR_4827_REQUIRES;
 
		byte p = 0;
 
@@ -243,13 +244,13 @@ public:
 
		for (byte j = 0; j < lengthof(indsp->accepts_cargo); j++) {
 
			if (indsp->accepts_cargo[j] == CT_INVALID) continue;
 
			if (p > 0) str++;
 
			SetDParam(p++, GetCargo(indsp->accepts_cargo[j])->name);
 
			SetDParam(p++, GetCargoSuffix(j, CST_FUND, NULL, this->selected_type, indsp));
 
		}
 
		DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width);
 
		DrawString(x_str, right, y_str, str, TC_FROMSTRING);
 
		y_str += 11;
 

	
 
		/* Draw the produced cargos, if any. Otherwhise, will print "Nothing" */
 
		str = STR_4827_PRODUCES;
 
		p = 0;
 
		SetDParam(0, STR_00D0_NOTHING);
 
@@ -257,13 +258,13 @@ public:
 
		for (byte j = 0; j < lengthof(indsp->produced_cargo); j++) {
 
			if (indsp->produced_cargo[j] == CT_INVALID) continue;
 
			if (p > 0) str++;
 
			SetDParam(p++, GetCargo(indsp->produced_cargo[j])->name);
 
			SetDParam(p++, GetCargoSuffix(j + 3, CST_FUND, NULL, this->selected_type, indsp));
 
		}
 
		DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width);
 
		DrawString(x_str, right, y_str, str, TC_FROMSTRING);
 
		y_str += 11;
 

	
 
		/* Get the additional purchase info text, if it has not already been */
 
		if (this->text[this->selected_index] == STR_NULL) {   // Have i been called already?
 
			if (HasBit(indsp->callback_flags, CBM_IND_FUND_MORE_TEXT)) {          // No. Can it be called?
 
				uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, this->selected_type, INVALID_TILE);
 
@@ -484,20 +485,20 @@ public:
 

	
 
		if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
 
			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
 
				if (i->accepts_cargo[j] == CT_INVALID) continue;
 
				has_accept = true;
 
				if (first) {
 
					DrawStringTruncated(2, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING, this->widget[IVW_INFO].right - 2);
 
					DrawString(2, this->widget[IVW_INFO].right, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING);
 
					y += 10;
 
					first = false;
 
				}
 
				SetDParam(0, i->accepts_cargo[j]);
 
				SetDParam(1, i->incoming_cargo_waiting[j]);
 
				SetDParam(2, GetCargoSuffix(j, CST_VIEW, i, i->type, ind));
 
				DrawStringTruncated(4, y, STR_INDUSTRY_WINDOW_WAITING_STOCKPILE_CARGO, TC_FROMSTRING, this->widget[IVW_INFO].right - 4);
 
				DrawString(4, this->widget[IVW_INFO].right, y, STR_INDUSTRY_WINDOW_WAITING_STOCKPILE_CARGO, TC_FROMSTRING);
 
				y += 10;
 
			}
 
		} else {
 
			StringID str = STR_4827_REQUIRES;
 
			byte p = 0;
 
			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
 
@@ -505,35 +506,35 @@ public:
 
				has_accept = true;
 
				if (p > 0) str++;
 
				SetDParam(p++, GetCargo(i->accepts_cargo[j])->name);
 
				SetDParam(p++, GetCargoSuffix(j, CST_VIEW, i, i->type, ind));
 
			}
 
			if (has_accept) {
 
				DrawStringTruncated(2, y, str, TC_FROMSTRING, this->widget[IVW_INFO].right - 2);
 
				DrawString(2, this->widget[IVW_INFO].right, y, str, TC_FROMSTRING);
 
				y += 10;
 
			}
 
		}
 

	
 
		first = true;
 
		for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
 
			if (i->produced_cargo[j] == CT_INVALID) continue;
 
			if (first) {
 
				if (has_accept) y += 10;
 
				DrawStringTruncated(2, y, STR_482A_PRODUCTION_LAST_MONTH, TC_FROMSTRING, this->widget[IVW_INFO].right - 2);
 
				DrawString(2, this->widget[IVW_INFO].right, y, STR_482A_PRODUCTION_LAST_MONTH, TC_FROMSTRING);
 
				y += 10;
 
				this->production_offset_y = y;
 
				first = false;
 
			}
 

	
 
			SetDParam(0, i->produced_cargo[j]);
 
			SetDParam(1, i->last_month_production[j]);
 
			SetDParam(2, GetCargoSuffix(j + 3, CST_VIEW, i, i->type, ind));
 

	
 
			SetDParam(3, i->last_month_pct_transported[j] * 100 >> 8);
 
			uint x = 4 + (IsProductionAlterable(i) ? 30 : 0);
 
			DrawStringTruncated(x, y, STR_482B_TRANSPORTED, TC_FROMSTRING, this->widget[IVW_INFO].right - x);
 
			DrawString(x, this->widget[IVW_INFO].right, y, STR_482B_TRANSPORTED, TC_FROMSTRING);
 
			/* Let's put out those buttons.. */
 
			if (IsProductionAlterable(i)) {
 
				DrawArrowButtons(5, y, COLOUR_YELLOW, (this->clicked_line == j + 1) ? this->clicked_button : 0,
 
						!IsProductionMinimum(i, j), !IsProductionMaximum(i, j));
 
			}
 
			y += 10;
 
@@ -900,13 +901,13 @@ public:
 
				SetDParam(p++, i->last_month_pct_transported[j] * 100 >> 8);
 
			}
 

	
 
			/* Drawing the right string */
 
			StringID str = STR_INDUSTRYDIR_ITEM_NOPROD;
 
			if (p != 1) str = (p == 5) ? STR_INDUSTRYDIR_ITEM : STR_INDUSTRYDIR_ITEM_TWO;
 
			DrawStringTruncated(4, y, str, TC_FROMSTRING, this->widget[IDW_INDUSTRY_LIST].right - 4);
 
			DrawString(4, this->widget[IDW_INDUSTRY_LIST].right, y, str, TC_FROMSTRING);
 

	
 
			y += 10;
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
src/misc_gui.cpp
Show inline comments
 
@@ -1406,13 +1406,13 @@ static void DrawFiosTexts(uint maxw)
 
		str = FiosGetDescText(&path, &tot);
 
		_fios_path_changed = false;
 
	}
 

	
 
	if (str != STR_4006_UNABLE_TO_READ_DRIVE) SetDParam(0, tot);
 
	DrawString(2, 37, str, TC_FROMSTRING);
 
	DoDrawStringTruncated(path, 2, 27, TC_BLACK, maxw);
 
	DrawString(2, 2 + maxw, 27, path, TC_BLACK);
 
}
 

	
 
static void MakeSortedSaveGameList()
 
{
 
	uint sort_start = 0;
 
	uint sort_end = 0;
 
@@ -1567,13 +1567,13 @@ public:
 
		this->DrawSortButtonState(_savegame_sort_order & SORT_BY_NAME ? SLWW_SORT_BYNAME : SLWW_SORT_BYDATE, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP);
 

	
 
		y = widg->top + 1;
 
		for (uint pos = this->vscroll.pos; pos < _fios_items.Length(); pos++) {
 
			const FiosItem *item = _fios_items.Get(pos);
 

	
 
			DoDrawStringTruncated(item->title, 4, y, _fios_colours[item->type], this->width - 18);
 
			DrawString(4, widg->right - 2, y, item->title, _fios_colours[item->type]);
 
			y += 10;
 
			if (y >= this->vscroll.cap * 10 + widg->top + 1) break;
 
		}
 

	
 
		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
 
			this->DrawEditBox(SLWW_SAVE_OSK_TITLE);
src/network/network_content_gui.cpp
Show inline comments
 
@@ -421,13 +421,13 @@ public:
 
			DrawSprite(sprite, pal, this->widget[NCLWW_CHECKBOX].left + (pal == PAL_NONE ? 3 : 4), y + (pal == PAL_NONE ? 1 : 0));
 

	
 
			StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS;
 
			DrawString(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK, SA_CENTER);
 

	
 
			SetDParamStr(0, ci->name);
 
			DrawStringTruncated(this->widget[NCLWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NCLWW_NAME].right - this->widget[NCLWW_NAME].left - 5);
 
			DrawString(this->widget[NCLWW_NAME].left + 5, this->widget[NCLWW_NAME].right, y, STR_JUST_RAW_STRING, TC_BLACK);
 
			y += this->resize.step_height;
 
		}
 

	
 
		/* Create the nice grayish rectangle at the details top */
 
		GfxFillRect(this->widget[NCLWW_DETAILS].left + 1, this->widget[NCLWW_DETAILS].top + 1, this->widget[NCLWW_DETAILS].right - 1, this->widget[NCLWW_DETAILS].top + 50, 157);
 
		DrawStringCentered((this->widget[NCLWW_DETAILS].left + this->widget[NCLWW_DETAILS].right) / 2, this->widget[NCLWW_DETAILS].top + 11, STR_CONTENT_DETAIL_TITLE, TC_FROMSTRING);
src/network/network_gui.cpp
Show inline comments
 
@@ -237,13 +237,13 @@ protected:
 
	void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight)
 
	{
 
		/* show highlighted item with a different colour */
 
		if (highlight) GfxFillRect(this->widget[NGWW_NAME].left + 1, y - 2, this->widget[NGWW_INFO].right - 1, y + 9, 10);
 

	
 
		SetDParamStr(0, cur_item->info.server_name);
 
		DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].left - 5);
 
		DrawString(this->widget[NGWW_NAME].left + 5, this->widget[NGWW_NAME].right, y, STR_JUST_RAW_STRING, TC_BLACK);
 

	
 
		/* only draw details if the server is online */
 
		if (cur_item->online) {
 
			SetDParam(0, cur_item->info.clients_on);
 
			SetDParam(1, cur_item->info.clients_max);
 
			SetDParam(2, cur_item->info.companies_on);
 
@@ -1212,13 +1212,13 @@ struct NetworkLobbyWindow : public Windo
 
			byte company = NetworkLobbyFindCompanyIndex(pos);
 
			bool income = false;
 
			if (this->company == company) {
 
				GfxFillRect(11, y - 1, 154, y + 10, 10); // show highlighted item with a different colour
 
			}
 

	
 
			DoDrawStringTruncated(this->company_info[company].company_name, 13, y, TC_BLACK, 135 - 13);
 
			DrawString(13, 135, y, this->company_info[company].company_name, TC_BLACK);
 
			if (this->company_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y);
 

	
 
			/* If the company's income was positive puts a green dot else a red dot */
 
			if (this->company_info[company].income >= 0) income = true;
 
			DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, 145, y);
 

	
 
@@ -1229,64 +1229,63 @@ struct NetworkLobbyWindow : public Windo
 

	
 
		/* Draw info about selected company when it is selected in the left window */
 
		GfxFillRect(174, 39, 403, 75, 157);
 
		DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING);
 
		if (this->company != INVALID_COMPANY && !StrEmpty(this->company_info[this->company].company_name)) {
 
			const uint x = 183;
 
			const uint trunc_width = this->widget[NLWW_DETAILS].right - x;
 
			y = 80;
 

	
 
			SetDParam(0, gi->clients_on);
 
			SetDParam(1, gi->clients_max);
 
			SetDParam(2, gi->companies_on);
 
			SetDParam(3, gi->companies_max);
 
			DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
 
			y += 10;
 

	
 
			SetDParamStr(0, this->company_info[this->company].company_name);
 
			DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width);
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_COMPANY_NAME, TC_GOLD);
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].inaugurated_year);
 
			DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].company_value);
 
			DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_VALUE, TC_GOLD); // company value
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].money);
 
			DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].income);
 
			DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].performance);
 
			DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].num_vehicle[0]);
 
			SetDParam(1, this->company_info[this->company].num_vehicle[1]);
 
			SetDParam(2, this->company_info[this->company].num_vehicle[2]);
 
			SetDParam(3, this->company_info[this->company].num_vehicle[3]);
 
			SetDParam(4, this->company_info[this->company].num_vehicle[4]);
 
			DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
 
			y += 10;
 

	
 
			SetDParam(0, this->company_info[this->company].num_station[0]);
 
			SetDParam(1, this->company_info[this->company].num_station[1]);
 
			SetDParam(2, this->company_info[this->company].num_station[2]);
 
			SetDParam(3, this->company_info[this->company].num_station[3]);
 
			SetDParam(4, this->company_info[this->company].num_station[4]);
 
			DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
 
			y += 10;
 

	
 
			SetDParamStr(0, this->company_info[this->company].clients);
 
			DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players
 
			DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_PLAYERS, TC_GOLD); // players
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
src/newgrf_gui.cpp
Show inline comments
 
@@ -168,13 +168,13 @@ struct NewGRFAddWindow : public Window {
 
			if (n >= this->vscroll.pos) {
 
				bool h = c == this->sel;
 
				const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
 

	
 
				/* Draw selection background */
 
				if (h) GfxFillRect(3, y, this->width - 15, y + 9, 156);
 
				DoDrawStringTruncated(text, 4, y, h ? TC_WHITE : TC_ORANGE, this->width - 18);
 
				DrawString(4, this->width - 22, y, text, h ? TC_WHITE : TC_ORANGE);
 
				y += 10;
 
			}
 
		}
 

	
 
		if (this->sel != NULL) {
 
			const Widget *wi = &this->widget[ANGRFW_GRF_INFO];
 
@@ -445,13 +445,13 @@ struct NewGRFWindow : public Window {
 
					}
 
				}
 

	
 
				DrawSprite(SPR_SQUARE, pal, 5, y + 2);
 
				if (c->error != NULL) DrawSprite(SPR_WARNING_SIGN, 0, 20, y + 2);
 
				txtoffset = c->error != NULL ? 35 : 25;
 
				DoDrawStringTruncated(text, txtoffset, y + 3, this->sel == c ? TC_WHITE : TC_BLACK, this->width - txtoffset - 10);
 
				DrawString(txtoffset, this->widget[SNGRFS_FILE_LIST].right - 2, y + 3, text, this->sel == c ? TC_WHITE : TC_BLACK);
 
				y += 14;
 
			}
 
		}
 

	
 
		if (this->sel != NULL) {
 
			/* Draw NewGRF file info */
src/news_gui.cpp
Show inline comments
 
@@ -695,13 +695,13 @@ static void DrawNewsString(int x, int y,
 
		}
 
		c_last = c;
 
	}
 

	
 
	*dest = '\0';
 
	/* Truncate and show string; postfixed by '...' if neccessary */
 
	DoDrawStringTruncated(buffer2, x, y, colour, maxw);
 
	DrawString(x, x + maxw, y, buffer2, colour);
 
}
 

	
 

	
 
struct MessageHistoryWindow : Window {
 
	MessageHistoryWindow(const WindowDesc *desc) : Window(desc)
 
	{
src/order_gui.cpp
Show inline comments
 
@@ -277,13 +277,13 @@ void DrawOrderString(const Vehicle *v, c
 
			break;
 

	
 
		default: NOT_REACHED();
 
	}
 

	
 
	SetDParam(0, order_index + 1);
 
	DrawStringTruncated(2, y, str, selected ? TC_WHITE : TC_BLACK, width);
 
	DrawString(2, width + 2, y, str, selected ? TC_WHITE : TC_BLACK);
 
}
 

	
 

	
 
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
 
{
 
	Order order;
src/rail_gui.cpp
Show inline comments
 
@@ -1075,15 +1075,15 @@ public:
 

	
 
				if (statspec != NULL && statspec->name != 0) {
 
					if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
 
						GfxFillRect(8, y - 2, 127, y + 10, 0, FILLRECT_CHECKER);
 
					}
 

	
 
					DrawStringTruncated(9, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118);
 
					DrawString(9, 127, y, statspec->name, i == _railstation.station_type ? TC_WHITE : TC_BLACK);
 
				} else {
 
					DrawStringTruncated(9, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK, 118);
 
					DrawString(9, 127, y, STR_STAT_CLASS_DFLT, i == _railstation.station_type ? TC_WHITE : TC_BLACK);
 
				}
 

	
 
				y += 14;
 
			}
 
		}
 
	}
src/roadveh_gui.cpp
Show inline comments
 
@@ -62,13 +62,13 @@ void DrawRoadVehDetails(const Vehicle *v
 

	
 
				first = false;
 
			}
 
		}
 

	
 
		SetDParamStr(0, capacity);
 
		DrawStringTruncated(x, y + 10 + y_offset, STR_JUST_RAW_STRING, TC_BLUE, 380 - x);
 
		DrawString(x, 300, y + 10 + y_offset, STR_JUST_RAW_STRING, TC_BLUE);
 

	
 
		for (const Vehicle *u = v; u != NULL; u = u->Next()) {
 
			if (u->cargo_cap == 0) continue;
 

	
 
			str = STR_8812_EMPTY;
 
			if (!u->cargo.Empty()) {
src/settings_gui.cpp
Show inline comments
 
@@ -846,13 +846,13 @@ uint SettingEntry::Draw(GameSettings *se
 
			}
 
			cur_row++;
 
			break;
 
		case SEF_SUBTREE_KIND:
 
			if (cur_row >= first_row) {
 
				DrawSprite((this->d.sub.folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, x, y);
 
				DrawStringTruncated(x + 12, y, this->d.sub.title, TC_FROMSTRING, max_x - x - 12);
 
				DrawString(x + 12, max_x, y, this->d.sub.title, TC_FROMSTRING);
 
			}
 
			cur_row++;
 
			if (!this->d.sub.folded) {
 
				if (this->flags & SEF_LAST_FIELD) {
 
					assert(this->level < sizeof(parent_last));
 
					SetBit(parent_last, this->level); // Add own last-field state
 
@@ -913,13 +913,13 @@ void SettingEntry::DrawSetting(GameSetti
 
			} else {
 
				SetDParam(0, (sdb->flags & SGF_NOCOMMA) ? STR_CONFIG_SETTING_INT32 : STR_7024);
 
			}
 
			SetDParam(1, value);
 
		}
 
	}
 
	DrawStringTruncated(x + 25, y, (sdb->str) + disabled, TC_FROMSTRING, max_x - x - 25);
 
	DrawString(x + 25, max_x, y, (sdb->str) + disabled, TC_FROMSTRING);
 
}
 

	
 

	
 
/* == SettingsPage methods == */
 

	
 
/**
src/station_gui.cpp
Show inline comments
 
@@ -824,13 +824,13 @@ struct StationViewWindow : public Window
 
						DrawStringRightAligned(x + width, y, STR_0009, TC_FROMSTRING);
 
					}
 
				} else {
 
					SetDParam(0, cd->cargo);
 
					SetDParam(1, cd->count);
 
					SetDParam(2, cd->source);
 
					DrawStringRightAlignedTruncated(x + width, y, STR_EN_ROUTE_FROM, TC_FROMSTRING, width);
 
					DrawString(x, x + width, y, STR_EN_ROUTE_FROM, TC_FROMSTRING, SA_RIGHT);
 
				}
 

	
 
				y += 10;
 
			}
 
		}
 

	
 
@@ -1140,24 +1140,24 @@ struct SelectStationWindow : Window {
 
		SetVScrollCount(this, _stations_nearby_list.Length() + 1);
 

	
 
		this->DrawWidgets();
 

	
 
		uint y = 17;
 
		if (this->vscroll.pos == 0) {
 
			DrawStringTruncated(3, y, STR_CREATE_SPLITTED_STATION, TC_FROMSTRING, this->widget[JSW_PANEL].right - 5);
 
			DrawString(3, this->widget[JSW_PANEL].right - 2, y, STR_CREATE_SPLITTED_STATION, TC_FROMSTRING);
 
			y += 10;
 
		}
 

	
 
		for (uint i = max<uint>(1, this->vscroll.pos); i <= _stations_nearby_list.Length(); ++i, y += 10) {
 
			/* Don't draw anything if it extends past the end of the window. */
 
			if (i - this->vscroll.pos >= this->vscroll.cap) break;
 

	
 
			const Station *st = GetStation(_stations_nearby_list[i - 1]);
 
			SetDParam(0, st->index);
 
			SetDParam(1, st->facilities);
 
			DrawStringTruncated(3, y, STR_3049_0, TC_FROMSTRING, this->widget[JSW_PANEL].right - 5);
 
			DrawString(3, this->widget[JSW_PANEL].right - 2, y, STR_3049_0, TC_FROMSTRING);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		if (widget != JSW_PANEL) return;
src/subsidy_gui.cpp
Show inline comments
 
@@ -104,72 +104,72 @@ struct SubsidyListWindow : Window {
 
		const Subsidy *s;
 

	
 
		this->DrawWidgets();
 

	
 
		ConvertDateToYMD(_date, &ymd);
 

	
 
		int width = this->width - 13;  // scroll bar = 11 + pixel each side
 
		int right = this->width - 12;  // scroll bar = 11 + pixel each side
 
		int y = 15;
 
		int x = 1;
 

	
 
		/* Section for drawing the offered subisidies */
 
		DrawStringTruncated(x, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING, width);
 
		DrawString(x, right, y, STR_2026_SUBSIDIES_ON_OFFER_FOR, TC_FROMSTRING);
 
		y += 10;
 
		uint num = 0;
 

	
 
		for (s = _subsidies; s != endof(_subsidies); s++) {
 
			if (s->cargo_type != CT_INVALID && s->age < 12) {
 
				int x2;
 

	
 
				/* Displays the two offered towns */
 
				SetupSubsidyDecodeParam(s, 1);
 
				x2 = DrawStringTruncated(x + 2, y, STR_2027_FROM_TO, TC_FROMSTRING, width - 2);
 
				x2 = DrawString(x + 2, right - 2, y, STR_2027_FROM_TO, TC_FROMSTRING);
 

	
 
				if (width - x2 > 10) {
 
					/* Displays the deadline before voiding the proposal */
 
					SetDParam(0, _date - ymd.day + 384 - s->age * 32);
 
					DrawStringTruncated(x2, y, STR_2028_BY, TC_FROMSTRING, width - x2);
 
					DrawString(x2, right, y, STR_2028_BY, TC_FROMSTRING);
 
				}
 

	
 
				y += 10;
 
				num++;
 
			}
 
		}
 

	
 
		if (num == 0) {
 
			DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2);
 
			DrawString(x + 2, right - 2, y, STR_202A_NONE, TC_FROMSTRING);
 
			y += 10;
 
		}
 

	
 
		/* Section for drawing the already granted subisidies */
 
		DrawStringTruncated(x, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING, width);
 
		DrawString(x, right, y + 1, STR_202B_SERVICES_ALREADY_SUBSIDISED, TC_FROMSTRING);
 
		y += 10;
 
		num = 0;
 

	
 
		for (s = _subsidies; s != endof(_subsidies); s++) {
 
			if (s->cargo_type != CT_INVALID && s->age >= 12) {
 
				int xt;
 

	
 
				SetupSubsidyDecodeParam(s, 1);
 

	
 
				SetDParam(3, GetStation(s->to)->owner);
 

	
 
				/* Displays the two connected stations */
 
				xt = DrawStringTruncated(x + 2, y, STR_202C_FROM_TO, TC_FROMSTRING, width - 2);
 
				xt = DrawString(x + 2, right - 2, y, STR_202C_FROM_TO, TC_FROMSTRING);
 

	
 
				/* Displays the date where the granted subsidy will end */
 
				if ((xt > 3) && (width - xt) > 9 ) { // do not draw if previous drawing failed or if it will overlap on scrollbar
 
					SetDParam(0, _date - ymd.day + 768 - s->age * 32);
 
					DrawStringTruncated(xt, y, STR_202D_UNTIL, TC_FROMSTRING, width - xt);
 
					DrawString(xt, right, y, STR_202D_UNTIL, TC_FROMSTRING);
 
				}
 
				y += 10;
 
				num++;
 
			}
 
		}
 

	
 
		if (num == 0) DrawStringTruncated(x + 2, y, STR_202A_NONE, TC_FROMSTRING, width - 2);
 
		if (num == 0) DrawString(x + 2, right - 2, y, STR_202A_NONE, TC_FROMSTRING);
 
	}
 
};
 

	
 
static const Widget _subsidies_list_widgets[] = {
 
{   WWT_CLOSEBOX, RESIZE_NONE,   COLOUR_BROWN,   0,  10,   0,  13, STR_00C5,           STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION, RESIZE_RIGHT,  COLOUR_BROWN,  11, 307,   0,  13, STR_2025_SUBSIDIES, STR_018C_WINDOW_TITLE_DRAG_THIS},
src/timetable_gui.cpp
Show inline comments
 
@@ -202,13 +202,13 @@ struct TimetableWindow : Window {
 
					string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED;
 
				} else {
 
					SetTimetableParams(0, 1, order->travel_time);
 
					string = STR_TIMETABLE_TRAVEL_FOR;
 
				}
 

	
 
				DrawStringTruncated(2, y, string, (i == selected) ? TC_WHITE : TC_BLACK, this->widget[TTV_TIMETABLE_PANEL].right - 4);
 
				DrawString(this->widget[TTV_TIMETABLE_PANEL].left + 2, this->widget[TTV_TIMETABLE_PANEL].right - 2, y, string, (i == selected) ? TC_WHITE : TC_BLACK);
 

	
 
				if (final_order) break;
 
			}
 

	
 
			i++;
 
			y += 10;
src/widget.cpp
Show inline comments
 
@@ -254,21 +254,21 @@ void Window::DrawWidgets() const
 
			break;
 
		}
 

	
 
		case WWT_TEXT: {
 
			const StringID str = wi->data;
 

	
 
			if (str != STR_NULL) DrawStringTruncated(r.left, r.top, str, (TextColour)wi->colour, r.right - r.left);
 
			if (str != STR_NULL) DrawString(r.left, r.right, r.top, str, (TextColour)wi->colour);
 
			break;
 
		}
 

	
 
		case WWT_INSET: {
 
			const StringID str = wi->data;
 
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, FR_LOWERED | FR_DARKENED);
 

	
 
			if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_FROMSTRING, r.right - r.left - 10);
 
			if (str != STR_NULL) DrawString(r.left + 2, r.right - 2, r.top + 1, str, TC_FROMSTRING);
 
			break;
 
		}
 

	
 
		case WWT_MATRIX: {
 
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, (clicked) ? FR_LOWERED : FR_NONE);
 

	
 
@@ -485,24 +485,24 @@ void Window::DrawWidgets() const
 
			assert(r.bottom - r.top == 11); // ensure consistent size
 

	
 
			StringID str = wi->data;
 
			DrawFrameRect(r.left, r.top, r.right - 12, r.bottom, wi->colour, FR_NONE);
 
			DrawFrameRect(r.right - 11, r.top, r.right, r.bottom, wi->colour, clicked ? FR_LOWERED : FR_NONE);
 
			DrawString(r.right - (clicked ? 8 : 9), r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
 
			if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 1, str, TC_BLACK, r.right - r.left - 12);
 
			if (str != STR_NULL) DrawString(r.left + 2, r.right - 14, r.top + 1, str, TC_BLACK);
 
			break;
 
		}
 

	
 
		case WWT_DROPDOWNIN: {
 
			assert(r.bottom - r.top == 11); // ensure consistent size
 

	
 
			StringID str = wi->data;
 
			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, FR_LOWERED | FR_DARKENED);
 
			DrawFrameRect(r.right - 11, r.top + 1, r.right - 1, r.bottom - 1, wi->colour, clicked ? FR_LOWERED : FR_NONE);
 
			DrawString(r.right - (clicked ? 8 : 9), r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
 
			if (str != STR_NULL) DrawStringTruncated(r.left + 2, r.top + 2, str, TC_BLACK, r.right - r.left - 12);
 
			if (str != STR_NULL) DrawString(r.left + 2, r.right - 13, r.top + 2, str, TC_BLACK);
 
			break;
 
		}
 
		}
 

	
 
		if (this->IsWidgetDisabled(i)) {
 
			GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, _colour_gradient[wi->colour & 0xF][2], FILLRECT_CHECKER);
0 comments (0 inline, 0 general)