(svn r22345) -Change: Remove pixel limiter for text buffers.

This commit is contained in:
terkhen 2011-04-17 18:44:09 +00:00
parent 97ceef7663
commit 23f42e5769
7 changed files with 13 additions and 20 deletions

View File

@ -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);

View File

@ -356,7 +356,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
/* 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;

View File

@ -1159,13 +1159,10 @@ bool MoveTextBufferPos(Textbuf *tb, int navmode)
* @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, char *buf, uint16 max_bytes, uint16 max_p
* @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, char *buf, uint16 max_bytes, uint16 max_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 QueryStringBaseWindow
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);

View File

@ -510,7 +510,6 @@ struct NewGRFWindow : public QueryStringBaseWindow {
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 QueryStringBaseWindow {
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);

View File

@ -155,7 +155,7 @@ struct SignListWindow : QueryStringBaseWindow, SignList {
/* 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 : QueryStringBaseWindow, SignList {
*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);

View File

@ -38,8 +38,8 @@ bool DeleteTextBufferChar(Textbuf *tb, int delmode);
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 */

View File

@ -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);
}