Changeset - r11427:99c6f58948e0
[Not reviewed]
master
0 15 0
rubidium - 16 years ago 2009-03-21 22:00:00
rubidium@openttd.org
(svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
15 files changed with 60 insertions and 119 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -89,13 +89,13 @@ static void DrawCompanyEconomyStats(cons
 
	int x, y, i, j, year;
 
	const Money (*tbl)[EXPENSES_END];
 
	StringID str;
 

	
 
	if (!small) { // normal sized economics window
 
		/* draw categories */
 
		DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, TC_FROMSTRING);
 
		DrawString(0, 122, 15, STR_700F_EXPENDITURE_INCOME, TC_FROMSTRING, SA_CENTER, true);
 

	
 
		y = 27;
 
		for (i = 0; i < _expenses_list_types[type].length; i++) {
 
			ExpensesType et = _expenses_list_types[type].et[i];
 
			if (et == INVALID_EXPENSES) {
 
				y += 2;
 
@@ -829,14 +829,14 @@ class SelectCompanyManagerFaceWindow : p
 
				/* else write the value + 1 */
 
				SetDParam(0, val + 1);
 
				str = STR_JUST_INT;
 
			}
 

	
 
			/* Draw the value/bool in white (0xC). If the button clicked adds 1px to x and y text coordinates (IsWindowWidgetLowered()). */
 
			DrawStringCentered(this->widget[widget_index].left + (this->widget[widget_index].right - this->widget[widget_index].left) / 2 +
 
				this->IsWidgetLowered(widget_index), this->widget[widget_index].top + 1 + this->IsWidgetLowered(widget_index), str, TC_WHITE);
 
			DrawString(this->widget[widget_index].left + this->IsWidgetLowered(widget_index), this->widget[widget_index].right - this->IsWidgetLowered(widget_index),
 
				this->widget[widget_index].top + 1 + this->IsWidgetLowered(widget_index), str, TC_WHITE, SA_CENTER);
 
		}
 
	}
 

	
 
	void UpdateData()
 
	{
 
		this->ge = (GenderEthnicity)GB(this->face, _cmf_info[CMFV_GEN_ETHN].offset, _cmf_info[CMFV_GEN_ETHN].length); // get the gender and ethnicity
src/engine_gui.cpp
Show inline comments
 
@@ -80,13 +80,13 @@ struct EnginePreviewWindow : Window {
 

	
 
		EngineID engine = this->window_number;
 
		SetDParam(0, GetEngineCategoryName(engine));
 
		DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
 

	
 
		SetDParam(0, engine);
 
		DrawString(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 80, STR_ENGINE_NAME, TC_BLACK);
 
		DrawString(this->widget[EPW_BACKGROUND].left + 2, this->widget[EPW_BACKGROUND].right - 2, 80, STR_ENGINE_NAME, TC_BLACK, SA_CENTER);
 

	
 
		const DrawEngineInfo *dei = &_draw_engine_list[GetEngine(engine)->type];
 

	
 
		int width = this->width;
 
		dei->engine_proc(width >> 1, 100, engine, 0);
 
		dei->info_proc(engine, width >> 1, 130, width - 52);
src/genworld_gui.cpp
Show inline comments
 
@@ -963,21 +963,21 @@ public:
 
		this->DrawWidgets();
 

	
 
		/* Draw the % complete with a bar and a text */
 
		DrawFrameRect(19, 20, (this->width - 18), 37, COLOUR_GREY, FR_BORDERONLY);
 
		DrawFrameRect(20, 21, (int)((this->width - 40) * _tp.percent / 100) + 20, 36, COLOUR_MAUVE, FR_NONE);
 
		SetDParam(0, _tp.percent);
 
		DrawStringCentered(90, 25, STR_PROGRESS, TC_FROMSTRING);
 
		DrawString(this->widget[GPWW_BACKGROUND].left, this->widget[GPWW_BACKGROUND].right, 25, STR_PROGRESS, TC_FROMSTRING, SA_CENTER);
 

	
 
		/* Tell which class we are generating */
 
		DrawStringCentered(90, 46, _tp.cls, TC_FROMSTRING);
 
		DrawString(this->widget[GPWW_BACKGROUND].left, this->widget[GPWW_BACKGROUND].right, 46, _tp.cls, TC_FROMSTRING, SA_CENTER);
 

	
 
		/* And say where we are in that class */
 
		SetDParam(0, _tp.current);
 
		SetDParam(1, _tp.total);
 
		DrawStringCentered(90, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING);
 
		DrawString(this->widget[GPWW_BACKGROUND].left, this->widget[GPWW_BACKGROUND].right, 58, STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_CENTER);
 

	
 
		this->SetDirty();
 
	}
 
};
 

	
 
/**
src/gfx.cpp
Show inline comments
 
@@ -421,13 +421,13 @@ static int DrawString(int left, int righ
 
	switch (align) {
 
		case SA_LEFT:
 
			right = left + w;
 
			break;
 

	
 
		case SA_CENTER:
 
			left += (right - left - w) / 2;
 
			left += (right - left - w + 1) / 2;
 
			right = left + w;
 
			break;
 

	
 
		case SA_RIGHT:
 
			left = right - w;
 
			break;
 
@@ -507,61 +507,12 @@ int DrawStringRightAligned(int x, int y,
 
int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(0, x, y, str, colour, SA_RIGHT, true);
 
}
 

	
 
/**
 
 * 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
 
 */
 
int DrawStringCentered(int x, int y, StringID str, TextColour colour)
 
{
 
	char buffer[DRAW_STRING_BUFFER];
 
	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.
 
 *
 
 * @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
 
 */
 
int DoDrawStringCentered(int x, int y, const char *str, TextColour colour)
 
{
 
	char buffer[DRAW_STRING_BUFFER];
 
	strecpy(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, with additional line underneath it
 
 *
 
 * @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
 
 */
 
int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour)
 
{
 
	char buffer[DRAW_STRING_BUFFER];
 
	GetString(buffer, str, lastof(buffer));
 
	int w = GetStringBoundingBox(buffer).width;
 
	return DrawString(x - w, y + w, y, buffer, lastof(buffer), 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.
src/gfx_func.h
Show inline comments
 
@@ -92,21 +92,15 @@ enum StringAlignment {
 
	SA_RIGHT,  ///< Right align the text
 
};
 

	
 
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align = SA_LEFT, bool underline = false);
 
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 DoDrawString(const char *string, int x, int y, TextColour colour, bool parse_string_also_when_clipped = false);
 

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

	
 
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour);
 
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);
src/graph_gui.cpp
Show inline comments
 
@@ -272,19 +272,19 @@ protected:
 
					year++;
 
				}
 
				x += GRAPH_X_POSITION_SEPARATION;
 
			}
 
		} else {
 
			/* Draw the label under the data point rather than on the grid line. */
 
			x = this->gd_left + GRAPH_X_POSITION_BEGINNING + (GRAPH_X_POSITION_SEPARATION / 2) + 1;
 
			x = this->gd_left + GRAPH_X_POSITION_BEGINNING;
 
			y = this->gd_top + this->gd_height + 1;
 
			uint16 label = this->x_values_start;
 

	
 
			for (int i = 0; i < this->num_on_x_axis; i++) {
 
				SetDParam(0, label);
 
				DrawStringCentered(x, y, STR_01CB, graph_axis_label_colour);
 
				DrawString(x + 1, x + GRAPH_X_POSITION_SEPARATION - 1, y, STR_01CB, graph_axis_label_colour, SA_CENTER);
 

	
 
				label += this->x_values_increment;
 
				x += GRAPH_X_POSITION_SEPARATION;
 
			}
 
		}
 

	
 
@@ -999,13 +999,13 @@ public:
 

	
 
			/* SCORE_LOAN is inversed */
 
			if (val < 0 && i == SCORE_LOAN) x = 0;
 

	
 
			/* Draw it */
 
			SetDParam(0, x);
 
			DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING);
 
			DrawString(112, 162, y, STR_PERFORMANCE_DETAIL_PERCENT, TC_FROMSTRING, SA_CENTER);
 

	
 
			/* SCORE_LOAN is inversed */
 
			if (i == SCORE_LOAN) val = needed - val;
 

	
 
			/* Draw the amount we have against what is needed
 
			 * For some of them it is in currency format */
src/music_gui.cpp
Show inline comments
 
@@ -227,31 +227,31 @@ public:
 
		this->LowerWidget(MTSW_LIST_RIGHT);
 
		this->DrawWidgets();
 

	
 
		GfxFillRect(  3, 23, 3 + 177,   23 + 191, 0);
 
		GfxFillRect(251, 23, 251 + 177, 23 + 191, 0);
 

	
 
		DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, TC_FROMSTRING);
 
		DrawString(this->widget[MTSW_LIST_LEFT].left + 2, this->widget[MTSW_LIST_LEFT].right - 2, 15, STR_01EE_TRACK_INDEX, TC_FROMSTRING, SA_CENTER);
 

	
 
		SetDParam(0, STR_01D5_ALL + msf.playlist);
 
		DrawStringCentered(340, 15, STR_01EF_PROGRAM, TC_FROMSTRING);
 
		DrawString(this->widget[MTSW_LIST_RIGHT].left + 2, this->widget[MTSW_LIST_RIGHT].right - 2, 15, STR_01EF_PROGRAM, TC_FROMSTRING, SA_CENTER);
 

	
 
		for (i = 1; i <= NUM_SONGS_AVAILABLE; i++) {
 
			SetDParam(0, i);
 
			SetDParam(2, i);
 
			SetDParam(1, SPECSTR_SONGNAME);
 
			DrawString(4, 23 + (i - 1) * 6, (i < 10) ? STR_01EC_0 : STR_01ED, TC_FROMSTRING);
 
		}
 

	
 
		for (i = 0; i != 6; i++) {
 
			DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? TC_WHITE : TC_BLACK);
 
			DrawString(this->widget[MTSW_ALL].left + 2, this->widget[MTSW_ALL].right - 2, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? TC_WHITE : TC_BLACK, SA_CENTER);
 
		}
 

	
 
		DrawStringCentered(216, 45 + 8 * 6 + 16, STR_01F0_CLEAR, TC_FROMSTRING);
 
		DrawString(this->widget[MTSW_ALL].left + 2, this->widget[MTSW_ALL].right - 2, 45 + 8 * 6 + 16, STR_01F0_CLEAR, TC_FROMSTRING, SA_CENTER);
 
#if 0
 
		DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, TC_FROMSTRING);
 
		DrawString(this->widget[MTSW_SAVE].left + 2, this->widget[MTSW_SAVE].right - 2, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, TC_FROMSTRING, SA_CENTER);
 
#endif
 

	
 
		y = 23;
 
		for (p = _playlists[msf.playlist], i = 0; (i = *p) != 0; p++) {
 
			SetDParam(0, i);
 
			SetDParam(1, SPECSTR_SONGNAME);
 
@@ -421,27 +421,27 @@ public:
 
		str = STR_01E6;
 
		if (_song_is_active != 0 && _music_wnd_cursong != 0) {
 
			str = STR_01E7;
 
			SetDParam(0, SPECSTR_SONGNAME);
 
			SetDParam(1, _music_wnd_cursong);
 
		}
 
		DrawStringCentered(155, 46, str, TC_FROMSTRING);
 
		DrawString(this->widget[MW_INFO].left, this->widget[MW_INFO].right, 46, str, TC_FROMSTRING, SA_CENTER);
 

	
 

	
 
		DrawString(60, 38, STR_01E8_TRACK_XTITLE, TC_FROMSTRING);
 

	
 
		for (i = 0; i != 6; i++) {
 
			DrawStringCentered(25 + i * 50, 59, STR_01D5_ALL + i, msf.playlist == i ? TC_WHITE : TC_BLACK);
 
			DrawString(this->widget[i + MW_ALL].left, this->widget[i + MW_ALL].right, 59, STR_01D5_ALL + i, msf.playlist == i ? TC_WHITE : TC_BLACK, SA_CENTER);
 
		}
 

	
 
		DrawStringCentered( 31, 43, STR_01E9_SHUFFLE, (msf.shuffle ? TC_WHITE : TC_BLACK));
 
		DrawStringCentered(269, 43, STR_01EA_PROGRAM, TC_FROMSTRING);
 
		DrawStringCentered(141, 15, STR_01DB_MUSIC_VOLUME, TC_FROMSTRING);
 
		DrawStringCentered(141, 29, STR_01DD_MIN_MAX, TC_FROMSTRING);
 
		DrawStringCentered(247, 15, STR_01DC_EFFECTS_VOLUME, TC_FROMSTRING);
 
		DrawStringCentered(247, 29, STR_01DD_MIN_MAX, TC_FROMSTRING);
 
		DrawString(this->widget[MW_NEXT].left, this->widget[MW_NEXT].right, 43, STR_01E9_SHUFFLE, (msf.shuffle ? TC_WHITE : TC_BLACK), SA_CENTER);
 
		DrawString(this->widget[MW_PROGRAMME].left, this->widget[MW_PROGRAMME].right, 43, STR_01EA_PROGRAM, TC_FROMSTRING, SA_CENTER);
 
		DrawString(108, 174, 15, STR_01DB_MUSIC_VOLUME, TC_FROMSTRING, SA_CENTER);
 
		DrawString(108, 174, 29, STR_01DD_MIN_MAX, TC_FROMSTRING, SA_CENTER);
 
		DrawString(214, 280, 15, STR_01DC_EFFECTS_VOLUME, TC_FROMSTRING, SA_CENTER);
 
		DrawString(214, 280, 29, STR_01DD_MIN_MAX, TC_FROMSTRING, SA_CENTER);
 

	
 
		DrawFrameRect(108, 23, 174, 26, COLOUR_GREY, FR_LOWERED);
 
		DrawFrameRect(214, 23, 280, 26, COLOUR_GREY, FR_LOWERED);
 

	
 
		DrawFrameRect(
 
			108 + msf.music_vol / 2, 22, 111 + msf.music_vol / 2, 28, COLOUR_GREY, FR_NONE
src/network/network_content_gui.cpp
Show inline comments
 
@@ -125,23 +125,23 @@ public:
 
		/* Draw nice progress bar :) */
 
		DrawFrameRect(20, 18, 20 + (int)((this->width - 40) * this->downloaded_bytes / this->total_bytes), 28, COLOUR_MAUVE, FR_NONE);
 

	
 
		SetDParam(0, this->downloaded_bytes);
 
		SetDParam(1, this->total_bytes);
 
		SetDParam(2, this->downloaded_bytes * 100 / this->total_bytes);
 
		DrawStringCentered(this->width / 2, 35, STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, TC_GREY);
 
		DrawString(this->widget[NCDSWW_BACKGROUND].left + 2, this->widget[NCDSWW_BACKGROUND].right - 2, 35, STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, TC_GREY, SA_CENTER);
 

	
 
		if  (this->downloaded_bytes == this->total_bytes) {
 
			DrawStringCentered(this->width / 2, 50, STR_CONTENT_DOWNLOAD_COMPLETE, TC_GREY);
 
			DrawString(this->widget[NCDSWW_BACKGROUND].left + 2, this->widget[NCDSWW_BACKGROUND].right - 2, 50, STR_CONTENT_DOWNLOAD_COMPLETE, TC_GREY, SA_CENTER);
 
		} else if (!StrEmpty(this->name)) {
 
			SetDParamStr(0, this->name);
 
			SetDParam(1, this->downloaded_files);
 
			SetDParam(2, this->total_files);
 
			DrawStringMultiCenter(this->width / 2, 50, STR_CONTENT_DOWNLOAD_FILE, this->width);
 
		} else {
 
			DrawStringCentered(this->width / 2, 50, STR_CONTENT_DOWNLOAD_INITIALISE, TC_GREY);
 
			DrawString(this->widget[NCDSWW_BACKGROUND].left + 2, this->widget[NCDSWW_BACKGROUND].right - 2, 50, STR_CONTENT_DOWNLOAD_INITIALISE, TC_GREY, SA_CENTER);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		if (widget == NCDSWW_CANCELOK) {
 
@@ -427,13 +427,13 @@ public:
 
			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);
 
		DrawString(this->widget[NCLWW_DETAILS].left + 2, this->widget[NCLWW_DETAILS].right - 2, this->widget[NCLWW_DETAILS].top + 11, STR_CONTENT_DETAIL_TITLE, TC_FROMSTRING, SA_CENTER);
 

	
 
		if (this->selected == NULL) return;
 

	
 
		/* And fill the rest of the details when there's information to place there */
 
		DrawStringMultiCenter((this->widget[NCLWW_DETAILS].left + this->widget[NCLWW_DETAILS].right) / 2, this->widget[NCLWW_DETAILS].top + 32, STR_CONTENT_DETAIL_SUBTITLE_UNSELECTED + this->selected->state, this->widget[NCLWW_DETAILS].right - this->widget[NCLWW_DETAILS].left - 10);
 

	
src/network/network_gui.cpp
Show inline comments
 
@@ -245,36 +245,36 @@ protected:
 
		/* 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);
 
			SetDParam(3, cur_item->info.companies_max);
 
			DrawStringCentered(this->widget[NGWW_CLIENTS].left + 39, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD);
 
			DrawString(this->widget[NGWW_CLIENTS].left, this->widget[NGWW_CLIENTS].right, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD, SA_CENTER);
 

	
 
			/* map size */
 
			if (!this->IsWidgetHidden(NGWW_MAPSIZE)) {
 
				SetDParam(0, cur_item->info.map_width);
 
				SetDParam(1, cur_item->info.map_height);
 
				DrawStringCentered(this->widget[NGWW_MAPSIZE].left + 39, y, STR_NETWORK_MAP_SIZE_SHORT, TC_BLACK);
 
				DrawString(this->widget[NGWW_MAPSIZE].left, this->widget[NGWW_MAPSIZE].right, y, STR_NETWORK_MAP_SIZE_SHORT, TC_BLACK, SA_CENTER);
 
			}
 

	
 
			/* current date */
 
			if (!this->IsWidgetHidden(NGWW_DATE)) {
 
				YearMonthDay ymd;
 
				ConvertDateToYMD(cur_item->info.game_date, &ymd);
 
				SetDParam(0, ymd.year);
 
				DrawStringCentered(this->widget[NGWW_DATE].left + 29, y, STR_JUST_INT, TC_BLACK);
 
				DrawString(this->widget[NGWW_DATE].left, this->widget[NGWW_DATE].right, y, STR_JUST_INT, TC_BLACK, SA_CENTER);
 
			}
 

	
 
			/* number of years the game is running */
 
			if (!this->IsWidgetHidden(NGWW_YEARS)) {
 
				YearMonthDay ymd_cur, ymd_start;
 
				ConvertDateToYMD(cur_item->info.game_date, &ymd_cur);
 
				ConvertDateToYMD(cur_item->info.start_date, &ymd_start);
 
				SetDParam(0, ymd_cur.year - ymd_start.year);
 
				DrawStringCentered(this->widget[NGWW_YEARS].left + 29, y, STR_JUST_INT, TC_BLACK);
 
				DrawString(this->widget[NGWW_YEARS].left, this->widget[NGWW_YEARS].right, y, STR_JUST_INT, TC_BLACK, SA_CENTER);
 
			}
 

	
 
			/* draw a lock if the server is password protected */
 
			if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[NGWW_INFO].left + 5, y - 1);
 

	
 
			/* draw red or green icon, depending on compatibility with server */
 
@@ -391,23 +391,23 @@ public:
 
		/* Draw the last joined server, if any */
 
		if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, last_joined == sel);
 

	
 
		/* Draw the right menu */
 
		GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157);
 
		if (sel == NULL) {
 
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
 
			DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING, SA_CENTER);
 
		} else if (!sel->online) {
 
			SetDParamStr(0, sel->info.server_name);
 
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 68, STR_JUST_RAW_STRING, TC_ORANGE); // game name
 
			DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 68, STR_JUST_RAW_STRING, TC_ORANGE, SA_CENTER); // game name
 

	
 
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING); // server offline
 
			DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING, SA_CENTER); // server offline
 
		} else { // show game info
 
			uint16 y = 100;
 
			const uint16 x = this->widget[NGWW_DETAILS].left + 5;
 

	
 
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
 
			DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING, SA_CENTER);
 

	
 

	
 
			SetDParamStr(0, sel->info.server_name);
 
			DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE, SA_CENTER); // game name
 

	
 
			SetDParamStr(0, sel->info.map_name);
 
@@ -450,18 +450,18 @@ public:
 
			DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date
 
			y += 10;
 

	
 
			y += 2;
 

	
 
			if (!sel->info.compatible) {
 
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch
 
				DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING, SA_CENTER); // server mismatch
 
			} else if (sel->info.clients_on == sel->info.clients_max) {
 
				/* Show: server full, when clients_on == max_clients */
 
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // server full
 
				DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING, SA_CENTER); // server full
 
			} else if (sel->info.use_password) {
 
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning
 
				DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, y, STR_NETWORK_PASSWORD, TC_FROMSTRING, SA_CENTER); // password warning
 
			}
 

	
 
			y += 10;
 
		}
 
	}
 

	
 
@@ -1226,15 +1226,15 @@ struct NetworkLobbyWindow : public Windo
 
			y += NET_PRC__SIZE_OF_ROW;
 
			if (pos >= this->vscroll.pos + this->vscroll.cap) break;
 
		}
 

	
 
		/* 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);
 
		DrawString(this->widget[NLWW_DETAILS].left + 10, this->widget[NLWW_DETAILS].right - 10, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING, SA_CENTER);
 
		if (this->company != INVALID_COMPANY && !StrEmpty(this->company_info[this->company].company_name)) {
 
			const uint x = 183;
 
			const uint x = this->widget[NLWW_DETAILS].left + 10;
 
			y = 80;
 

	
 
			SetDParam(0, gi->clients_on);
 
			SetDParam(1, gi->clients_max);
 
			SetDParam(2, gi->companies_on);
 
			SetDParam(3, gi->companies_max);
src/news_gui.cpp
Show inline comments
 
@@ -54,47 +54,47 @@ static void DrawNewsBankrupcy(Window *w,
 

	
 
	SetDParamStr(0, cni->president_name);
 
	DrawStringMultiCenter(49, 148, STR_JUST_RAW_STRING, 94);
 

	
 
	switch (ni->subtype) {
 
		case NS_COMPANY_TROUBLE:
 
			DrawStringCentered(w->width >> 1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, TC_FROMSTRING);
 
			DrawString(0, w->width, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, TC_FROMSTRING, SA_CENTER);
 

	
 
			SetDParam(0, ni->params[2]);
 

	
 
			DrawStringMultiCenter(
 
				((w->width - 101) >> 1) + 98,
 
				90,
 
				STR_7057_WILL_BE_SOLD_OFF_OR_DECLARED,
 
				w->width - 101);
 
			break;
 

	
 
		case NS_COMPANY_MERGER:
 
			DrawStringCentered(w->width >> 1, 1, STR_7059_TRANSPORT_COMPANY_MERGER, TC_FROMSTRING);
 
			DrawString(0, w->width, 1, STR_7059_TRANSPORT_COMPANY_MERGER, TC_FROMSTRING, SA_CENTER);
 
			SetDParam(0, ni->params[2]);
 
			SetDParam(1, ni->params[3]);
 
			SetDParam(2, ni->params[4]);
 
			DrawStringMultiCenter(
 
				((w->width - 101) >> 1) + 98,
 
				90,
 
				ni->params[4] == 0 ? STR_707F_HAS_BEEN_TAKEN_OVER_BY : STR_705A_HAS_BEEN_SOLD_TO_FOR,
 
				w->width - 101);
 
			break;
 

	
 
		case NS_COMPANY_BANKRUPT:
 
			DrawStringCentered(w->width >> 1, 1, STR_705C_BANKRUPT, TC_FROMSTRING);
 
			DrawString(0, w->width, 1, STR_705C_BANKRUPT, TC_FROMSTRING, SA_CENTER);
 
			SetDParam(0, ni->params[2]);
 
			DrawStringMultiCenter(
 
				((w->width - 101) >> 1) + 98,
 
				90,
 
				STR_705D_HAS_BEEN_CLOSED_DOWN_BY,
 
				w->width - 101);
 
			break;
 

	
 
		case NS_COMPANY_NEW:
 
			DrawStringCentered(w->width >> 1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, TC_FROMSTRING);
 
			DrawString(0, w->width, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, TC_FROMSTRING, SA_CENTER);
 
			SetDParam(0, ni->params[2]);
 
			SetDParam(1, ni->params[3]);
 
			DrawStringMultiCenter(
 
				((w->width - 101) >> 1) + 98,
 
				90,
 
				STR_705F_STARTS_CONSTRUCTION_NEAR,
 
@@ -839,15 +839,13 @@ struct MessageOptionsWindow : Window {
 

	
 
		this->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = _message_opt[this->state];
 
		this->DrawWidgets();
 

	
 
		/* Draw the string of each setting on each button. */
 
		for (int i = 0, y = 26; i < NT_END; i++, y += 12) {
 
			/* 51 comes from 13 + 89 (left and right of the button)+1, shiefted by one as to get division,
 
			 * which will give centered position */
 
			DrawStringCentered(51, y + 1, _message_opt[_news_type_data[i].display], TC_BLACK);
 
			DrawString(this->widget[WIDGET_NEWSOPT_START_OPTION + 1].left, this->widget[WIDGET_NEWSOPT_START_OPTION + 1].right, y + 1, _message_opt[_news_type_data[i].display], TC_BLACK, SA_CENTER);
 
		}
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
src/rail_gui.cpp
Show inline comments
 
@@ -1051,16 +1051,16 @@ public:
 
			if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
 
				StationPickerDrawSprite(32, 16, STATION_RAIL, _cur_railtype, INVALID_ROADTYPE, 3);
 
			}
 
			_cur_dpi = old_dpi;
 
		}
 

	
 
		DrawStringCentered(74, 15 + y_offset, STR_3002_ORIENTATION, TC_FROMSTRING);
 
		DrawStringCentered(74, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, TC_FROMSTRING);
 
		DrawStringCentered(74, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING);
 
		DrawStringCentered(74, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING);
 
		DrawString(this->widget[BRSW_PLATFORM_LEN_1].left, this->widget[BRSW_PLATFORM_LEN_7].right, 15 + y_offset, STR_3002_ORIENTATION, TC_FROMSTRING, SA_CENTER);
 
		DrawString(this->widget[BRSW_PLATFORM_LEN_1].left, this->widget[BRSW_PLATFORM_LEN_7].right, 76 + y_offset, STR_3003_NUMBER_OF_TRACKS, TC_FROMSTRING, SA_CENTER);
 
		DrawString(this->widget[BRSW_PLATFORM_LEN_1].left, this->widget[BRSW_PLATFORM_LEN_7].right, 101 + y_offset, STR_3004_PLATFORM_LENGTH, TC_FROMSTRING, SA_CENTER);
 
		DrawString(this->widget[BRSW_PLATFORM_LEN_1].left, this->widget[BRSW_PLATFORM_LEN_7].right, 141 + y_offset, STR_3066_COVERAGE_AREA_HIGHLIGHT, TC_FROMSTRING, SA_CENTER);
 

	
 
		int text_end = DrawStationCoverageAreaText(2, 166 + y_offset, SCT_ALL, rad, false);
 
		text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
 
		if (text_end != this->widget[BRSW_BACKGROUND].bottom) {
 
			this->SetDirty();
 
			ResizeWindowForWidget(this, BRSW_BACKGROUND, 0, text_end - this->widget[BRSW_BACKGROUND].bottom);
 
@@ -1429,15 +1429,14 @@ public:
 
		this->DrawSignalSprite(BSW_ELECTRIC_COMBO,  SPR_IMG_SIGNAL_ELECTRIC_COMBO,  -2,  6);
 
		this->DrawSignalSprite(BSW_ELECTRIC_PBS,    SPR_IMG_SIGNAL_ELECTRIC_PBS,    -1,  4);
 
		this->DrawSignalSprite(BSW_ELECTRIC_PBS_OWAY,SPR_IMG_SIGNAL_ELECTRIC_PBS_OWAY,-2,  6);
 

	
 
		/* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */
 
		SetDParam(0, _settings_client.gui.drag_signals_density);
 
		DrawStringCentered(this->widget[BSW_DRAG_SIGNALS_DENSITY].left + (this->widget[BSW_DRAG_SIGNALS_DENSITY].right -
 
				this->widget[BSW_DRAG_SIGNALS_DENSITY].left) / 2 + 1,
 
				this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE);
 
		DrawString(this->widget[BSW_DRAG_SIGNALS_DENSITY].left, this->widget[BSW_DRAG_SIGNALS_DENSITY].right,
 
				this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE, SA_CENTER);
 
	}
 

	
 
	virtual void OnClick(Point pt, int widget)
 
	{
 
		switch (widget) {
 
			case BSW_SEMAPHORE_NORM:
src/settings_gui.cpp
Show inline comments
 
@@ -1455,14 +1455,14 @@ void ShowGameSettings()
 
void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right)
 
{
 
	int colour = _colour_gradient[button_colour][2];
 

	
 
	DrawFrameRect(x,      y + 1, x +  9, y + 9, button_colour, (state == 1) ? FR_LOWERED : FR_NONE);
 
	DrawFrameRect(x + 10, y + 1, x + 19, y + 9, button_colour, (state == 2) ? FR_LOWERED : FR_NONE);
 
	DrawStringCentered(x +  5, y + 1, STR_6819, TC_FROMSTRING); // [<]
 
	DrawStringCentered(x + 15, y + 1, STR_681A, TC_FROMSTRING); // [>]
 
	DrawString(x,      x +  9, y + 1, STR_6819, TC_FROMSTRING, SA_CENTER); // [<]
 
	DrawString(x + 10, x + 19, y + 1, STR_681A, TC_FROMSTRING, SA_CENTER); // [>]
 

	
 
	/* Grey out the buttons that aren't clickable */
 
	if (!clickable_left) {
 
		GfxFillRect(x +  1, y + 1, x +  1 + 8, y + 8, colour, FILLRECT_CHECKER);
 
	}
 
	if (!clickable_right) {
src/station_gui.cpp
Show inline comments
 
@@ -331,23 +331,22 @@ public:
 
		for (CargoID c = 0; c < NUM_CARGO; c++) {
 
			const CargoSpec *cs = GetCargo(c);
 
			if (!cs->IsValid()) continue;
 

	
 
			cg_ofst = HasBit(this->cargo_filter, c) ? 2 : 1;
 
			GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
 
			DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK);
 
			DrawString(x + cg_ofst, x + 12 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK, SA_CENTER);
 
			x += 14;
 
			i++;
 
		}
 

	
 
		x += 6;
 
		cg_ofst = this->IsWidgetLowered(SLW_NOCARGOWAITING) ? 2 : 1;
 
		DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_NONE, TC_BLACK);
 
		DrawString(x + cg_ofst, x + cg_ofst + 12, y + cg_ofst, STR_ABBREV_NONE, TC_BLACK, SA_CENTER);
 
		x += 14;
 
		cg_ofst = this->IsWidgetLowered(SLW_CARGOALL) ? 2 : 1;
 
		DrawStringCentered(x + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
 
		DrawString(x + cg_ofst, x + cg_ofst + 12, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK, SA_CENTER);
 

	
 
		cg_ofst = this->IsWidgetLowered(SLW_FACILALL) ? 2 : 1;
 
		DrawString(71 + cg_ofst, y + cg_ofst, STR_ABBREV_ALL, TC_BLACK);
 

	
 
		if (this->vscroll.count == 0) { // company has no stations
 
			DrawString(xb, 40, STR_304A_NONE, TC_FROMSTRING);
src/statusbar_gui.cpp
Show inline comments
 
@@ -94,18 +94,18 @@ struct StatusBarWindow : Window {
 
	virtual void OnPaint()
 
	{
 
		const Company *c = (_local_company == COMPANY_SPECTATOR) ? NULL : GetCompany(_local_company);
 

	
 
		this->DrawWidgets();
 
		SetDParam(0, _date);
 
		DrawStringCentered(70, 1, (_pause_game || _settings_client.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
 
		DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, (_pause_game || _settings_client.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING, SA_CENTER);
 

	
 
		if (c != NULL) {
 
			/* Draw company money */
 
			SetDParam(0, c->money);
 
			DrawStringCentered(this->widget[SBW_RIGHT].left + 70, 1, STR_0004, TC_FROMSTRING);
 
			DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0004, TC_FROMSTRING, SA_CENTER);
 
		}
 

	
 
		/* Draw status bar */
 
		if (this->saving) { // true when saving is active
 
			DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING, SA_CENTER);
 
		} else if (_do_autosave) {
src/widget.cpp
Show inline comments
 
@@ -247,13 +247,13 @@ void Window::DrawWidgets() const
 

	
 
		case WWT_LABEL: {
 
			StringID str = wi->data;
 

	
 
			if ((wi->type & WWT_MASK) == WWT_TEXTBTN_2 && clicked) str++;
 

	
 
			DrawStringCentered(((r.left + r.right + 1) >> 1) + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, TC_FROMSTRING);
 
			DrawString(r.left + clicked, r.right + clicked, ((r.top + r.bottom + 1) >> 1) - 5 + clicked, str, TC_FROMSTRING, SA_CENTER);
 
			break;
 
		}
 

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

	
0 comments (0 inline, 0 general)