Reorder DrawWidget on StatusBarWindow.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user