Changeset - r17571:79b9561c7d43
[Not reviewed]
master
0 7 0
terkhen - 13 years ago 2011-04-17 18:44:09
terkhen@openttd.org
(svn r22345) -Change: Remove pixel limiter for text buffers.
7 files changed with 13 insertions and 20 deletions:
0 comments (0 inline, 0 general)
src/fios_gui.cpp
Show inline comments
 
@@ -267,7 +267,7 @@ public:
 
		}
 

	
 
		this->afilter = CS_ALPHANUMERAL;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 240);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size);
 

	
 
		this->CreateNestedTree(desc, true);
 
		if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(SLWW_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL);
src/genworld_gui.cpp
Show inline comments
 
@@ -356,7 +356,7 @@ struct GenerateLandscapeWindow : public 
 

	
 
		/* snprintf() always outputs trailing '\0', so whole buffer can be used */
 
		snprintf(this->edit_str_buf, this->edit_str_size, "%u", _settings_newgame.game_creation.generation_seed);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size);
 
		this->caption = STR_NULL;
 
		this->afilter = CS_NUMERAL;
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -1159,13 +1159,10 @@ bool MoveTextBufferPos(Textbuf *tb, int 
 
 * @param tb Textbuf type which is getting initialized
 
 * @param buf the buffer that will be holding the data for input
 
 * @param max_bytes maximum size in bytes, including terminating '\0'
 
 * @param max_pixels maximum length in pixels of this buffer. If reached, buffer
 
 * cannot grow, even if maxsize would allow because there is space. Width
 
 * of zero '0' means the buffer is only restricted by maxsize
 
 */
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_pixels)
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes)
 
{
 
	InitializeTextBuffer(tb, buf, max_bytes, max_bytes, max_pixels);
 
	InitializeTextBuffer(tb, buf, max_bytes, max_bytes);
 
}
 

	
 
/**
 
@@ -1175,11 +1172,8 @@ void InitializeTextBuffer(Textbuf *tb, c
 
 * @param buf the buffer that will be holding the data for input
 
 * @param max_bytes maximum size in bytes, including terminating '\0'
 
 * @param max_chars maximum size in chars, including terminating '\0'
 
 * @param max_pixels maximum length in pixels of this buffer. If reached, buffer
 
 * cannot grow, even if maxsize would allow because there is space. Width
 
 * of zero '0' means the buffer is only restricted by maxsize
 
 */
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars, uint16 max_pixels)
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars)
 
{
 
	assert(max_bytes != 0);
 
	assert(max_chars != 0);
 
@@ -1187,7 +1181,7 @@ void InitializeTextBuffer(Textbuf *tb, c
 
	tb->buf        = buf;
 
	tb->max_bytes  = max_bytes;
 
	tb->max_chars  = max_chars;
 
	tb->max_pixels = max_pixels;
 
	tb->max_pixels = 0;
 
	tb->caret      = true;
 
	UpdateTextBufferSize(tb);
 
}
 
@@ -1382,7 +1376,7 @@ struct QueryStringWindow : public QueryS
 
		this->caption = caption;
 
		this->afilter = afilter;
 
		this->flags = flags;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars, 0);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars);
 

	
 
		this->InitNested(desc);
 

	
src/newgrf_gui.cpp
Show inline comments
 
@@ -510,7 +510,6 @@ struct NewGRFWindow : public QueryString
 
	typedef GUIList<const GRFConfig *> GUIGRFConfigList;
 

	
 
	static const uint EDITBOX_MAX_SIZE   =  50;
 
	static const uint EDITBOX_MAX_LENGTH = 300;
 

	
 
	static Listing   last_sorting;   ///< Default sorting of #GUIGRFConfigList.
 
	static Filtering last_filtering; ///< Default filtering of #GUIGRFConfigList.
 
@@ -556,7 +555,7 @@ struct NewGRFWindow : public QueryString
 
		this->GetWidget<NWidgetStacked>(SNGRFS_SHOW_APPLY)->SetDisplayedPlane(this->editable ? 0 : SZSP_HORIZONTAL);
 
		this->FinishInitNested(desc);
 

	
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, EDITBOX_MAX_LENGTH);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size);
 
		this->SetFocusedWidget(SNGRFS_FILTER);
 

	
 
		this->avails.SetListing(this->last_sorting);
src/signs_gui.cpp
Show inline comments
 
@@ -155,7 +155,7 @@ struct SignListWindow : QueryStringBaseW
 

	
 
		/* Initialize the text edit widget */
 
		this->afilter = CS_ALPHANUMERAL;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS, 0);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS);
 
		ClearFilterTextWidget();
 

	
 
		/* Initialize the filtering variables */
 
@@ -502,7 +502,7 @@ struct SignWindow : QueryStringBaseWindo
 
		*last_of = '\0';
 

	
 
		this->cur_sign = si->index;
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars, 0);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars);
 

	
 
		this->SetWidgetDirty(QUERY_EDIT_SIGN_WIDGET_TEXT);
 
		this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT);
src/textbuf_gui.h
Show inline comments
 
@@ -38,8 +38,8 @@ bool DeleteTextBufferChar(Textbuf *tb, i
 
bool InsertTextBufferChar(Textbuf *tb, uint32 key);
 
bool InsertTextBufferClipboard(Textbuf *tb);
 
bool MoveTextBufferPos(Textbuf *tb, int navmode);
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_pixels);
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars, uint16 max_pixels);
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes);
 
void InitializeTextBuffer(Textbuf *tb, char *buf, uint16 max_bytes, uint16 max_chars);
 
void UpdateTextBufferSize(Textbuf *tb);
 

	
 
/** Flags used in ShowQueryString() call */
src/town_gui.cpp
Show inline comments
 
@@ -1030,7 +1030,7 @@ public:
 
			params(_settings_game.game_creation.town_name)
 
	{
 
		this->InitNested(desc, window_number);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars, 0);
 
		InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars);
 
		this->RandomTownName();
 
		this->UpdateButtons(true);
 
	}
0 comments (0 inline, 0 general)