summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-22 14:39:20 +0000
committerrubidium <rubidium@openttd.org>2009-03-22 14:39:20 +0000
commit9038733f1aa4f3203b229ac6350833f5af5b016a (patch)
tree297239fff1bd8ddcea1c5fc7722ebca4d3e9f3e0
parent22d4270ea8664975384198353c40f4fc859dd5f1 (diff)
downloadopenttd-9038733f1aa4f3203b229ac6350833f5af5b016a.tar.xz
(svn r15812) -Codechange: use the new DrawString API in another set of GUIs
-rw-r--r--src/graph_gui.cpp20
-rw-r--r--src/group_gui.cpp6
-rw-r--r--src/network/network_gui.cpp26
-rw-r--r--src/news_gui.cpp8
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/signs_gui.cpp4
-rw-r--r--src/widget.cpp8
7 files changed, 38 insertions, 38 deletions
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 1d32f1f5c..e0e90b56d 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -57,7 +57,7 @@ struct GraphLegendWindow : Window {
SetDParam(0, c->index);
SetDParam(1, c->index);
- DrawString(21, 17 + c->index * 12, STR_7021, HasBit(_legend_excluded_companies, c->index) ? TC_BLACK : TC_WHITE);
+ DrawString(21, this->width - 4, 17 + c->index * 12, STR_7021, HasBit(_legend_excluded_companies, c->index) ? TC_BLACK : TC_WHITE);
}
}
@@ -264,7 +264,7 @@ protected:
SetDParam(0, month + STR_0162_JAN);
SetDParam(1, month + STR_0162_JAN + 2);
SetDParam(2, year);
- DrawString(x, y, month == 0 ? STR_016F : STR_016E, graph_axis_label_colour);
+ DrawString(x, x + GRAPH_X_POSITION_SEPARATION, y, month == 0 ? STR_016F : STR_016E, graph_axis_label_colour);
month += 3;
if (month >= 12) {
@@ -684,7 +684,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0);
GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, cs->legend_colour);
SetDParam(0, cs->name);
- DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, TC_FROMSTRING);
+ DrawString(x + 14 + clk_dif, this->width, y + clk_dif, STR_7065, TC_FROMSTRING);
y += 8;
}
@@ -699,8 +699,8 @@ struct PaymentRatesGraphWindow : BaseGraphWindow {
this->DrawGraph();
- DrawString(2 + 46, 24 + this->gd_height + 7, STR_7062_DAYS_IN_TRANSIT, TC_FROMSTRING);
- DrawString(2 + 84, 24 - 9, STR_7063_PAYMENT_FOR_DELIVERING, TC_FROMSTRING);
+ DrawString(2 + 46, this->width, 24 + this->gd_height + 7, STR_7062_DAYS_IN_TRANSIT, TC_FROMSTRING);
+ DrawString(2 + 84, this->width, 24 - 9, STR_7063_PAYMENT_FOR_DELIVERING, TC_FROMSTRING);
}
virtual void OnClick(Point pt, int widget)
@@ -812,7 +812,7 @@ public:
SetDParam(2, c->index);
SetDParam(3, GetPerformanceTitleFromValue(c->old_economy[1].performance_history));
- DrawString(2, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, TC_FROMSTRING);
+ DrawString(2, this->width, 15 + i * 10, i == 0 ? STR_7054 : STR_7055, TC_FROMSTRING);
DrawCompanyIcon(c->index, 27, 16 + i * 10);
}
}
@@ -978,11 +978,11 @@ public:
total_score += score;
}
- DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, TC_FROMSTRING);
+ DrawString(7, 107, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, TC_FROMSTRING);
/* Draw the score */
SetDParam(0, score);
- DrawString(0, 107, y, STR_PERFORMANCE_DETAIL_INT, TC_FROMSTRING, SA_RIGHT);
+ DrawString(7, 107, y, STR_PERFORMANCE_DETAIL_INT, TC_FROMSTRING, SA_RIGHT);
/* Calculate the %-bar */
x = Clamp(val, 0, needed) * 50 / needed;
@@ -1017,10 +1017,10 @@ public:
case SCORE_MAX_INCOME:
case SCORE_MONEY:
case SCORE_LOAN:
- DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, TC_FROMSTRING);
+ DrawString(167, this->width, y, STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY, TC_FROMSTRING);
break;
default:
- DrawString(167, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, TC_FROMSTRING);
+ DrawString(167, this->width, y, STR_PERFORMANCE_DETAIL_AMOUNT_INT, TC_FROMSTRING);
}
}
}
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 8cc8821bc..6d933710d 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -410,11 +410,11 @@ public:
break;
default: NOT_REACHED();
}
- DrawString(10, y1, str_all_veh, IsAllGroupID(this->group_sel) ? TC_WHITE : TC_BLACK);
+ DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left + 10, this->widget[GRP_WIDGET_LIST_GROUP].right, y1, str_all_veh, IsAllGroupID(this->group_sel) ? TC_WHITE : TC_BLACK);
y1 += 13;
- DrawString(10, y1, str_no_group_veh, IsDefaultGroupID(this->group_sel) ? TC_WHITE : TC_BLACK);
+ DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left + 10, this->widget[GRP_WIDGET_LIST_GROUP].right, y1, str_no_group_veh, IsDefaultGroupID(this->group_sel) ? TC_WHITE : TC_BLACK);
max = min(this->vscroll2.pos + this->vscroll2.cap, this->groups.Length());
for (i = this->vscroll2.pos ; i < max ; ++i) {
@@ -426,7 +426,7 @@ public:
/* draw the selected group in white, else we draw it in black */
SetDParam(0, g->index);
- DrawString(10, y1, STR_GROUP_NAME, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK);
+ DrawString(this->widget[GRP_WIDGET_LIST_GROUP].left + 10, this->widget[GRP_WIDGET_LIST_GROUP].right, y1, STR_GROUP_NAME, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK);
/* draw the number of vehicles of the group */
SetDParam(0, g->num_vehicle);
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 3a05806f0..60aa5d79b 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -365,7 +365,7 @@ public:
/* Edit box to set client name */
this->DrawEditBox(NGWW_CLIENT);
- DrawString(this->widget[NGWW_CLIENT].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
+ DrawString(0, this->widget[NGWW_CLIENT].left - 5, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD, SA_RIGHT);
/* Sort based on widgets: name, clients, compatibility */
switch (this->servers.SortType()) {
@@ -417,37 +417,37 @@ public:
SetDParam(1, sel->info.clients_max);
SetDParam(2, sel->info.companies_on);
SetDParam(3, sel->info.companies_max);
- DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_CLIENTS, TC_GOLD);
y += 10;
SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
- DrawString(x, y, STR_NETWORK_LANGUAGE, TC_GOLD); // server language
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_LANGUAGE, TC_GOLD); // server language
y += 10;
SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set);
- DrawString(x, y, STR_NETWORK_TILESET, TC_GOLD); // tileset
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_TILESET, TC_GOLD); // tileset
y += 10;
SetDParam(0, sel->info.map_width);
SetDParam(1, sel->info.map_height);
- DrawString(x, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size
y += 10;
SetDParamStr(0, sel->info.server_revision);
- DrawString(x, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version
y += 10;
SetDParamStr(0, sel->info.hostname);
SetDParam(1, sel->port);
- DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address
y += 10;
SetDParam(0, sel->info.start_date);
- DrawString(x, y, STR_NETWORK_START_DATE, TC_GOLD); // start date
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_START_DATE, TC_GOLD); // start date
y += 10;
SetDParam(0, sel->info.game_date);
- DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date
+ DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date
y += 10;
y += 2;
@@ -917,7 +917,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour
if (pos == 0) {
- DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN);
+ DrawString(14, this->width - 1, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN);
} else {
DrawString(14, this->width - 1, y, item->title, _fios_colours[item->type] );
}
@@ -1238,7 +1238,7 @@ struct NetworkLobbyWindow : public Window {
SetDParam(1, gi->clients_max);
SetDParam(2, gi->companies_on);
SetDParam(3, gi->companies_max);
- DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
+ DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_CLIENTS, TC_GOLD);
y += 10;
SetDParamStr(0, this->company_info[this->company].company_name);
@@ -1710,9 +1710,9 @@ struct NetworkClientListWindow : Window
}
if (ci->client_id == CLIENT_ID_SERVER) {
- DrawString(4, y, STR_NETWORK_SERVER, colour);
+ DrawString(4, 81, y, STR_NETWORK_SERVER, colour);
} else {
- DrawString(4, y, STR_NETWORK_CLIENT, colour);
+ DrawString(4, 81, y, STR_NETWORK_CLIENT, colour);
}
/* Filter out spectators */
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 0e274b95a..7628cf211 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -180,7 +180,7 @@ struct NewsWindow : Window {
GfxFillRect(left, top, right, top, 0xD7);
GfxFillRect(left, bottom, right, bottom, 0xD7);
- DrawString(left + 2, top + 1, STR_00C6, TC_FROMSTRING);
+ DrawString(left + 2, right - 2, top + 1, STR_00C6, TC_FROMSTRING);
}
virtual void OnPaint()
@@ -197,10 +197,10 @@ struct NewsWindow : Window {
break;
}
- DrawString(2, 1, STR_00C6, TC_FROMSTRING);
+ DrawString(2, this->width - 1, 1, STR_00C6, TC_FROMSTRING);
SetDParam(0, this->ni->date);
- DrawString(1, this->width - 1, 1, STR_01FF, TC_FROMSTRING, SA_RIGHT);
+ DrawString(2, 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));
@@ -715,7 +715,7 @@ struct MessageHistoryWindow : Window {
for (int n = this->vscroll.cap; n > 0; n--) {
SetDParam(0, ni->date);
- DrawString(4, y, STR_SHORT_DATE, TC_WHITE);
+ DrawString(4, 82, y, STR_SHORT_DATE, TC_WHITE);
DrawNewsString(82, y, TC_WHITE, ni, this->width - 95);
y += 12;
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 6d4f1e4fb..6a50f6634 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -179,7 +179,7 @@ struct GameOptionsWindow : Window {
SetDParamStr(9, GetGraphicsSetName(GetIndexOfCurrentGraphicsSet()));
this->DrawWidgets();
- DrawString(20, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
+ DrawString(20, this->width / 2, 175, STR_OPTIONS_FULLSCREEN, TC_FROMSTRING); // fullscreen
}
virtual void OnClick(Point pt, int widget)
@@ -475,7 +475,7 @@ public:
value += sdb->str;
SetDParam(0, value);
- DrawString(30, y, str, TC_FROMSTRING);
+ DrawString(30, this->width, y, str, TC_FROMSTRING);
y += GAMEDIFF_WND_ROWSIZE + 2; // space items apart a bit
str++;
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 43407f636..3ed9f395a 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -96,7 +96,7 @@ struct SignListWindow : Window, SignList {
/* No signs? */
int y = 16; // offset from top of widget
if (this->vscroll.count == 0) {
- DrawString(2, y, STR_304A_NONE, TC_FROMSTRING);
+ DrawString(2, 346, y, STR_304A_NONE, TC_FROMSTRING);
return;
}
@@ -107,7 +107,7 @@ struct SignListWindow : Window, SignList {
if (si->owner != OWNER_NONE) DrawCompanyIcon(si->owner, 4, y + 1);
SetDParam(0, si->index);
- DrawString(22, y, STR_SIGN_NAME, TC_YELLOW);
+ DrawString(22, 346, y, STR_SIGN_NAME, TC_YELLOW);
y += 10;
}
}
diff --git a/src/widget.cpp b/src/widget.cpp
index 876723882..23e36d5ba 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -409,7 +409,7 @@ void Window::DrawWidgets() const
const StringID str = wi->data;
int x2 = r.left; // by default the left side is the left side of the widget
- if (str != STR_NULL) x2 = DrawString(r.left + 6, r.top, str, TC_FROMSTRING);
+ if (str != STR_NULL) x2 = DrawString(r.left + 6, r.right - 6, r.top, str, TC_FROMSTRING);
int c1 = _colour_gradient[wi->colour][3];
int c2 = _colour_gradient[wi->colour][7];
@@ -465,7 +465,7 @@ void Window::DrawWidgets() const
assert(r.right - r.left == 10); // To ensure the same sizes are used everywhere
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->colour, FR_NONE);
- DrawString(r.left + 2, r.top + 2, str, TC_FROMSTRING);
+ DrawString(r.left + 2, r.right, r.top + 2, str, TC_FROMSTRING);
break;
}
@@ -487,7 +487,7 @@ void Window::DrawWidgets() const
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);
+ DrawString(r.right - (clicked ? 8 : 9), r.right, r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
if (str != STR_NULL) DrawString(r.left + 2, r.right - 14, r.top + 1, str, TC_BLACK);
break;
}
@@ -498,7 +498,7 @@ void Window::DrawWidgets() const
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);
+ DrawString(r.right - (clicked ? 8 : 9), r.right, r.top + (clicked ? 2 : 1), STR_0225, TC_BLACK);
if (str != STR_NULL) DrawString(r.left + 2, r.right - 13, r.top + 2, str, TC_BLACK);
break;
}