Changeset - r10145:99ade42f8be3
[Not reviewed]
master
0 17 0
smatz - 16 years ago 2008-09-15 16:29:40
smatz@openttd.org
(svn r14331) -Codechange: use an enum as additional parameter for ShowQueryString()
17 files changed with 49 insertions and 40 deletions:
0 comments (0 inline, 0 general)
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -1091,13 +1091,13 @@ struct BuildVehicleWindow : Window {
 
						case VEH_TRAIN:    str = STR_886A_RENAME_TRAIN_VEHICLE_TYPE; break;
 
						case VEH_ROAD:     str = STR_9036_RENAME_ROAD_VEHICLE_TYPE;  break;
 
						case VEH_SHIP:     str = STR_9838_RENAME_SHIP_TYPE;          break;
 
						case VEH_AIRCRAFT: str = STR_A039_RENAME_AIRCRAFT_TYPE;      break;
 
					}
 
					SetDParam(0, sel_eng);
 
					ShowQueryString(STR_ENGINE_NAME, str, MAX_LENGTH_ENGINE_NAME_BYTES, MAX_LENGTH_ENGINE_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
					ShowQueryString(STR_ENGINE_NAME, str, MAX_LENGTH_ENGINE_NAME_BYTES, MAX_LENGTH_ENGINE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
				}
 
				break;
 
			}
 
		}
 
	}
 

	
src/genworld_gui.cpp
Show inline comments
 
@@ -412,13 +412,13 @@ struct GenerateLandscapeWindow : public 
 
				_left_button_clicked = false;
 
				break;
 

	
 
			case GLAND_START_DATE_TEXT: // Year text
 
				this->widget_id = GLAND_START_DATE_TEXT;
 
				SetDParam(0, _settings_newgame.game_creation.starting_year);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_NONE);
 
				break;
 

	
 
			case GLAND_SNOW_LEVEL_DOWN:
 
			case GLAND_SNOW_LEVEL_UP: // Snow line buttons
 
				/* Don't allow too fast scrolling */
 
				if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
 
@@ -430,13 +430,13 @@ struct GenerateLandscapeWindow : public 
 
				_left_button_clicked = false;
 
				break;
 

	
 
			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_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL, QSF_NONE);
 
				break;
 

	
 
			case GLAND_TREE_PULLDOWN: // Tree placer
 
				ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, GLAND_TREE_PULLDOWN, 0, 0);
 
				break;
 

	
 
@@ -706,13 +706,13 @@ struct CreateScenarioWindow : public Win
 
				_left_button_clicked = false;
 
				break;
 

	
 
			case CSCEN_START_DATE_TEXT: // Year text
 
				this->widget_id = CSCEN_START_DATE_TEXT;
 
				SetDParam(0, _settings_newgame.game_creation.starting_year);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL, QSF_NONE);
 
				break;
 

	
 
			case CSCEN_FLAT_LAND_HEIGHT_DOWN:
 
			case CSCEN_FLAT_LAND_HEIGHT_UP: // Height level buttons
 
				/* Don't allow too fast scrolling */
 
				if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
 
@@ -724,13 +724,13 @@ struct CreateScenarioWindow : public Win
 
				_left_button_clicked = false;
 
				break;
 

	
 
			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_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL, QSF_NONE);
 
				break;
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
src/group_gui.cpp
Show inline comments
 
@@ -527,13 +527,13 @@ public:
 
			case GRP_WIDGET_RENAME_GROUP: { // Rename the selected roup
 
				assert(IsValidGroupID(this->group_sel));
 

	
 
				const Group *g = GetGroup(this->group_sel);
 

	
 
				SetDParam(0, g->index);
 
				ShowQueryString(STR_GROUP_NAME, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_BYTES, MAX_LENGTH_GROUP_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_GROUP_NAME, STR_GROUP_RENAME_CAPTION, MAX_LENGTH_GROUP_NAME_BYTES, MAX_LENGTH_GROUP_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
			} break;
 

	
 

	
 
			case GRP_WIDGET_AVAILABLE_VEHICLES:
 
				ShowBuildVehicleWindow(0, this->vehicle_type);
 
				break;
src/industry_gui.cpp
Show inline comments
 
@@ -602,13 +602,13 @@ public:
 
						this->clicked_line = line + 1;
 
						this->clicked_button = (x < 15 ? 1 : 2);
 
					} else if (IsInsideMM(x, 34, 160)) {
 
						/* clicked the text */
 
						this->editbox_line = line;
 
						SetDParam(0, i->production_rate[line] * 8);
 
						ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, this, CS_ALPHANUMERAL);
 
						ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, this, CS_ALPHANUMERAL, QSF_NONE);
 
					}
 
				}
 
			} break;
 

	
 
			case IVW_GOTO:
 
				i = GetIndustry(this->window_number);
src/main_gui.cpp
Show inline comments
 
@@ -119,13 +119,13 @@ void CcPlaySound10(bool success, TileInd
 

	
 
#ifdef ENABLE_NETWORK
 
void ShowNetworkGiveMoneyWindow(PlayerID player)
 
{
 
	_rename_id = player;
 
	_rename_what = 3;
 
	ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL);
 
	ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL, QSF_NONE);
 
}
 
#endif /* ENABLE_NETWORK */
 

	
 

	
 
/* Zooms a viewport in a window in or out */
 
/* No button handling or what so ever */
src/misc_gui.cpp
Show inline comments
 
@@ -1151,36 +1151,35 @@ static const WindowDesc _query_string_de
 
	_query_string_widgets,
 
};
 

	
 
/** Show a query popup window with a textbox in it.
 
 * @param str StringID for the text shown in the textbox
 
 * @param caption StringID of text shown in caption of querywindow
 
 * @param maxlen maximum length in characters allowed. If bit 12 is set we
 
 *               will not check the resulting string against to original string to return success
 
 * @param maxlen maximum length in characters allowed
 
 * @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 */
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter)
 
 * @param afilter filters out unwanted character input
 
 * @param flags various flags, @see QueryStringFlags
 
 */
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
 
{
 
	uint realmaxlen = maxlen & ~0x1000;
 

	
 
	DeleteWindowById(WC_QUERY_STRING, 0);
 
	DeleteWindowById(WC_SAVELOAD, 0);
 

	
 
	QueryStringWindow *w = new QueryStringWindow(realmaxlen + 1, &_query_string_desc, parent);
 
	QueryStringWindow *w = new QueryStringWindow(maxlen + 1, &_query_string_desc, parent);
 

	
 
	GetString(w->edit_str_buf, str, &w->edit_str_buf[realmaxlen]);
 
	w->edit_str_buf[realmaxlen] = '\0';
 
	GetString(w->edit_str_buf, str, &w->edit_str_buf[maxlen]);
 
	w->edit_str_buf[maxlen] = '\0';
 

	
 
	if (!(maxlen & 0x1000)) w->orig = strdup(w->edit_str_buf);
 
	if ((flags & QSF_ACCEPT_UNCHANGED) == 0) w->orig = strdup(w->edit_str_buf);
 

	
 
	w->LowerWidget(QUERY_STR_WIDGET_TEXT);
 
	w->caption = caption;
 
	w->afilter = afilter;
 
	InitializeTextBuffer(&w->text, w->edit_str_buf, realmaxlen, maxwidth);
 
	InitializeTextBuffer(&w->text, w->edit_str_buf, maxlen, maxwidth);
 
}
 

	
 

	
 
enum QueryWidgets {
 
	QUERY_WIDGET_CAPTION = 1,
 
	QUERY_WIDGET_NO = 3,
src/network/network_gui.cpp
Show inline comments
 
@@ -500,15 +500,15 @@ public:
 

	
 
			case NGWW_ADD: // Add a server
 
				SetDParamStr(0, _settings_client.network.connect_to_ip);
 
				ShowQueryString(
 
					STR_JUST_RAW_STRING,
 
					STR_NETWORK_ENTER_IP,
 
					31 | 0x1000,  // maximum number of characters OR
 
					31,  // maximum number of characters
 
					250, // characters up to this width pixels, whichever is satisfied first
 
					this, CS_ALPHANUMERAL);
 
					this, CS_ALPHANUMERAL, QSF_ACCEPT_UNCHANGED);
 
				break;
 

	
 
			case NGWW_START: // Start server
 
				ShowNetworkStartServerWindow();
 
				break;
 

	
 
@@ -831,13 +831,13 @@ struct NetworkStartServerWindow : public
 
				ShowOnScreenKeyboard(this, NSSW_GAMENAME, 0, 0);
 
				break;
 

	
 
			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_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_JUST_RAW_STRING, STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case NSSW_SELMAP: { // Select map
 
				int y = (pt.y - NSSWND_START) / NSSWND_ROWSIZE;
 

	
 
				y += this->vscroll.pos;
 
@@ -874,25 +874,25 @@ struct NetworkStartServerWindow : public
 
				_left_button_clicked = false;
 
				break;
 

	
 
			case NSSW_CLIENTS_TXT:    // Click on number of players
 
				this->widget_id = NSSW_CLIENTS_TXT;
 
				SetDParam(0, _settings_client.network.max_clients);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS,    3, 50, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS,    3, 50, 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_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES,  3, 50, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES,  3, 50, 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_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL, QSF_NONE);
 
				break;
 

	
 
			case NSSW_LANGUAGE_BTN: { // Language
 
				uint sel = 0;
 
				for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) {
 
					if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) {
 
@@ -1657,13 +1657,13 @@ void ShowNetworkNeedPassword(NetworkPass
 
	pw_type = npt;
 
	switch (npt) {
 
		default: NOT_REACHED();
 
		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, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL);
 
	ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL, QSF_NONE);
 
}
 

	
 
// Vars needed for the join-GUI
 
NetworkJoinStatus _network_join_status;
 
uint8 _network_join_waiting;
 
uint16 _network_join_kbytes;
src/newgrf_gui.cpp
Show inline comments
 
@@ -463,13 +463,13 @@ struct NewGRFWindow : public Window {
 
				ShowDropDownList(this, list, this->preset, SNGRFS_PRESET_LIST);
 
				break;
 
			}
 

	
 
			case SNGRFS_PRESET_SAVE:
 
				this->query_widget = widget;
 
				ShowQueryString(STR_EMPTY, STR_NEWGRF_PRESET_SAVE_QUERY, 32, 100, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_EMPTY, STR_NEWGRF_PRESET_SAVE_QUERY, 32, 100, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case SNGRFS_PRESET_DELETE:
 
				if (this->preset == -1) return;
 

	
 
				DeleteGRFPresetFromConfig(_grf_preset_list[this->preset]);
 
@@ -572,13 +572,13 @@ struct NewGRFWindow : public Window {
 
				if (this->sel == NULL) break;
 

	
 
				this->query_widget = widget;
 
				static char buff[512];
 
				GRFBuildParamList(buff, this->sel, lastof(buff));
 
				SetDParamStr(0, buff);
 
				ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_JUST_RAW_STRING, STR_NEWGRF_PARAMETER_QUERY, 63, 250, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 
			}
 

	
 
			case SNGRFS_TOGGLE_PALETTE: {
 
				if (this->sel != NULL) {
 
					this->sel->windows_paletted ^= true;
src/order_gui.cpp
Show inline comments
 
@@ -871,13 +871,13 @@ public:
 

	
 
			case ORDER_WIDGET_COND_VALUE: {
 
				const Order *order = GetVehicleOrder(this->vehicle, this->OrderGetSel());
 
				uint value = order->GetConditionValue();
 
				if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
 
				SetDParam(0, value);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, 100, this, CS_NUMERAL);
 
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, 100, this, CS_NUMERAL, QSF_NONE);
 
			} break;
 

	
 
			case ORDER_WIDGET_SHARED_ORDER_LIST:
 
				ShowVehicleListWindow(this->vehicle);
 
				break;
 
		}
src/player_gui.cpp
Show inline comments
 
@@ -913,13 +913,13 @@ public:
 
				this->SetDirty();
 
				break;
 

	
 
			/* 'Player face number' button, view and/or set player face number */
 
			case PFW_WIDGET_FACECODE:
 
				SetDParam(0, this->face);
 
				ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, this, CS_NUMERAL);
 
				ShowQueryString(STR_JUST_INT, STR_FACE_FACECODE_CAPTION, 10 + 1, 0, this, CS_NUMERAL, QSF_NONE);
 
				break;
 

	
 
			/* Save button */
 
			case PFW_WIDGET_SAVE:
 
				_player_face = this->face;
 
				ShowErrorMessage(INVALID_STRING_ID, STR_FACE_SAVE_DONE, 0, 0);
 
@@ -1254,19 +1254,19 @@ struct PlayerCompanyWindow : Window
 
				new SelectPlayerLiveryWindow(&_select_player_livery_desc, (PlayerID)this->window_number);
 
				break;
 

	
 
			case PCW_WIDGET_PRESIDENT_NAME:
 
				this->query_widget = PCW_WIDGET_PRESIDENT_NAME;
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_PLAYER_NAME, STR_700B_PRESIDENT_S_NAME, MAX_LENGTH_PRESIDENT_NAME_BYTES, MAX_LENGTH_PRESIDENT_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_PLAYER_NAME, STR_700B_PRESIDENT_S_NAME, MAX_LENGTH_PRESIDENT_NAME_BYTES, MAX_LENGTH_PRESIDENT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case PCW_WIDGET_COMPANY_NAME:
 
				this->query_widget = PCW_WIDGET_COMPANY_NAME;
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_COMPANY_NAME, STR_700A_COMPANY_NAME, MAX_LENGTH_COMPANY_NAME_BYTES, MAX_LENGTH_COMPANY_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_COMPANY_NAME, STR_700A_COMPANY_NAME, MAX_LENGTH_COMPANY_NAME_BYTES, MAX_LENGTH_COMPANY_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case PCW_WIDGET_BUILD_VIEW_HQ: {
 
				TileIndex tile = GetPlayer((PlayerID)this->window_number)->location_of_HQ;
 
				if (tile == 0) {
 
					if ((byte)this->window_number != _local_player) return;
src/settings_gui.cpp
Show inline comments
 
@@ -924,13 +924,13 @@ struct PatchesSelectionWindow : Window {
 
					if (sd->desc.cmd != SDT_BOOLX && !(sd->desc.flags & SGF_MULTISTRING)) {
 
						/* Show the correct currency-translated value */
 
						if (sd->desc.flags & SGF_CURRENCY) value *= _currency->rate;
 

	
 
						this->entry = btn;
 
						SetDParam(0, value);
 
						ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, this, CS_NUMERAL);
 
						ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, this, CS_NUMERAL, QSF_NONE);
 
					}
 
				}
 
			} break;
 

	
 
			case PATCHSEL_INTERFACE: case PATCHSEL_CONSTRUCTION: case PATCHSEL_VEHICLES:
 
			case PATCHSEL_STATIONS:  case PATCHSEL_ECONOMY:      case PATCHSEL_COMPETITORS:
 
@@ -1162,13 +1162,13 @@ struct CustomCurrencyWindow : Window {
 
				}
 
				break;
 
		}
 

	
 
		if (len != 0) {
 
			this->query_widget = line;
 
			ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter);
 
			ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, this, afilter, QSF_NONE);
 
		}
 

	
 
		this->flags4 |= 5 << WF_TIMEOUT_SHL;
 
		this->SetDirty();
 
	}
 

	
src/station_gui.cpp
Show inline comments
 
@@ -909,13 +909,13 @@ struct StationViewWindow : public Window
 

	
 
				this->SetDirty();
 
				break;
 

	
 
			case SVW_RENAME:
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_STATION, STR_3030_RENAME_STATION_LOADING, MAX_LENGTH_STATION_NAME_BYTES, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_STATION, STR_3030_RENAME_STATION_LOADING, MAX_LENGTH_STATION_NAME_BYTES, MAX_LENGTH_STATION_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case SVW_TRAINS: { // Show a list of scheduled trains to this station
 
				const Station *st = GetStation(this->window_number);
 
				ShowVehicleListWindow(st->owner, VEH_TRAIN, (StationID)this->window_number);
 
				break;
src/textbuf_gui.h
Show inline comments
 
@@ -5,12 +5,13 @@
 
#ifndef TEXTBUF_GUI_H
 
#define TEXTBUF_GUI_H
 

	
 
#include "window_type.h"
 
#include "string_type.h"
 
#include "strings_type.h"
 
#include "core/enum_type.hpp"
 

	
 
struct Textbuf {
 
	char *buf;                  ///< buffer in which text is saved
 
	uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
 
	uint16 length, width;       ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
 
	bool caret;                 ///< is the caret ("_") visible or not
 
@@ -25,15 +26,24 @@ 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, const char *buf, uint16 maxlength, uint16 maxwidth);
 
void UpdateTextBufferSize(Textbuf *tb);
 

	
 
/** Flags used in ShowQueryString() call */
 
enum QueryStringFlags {
 
	QSF_NONE            =    0,
 
	QSF_ACCEPT_UNCHANGED = 0x01, ///< return success even when the text didn't change
 
};
 

	
 
DECLARE_ENUM_AS_BIT_SET(QueryStringFlags)
 

	
 

	
 
typedef void QueryCallbackProc(Window*, bool);
 

	
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter);
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, 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. */
 
static const uint OSK_KEYBOARD_ENTRIES = 50;
 

	
 
/**
src/timetable_gui.cpp
Show inline comments
 
@@ -228,13 +228,13 @@ struct TimetableWindow : Window {
 
					if (time != 0) {
 
						SetDParam(0, time);
 
						current = STR_CONFIG_PATCHES_INT32;
 
					}
 
				}
 

	
 
				ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, 150, this, CS_NUMERAL);
 
				ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, 150, this, CS_NUMERAL, QSF_NONE);
 
			} break;
 

	
 
			case TTV_CLEAR_TIME: { /* Clear waiting time button. */
 
				uint32 p1 = PackTimetableArgs(v, this->sel_index);
 
				DoCommandP(0, p1, 0, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
 
			} break;
src/town_gui.cpp
Show inline comments
 
@@ -367,13 +367,13 @@ public:
 
			case TVW_SHOWAUTORITY: /* town authority */
 
				ShowTownAuthorityWindow(this->window_number);
 
				break;
 

	
 
			case TVW_CHANGENAME: /* rename */
 
				SetDParam(0, this->window_number);
 
				ShowQueryString(STR_TOWN, STR_2007_RENAME_TOWN, MAX_LENGTH_TOWN_NAME_BYTES, MAX_LENGTH_TOWN_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_TOWN, STR_2007_RENAME_TOWN, MAX_LENGTH_TOWN_NAME_BYTES, MAX_LENGTH_TOWN_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case TVW_EXPAND: /* expand town - only available on Scenario editor */
 
				ExpandTown(this->town);
 
				break;
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -1467,13 +1467,13 @@ struct VehicleDetailsWindow : Window {
 
		};
 

	
 
		switch (widget) {
 
			case VLD_WIDGET_RENAME_VEHICLE: {// rename
 
				const Vehicle *v = GetVehicle(this->window_number);
 
				SetDParam(0, v->index);
 
				ShowQueryString(STR_VEHICLE_NAME, _name_vehicle_title[v->type], MAX_LENGTH_VEHICLE_NAME_BYTES, MAX_LENGTH_VEHICLE_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_VEHICLE_NAME, _name_vehicle_title[v->type], MAX_LENGTH_VEHICLE_NAME_BYTES, MAX_LENGTH_VEHICLE_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
			} break;
 

	
 
			case VLD_WIDGET_INCREASE_SERVICING_INTERVAL:   // increase int
 
			case VLD_WIDGET_DECREASE_SERVICING_INTERVAL: { // decrease int
 
				int mod = _ctrl_pressed ? 5 : 10;
 
				const Vehicle *v = GetVehicle(this->window_number);
src/waypoint_gui.cpp
Show inline comments
 
@@ -71,13 +71,13 @@ public:
 
					ScrollMainWindowToTile(this->wp->xy);
 
				}
 
				break;
 

	
 
			case WAYPVW_RENAME: /* rename */
 
				SetDParam(0, this->wp->index);
 
				ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_WAYPOINT_NAME_BYTES, MAX_LENGTH_WAYPOINT_NAME_PIXELS, this, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, MAX_LENGTH_WAYPOINT_NAME_BYTES, MAX_LENGTH_WAYPOINT_NAME_PIXELS, this, CS_ALPHANUMERAL, QSF_NONE);
 
				break;
 

	
 
			case WAYPVW_SHOW_TRAINS: /* show list of trains having this waypoint in their orders*/
 
				ShowVehicleListWindow(this->wp);
 
				break;
 
		}
0 comments (0 inline, 0 general)