Changeset - r19772:e6f38e18a8e8
[Not reviewed]
master
0 3 0
frosch - 12 years ago 2012-11-13 21:46:37
frosch@openttd.org
(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.
3 files changed with 36 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -1342,9 +1342,7 @@ struct AIDebugWindow : public QueryStrin
 
		EventState state = ES_NOT_HANDLED;
 
		switch (this->HandleEditBoxKey(WID_AID_BREAK_STR_EDIT_BOX, key, keycode, state)) {
 
			case HEBR_EDITING:
 
				/* Save the current string to static member so it can be restored next time the window is opened. */
 
				strecpy(this->break_string, this->edit_str_buf, lastof(this->break_string));
 
				break_string_filter.SetFilterTerm(this->break_string);
 
				this->OnOSKInput(WID_AID_BREAK_STR_EDIT_BOX);
 
				break;
 

	
 
			case HEBR_CANCEL:
 
@@ -1373,6 +1371,15 @@ struct AIDebugWindow : public QueryStrin
 
		return state;
 
	}
 

	
 
	virtual void OnOSKInput(int wid)
 
	{
 
		if (wid == WID_AID_BREAK_STR_EDIT_BOX) {
 
			/* Save the current string to static member so it can be restored next time the window is opened. */
 
			strecpy(this->break_string, this->edit_str_buf, lastof(this->break_string));
 
			break_string_filter.SetFilterTerm(this->break_string);
 
		}
 
	}
 

	
 
	/**
 
	 * Some data on this window has become invalid.
 
	 * @param data Information about the changed data.
src/genworld_gui.cpp
Show inline comments
 
@@ -697,13 +697,19 @@ struct GenerateLandscapeWindow : public 
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state);
 
		if (this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state) == HEBR_EDITING) this->OnOSKInput(WID_GL_RANDOM_EDITBOX);
 
		return state;
 
	}
 

	
 
	virtual void OnOSKInput(int wid)
 
	{
 
		if (wid == WID_GL_RANDOM_EDITBOX) {
 
		/* the seed is unsigned, therefore atoi cannot be used.
 
		 * As UINT32_MAX is a 'magic' value (use random seed) it
 
		 * should not be possible to be entered into the input
 
		 * field; the generate seed button can be used instead. */
 
		_settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, 10), UINT32_MAX - 1);
 
		return state;
 
		}
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
src/network/network_gui.cpp
Show inline comments
 
@@ -851,16 +851,23 @@ public:
 
				break;
 

	
 
			default:
 
				this->OnOSKInput(WID_NG_CLIENT);
 
				break;
 
		}
 

	
 
		return state;
 
	}
 

	
 
	virtual void OnOSKInput(int wid)
 
	{
 
		if (wid == WID_NG_CLIENT) {
 
				/* The name is only allowed when it starts with a letter! */
 
				if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
 
					strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name));
 
				} else {
 
					strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
 
				}
 
				break;
 
		}
 

	
 
		return state;
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
@@ -1183,13 +1190,20 @@ struct NetworkStartServerWindow : public
 
				break;
 

	
 
			default:
 
				strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name));
 
				this->OnOSKInput(WID_NSS_GAMENAME);
 
				break;
 
		}
 

	
 
		return state;
 
	}
 

	
 
	virtual void OnOSKInput(int wid)
 
	{
 
		if (wid == WID_NSS_GAMENAME) {
 
			strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name));
 
		}
 
	}
 

	
 
	virtual void OnTimeout()
 
	{
 
		static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WID_NSS_SPECTATORS_BTND, WID_NSS_SPECTATORS_BTNU, WIDGET_LIST_END};
0 comments (0 inline, 0 general)