From 10caf391a1b6de33e1ac03236b2744adc9a2b2c5 Mon Sep 17 00:00:00 2001 From: terkhen Date: Sun, 17 Apr 2011 18:42:17 +0000 Subject: [PATCH] (svn r22343) -Change: Remove pixel limiter for query strings. --- src/ai/ai_gui.cpp | 2 +- src/build_vehicle_gui.cpp | 2 +- src/cheat_gui.cpp | 2 +- src/company_gui.cpp | 8 ++++---- src/company_type.h | 8 +++----- src/depot_gui.cpp | 2 +- src/depot_type.h | 3 +-- src/engine_type.h | 3 +-- src/genworld_gui.cpp | 12 ++++++------ src/group_gui.cpp | 2 +- src/group_type.h | 3 +-- src/industry_gui.cpp | 4 ++-- src/main_gui.cpp | 2 +- src/misc_gui.cpp | 9 ++++----- src/network/network_gui.cpp | 11 +++++------ src/newgrf_debug_gui.cpp | 4 ++-- src/newgrf_gui.cpp | 4 ++-- src/order_gui.cpp | 2 +- src/settings_gui.cpp | 4 ++-- src/signs_gui.cpp | 4 ++-- src/station_gui.cpp | 2 +- src/station_type.h | 3 +-- src/textbuf_gui.h | 2 +- src/timetable_gui.cpp | 2 +- src/toolbar_gui.cpp | 2 +- src/town_gui.cpp | 4 ++-- src/town_type.h | 3 +-- src/vehicle_gui.cpp | 2 +- src/vehicle_type.h | 3 +-- src/waypoint_gui.cpp | 2 +- 30 files changed, 53 insertions(+), 63 deletions(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index edbd9652c9..7d2b1fecd7 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -397,7 +397,7 @@ struct AISettingsWindow : public Window { /* Display a query box so users can enter a custom value. */ this->clicked_row = num; SetDParam(0, this->ai_config->GetSetting(config_item.name)); - ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, 100, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE); } this->SetDirty(); diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 2caa42d9dd..70cd31d629 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1211,7 +1211,7 @@ struct BuildVehicleWindow : Window { if (sel_eng != INVALID_ENGINE) { this->rename_engine = sel_eng; SetDParam(0, sel_eng); - ShowQueryString(STR_ENGINE_NAME, STR_QUERY_RENAME_TRAIN_TYPE_CAPTION + this->vehicle_type, MAX_LENGTH_ENGINE_NAME_CHARS, MAX_LENGTH_ENGINE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(STR_ENGINE_NAME, STR_QUERY_RENAME_TRAIN_TYPE_CAPTION + this->vehicle_type, MAX_LENGTH_ENGINE_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); } break; } diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index abb8445be6..b88a9355cf 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -334,7 +334,7 @@ struct CheatWindow : Window { if (btn == CHT_CHANGE_DATE && x >= 40) { /* Click at the date text directly. */ SetDParam(0, value); - ShowQueryString(STR_JUST_INT, STR_CHEAT_CHANGE_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); + ShowQueryString(STR_JUST_INT, STR_CHEAT_CHANGE_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED); return; } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 7c45f3fed3..968a216d0d 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1455,7 +1455,7 @@ public: /* 'Company manager face number' button, view and/or set company manager face number */ case SCMFW_WIDGET_FACECODE: SetDParam(0, this->face); - ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, this, CS_NUMERAL, QSF_NONE); break; /* Save button */ @@ -1952,13 +1952,13 @@ struct CompanyWindow : Window case CW_WIDGET_PRESIDENT_NAME: this->query_widget = CW_WIDGET_PRESIDENT_NAME; SetDParam(0, this->window_number); - ShowQueryString(STR_PRESIDENT_NAME, STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION, MAX_LENGTH_PRESIDENT_NAME_CHARS, MAX_LENGTH_PRESIDENT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(STR_PRESIDENT_NAME, STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION, MAX_LENGTH_PRESIDENT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; case CW_WIDGET_COMPANY_NAME: this->query_widget = CW_WIDGET_COMPANY_NAME; SetDParam(0, this->window_number); - ShowQueryString(STR_COMPANY_NAME, STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION, MAX_LENGTH_COMPANY_NAME_CHARS, MAX_LENGTH_COMPANY_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(STR_COMPANY_NAME, STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION, MAX_LENGTH_COMPANY_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; case CW_WIDGET_VIEW_HQ: { @@ -2007,7 +2007,7 @@ struct CompanyWindow : Window MarkWholeScreenDirty(); } else if (NetworkCompanyIsPassworded(company)) { /* ask for the password */ - ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, NETWORK_PASSWORD_LENGTH, 180, this, CS_ALPHANUMERAL, QSF_NONE); + ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, NETWORK_PASSWORD_LENGTH, this, CS_ALPHANUMERAL, QSF_NONE); } else { /* just send the join command */ NetworkClientRequestMove(company); diff --git a/src/company_type.h b/src/company_type.h index 88949b9ad3..922b633645 100644 --- a/src/company_type.h +++ b/src/company_type.h @@ -37,12 +37,10 @@ enum Owner { }; DECLARE_POSTFIX_INCREMENT(Owner) -static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0' -static const uint MAX_LENGTH_PRESIDENT_NAME_PIXELS = 94; ///< The maximum length of a president name in pixels -static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0' -static const uint MAX_LENGTH_COMPANY_NAME_PIXELS = 150; ///< The maximum length of a company name in pixels +static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS = 32; ///< The maximum length of a president name in characters including '\0' +static const uint MAX_LENGTH_COMPANY_NAME_CHARS = 32; ///< The maximum length of a company name in characters including '\0' -static const uint MAX_HISTORY_MONTHS = 24; ///< The maximum number of months kept as performance's history +static const uint MAX_HISTORY_MONTHS = 24; ///< The maximum number of months kept as performance's history /** Define basic enum properties */ template <> struct EnumPropsT : MakeEnumPropsT {}; diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index d5013f7c6e..57a0c789d6 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -732,7 +732,7 @@ struct DepotWindow : Window { case DEPOT_WIDGET_RENAME: // Rename button SetDParam(0, this->type); SetDParam(1, Depot::GetByTile((TileIndex)this->window_number)->index); - ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, MAX_LENGTH_DEPOT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(STR_DEPOT_NAME, STR_DEPOT_RENAME_DEPOT_CAPTION, MAX_LENGTH_DEPOT_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; case DEPOT_WIDGET_STOP_ALL: diff --git a/src/depot_type.h b/src/depot_type.h index 61ea123433..c5cbb1ab10 100644 --- a/src/depot_type.h +++ b/src/depot_type.h @@ -15,7 +15,6 @@ typedef uint16 DepotID; struct Depot; -static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 32; ///< The maximum length of a depot name in characters including '\0' -static const uint MAX_LENGTH_DEPOT_NAME_PIXELS = 180; ///< The maximum length of a depot name in pixels +static const uint MAX_LENGTH_DEPOT_NAME_CHARS = 32; ///< The maximum length of a depot name in characters including '\0' #endif /* DEPOT_TYPE_H */ diff --git a/src/engine_type.h b/src/engine_type.h index 65ba029b22..4de250e42c 100644 --- a/src/engine_type.h +++ b/src/engine_type.h @@ -154,8 +154,7 @@ enum EngineFlags { ENGINE_OFFER_WINDOW_OPEN = 4, ///< The exclusive offer window is currently open for a company. }; -static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32; ///< The maximum length of an engine name in characters including '\0' -static const uint MAX_LENGTH_ENGINE_NAME_PIXELS = 160; ///< The maximum length of an engine name in pixels +static const uint MAX_LENGTH_ENGINE_NAME_CHARS = 32; ///< The maximum length of an engine name in characters including '\0' static const EngineID INVALID_ENGINE = 0xFFFF; ///< Constant denoting an invalid engine. diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 90d7ab927c..a97859e7e1 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -633,7 +633,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { case GLAND_START_DATE_TEXT: // Year text this->widget_id = GLAND_START_DATE_TEXT; SetDParam(0, _settings_newgame.game_creation.starting_year); - ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); + ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); break; case GLAND_SNOW_LEVEL_DOWN: @@ -651,7 +651,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { case GLAND_SNOW_LEVEL_TEXT: // Snow line text this->widget_id = GLAND_SNOW_LEVEL_TEXT; SetDParam(0, _settings_newgame.game_creation.snow_line_height); - ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); + ShowQueryString(STR_JUST_INT, STR_MAPGEN_SNOW_LINE_QUERY_CAPT, 3, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); break; case GLAND_TREE_PULLDOWN: // Tree placer @@ -759,7 +759,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { if ((uint)index == CUSTOM_TOWN_NUMBER_DIFFICULTY) { this->widget_id = widget; SetDParam(0, _settings_newgame.game_creation.custom_town_number); - ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_TOWNS, 5, 50, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_MAPGEN_NUMBER_OF_TOWNS, 5, this, CS_NUMERAL, QSF_NONE); } IConsoleSetSetting("difficulty.number_towns", index); break; @@ -780,7 +780,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow { if ((uint)index == CUSTOM_SEA_LEVEL_NUMBER_DIFFICULTY) { this->widget_id = widget; SetDParam(0, _settings_newgame.game_creation.custom_sea_level); - ShowQueryString(STR_JUST_INT, STR_MAPGEN_QUANTITY_OF_SEA_LAKES, 3, 50, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_MAPGEN_QUANTITY_OF_SEA_LAKES, 3, this, CS_NUMERAL, QSF_NONE); } GameMode old_gm = _game_mode; _game_mode = GM_MENU; @@ -1031,7 +1031,7 @@ struct CreateScenarioWindow : public Window case CSCEN_START_DATE_TEXT: // Year text this->widget_id = CSCEN_START_DATE_TEXT; SetDParam(0, _settings_newgame.game_creation.starting_year); - ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_NONE); break; case CSCEN_FLAT_LAND_HEIGHT_DOWN: @@ -1049,7 +1049,7 @@ struct CreateScenarioWindow : public Window case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text this->widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT; SetDParam(0, _settings_newgame.game_creation.se_flat_world_height); - ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_SE_MAPGEN_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, this, CS_NUMERAL, QSF_NONE); break; } } diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 6cbd89920c..241582603e 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -631,7 +631,7 @@ public: SetDParam(0, group); str = STR_GROUP_NAME; } - ShowQueryString(str, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_CHARS, MAX_LENGTH_GROUP_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(str, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); } /** diff --git a/src/group_type.h b/src/group_type.h index db11bbaacb..7d09ce3ff1 100644 --- a/src/group_type.h +++ b/src/group_type.h @@ -18,8 +18,7 @@ static const GroupID ALL_GROUP = 0xFFFD; static const GroupID DEFAULT_GROUP = 0xFFFE; ///< ungrouped vehicles are in this group. static const GroupID INVALID_GROUP = 0xFFFF; -static const uint MAX_LENGTH_GROUP_NAME_CHARS = 32; ///< The maximum length of a group name in characters including '\0' -static const uint MAX_LENGTH_GROUP_NAME_PIXELS = 150; ///< The maximum length of a group name in pixels +static const uint MAX_LENGTH_GROUP_NAME_CHARS = 32; ///< The maximum length of a group name in characters including '\0' struct Group; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index ab1cfe28fd..cf1d8b1f25 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -883,12 +883,12 @@ public: switch (this->editable) { case EA_MULTIPLIER: SetDParam(0, RoundDivSU(i->prod_level * 100, PRODLEVEL_DEFAULT)); - ShowQueryString(STR_JUST_INT, STR_CONFIG_GAME_PRODUCTION_LEVEL, 10, 100, this, CS_ALPHANUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_CONFIG_GAME_PRODUCTION_LEVEL, 10, this, CS_ALPHANUMERAL, QSF_NONE); break; case EA_RATE: SetDParam(0, i->production_rate[line - IL_RATE1] * 8); - ShowQueryString(STR_JUST_INT, STR_CONFIG_GAME_PRODUCTION, 10, 100, this, CS_ALPHANUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_CONFIG_GAME_PRODUCTION, 10, this, CS_ALPHANUMERAL, QSF_NONE); break; default: NOT_REACHED(); diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 45f2d7ebb5..d87f1dbefa 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -123,7 +123,7 @@ void ShowNetworkGiveMoneyWindow(CompanyID company) { _rename_id = company; _rename_what = 3; - ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, NULL, CS_NUMERAL, QSF_NONE); } #endif /* ENABLE_NETWORK */ diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 137d533889..d157da0431 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -1365,7 +1365,7 @@ struct QueryStringWindow : public QueryStringBaseWindow { QueryStringFlags flags; ///< Flags controlling behaviour of the window. - QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, uint max_pixels, const WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) : + QueryStringWindow(StringID str, StringID caption, uint max_bytes, uint max_chars, const WindowDesc *desc, Window *parent, CharSetFilter afilter, QueryStringFlags flags) : QueryStringBaseWindow(max_bytes, max_chars) { GetString(this->edit_str_buf, str, &this->edit_str_buf[max_bytes - 1]); @@ -1382,7 +1382,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, max_pixels); + InitializeTextBuffer(&this->text, this->edit_str_buf, max_bytes, max_chars, 0); this->InitNested(desc); @@ -1508,16 +1508,15 @@ static const WindowDesc _query_string_desc( * @param str StringID for the text shown in the textbox * @param caption StringID of text shown in caption of querywindow * @param maxsize maximum size in bytes or characters (including terminating '\0') depending on flags - * @param maxwidth maximum width in pixels allowed * @param parent pointer to a Window that will handle the events (ok/cancel) of this * window. If NULL, results are handled by global function HandleOnEditText * @param afilter filters out unwanted character input * @param flags various flags, @see QueryStringFlags */ -void ShowQueryString(StringID str, StringID caption, uint maxsize, uint maxwidth, Window *parent, CharSetFilter afilter, QueryStringFlags flags) +void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags) { DeleteWindowById(WC_QUERY_STRING, 0); - new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, maxwidth, &_query_string_desc, parent, afilter, flags); + new QueryStringWindow(str, caption, ((flags & QSF_LEN_IN_CHARS) ? MAX_CHAR_LENGTH : 1) * maxsize, maxsize, &_query_string_desc, parent, afilter, flags); } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 0eb99ce7fb..6f2f28b639 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -749,7 +749,6 @@ public: STR_JUST_RAW_STRING, STR_NETWORK_SERVER_LIST_ENTER_IP, NETWORK_HOSTNAME_LENGTH, // maximum number of characters including '\0' - 0, // no limit in pixels this, CS_ALPHANUMERAL, QSF_ACCEPT_UNCHANGED); break; @@ -1121,7 +1120,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow { case NSSW_SETPWD: // Set password button this->widget_id = NSSW_SETPWD; SetDParamStr(0, _settings_client.network.server_password); - ShowQueryString(STR_JUST_RAW_STRING, STR_NETWORK_START_SERVER_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_RAW_STRING, STR_NETWORK_START_SERVER_SET_PASSWORD, 20, this, CS_ALPHANUMERAL, QSF_NONE); break; case NSSW_CONNTYPE_BTN: // Connection type @@ -1154,19 +1153,19 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow { case NSSW_CLIENTS_TXT: // Click on number of clients this->widget_id = NSSW_CLIENTS_TXT; SetDParam(0, _settings_client.network.max_clients); - ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, 4, 50, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, 4, this, CS_NUMERAL, QSF_NONE); break; case NSSW_COMPANIES_TXT: // Click on number of companies this->widget_id = NSSW_COMPANIES_TXT; SetDParam(0, _settings_client.network.max_companies); - ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, 3, 50, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, 3, this, CS_NUMERAL, QSF_NONE); break; case NSSW_SPECTATORS_TXT: // Click on number of spectators this->widget_id = NSSW_SPECTATORS_TXT; SetDParam(0, _settings_client.network.max_spectators); - ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, 4, 50, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, 4, this, CS_NUMERAL, QSF_NONE); break; case NSSW_LANGUAGE_BTN: { // Language @@ -2204,7 +2203,7 @@ void ShowNetworkNeedPassword(NetworkPasswordType npt) case NETWORK_GAME_PASSWORD: caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break; case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break; } - ShowQueryString(STR_EMPTY, caption, NETWORK_PASSWORD_LENGTH, 180, w, CS_ALPHANUMERAL, QSF_NONE); + ShowQueryString(STR_EMPTY, caption, NETWORK_PASSWORD_LENGTH, w, CS_ALPHANUMERAL, QSF_NONE); } diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 40581b9b2d..6156443671 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -441,7 +441,7 @@ struct NewGRFInspectWindow : Window { if (!HasVariableParameter(niv->var)) break; this->current_edit_param = niv->var; - ShowQueryString(STR_EMPTY, STR_NEWGRF_INSPECT_QUERY_CAPTION, 3, 100, this, CS_HEXADECIMAL, QSF_NONE); + ShowQueryString(STR_EMPTY, STR_NEWGRF_INSPECT_QUERY_CAPTION, 3, this, CS_HEXADECIMAL, QSF_NONE); } } } @@ -699,7 +699,7 @@ struct SpriteAlignerWindow : Window { break; case SAW_GOTO: - ShowQueryString(STR_EMPTY, STR_SPRITE_ALIGNER_GOTO_CAPTION, 7, 150, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_EMPTY, STR_SPRITE_ALIGNER_GOTO_CAPTION, 7, this, CS_NUMERAL, QSF_NONE); break; case SAW_NEXT: diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index a1e45e3cc2..c0a2312e33 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -342,7 +342,7 @@ struct NewGRFParametersWindow : public Window { } else if (par_info->type == PTYPE_UINT_ENUM && click_count >= 2) { /* Display a query box so users can enter a custom value. */ SetDParam(0, this->grf_config->param[num]); - ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, 100, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_NONE); } this->SetDirty(); @@ -786,7 +786,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } case SNGRFS_PRESET_SAVE: - ShowQueryString(STR_EMPTY, STR_NEWGRF_SETTINGS_PRESET_SAVE_QUERY, 32, 100, this, CS_ALPHANUMERAL, QSF_NONE); + ShowQueryString(STR_EMPTY, STR_NEWGRF_SETTINGS_PRESET_SAVE_QUERY, 32, this, CS_ALPHANUMERAL, QSF_NONE); break; case SNGRFS_PRESET_DELETE: diff --git a/src/order_gui.cpp b/src/order_gui.cpp index b1889a5116..b1b3eb787d 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1237,7 +1237,7 @@ public: uint value = order->GetConditionValue(); if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value); SetDParam(0, value); - ShowQueryString(STR_JUST_INT, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, 100, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(STR_JUST_INT, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, this, CS_NUMERAL, QSF_NONE); break; } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index a070e117e5..1556e3bc41 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1740,7 +1740,7 @@ struct GameSettingsWindow : Window { this->valuewindow_entry = pe; SetDParam(0, value); - ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, 100, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); + ShowQueryString(STR_JUST_INT, STR_CONFIG_SETTING_QUERY_CAPTION, 10, this, CS_NUMERAL, QSF_ENABLE_DEFAULT); } } } @@ -1993,7 +1993,7 @@ struct CustomCurrencyWindow : Window { if (len != 0) { this->query_widget = line; - ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter, QSF_NONE); + ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, this, afilter, QSF_NONE); } this->flags4 |= WF_TIMEOUT_BEGIN; diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 40039c3cfa..9f104a8b1e 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, MAX_LENGTH_SIGN_NAME_PIXELS); + InitializeTextBuffer(&this->text, this->edit_str_buf, MAX_LENGTH_SIGN_NAME_CHARS * MAX_CHAR_LENGTH, MAX_LENGTH_SIGN_NAME_CHARS, 0); 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, MAX_LENGTH_SIGN_NAME_PIXELS); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars, 0); this->SetWidgetDirty(QUERY_EDIT_SIGN_WIDGET_TEXT); this->SetFocusedWidget(QUERY_EDIT_SIGN_WIDGET_TEXT); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index e55c03226c..b70e922901 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1191,7 +1191,7 @@ struct StationViewWindow : public Window { case SVW_RENAME: SetDParam(0, this->window_number); - ShowQueryString(STR_STATION_NAME, STR_STATION_VIEW_RENAME_STATION_CAPTION, MAX_LENGTH_STATION_NAME_CHARS, MAX_LENGTH_STATION_NAME_PIXELS, + ShowQueryString(STR_STATION_NAME, STR_STATION_VIEW_RENAME_STATION_CAPTION, MAX_LENGTH_STATION_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; diff --git a/src/station_type.h b/src/station_type.h index d6084d79d1..c5eced579c 100644 --- a/src/station_type.h +++ b/src/station_type.h @@ -85,8 +85,7 @@ enum CatchmentArea { MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled }; -static const uint MAX_LENGTH_STATION_NAME_CHARS = 32; ///< The maximum length of a station name in characters including '\0' -static const uint MAX_LENGTH_STATION_NAME_PIXELS = 180; ///< The maximum length of a station name in pixels +static const uint MAX_LENGTH_STATION_NAME_CHARS = 32; ///< The maximum length of a station name in characters including '\0' /** List of stations */ typedef SmallVector StationList; diff --git a/src/textbuf_gui.h b/src/textbuf_gui.h index a5d65735b8..7b2582868c 100644 --- a/src/textbuf_gui.h +++ b/src/textbuf_gui.h @@ -55,7 +55,7 @@ DECLARE_ENUM_AS_BIT_SET(QueryStringFlags) typedef void QueryCallbackProc(Window*, bool); -void ShowQueryString(StringID str, StringID caption, uint max_len, uint max_pixels, Window *parent, CharSetFilter afilter, QueryStringFlags flags); +void ShowQueryString(StringID str, StringID caption, uint max_len, Window *parent, CharSetFilter afilter, QueryStringFlags flags); void ShowQuery(StringID caption, StringID message, Window *w, QueryCallbackProc *callback); /** The number of 'characters' on the on-screen keyboard. */ diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 7abe4f4f0b..09e3df8443 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -556,7 +556,7 @@ struct TimetableWindow : Window { } } - ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, 150, this, CS_NUMERAL, QSF_NONE); + ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, this, CS_NUMERAL, QSF_NONE); break; } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 711b738467..2b927ded90 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -884,7 +884,7 @@ static CallBackFunction ToolbarSwitchClick(Window *w) static CallBackFunction ToolbarScenDatePanel(Window *w) { SetDParam(0, _settings_game.game_creation.starting_year); - ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL, QSF_ENABLE_DEFAULT); + ShowQueryString(STR_JUST_INT, STR_MAPGEN_START_DATE_QUERY_CAPT, 8, w, CS_NUMERAL, QSF_ENABLE_DEFAULT); _left_button_clicked = false; return CBF_NONE; } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 76b89e2cc4..e1e89648a5 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -451,7 +451,7 @@ public: case TVW_CHANGENAME: // rename SetDParam(0, this->window_number); - ShowQueryString(STR_TOWN_NAME, STR_TOWN_VIEW_RENAME_TOWN_BUTTON, MAX_LENGTH_TOWN_NAME_CHARS, MAX_LENGTH_TOWN_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(STR_TOWN_NAME, STR_TOWN_VIEW_RENAME_TOWN_BUTTON, MAX_LENGTH_TOWN_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; case TVW_EXPAND: { // expand town - only available on Scenario editor @@ -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, MAX_LENGTH_TOWN_NAME_PIXELS); + InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, this->max_chars, 0); this->RandomTownName(); this->UpdateButtons(true); } diff --git a/src/town_type.h b/src/town_type.h index 0efc2268d9..14d840cb0a 100644 --- a/src/town_type.h +++ b/src/town_type.h @@ -105,7 +105,6 @@ enum TownFounding { /** It needs to be 8bits, because we save and load it as such */ typedef SimpleTinyEnumT TownFoundingByte; -static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32; ///< The maximum length of a town name in characters including '\0' -static const uint MAX_LENGTH_TOWN_NAME_PIXELS = 130; ///< The maximum length of a town name in pixels +static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32; ///< The maximum length of a town name in characters including '\0' #endif /* TOWN_TYPE_H */ diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 324a4d9797..211c0611a9 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2052,7 +2052,7 @@ struct VehicleDetailsWindow : Window { const Vehicle *v = Vehicle::Get(this->window_number); SetDParam(0, v->index); ShowQueryString(STR_VEHICLE_NAME, STR_QUERY_RENAME_TRAIN_CAPTION + v->type, - MAX_LENGTH_VEHICLE_NAME_CHARS, MAX_LENGTH_VEHICLE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + MAX_LENGTH_VEHICLE_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; } diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 32c79421df..a1a8b85abf 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -64,8 +64,7 @@ enum DepotCommand { DEPOT_COMMAND_MASK = 0xFU << 28, }; -static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32; ///< The maximum length of a vehicle name in characters including '\0' -static const uint MAX_LENGTH_VEHICLE_NAME_PIXELS = 150; ///< The maximum length of a vehicle name in pixels +static const uint MAX_LENGTH_VEHICLE_NAME_CHARS = 32; ///< The maximum length of a vehicle name in characters including '\0' /** The length of a vehicle in tile units. */ static const uint VEHICLE_LENGTH = 8; diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index af126f3ae5..869086a5d1 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -105,7 +105,7 @@ public: case WAYPVW_RENAME: // rename SetDParam(0, this->wp->index); - ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_STATION_NAME_CHARS, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); + ShowQueryString(STR_WAYPOINT_NAME, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_STATION_NAME_CHARS, this, CS_ALPHANUMERAL, QSF_ENABLE_DEFAULT | QSF_LEN_IN_CHARS); break; case WAYPVW_SHOW_VEHICLES: // show list of vehicles having this waypoint in their orders