Changeset - r11428:c6949c853522
[Not reviewed]
master
0 11 0
rubidium - 15 years ago 2009-03-21 22:22:00
rubidium@openttd.org
(svn r15791) -Codechange: remove the *RightAligned part of the old text drawing API.
11 files changed with 22 insertions and 51 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -99,7 +99,7 @@ static void DrawCompanyEconomyStats(cons
 
			ExpensesType et = _expenses_list_types[type].et[i];
 
			if (et == INVALID_EXPENSES) {
 
				y += 2;
 
				DrawStringRightAligned(111, y, STR_7020_TOTAL, TC_FROMSTRING);
 
				DrawString(0, 111, y, STR_7020_TOTAL, TC_FROMSTRING, SA_RIGHT);
 
				y += 20;
 
			} else {
 
				DrawString(2, y, STR_7011_CONSTRUCTION + et, TC_FROMSTRING);
 
@@ -107,7 +107,7 @@ static void DrawCompanyEconomyStats(cons
 
			}
 
		}
 

	
 
		DrawStringRightAligned(111, y + 2, STR_7020_TOTAL, TC_FROMSTRING);
 
		DrawString(0, 111, y + 2, STR_7020_TOTAL, TC_FROMSTRING, SA_RIGHT);
 

	
 
		/* draw the price columns */
 
		year = _cur_year - 2;
 
@@ -118,7 +118,7 @@ static void DrawCompanyEconomyStats(cons
 
		do {
 
			if (year >= c->inaugurated_year) {
 
				SetDParam(0, year);
 
				DrawStringRightAlignedUnderline(x, 15, STR_7010, TC_FROMSTRING);
 
				DrawString(x - 75, x, 15, STR_7010, TC_FROMSTRING, SA_RIGHT, true);
 

	
 
				Money sum = 0;
 
				Money subtotal = 0;
 
@@ -144,7 +144,7 @@ static void DrawCompanyEconomyStats(cons
 
						str = STR_701E;
 
						if (cost < 0) { cost = -cost; str++; }
 
						SetDParam(0, cost);
 
						DrawStringRightAligned(x, y, str, TC_FROMSTRING);
 
						DrawString(x - 75, x, y, str, TC_FROMSTRING, SA_RIGHT);
 
					}
 
					y += (et == INVALID_EXPENSES) ? 20 : 10;
 
				}
 
@@ -152,7 +152,7 @@ static void DrawCompanyEconomyStats(cons
 
				str = STR_701E;
 
				if (sum < 0) { sum = -sum; str++; }
 
				SetDParam(0, sum);
 
				DrawStringRightAligned(x, y + 2, str, TC_FROMSTRING);
 
				DrawString(x - 75, x, y + 2, str, TC_FROMSTRING, SA_RIGHT);
 

	
 
				GfxFillRect(x - 75, y, x, y, 215);
 
				x += 95;
 
@@ -172,20 +172,20 @@ static void DrawCompanyEconomyStats(cons
 

	
 
	DrawString(2, y, STR_7026_BANK_BALANCE, TC_FROMSTRING);
 
	SetDParam(0, c->money);
 
	DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING);
 
	DrawString(182 - 75, 182, y, STR_7028, TC_FROMSTRING, SA_RIGHT);
 

	
 
	y += 10;
 

	
 
	DrawString(2, y, STR_7027_LOAN, TC_FROMSTRING);
 
	SetDParam(0, c->current_loan);
 
	DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING);
 
	DrawString(182 - 75, 182, y, STR_7028, TC_FROMSTRING, SA_RIGHT);
 

	
 
	y += 12;
 

	
 
	GfxFillRect(182 - 75, y - 2, 182, y - 2, 215);
 

	
 
	SetDParam(0, c->money - c->current_loan);
 
	DrawStringRightAligned(182, y, STR_7028, TC_FROMSTRING);
 
	DrawString(182 - 75, 182, y, STR_7028, TC_FROMSTRING, SA_RIGHT);
 
}
 

	
 
enum CompanyFinancesWindowWidgets {
 
@@ -819,7 +819,7 @@ class SelectCompanyManagerFaceWindow : p
 
	void DrawFaceStringLabel(byte widget_index, StringID str, uint8 val, bool is_bool_widget)
 
	{
 
		/* Write the label in gold (0x2) to the left of the button. */
 
		DrawStringRightAligned(this->widget[widget_index].left - (is_bool_widget ? 5 : 14), this->widget[widget_index].top + 1, str, TC_GOLD);
 
		DrawString(0, this->widget[widget_index].left - (is_bool_widget ? 5 : 14), this->widget[widget_index].top + 1, str, TC_GOLD, SA_RIGHT);
 

	
 
		if (!this->IsWidgetDisabled(widget_index)) {
 
			if (is_bool_widget) {
src/depot_gui.cpp
Show inline comments
 
@@ -272,7 +272,7 @@ struct DepotWindow : Window {
 

	
 
				/* Number of wagons relative to a standard length wagon (rounded up) */
 
				SetDParam(0, (v->u.rail.cached_total_length + 7) / 8);
 
				DrawStringRightAligned(this->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter
 
				DrawString(this->widget[DEPOT_WIDGET_MATRIX].left, this->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING, SA_RIGHT); // Draw the counter
 
				break;
 

	
 
			case VEH_ROAD:     DrawRoadVehImage( v, x + 24, sprite_y, this->sel, 1); break;
 
@@ -376,7 +376,7 @@ struct DepotWindow : Window {
 
			u = v;
 
			do i++; while ((u = u->Next()) != NULL); // Determine length of train
 
			SetDParam(0, i);                      // Set the counter
 
			DrawStringRightAligned(this->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING); // Draw the counter
 
			DrawString(this->widget[DEPOT_WIDGET_MATRIX].left, this->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, TC_FROMSTRING, SA_RIGHT); // Draw the counter
 
		}
 
	}
 

	
src/gfx.cpp
Show inline comments
 
@@ -484,32 +484,6 @@ int DrawString(int left, int right, int 
 
}
 

	
 
/**
 
 * 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
 
 */
 
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(0, 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
 
 */
 
int DrawStringRightAlignedUnderline(int x, int y, StringID str, TextColour colour)
 
{
 
	return DrawString(0, x, y, str, colour, SA_RIGHT, 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
src/gfx_func.h
Show inline comments
 
@@ -98,9 +98,6 @@ int DrawString(int left, int right, int 
 
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 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
 
@@ -248,7 +248,7 @@ protected:
 
		for (int i = 0; i < GRAPH_NUM_LINES_Y; i++) {
 
			SetDParam(0, this->format_str_y_axis);
 
			SetDParam(1, y_label);
 
			DrawStringRightAligned(x, y, STR_0170, graph_axis_label_colour);
 
			DrawString(x - GRAPH_X_POSITION_BEGINNING, x, y, STR_0170, graph_axis_label_colour, SA_RIGHT);
 

	
 
			y_label -= y_label_separation;
 
			y += (this->gd_height / (GRAPH_NUM_LINES_Y - 1));
 
@@ -982,7 +982,7 @@ public:
 

	
 
			/* Draw the score */
 
			SetDParam(0, score);
 
			DrawStringRightAligned(107, y, STR_PERFORMANCE_DETAIL_INT, TC_FROMSTRING);
 
			DrawString(0, 107, y, STR_PERFORMANCE_DETAIL_INT, TC_FROMSTRING, SA_RIGHT);
 

	
 
			/* Calculate the %-bar */
 
			x = Clamp(val, 0, needed) * 50 / needed;
src/group_gui.cpp
Show inline comments
 
@@ -430,7 +430,7 @@ public:
 

	
 
			/* draw the number of vehicles of the group */
 
			SetDParam(0, g->num_vehicle);
 
			DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK);
 
			DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left, this->widget[GRP_WIDGET_LIST_GROUP].right, y1 + 1, STR_GROUP_TINY_NUM, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK, SA_RIGHT);
 
		}
 

	
 
		this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -445,7 +445,7 @@ public:
 
		this->DrawWidgets();
 

	
 
		assert((uint)this->dtype < lengthof(chat_captions));
 
		DrawStringRightAligned(this->widget[NWCW_TEXTBOX].left - 2, this->widget[NWCW_TEXTBOX].top + 1, chat_captions[this->dtype], TC_BLACK);
 
		DrawString(this->widget[NWCW_BACKGROUND].left, this->widget[NWCW_TEXTBOX].left - 2, this->widget[NWCW_TEXTBOX].top + 1, chat_captions[this->dtype], TC_BLACK, SA_RIGHT);
 
		this->DrawEditBox(NWCW_TEXTBOX);
 
	}
 

	
src/network/network_content_gui.cpp
Show inline comments
 
@@ -392,7 +392,7 @@ public:
 

	
 
		/* Edit box to filter for keywords */
 
		this->DrawEditBox(NCLWW_FILTER);
 
		DrawStringRightAligned(this->widget[NCLWW_FILTER].left - 8, this->widget[NCLWW_FILTER].top + 2, STR_CONTENT_FILTER_TITLE, TC_FROMSTRING);
 
		DrawString(this->widget[NCLWW_MATRIX].left, this->widget[NCLWW_FILTER].left - 8, this->widget[NCLWW_FILTER].top + 2, STR_CONTENT_FILTER_TITLE, TC_FROMSTRING, SA_RIGHT);
 

	
 
		switch (this->content.SortType()) {
 
			case NCLWW_CHECKBOX - NCLWW_CHECKBOX: this->DrawSortButtonState(NCLWW_CHECKBOX, arrow); break;
src/news_gui.cpp
Show inline comments
 
@@ -216,7 +216,7 @@ struct NewsWindow : Window {
 
				DrawString(2, 1, STR_00C6, TC_FROMSTRING);
 

	
 
				SetDParam(0, this->ni->date);
 
				DrawStringRightAligned(428, 1, STR_01FF, TC_FROMSTRING);
 
				DrawString(1, this->width - 1, 1, STR_01FF, TC_FROMSTRING, SA_RIGHT);
 

	
 
				if (!(this->ni->flags & NF_VIEWPORT)) {
 
					CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
src/station_gui.cpp
Show inline comments
 
@@ -817,10 +817,10 @@ struct StationViewWindow : public Window
 
					if (HasBit(transfers, cd->cargo)) {
 
						/* This cargo has transfers waiting so show the expand or shrink 'button' */
 
						const char *sym = HasBit(this->cargo, cd->cargo) ? "-" : "+";
 
						DrawStringRightAligned(x + width - 8, y, STR_0009, TC_FROMSTRING);
 
						DoDrawString(sym, x + width - 6, y, TC_YELLOW);
 
						DrawString(this->widget[SVW_WAITING].left, this->widget[SVW_WAITING].right - 12, y, STR_0009, TC_FROMSTRING, SA_RIGHT);
 
						DrawString(this->widget[SVW_WAITING].right - 10, this->widget[SVW_WAITING].right, y, sym, TC_YELLOW);
 
					} else {
 
						DrawStringRightAligned(x + width, y, STR_0009, TC_FROMSTRING);
 
						DrawString(this->widget[SVW_WAITING].left, this->widget[SVW_WAITING].right - 4, y, STR_0009, TC_FROMSTRING, SA_RIGHT);
 
					}
 
				} else {
 
					SetDParam(0, cd->cargo);
src/statusbar_gui.cpp
Show inline comments
 
@@ -97,12 +97,12 @@ struct StatusBarWindow : Window {
 

	
 
		this->DrawWidgets();
 
		SetDParam(0, _date);
 
		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);
 
		DrawString(this->widget[SBW_RIGHT].left + 1, this->widget[SBW_RIGHT].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);
 
			DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0004, TC_FROMSTRING, SA_CENTER);
 
			DrawString(this->widget[SBW_LEFT].left + 1, this->widget[SBW_LEFT].right - 1, 1, STR_0004, TC_FROMSTRING, SA_CENTER);
 
		}
 

	
 
		/* Draw status bar */
0 comments (0 inline, 0 general)