diff options
author | rubidium <rubidium@openttd.org> | 2009-03-21 19:10:26 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-03-21 19:10:26 +0000 |
commit | 8a758beec30dcf3c43d69d5adafbac59f296b9f1 (patch) | |
tree | 9ca3a33b849822c4e63bc8b455a7c3b5bb27da28 /src | |
parent | 971ed8d2a328d0c1ded25fa61496b5b47304c6ac (diff) | |
download | openttd-8a758beec30dcf3c43d69d5adafbac59f296b9f1.tar.xz |
(svn r15782) -Codechange: replace some calls to the all text drawing API to the new one.
Diffstat (limited to 'src')
-rw-r--r-- | src/gfx_func.h | 2 | ||||
-rw-r--r-- | src/network/network_content_gui.cpp | 2 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 4 | ||||
-rw-r--r-- | src/statusbar_gui.cpp | 10 | ||||
-rw-r--r-- | src/toolbar_gui.cpp | 6 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 2 | ||||
-rw-r--r-- | src/widget.cpp | 2 |
7 files changed, 13 insertions, 15 deletions
diff --git a/src/gfx_func.h b/src/gfx_func.h index 97795e48a..91a696a5b 100644 --- a/src/gfx_func.h +++ b/src/gfx_func.h @@ -96,7 +96,6 @@ int DrawString(int left, int right, int top, const char *str, TextColour colour, int DrawString(int left, int right, int top, StringID str, TextColour colour, TextAlignment align = TA_LEFT, bool underline = false); int DrawStringCentered(int x, int y, StringID str, TextColour colour); -int DrawStringCenteredTruncated(int xl, int xr, 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); @@ -106,7 +105,6 @@ int DoDrawString(const char *string, int x, int y, TextColour colour, bool parse int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw); int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour); -int DrawStringCenterUnderlineTruncated(int xl, int xr, 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); diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 73c1be9b9..3f09decfb 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -421,7 +421,7 @@ 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; - DrawStringCenteredTruncated(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK); + DrawString(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK, TA_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); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 783806e33..a8548ea71 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -408,10 +408,10 @@ public: SetDParamStr(0, sel->info.server_name); - DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE); // game name + DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE, TA_CENTER); // game name SetDParamStr(0, sel->info.map_name); - DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK); // map name + DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK, TA_CENTER); // map name SetDParam(0, sel->info.clients_on); SetDParam(1, sel->info.clients_max); diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 2d82cd2a6..0371a5de9 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -107,11 +107,11 @@ struct StatusBarWindow : Window { /* Draw status bar */ if (this->saving) { // true when saving is active - DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING); + DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING, TA_CENTER); } else if (_do_autosave) { - DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING); + DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING, TA_CENTER); } else if (_pause_game) { - DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING); + DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING, TA_CENTER); } else if (this->ticker_scroll > TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item.string_id != 0) { /* Draw the scrolling news text */ if (!DrawScrollingStatusText(&_statusbar_news_item, this->ticker_scroll, this->widget[SBW_MIDDLE].right - this->widget[SBW_MIDDLE].left - 2)) { @@ -119,14 +119,14 @@ struct StatusBarWindow : Window { if (c != NULL) { /* This is the default text */ SetDParam(0, c->index); - DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING); + DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, TA_CENTER); } } } else { if (c != NULL) { /* This is the default text */ SetDParam(0, c->index); - DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING); + DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, TA_CENTER); } } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index de616ba4e..657802d38 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -1243,13 +1243,13 @@ public: this->DrawWidgets(); SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); - DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING); + DrawString(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING, TA_CENTER); /* We hide this panel when the toolbar space gets too small */ const Widget *panel = &this->widget[TBSE_SPACERPANEL]; if (panel->left != panel->right) { - DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING); - DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING); + DrawString(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING, TA_CENTER); + DrawString(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING, TA_CENTER); } } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 97d4df34e..e215e74dc 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1938,7 +1938,7 @@ struct VehicleViewWindow : Window { /* draw the flag plus orders */ DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1); - DrawStringCenteredTruncated(this->widget[VVW_WIDGET_START_STOP_VEH].left + 8, this->widget[VVW_WIDGET_START_STOP_VEH].right, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING); + DrawString(this->widget[VVW_WIDGET_START_STOP_VEH].left + 8, this->widget[VVW_WIDGET_START_STOP_VEH].right, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING, TA_CENTER); this->DrawViewport(); } diff --git a/src/widget.cpp b/src/widget.cpp index 2643eb9e3..0b10ea51a 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -478,7 +478,7 @@ void Window::DrawWidgets() const GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[this->owner]][4]); } - DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING); + DrawString(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING, TA_CENTER); break; case WWT_DROPDOWN: { |