From 5bb7a48cd23a61ed523d09a5884848aa94e47da6 Mon Sep 17 00:00:00 2001 From: terkhen Date: Sun, 17 Apr 2011 18:44:09 +0000 Subject: [PATCH] (svn r22345) -Change: Remove pixel limiter for text buffers. --- src/fios_gui.cpp | 2 +- src/genworld_gui.cpp | 2 +- src/misc_gui.cpp | 16 +++++----------- src/newgrf_gui.cpp | 3 +-- src/signs_gui.cpp | 4 ++-- src/textbuf_gui.h | 4 ++-- src/town_gui.cpp | 2 +- 7 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 3b97b420b2..e7ad518c19 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -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(SLWW_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index a97859e7e1..f1a58679bb 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -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; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index d157da0431..a3954a9131 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -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); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index c0a2312e33..3443f67131 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -510,7 +510,6 @@ struct NewGRFWindow : public QueryStringBaseWindow { typedef GUIList 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(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); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index ca65a8c94e..2c189d705b 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -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); diff --git a/src/textbuf_gui.h b/src/textbuf_gui.h index 7b2582868c..a96fe91063 100644 --- a/src/textbuf_gui.h +++ b/src/textbuf_gui.h @@ -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 */ diff --git a/src/town_gui.cpp b/src/town_gui.cpp index e1e89648a5..aa95884f02 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -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); }