87 lines
4.0 KiB
Diff
87 lines
4.0 KiB
Diff
From acd5c1d49292557fb174c42b33d02232b52b9c6f Mon Sep 17 00:00:00 2001
|
|
From: Juanjo <juanjo.ng.83@gmail.com>
|
|
Date: Wed, 26 Jun 2013 20:34:38 +0200
|
|
Subject: [PATCH 173/249] Reorder DrawWidget on StatusBarWindow.
|
|
|
|
---
|
|
src/statusbar_gui.cpp | 27 +++++++++++++++------------
|
|
1 file changed, 15 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp
|
|
index 62799e1..fe9b2b3 100644
|
|
--- a/src/statusbar_gui.cpp
|
|
+++ b/src/statusbar_gui.cpp
|
|
@@ -128,11 +128,13 @@ struct StatusBarWindow : Window {
|
|
|
|
virtual void DrawWidget(const Rect &r, int widget) const
|
|
{
|
|
+ StringID str = INVALID_STRING_ID;
|
|
+
|
|
switch (widget) {
|
|
case WID_S_LEFT:
|
|
/* Draw the date */
|
|
SetDParam(0, _date);
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_WHITE_DATE_LONG, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_WHITE_DATE_LONG;
|
|
break;
|
|
|
|
case WID_S_RIGHT: {
|
|
@@ -140,7 +142,7 @@ struct StatusBarWindow : Window {
|
|
const Company *c = Company::GetIfValid(_local_company);
|
|
if (c != NULL) {
|
|
SetDParam(0, c->money);
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_COMPANY_MONEY, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_COMPANY_MONEY;
|
|
}
|
|
break;
|
|
}
|
|
@@ -148,11 +150,11 @@ struct StatusBarWindow : Window {
|
|
case WID_S_MIDDLE:
|
|
/* Draw status bar */
|
|
if (this->saving) { // true when saving is active
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_SAVING_GAME, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_STATUSBAR_SAVING_GAME;
|
|
} else if (_do_autosave) {
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_AUTOSAVE, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_STATUSBAR_AUTOSAVE;
|
|
} else if (_pause_mode != PM_UNPAUSED) {
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_PAUSED, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_STATUSBAR_PAUSED;
|
|
} else if (this->ticker_scroll < TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item != NULL && _statusbar_news_item->string_id != 0) {
|
|
/* Draw the scrolling news text */
|
|
if (!DrawScrollingStatusText(_statusbar_news_item, this->ticker_scroll, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom)) {
|
|
@@ -160,22 +162,23 @@ struct StatusBarWindow : Window {
|
|
if (Company::IsValidID(_local_company)) {
|
|
/* This is the default text */
|
|
SetDParam(0, _local_company);
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_STATUSBAR_COMPANY_NAME;
|
|
}
|
|
}
|
|
} else {
|
|
if (Company::IsValidID(_local_company)) {
|
|
/* This is the default text */
|
|
SetDParam(0, _local_company);
|
|
- DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+ str = STR_STATUSBAR_COMPANY_NAME;
|
|
}
|
|
}
|
|
+ }
|
|
|
|
- if (this->reminder_timeout > 0) {
|
|
- Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS);
|
|
- DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2);
|
|
- }
|
|
- break;
|
|
+ if (str != INVALID_STRING_ID) DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_FROMSTRING, SA_HOR_CENTER);
|
|
+
|
|
+ if (widget == WID_S_MIDDLE && this->reminder_timeout > 0) {
|
|
+ Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS);
|
|
+ DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + WD_FRAMERECT_TOP + (int)(FONT_HEIGHT_NORMAL - icon_size.height) / 2);
|
|
}
|
|
}
|
|
|
|
--
|
|
1.8.1.2
|
|
|