Changeset - r5431:2abf239227ce
[Not reviewed]
master
0 18 0
Darkvater - 18 years ago 2006-12-30 01:17:53
darkvater@openttd.org
(svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
query has no parent (eg give money, rename waypoint), the global function
HandleOnEditText is used.
18 files changed with 111 insertions and 135 deletions:
0 comments (0 inline, 0 general)
aircraft_gui.c
Show inline comments
 
@@ -125,7 +125,7 @@ static void AircraftDetailsWndProc(Windo
 
		case 2: /* rename */
 
			v = GetVehicle(w->window_number);
 
			SetDParam(0, v->unitnumber);
 
			ShowQueryString(v->string_id, STR_A030_NAME_AIRCRAFT, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
			ShowQueryString(v->string_id, STR_A030_NAME_AIRCRAFT, 31, 150, w, CS_ALPHANUMERAL);
 
			break;
 
		case 5: /* increase int */
 
			mod = _ctrl_pressed? 5 : 10;
build_vehicle_gui.c
Show inline comments
 
@@ -396,7 +396,7 @@ static void BuildAircraftClickEvent(Wind
 
			EngineID sel_eng = bv->sel_engine;
 
			if (sel_eng != INVALID_ENGINE) {
 
				bv->rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng), STR_A039_RENAME_AIRCRAFT_TYPE, 31, 160, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
				ShowQueryString(GetCustomEngineName(sel_eng), STR_A039_RENAME_AIRCRAFT_TYPE, 31, 160, w, CS_ALPHANUMERAL);
 
			}
 
			break;
 
		}
genworld_gui.c
Show inline comments
 
@@ -345,7 +345,7 @@ void GenerateLandscapeWndProc(Window *w,
 
		case 19: // Year text
 
			WP(w, def_d).data_3 = START_DATE_QUERY;
 
			SetDParam(0, _patches_newgame.starting_year);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, WC_GENERATE_LANDSCAPE, mode, CS_NUMERAL);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL);
 
			break;
 
		case 21: case 23: // Snow line buttons
 
			/* Don't allow too fast scrolling */
 
@@ -360,7 +360,7 @@ void GenerateLandscapeWndProc(Window *w,
 
		case 22: // Snow line text
 
			WP(w, def_d).data_3 = SNOW_LINE_QUERY;
 
			SetDParam(0, _patches_newgame.snow_line_height);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, WC_GENERATE_LANDSCAPE, mode, CS_NUMERAL);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, w, CS_NUMERAL);
 
			break;
 
		case 24: case 25: // Tree placer
 
			ShowDropDownMenu(w, tree_placer, _patches_newgame.tree_placer, 25, 0, 0);
 
@@ -604,7 +604,7 @@ void CreateScenarioWndProc(Window *w, Wi
 
		case 15: // Year text
 
			WP(w, def_d).data_3 = START_DATE_QUERY;
 
			SetDParam(0, _patches_newgame.starting_year);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, WC_GENERATE_LANDSCAPE, GLWP_SCENARIO, CS_NUMERAL);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, w, CS_NUMERAL);
 
			break;
 
		case 17: case 19: // Height level buttons
 
			/* Don't allow too fast scrolling */
 
@@ -619,7 +619,7 @@ void CreateScenarioWndProc(Window *w, Wi
 
		case 18: // Height level text
 
			WP(w, def_d).data_3 = FLAT_WORLD_HEIGHT_QUERY;
 
			SetDParam(0, _patches_newgame.se_flat_world_height);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, WC_GENERATE_LANDSCAPE, GLWP_SCENARIO, CS_NUMERAL);
 
			ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, w, CS_NUMERAL);
 
			break;
 
		}
 
		break;
gui.h
Show inline comments
 
@@ -126,11 +126,12 @@ extern const byte _fios_colors[];
 
void ShowBuildBridgeWindow(uint start, uint end, byte type);
 

	
 
void ShowBuildIndustryWindow(void);
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number, CharSetFilter afilter);
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, Window *parent, CharSetFilter afilter);
 
void ShowQuery(StringID caption, StringID message, Window *w, void (*callback)(Window*, bool));
 
void ShowMusicWindow(void);
 

	
 
/* main_gui.c */
 
void HandleOnEditText(const char *str);
 
VARDEF byte _station_show_coverage;
 
VARDEF PlaceProc *_place_proc;
 

	
industry_gui.c
Show inline comments
 
@@ -380,10 +380,7 @@ static void IndustryViewWndProc(Window *
 
					// clicked the text
 
					WP(w,vp2_d).data_1 = line;
 
					SetDParam(0, i->production_rate[line] * 8);
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32,
 
							STR_CONFIG_GAME_PRODUCTION,
 
							10, 100, w->window_class,
 
							w->window_number, CS_ALPHANUMERAL);
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, w, CS_ALPHANUMERAL);
 
				}
 
			}
 
		} break;
intro_gui.c
Show inline comments
 
@@ -41,8 +41,6 @@ static const Widget _select_game_widgets
 
{   WIDGETS_END},
 
};
 

	
 
extern void HandleOnEditText(WindowEvent *e);
 

	
 
static inline void SetNewLandscapeType(byte landscape)
 
{
 
	_opt_newgame.landscape = landscape;
 
@@ -88,8 +86,6 @@ static void SelectGameWndProc(Window *w,
 
		case 16: HandleExitGameRequest(); break;
 
		}
 
		break;
 

	
 
		case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
 
	}
 
}
 

	
main_gui.c
Show inline comments
 
@@ -54,27 +54,23 @@ extern void GenerateIndustries(void);
 
extern bool GenerateTowns(void);
 

	
 

	
 
void HandleOnEditText(WindowEvent *e)
 
void HandleOnEditText(const char *str)
 
{
 
	const char *b = e->we.edittext.str;
 
	int id;
 

	
 
	_cmd_text = b;
 

	
 
	id = _rename_id;
 
	int id = _rename_id;
 
	_cmd_text = str;
 

	
 
	switch (_rename_what) {
 
	case 0: /* Rename a s sign, if string is empty, delete sign */
 
		DoCommandP(0, id, 0, NULL, CMD_RENAME_SIGN | CMD_MSG(STR_280C_CAN_T_CHANGE_SIGN_NAME));
 
		break;
 
	case 1: /* Rename a waypoint */
 
		if (*b == '\0') return;
 
		if (*str == '\0') return;
 
		DoCommandP(0, id, 0, NULL, CMD_RENAME_WAYPOINT | CMD_MSG(STR_CANT_CHANGE_WAYPOINT_NAME));
 
		break;
 
#ifdef ENABLE_NETWORK
 
	case 3: { /* Give money, you can only give money in excess of loan */
 
		const Player *p = GetPlayer(_current_player);
 
		int32 money = min(p->money64 - p->current_loan, atoi(e->we.edittext.str) / _currency->rate);
 
		int32 money = min(p->money64 - p->current_loan, atoi(str) / _currency->rate);
 
		char msg[20];
 

	
 
		money = clamp(money, 0, 20000000); // Clamp between 20 million and 0
 
@@ -311,7 +307,7 @@ void ShowNetworkGiveMoneyWindow(PlayerID
 
{
 
	_rename_id = player;
 
	_rename_what = 3;
 
	ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, 1, 0, CS_NUMERAL);
 
	ShowQueryString(STR_EMPTY, STR_NETWORK_GIVE_MONEY_CAPTION, 30, 180, NULL, CS_NUMERAL);
 
}
 
#endif /* ENABLE_NETWORK */
 

	
 
@@ -319,7 +315,7 @@ void ShowRenameSignWindow(const Sign *si
 
{
 
	_rename_id = si->index;
 
	_rename_what = 0;
 
	ShowQueryString(si->str, STR_280B_EDIT_SIGN_TEXT, 30, 180, 1, 0, CS_ALPHANUMERAL);
 
	ShowQueryString(si->str, STR_280B_EDIT_SIGN_TEXT, 30, 180, NULL, CS_ALPHANUMERAL);
 
}
 

	
 
void ShowRenameWaypointWindow(const Waypoint *wp)
 
@@ -336,7 +332,7 @@ void ShowRenameWaypointWindow(const Wayp
 
	_rename_id = id;
 
	_rename_what = 1;
 
	SetDParam(0, id);
 
	ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, 1, 0, CS_ALPHANUMERAL);
 
	ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL);
 
}
 

	
 
static void SelectSignTool(void)
 
@@ -1837,8 +1833,6 @@ static void MainToolbarWndProc(Window *w
 
		SetWindowDirty(w);
 
	} break;
 

	
 
	case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
 

	
 
	case WE_MOUSELOOP:
 
		if (IsWindowWidgetLowered(w, 0) != !!_pause) {
 
			ToggleWidgetLoweredState(w, 0);
 
@@ -2038,8 +2032,6 @@ static void ScenEditToolbarWndProc(Windo
 
		SetWindowDirty(w);
 
	} break;
 

	
 
	case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
 

	
 
	case WE_MOUSELOOP:
 
		if (IsWindowWidgetLowered(w, 0) != !!_pause) {
 
			ToggleWidgetLoweredState(w, 0);
misc_gui.c
Show inline comments
 
@@ -1038,93 +1038,87 @@ void DrawEditBox(Window *w, querystr_d *
 
	_cur_dpi = old_dpi;
 
}
 

	
 
enum QueryStringWidgets {
 
	QUERY_STR_WIDGET_TEXT = 3,
 
	QUERY_STR_WIDGET_CANCEL,
 
	QUERY_STR_WIDGET_OK
 
};
 

	
 

	
 
static void QueryStringWndProc(Window *w, WindowEvent *e)
 
{
 
	static bool closed = false;
 
	querystr_d *qs = &WP(w, querystr_d);
 

	
 
	switch (e->event) {
 
	case WE_CREATE:
 
		SETBIT(_no_scroll, SCROLL_EDIT);
 
		closed = false;
 
		break;
 
		case WE_CREATE:
 
			SETBIT(_no_scroll, SCROLL_EDIT);
 
			break;
 

	
 
	case WE_PAINT:
 
		SetDParam(0, WP(w,querystr_d).caption);
 
		DrawWindowWidgets(w);
 
		case WE_PAINT:
 
			SetDParam(0, qs->caption);
 
			DrawWindowWidgets(w);
 

	
 
		DrawEditBox(w, &WP(w,querystr_d), 5);
 
		break;
 
			DrawEditBox(w, qs, QUERY_STR_WIDGET_TEXT);
 
			break;
 

	
 
	case WE_CLICK:
 
		switch (e->we.click.widget) {
 
		case 3: DeleteWindow(w); break;
 
		case 4:
 
press_ok:;
 
			if (WP(w, querystr_d).orig != NULL &&
 
					strcmp(WP(w, querystr_d).text.buf, WP(w, querystr_d).orig) == 0) {
 
				DeleteWindow(w);
 
			} else {
 
				char *buf = WP(w,querystr_d).text.buf;
 
				WindowClass wnd_class = WP(w,querystr_d).wnd_class;
 
				WindowNumber wnd_num = WP(w,querystr_d).wnd_num;
 
				Window *parent;
 
		case WE_CLICK:
 
			switch (e->we.click.widget) {
 
				case QUERY_STR_WIDGET_OK:
 
		press_ok:;
 
					if (qs->orig == NULL || strcmp(qs->text.buf, qs->orig) != 0) {
 
						Window *parent = w->parent;
 
						qs->handled = true;
 

	
 
				// Mask the edit-box as closed, so we don't send out a CANCEL
 
				closed = true;
 

	
 
				DeleteWindow(w);
 

	
 
				parent = FindWindowById(wnd_class, wnd_num);
 
				if (parent != NULL) {
 
					WindowEvent e;
 
					e.event = WE_ON_EDIT_TEXT;
 
					e.we.edittext.str = buf;
 
					parent->wndproc(parent, &e);
 
				}
 
						/* If the parent is NULL, the editbox is handled by general function
 
						 * HandleOnEditText */
 
						if (parent != NULL) {
 
							WindowEvent e;
 
							e.event = WE_ON_EDIT_TEXT;
 
							e.we.edittext.str = qs->text.buf;
 
							parent->wndproc(parent, &e);
 
						} else {
 
							HandleOnEditText(qs->text.buf);
 
						}
 
					}
 
					/* Fallthrough */
 
				case QUERY_STR_WIDGET_CANCEL:
 
					DeleteWindow(w);
 
					break;
 
			}
 
			break;
 
		}
 
		break;
 

	
 
	case WE_MOUSELOOP: {
 
		if (!FindWindowById(WP(w,querystr_d).wnd_class, WP(w,querystr_d).wnd_num)) {
 
			DeleteWindow(w);
 
			return;
 
		}
 
		HandleEditBox(w, &WP(w, querystr_d), 5);
 
	} break;
 
		case WE_MOUSELOOP:
 
			HandleEditBox(w, qs, QUERY_STR_WIDGET_TEXT);
 
			break;
 

	
 
	case WE_KEYPRESS: {
 
		switch (HandleEditBoxKey(w, &WP(w, querystr_d), 5, e)) {
 
		case 1: // Return
 
			goto press_ok;
 
		case 2: // Escape
 
			DeleteWindow(w);
 
		case WE_KEYPRESS:
 
			switch (HandleEditBoxKey(w, qs, QUERY_STR_WIDGET_TEXT, e)) {
 
				case 1: goto press_ok; /* Enter pressed, confirms change */
 
				case 2: DeleteWindow(w); break; /* ESC pressed, closes window, abandons changes */
 
			}
 
			break;
 
		}
 
	} break;
 

	
 
	case WE_DESTROY:
 
		// If the window is not closed yet, it means it still needs to send a CANCEL
 
		if (!closed) {
 
			Window *parent = FindWindowById(WP(w,querystr_d).wnd_class, WP(w,querystr_d).wnd_num);
 
			if (parent != NULL) {
 
		case WE_DESTROY: /* Call cancellation of query, if we have not handled it before */
 
			if (!qs->handled && w->parent != NULL) {
 
				WindowEvent e;
 
				Window *parent = w->parent;
 

	
 
				qs->handled = true;
 
				e.event = WE_ON_EDIT_TEXT_CANCEL;
 
				parent->wndproc(parent, &e);
 
			}
 
			CLRBIT(_no_scroll, SCROLL_EDIT);
 
			break;
 
		}
 
		CLRBIT(_no_scroll, SCROLL_EDIT);
 
		break;
 
	}
 
}
 

	
 
static const Widget _query_string_widgets[] = {
 
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,        STR_018B_CLOSE_WINDOW},
 
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   259,     0,    13, STR_012D,        STR_NULL},
 
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   259,    14,    29, 0x0,             STR_NULL},
 
{      WWT_PANEL,   RESIZE_NONE,    14,     2,   257,    16,    27, 0x0,             STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,     0,   129,    30,    41, STR_012E_CANCEL, STR_NULL},
 
{    WWT_TEXTBTN,   RESIZE_NONE,    14,   130,   259,    30,    41, STR_012F_OK,     STR_NULL},
 
{      WWT_PANEL,   RESIZE_NONE,    14,     2,   257,    16,    27, 0x0,             STR_NULL},
 
{   WIDGETS_END},
 
};
 

	
 
@@ -1137,10 +1131,19 @@ static const WindowDesc _query_string_de
 
};
 

	
 
static char _edit_str_buf[64];
 
static char _orig_str_buf[lengthof(_edit_str_buf)];
 

	
 
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number, CharSetFilter afilter)
 
/** 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 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)
 
{
 
	static char orig_str_buf[lengthof(_edit_str_buf)];
 
	Window *w;
 
	uint realmaxlen = maxlen & ~0x1000;
 

	
 
@@ -1150,6 +1153,7 @@ void ShowQueryString(StringID str, Strin
 
	DeleteWindowById(WC_SAVELOAD, 0);
 

	
 
	w = AllocateWindowDesc(&_query_string_desc);
 
	w->parent = parent;
 

	
 
	GetString(_edit_str_buf, str, lastof(_edit_str_buf));
 
	_edit_str_buf[realmaxlen - 1] = '\0';
 
@@ -1157,14 +1161,12 @@ void ShowQueryString(StringID str, Strin
 
	if (maxlen & 0x1000) {
 
		WP(w, querystr_d).orig = NULL;
 
	} else {
 
		strecpy(_orig_str_buf, _edit_str_buf, lastof(_orig_str_buf));
 
		WP(w, querystr_d).orig = _orig_str_buf;
 
		strecpy(orig_str_buf, _edit_str_buf, lastof(orig_str_buf));
 
		WP(w, querystr_d).orig = orig_str_buf;
 
	}
 

	
 
	LowerWindowWidget(w, 5);
 
	LowerWindowWidget(w, QUERY_STR_WIDGET_TEXT);
 
	WP(w, querystr_d).caption = caption;
 
	WP(w, querystr_d).wnd_class = window_class;
 
	WP(w, querystr_d).wnd_num = window_number;
 
	WP(w, querystr_d).afilter = afilter;
 
	InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, realmaxlen, maxwidth);
 
}
network_gui.c
Show inline comments
 
@@ -424,8 +424,7 @@ static void NetworkGameWindowWndProc(Win
 
				STR_NETWORK_ENTER_IP,
 
				31 | 0x1000,  // maximum number of characters OR
 
				250, // characters up to this width pixels, whichever is satisfied first
 
				w->window_class,
 
				w->window_number, CS_ALPHANUMERAL);
 
				w, CS_ALPHANUMERAL);
 
		} break;
 
		case 13: /* Start server */
 
			ShowNetworkStartServerWindow();
 
@@ -648,8 +647,7 @@ static void NetworkStartServerWindowWndP
 
			break;
 

	
 
		case 4: /* Set password button */
 
			ShowQueryString(BindCString(_network_server_password),
 
				STR_NETWORK_SET_PASSWORD, 20, 250, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
			ShowQueryString(BindCString(_network_server_password), STR_NETWORK_SET_PASSWORD, 20, 250, w, CS_ALPHANUMERAL);
 
			break;
 

	
 
		case 5: { /* Select map */
 
@@ -1381,7 +1379,7 @@ void ShowNetworkNeedPassword(NetworkPass
 
		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, WC_NETWORK_STATUS_WINDOW, 0, CS_ALPHANUMERAL);
 
	ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL);
 
}
 

	
 

	
 
@@ -1421,13 +1419,14 @@ static void NetworkJoinStatusWindowWndPr
 
			case 0: /* Close 'X' */
 
			case 3: /* Disconnect button */
 
				NetworkDisconnect();
 
				DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
				DeleteWindow(w);
 
				SwitchMode(SM_MENU);
 
				ShowNetworkGameWindow();
 
				break;
 
		}
 
		break;
 

	
 
		/* If the server asks for a password, we need to fill it in */
 
		case WE_ON_EDIT_TEXT_CANCEL:
 
			NetworkDisconnect();
 
			ShowNetworkGameWindow();
 
@@ -1709,10 +1708,8 @@ void ShowNetworkChatQueryWindow(DestType
 
	w = AllocateWindowDesc(&_chat_window_desc);
 

	
 
	LowerWindowWidget(w, 2);
 
	WP(w,querystr_d).caption = GB(type, 0, 8) | (dest << 8); // Misuse of caption
 
	WP(w,querystr_d).wnd_class = WC_MAIN_TOOLBAR;
 
	WP(w,querystr_d).wnd_num = 0;
 
	WP(w,querystr_d).afilter = CS_ALPHANUMERAL;
 
	WP(w, querystr_d).caption = GB(type, 0, 8) | (dest << 8); // Misuse of caption
 
	WP(w, querystr_d).afilter = CS_ALPHANUMERAL;
 
	InitializeTextBuffer(&WP(w, querystr_d).text, _edit_str_buf, lengthof(_edit_str_buf), 0);
 
}
 

	
newgrf_gui.c
Show inline comments
 
@@ -436,7 +436,7 @@ static void NewGRFWndProc(Window *w, Win
 
					if (WP(w, newgrf_d).sel == NULL) break;
 

	
 
					GRFBuildParamList(buff, WP(w, newgrf_d).sel, lastof(buff));
 
					ShowQueryString(BindCString(buff), STR_NEWGRF_PARAMETER_QUERY, 63, 250, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
					ShowQueryString(BindCString(buff), STR_NEWGRF_PARAMETER_QUERY, 63, 250, w, CS_ALPHANUMERAL);
 
					break;
 
				}
 
			}
player_gui.c
Show inline comments
 
@@ -765,7 +765,7 @@ static void PlayerCompanyWndProc(Window 
 
					const Player *p = GetPlayer(w->window_number);
 
					WP(w, def_d).byte_1 = 0;
 
					SetDParam(0, p->president_name_2);
 
					ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
					ShowQueryString(p->president_name_1, STR_700B_PRESIDENT_S_NAME, 31, 94, w, CS_ALPHANUMERAL);
 
					break;
 
				}
 

	
 
@@ -773,7 +773,7 @@ static void PlayerCompanyWndProc(Window 
 
					Player *p = GetPlayer(w->window_number);
 
					WP(w,def_d).byte_1 = 1;
 
					SetDParam(0, p->name_2);
 
					ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
					ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL);
 
					break;
 
				}
 

	
 
@@ -812,7 +812,7 @@ static void PlayerCompanyWndProc(Window 
 
					if (w->window_number == _local_player) {
 
						WP(w,def_d).byte_1 = 2;
 
						ShowQueryString(BindCString(_network_player_info[_local_player].password),
 
							STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
							STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w, CS_ALPHANUMERAL);
 
					}
 
					break;
 
				#endif /* ENABLE_NETWORK */
roadveh_gui.c
Show inline comments
 
@@ -162,7 +162,7 @@ static void RoadVehDetailsWndProc(Window
 
		case 2: /* rename */
 
			v = GetVehicle(w->window_number);
 
			SetDParam(0, v->unitnumber);
 
			ShowQueryString(v->string_id, STR_902C_NAME_ROAD_VEHICLE, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
			ShowQueryString(v->string_id, STR_902C_NAME_ROAD_VEHICLE, 31, 150, w, CS_ALPHANUMERAL);
 
			break;
 

	
 
		case 5: /* increase int */
 
@@ -479,8 +479,7 @@ static void NewRoadVehWndProc(Window *w,
 
			EngineID sel_eng = WP(w,buildvehicle_d).sel_engine;
 
			if (sel_eng != INVALID_ENGINE) {
 
				WP(w,buildvehicle_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng),
 
					STR_9036_RENAME_ROAD_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
				ShowQueryString(GetCustomEngineName(sel_eng), STR_9036_RENAME_ROAD_VEHICLE_TYPE, 31, 160, w, CS_ALPHANUMERAL);
 
			}
 
		}	break;
 
		}
settings_gui.c
Show inline comments
 
@@ -845,7 +845,7 @@ static void PatchesSelectionWndProc(Wind
 

	
 
					WP(w,def_d).data_3 = btn;
 
					SetDParam(0, value);
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, WC_GAME_OPTIONS, 0, CS_NUMERAL);
 
					ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, w, CS_NUMERAL);
 
				}
 
			}
 

	
 
@@ -1061,14 +1061,8 @@ static void CustCurrencyWndProc(Window *
 
			}
 

	
 
			if (len != 0) {
 
				WP(w,def_d).data_2 = line;
 
				ShowQueryString(
 
				str,
 
				STR_CURRENCY_CHANGE_PARAMETER,
 
				len + 1, // maximum number of characters OR
 
				250, // characters up to this width pixels, whichever is satisfied first
 
				w->window_class,
 
				w->window_number, afilter);
 
				WP(w, def_d).data_2 = line;
 
				ShowQueryString(str, STR_CURRENCY_CHANGE_PARAMETER, len + 1, 250, w, afilter);
 
			}
 

	
 
			w->flags4 |= 5 << WF_TIMEOUT_SHL;
ship_gui.c
Show inline comments
 
@@ -161,7 +161,7 @@ static void ShipDetailsWndProc(Window *w
 
		case 2: /* rename */
 
			v = GetVehicle(w->window_number);
 
			SetDParam(0, v->unitnumber);
 
			ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
			ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w, CS_ALPHANUMERAL);
 
			break;
 
		case 5: /* increase int */
 
			mod = _ctrl_pressed? 5 : 10;
 
@@ -302,9 +302,8 @@ static void NewShipWndProc(Window *w, Wi
 
		case 6: { /* rename */
 
			EngineID sel_eng = WP(w,buildvehicle_d).sel_engine;
 
			if (sel_eng != INVALID_ENGINE) {
 
				WP(w,buildvehicle_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng),
 
					STR_9838_RENAME_SHIP_TYPE, 31, 160, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
				WP(w, buildvehicle_d).rename_engine = sel_eng;
 
				ShowQueryString(GetCustomEngineName(sel_eng), STR_9838_RENAME_SHIP_TYPE, 31, 160, w, CS_ALPHANUMERAL);
 
			}
 
		}	break;
 
		}
station_gui.c
Show inline comments
 
@@ -749,7 +749,7 @@ static void StationViewWndProc(Window *w
 

	
 
		case 9: {
 
			SetDParam(0, w->window_number);
 
			ShowQueryString(STR_STATION, STR_3030_RENAME_STATION_LOADING, 31, 180, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
			ShowQueryString(STR_STATION, STR_3030_RENAME_STATION_LOADING, 31, 180, w, CS_ALPHANUMERAL);
 
		} break;
 

	
 
		case 10: { /* Show a list of scheduled trains to this station */
town_gui.c
Show inline comments
 
@@ -266,7 +266,7 @@ static void TownViewWndProc(Window *w, W
 

	
 
			case 8: /* rename */
 
				SetDParam(0, w->window_number);
 
				ShowQueryString(STR_TOWN, STR_2007_RENAME_TOWN, 31, 130, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
				ShowQueryString(STR_TOWN, STR_2007_RENAME_TOWN, 31, 130, w, CS_ALPHANUMERAL);
 
				break;
 

	
 
			case 9: /* expand town */
train_gui.c
Show inline comments
 
@@ -515,7 +515,7 @@ static void NewRailVehicleWndProc(Window
 
					EngineID sel_eng = bv->sel_engine;
 
					if (sel_eng != INVALID_ENGINE) {
 
						bv->rename_engine = sel_eng;
 
						ShowQueryString(GetCustomEngineName(sel_eng), STR_886A_RENAME_TRAIN_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
						ShowQueryString(GetCustomEngineName(sel_eng), STR_886A_RENAME_TRAIN_VEHICLE_TYPE, 31, 160, w, CS_ALPHANUMERAL);
 
					}
 
					break;
 
				}
 
@@ -1037,7 +1037,7 @@ static void TrainDetailsWndProc(Window *
 
		case 2: /* name train */
 
			v = GetVehicle(w->window_number);
 
			SetDParam(0, v->unitnumber);
 
			ShowQueryString(v->string_id, STR_8865_NAME_TRAIN, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL);
 
			ShowQueryString(v->string_id, STR_8865_NAME_TRAIN, 31, 150, w, CS_ALPHANUMERAL);
 
			break;
 
		case 6: /* inc serv interval */
 
			mod = _ctrl_pressed? 5 : 10;
window.h
Show inline comments
 
@@ -342,11 +342,10 @@ struct Window {
 

	
 
typedef struct querystr_d {
 
	StringID caption;
 
	WindowClass wnd_class;
 
	WindowNumber wnd_num;
 
	Textbuf text;
 
	const char *orig;
 
	CharSetFilter afilter;
 
	bool handled;
 
} querystr_d;
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
 

	
0 comments (0 inline, 0 general)