|
@@ -76,16 +76,17 @@ static bool DrawScrollingStatusText(cons
|
|
|
return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0);
|
|
|
}
|
|
|
|
|
|
struct StatusBarWindow : Window {
|
|
|
bool saving;
|
|
|
int ticker_scroll;
|
|
|
uint ticker_timer;
|
|
|
int reminder_timeout;
|
|
|
|
|
|
static const int TICKER_STOP = 1640; ///< scrolling is finished when counter reaches this value
|
|
|
static const int REMINDER_START = 91; ///< initial value of the reminder counter (right dot on the right)
|
|
|
static const int REMINDER_START = 1350; ///< time in ms for reminder notification (red dot on the right) to stay
|
|
|
static const int REMINDER_STOP = 0; ///< reminder disappears when counter reaches this value
|
|
|
static const int COUNTER_STEP = 2; ///< this is subtracted from active counters every tick
|
|
|
|
|
|
StatusBarWindow(WindowDesc *desc) : Window(desc)
|
|
|
{
|
|
|
this->ticker_scroll = TICKER_STOP;
|
|
@@ -200,12 +201,13 @@ struct StatusBarWindow : Window {
|
|
|
case SBI_SAVELOAD_START: this->saving = true; break;
|
|
|
case SBI_SAVELOAD_FINISH: this->saving = false; break;
|
|
|
case SBI_SHOW_TICKER: this->ticker_scroll = 0; break;
|
|
|
case SBI_SHOW_REMINDER: this->reminder_timeout = REMINDER_START; break;
|
|
|
case SBI_NEWS_DELETED:
|
|
|
this->ticker_scroll = TICKER_STOP; // reset ticker ...
|
|
|
this->ticker_timer = 0;
|
|
|
this->reminder_timeout = REMINDER_STOP; // ... and reminder
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnClick(Point pt, int widget, int click_count)
|
|
@@ -214,25 +216,26 @@ struct StatusBarWindow : Window {
|
|
|
case WID_S_MIDDLE: ShowLastNewsMessage(); break;
|
|
|
case WID_S_RIGHT: if (_local_company != COMPANY_SPECTATOR) ShowCompanyFinances(_local_company); break;
|
|
|
default: ResetObjectToPlace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
virtual void OnTick()
|
|
|
virtual void OnRealtimeTick(uint delta_ms)
|
|
|
{
|
|
|
if (_pause_mode != PM_UNPAUSED) return;
|
|
|
|
|
|
if (this->ticker_scroll < TICKER_STOP) { // Scrolling text
|
|
|
this->ticker_scroll += COUNTER_STEP;
|
|
|
this->SetWidgetDirty(WID_S_MIDDLE);
|
|
|
uint count = CountIntervalElapsed(this->ticker_timer, delta_ms, 15);
|
|
|
if (count > 0) {
|
|
|
this->ticker_scroll += count;
|
|
|
this->SetWidgetDirty(WID_S_MIDDLE);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (this->reminder_timeout > REMINDER_STOP) { // Red blot to show there are new unread newsmessages
|
|
|
this->reminder_timeout -= COUNTER_STEP;
|
|
|
} else if (this->reminder_timeout < REMINDER_STOP) {
|
|
|
this->reminder_timeout = REMINDER_STOP;
|
|
|
// Red blot to show there are new unread newsmessages
|
|
|
if (TimerElapsed(this->reminder_timeout, delta_ms)) {
|
|
|
this->SetWidgetDirty(WID_S_MIDDLE);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
static const NWidgetPart _nested_main_status_widgets[] = {
|