Changeset - r11878:56346e40ae7a
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-05-12 19:59:33
rubidium@openttd.org
(svn r16283) -Fix [FS#2890]: news ticker truncated too early
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/statusbar_gui.cpp
Show inline comments
 
@@ -36,49 +36,49 @@ static bool DrawScrollingStatusText(cons
 
	char *d = buffer;
 
	const char *last = lastof(buffer);
 

	
 
	for (;;) {
 
		WChar c = Utf8Consume(&s);
 
		if (c == 0) {
 
			break;
 
		} else if (c == '\n') {
 
			if (d + 4 >= last) break;
 
			d[0] = d[1] = d[2] = d[3] = ' ';
 
			d += 4;
 
		} else if (IsPrintable(c)) {
 
			if (d + Utf8CharLen(c) >= last) break;
 
			d += Utf8Encode(d, c);
 
		}
 
	}
 
	*d = '\0';
 

	
 
	DrawPixelInfo tmp_dpi;
 
	if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, width, 11)) return true;
 

	
 
	DrawPixelInfo *old_dpi = _cur_dpi;
 
	_cur_dpi = &tmp_dpi;
 

	
 
	int x = DrawString(pos, pos + width, 0, buffer, TC_LIGHT_BLUE);
 
	int x = DrawString(pos, INT16_MAX, 0, buffer, TC_LIGHT_BLUE);
 
	_cur_dpi = old_dpi;
 

	
 
	return x > 0;
 
}
 

	
 
enum StatusbarWidget {
 
	SBW_LEFT,   ///< left part of the statusbar; date is shown there
 
	SBW_MIDDLE, ///< middle part; current news or company name or *** SAVING *** or *** PAUSED ***
 
	SBW_RIGHT,  ///< right part; bank balance
 
};
 

	
 
struct StatusBarWindow : Window {
 
	bool saving;
 
	int ticker_scroll;
 
	int reminder_timeout;
 

	
 
	enum {
 
		TICKER_START   =   360, ///< initial value of the ticker counter (scrolling news)
 
		TICKER_STOP    = -1280, ///< scrolling is finished when counter reaches this value
 
		REMINDER_START =    91, ///< initial value of the reminder counter (right dot on the right)
 
		REMINDER_STOP  =     0, ///< reminder disappears when counter reaches this value
 
		COUNTER_STEP   =     2, ///< this is subtracted from active counters every tick
 
	};
 

	
0 comments (0 inline, 0 general)