| 37 | #include "safeguards.h" |
| 38 | |
| 39 | static bool DrawScrollingStatusText(const NewsItem &ni, int scroll_pos, int left, int right, int top, int bottom) |
| 40 | { |
| 41 | /* Replace newlines and the likes with spaces. */ |
| 42 | std::string message = StrMakeValid(ni.GetStatusText(), StringValidationSetting::ReplaceTabCrNlWithSpace); |
| 43 | |
| 44 | DrawPixelInfo tmp_dpi; |
| 45 | if (!FillDrawPixelInfo(&tmp_dpi, left, top, right - left, bottom)) return true; |
| 46 | |
| 47 | int width = GetStringBoundingBox(message).width; |
| 48 | int pos = (_current_text_dir == TD_RTL) ? (scroll_pos - width) : (right - scroll_pos - left); |
| 49 | |
| 50 | AutoRestoreBackup dpi_backup(_cur_dpi, &tmp_dpi); |
| 51 | DrawString(pos, INT16_MAX, 0, message, TC_LIGHT_BLUE, SA_LEFT | SA_FORCE); |
| 52 | |
| 53 | return (_current_text_dir == TD_RTL) ? (pos < right - left) : (pos + width > 0); |
| 54 | } |
| 55 | |
| 56 | struct StatusBarWindow : Window { |
| 57 | bool saving = false; |
no test coverage detected