diff options
-rw-r--r-- | src/fios_gui.cpp | 1 | ||||
-rw-r--r-- | src/genworld_gui.cpp | 2 | ||||
-rw-r--r-- | src/misc_gui.cpp | 4 | ||||
-rw-r--r-- | src/network/network_chat_gui.cpp | 1 | ||||
-rw-r--r-- | src/network/network_content_gui.cpp | 1 | ||||
-rw-r--r-- | src/network/network_gui.cpp | 3 | ||||
-rw-r--r-- | src/osk_gui.cpp | 6 | ||||
-rw-r--r-- | src/querystring_gui.h | 1 | ||||
-rw-r--r-- | src/signs_gui.cpp | 2 | ||||
-rw-r--r-- | src/textbuf.cpp | 1 | ||||
-rw-r--r-- | src/textbuf_type.h | 1 |
11 files changed, 8 insertions, 15 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 5bc542c04..498798b13 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -266,7 +266,6 @@ public: this->querystrings[WID_SL_SAVE_OSK_TITLE] = &this->filename_editbox; this->filename_editbox.ok_button = WID_SL_SAVE_GAME; - this->filename_editbox.afilter = CS_ALPHANUMERAL; this->CreateNestedTree(desc, true); if (mode == SLD_LOAD_GAME) this->GetWidget<NWidgetStacked>(WID_SL_CONTENT_DOWNLOAD_SEL)->SetDisplayedPlane(SZSP_HORIZONTAL); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 94a06e748..82f285748 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -320,7 +320,7 @@ struct GenerateLandscapeWindow : public Window { this->querystrings[WID_GL_RANDOM_EDITBOX] = &this->seed_editbox; this->seed_editbox.text.Print("%u", _settings_newgame.game_creation.generation_seed); this->seed_editbox.caption = STR_NULL; - this->seed_editbox.afilter = CS_NUMERAL; + this->seed_editbox.text.afilter = CS_NUMERAL; this->mode = (GenenerateLandscapeWindowMode)this->window_number; diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index bd390c7bf..d6303fa35 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -764,7 +764,7 @@ HandleEditBoxResult QueryString::HandleEditBoxKey(Window *w, int wid, uint16 key break; default: - if (IsValidChar(key, this->afilter)) { + if (IsValidChar(key, this->text.afilter)) { edited = this->text.InsertChar(key); } else { state = ES_NOT_HANDLED; @@ -889,7 +889,7 @@ struct QueryStringWindow : public Window this->editbox.caption = caption; this->editbox.cancel_button = WID_QS_CANCEL; this->editbox.ok_button = WID_QS_OK; - this->editbox.afilter = afilter; + this->editbox.text.afilter = afilter; this->flags = flags; this->InitNested(desc, WN_QUERY_STRING); diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index f43f2414a..062858e11 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -303,7 +303,6 @@ struct NetworkChatWindow : public Window { this->querystrings[WID_NC_TEXTBOX] = &this->message_editbox; this->message_editbox.cancel_button = WID_NC_CLOSE; this->message_editbox.ok_button = WID_NC_SENDBUTTON; - this->message_editbox.afilter = CS_ALPHANUMERAL; static const StringID chat_captions[] = { STR_NETWORK_CHAT_ALL_CAPTION, diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 3c387c2d0..a7c503a60 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -486,7 +486,6 @@ public: this->querystrings[WID_NCL_FILTER] = &this->filter_editbox; this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; - this->filter_editbox.afilter = CS_ALPHANUMERAL; this->SetFocusedWidget(WID_NCL_FILTER); this->SetWidgetDisabledState(WID_NCL_SEARCH_EXTERNAL, this->auto_select); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 91eacfcee..f93b31c77 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -454,7 +454,6 @@ public: this->querystrings[WID_NG_CLIENT] = &this->name_editbox; this->name_editbox.text.Assign(_settings_client.network.client_name); - this->name_editbox.afilter = CS_ALPHANUMERAL; this->querystrings[WID_NG_FILTER] = &this->filter_editbox; this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; @@ -1042,7 +1041,6 @@ struct NetworkStartServerWindow : public Window { this->querystrings[WID_NSS_GAMENAME] = &this->name_editbox; this->name_editbox.text.Assign(_settings_client.network.server_name); - this->name_editbox.afilter = CS_ALPHANUMERAL; this->SetFocusedWidget(WID_NSS_GAMENAME); } @@ -2147,7 +2145,6 @@ struct NetworkCompanyPasswordWindow : public Window { this->querystrings[WID_NCP_PASSWORD] = &this->password_editbox; this->password_editbox.cancel_button = WID_NCP_CANCEL; this->password_editbox.ok_button = WID_NCP_OK; - this->password_editbox.afilter = CS_ALPHANUMERAL; this->SetFocusedWidget(WID_NCP_PASSWORD); } diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index ea66782e8..015222d4d 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -83,9 +83,9 @@ struct OskWindow : public Window { for (uint i = 0; i < OSK_KEYBOARD_ENTRIES; i++) { this->SetWidgetDisabledState(WID_OSK_LETTERS + i, - !IsValidChar(_keyboard[this->shift][i], this->qs->afilter) || _keyboard[this->shift][i] == ' '); + !IsValidChar(_keyboard[this->shift][i], this->qs->text.afilter) || _keyboard[this->shift][i] == ' '); } - this->SetWidgetDisabledState(WID_OSK_SPACE, !IsValidChar(' ', this->qs->afilter)); + this->SetWidgetDisabledState(WID_OSK_SPACE, !IsValidChar(' ', this->qs->text.afilter)); this->SetWidgetLoweredState(WID_OSK_SHIFT, HasBit(_keystate, KEYS_SHIFT)); this->SetWidgetLoweredState(WID_OSK_CAPS, HasBit(_keystate, KEYS_CAPS)); @@ -113,7 +113,7 @@ struct OskWindow : public Window { if (widget >= WID_OSK_LETTERS) { WChar c = _keyboard[this->shift][widget - WID_OSK_LETTERS]; - if (!IsValidChar(c, this->qs->afilter)) return; + if (!IsValidChar(c, this->qs->text.afilter)) return; if (this->qs->text.InsertChar(c)) this->OnEditboxChanged(WID_OSK_TEXT); diff --git a/src/querystring_gui.h b/src/querystring_gui.h index a7916a801..6ec93ffd9 100644 --- a/src/querystring_gui.h +++ b/src/querystring_gui.h @@ -42,7 +42,6 @@ struct QueryString { int cancel_button; ///< Widget button of parent window to simulate when pressing CANCEL in OSK. Textbuf text; const char *orig; - CharSetFilter afilter; bool handled; /** diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 357fcaf52..cd4d7e1b8 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -160,7 +160,6 @@ struct SignListWindow : Window, SignList { this->querystrings[WID_SIL_FILTER_TEXT] = &this->filter_editbox; this->filter_editbox.ok_button = WID_SIL_FILTER_ENTER_BTN; this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; - this->filter_editbox.afilter = CS_ALPHANUMERAL; /* Initialize the filtering variables */ this->SetFilterString(""); @@ -419,7 +418,6 @@ struct SignWindow : Window, SignList { this->name_editbox.caption = STR_EDIT_SIGN_CAPTION; this->name_editbox.cancel_button = WID_QES_CANCEL; this->name_editbox.ok_button = WID_QES_OK; - this->name_editbox.afilter = CS_ALPHANUMERAL; this->InitNested(desc, WN_QUERY_STRING_SIGN); diff --git a/src/textbuf.cpp b/src/textbuf.cpp index 9b9eb2d6a..457388db7 100644 --- a/src/textbuf.cpp +++ b/src/textbuf.cpp @@ -364,6 +364,7 @@ Textbuf::Textbuf(uint16 max_bytes, uint16 max_chars) assert(max_bytes != 0); assert(max_chars != 0); + this->afilter = CS_ALPHANUMERAL; this->max_bytes = max_bytes; this->max_chars = max_chars == UINT16_MAX ? max_bytes : max_chars; this->caret = true; diff --git a/src/textbuf_type.h b/src/textbuf_type.h index 8d38e8b8a..2582d1e25 100644 --- a/src/textbuf_type.h +++ b/src/textbuf_type.h @@ -17,6 +17,7 @@ /** Helper/buffer for input fields. */ struct Textbuf { + CharSetFilter afilter; ///< Allowed characters char * const buf; ///< buffer in which text is saved uint16 max_bytes; ///< the maximum size of the buffer in bytes (including terminating '\0') uint16 max_chars; ///< the maximum size of the buffer in characters (including terminating '\0') |