Changeset - r19774:47e5514dfea2
[Not reviewed]
master
0 9 0
frosch - 12 years ago 2012-11-13 21:46:46
frosch@openttd.org
(svn r24729) -Codechange: Unify the handling of HEBR_EDITING.
9 files changed with 20 insertions and 49 deletions:
0 comments (0 inline, 0 general)
src/ai/ai_gui.cpp
Show inline comments
 
@@ -1341,10 +1341,6 @@ struct AIDebugWindow : public QueryStrin
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		switch (this->HandleEditBoxKey(WID_AID_BREAK_STR_EDIT_BOX, key, keycode, state)) {
 
			case HEBR_EDITING:
 
				this->OnOSKInput(WID_AID_BREAK_STR_EDIT_BOX);
 
				break;
 

	
 
			case HEBR_CANCEL:
 
				/* Unfocus the text box. */
 
				this->UnfocusFocusedWidget();
src/genworld_gui.cpp
Show inline comments
 
@@ -697,7 +697,7 @@ struct GenerateLandscapeWindow : public 
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		if (this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state) == HEBR_EDITING) this->OnOSKInput(WID_GL_RANDOM_EDITBOX);
 
		this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state);
 
		return state;
 
	}
 

	
src/misc_gui.cpp
Show inline comments
 
@@ -757,6 +757,9 @@ HandleEditBoxResult QueryString::HandleE
 
			}
 
	}
 

	
 
	Window *osk = FindWindowById(WC_OSK, 0);
 
	if (osk != NULL && osk->parent == w) osk->InvalidateData();
 

	
 
	return HEBR_EDITING;
 
}
 

	
 
@@ -810,7 +813,15 @@ void QueryString::DrawEditBox(const Wind
 

	
 
HandleEditBoxResult QueryStringBaseWindow::HandleEditBoxKey(int wid, uint16 key, uint16 keycode, EventState &state)
 
{
 
	return this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state);
 
	HandleEditBoxResult result = this->QueryString::HandleEditBoxKey(this, wid, key, keycode, state);
 
	switch (result) {
 
		case HEBR_EDITING:
 
			this->OnOSKInput(wid);
 
			break;
 

	
 
		default: break;
 
	}
 
	return result;
 
}
 

	
 
void QueryStringBaseWindow::OnOpenOSKWindow(int wid)
 
@@ -898,16 +909,10 @@ struct QueryStringWindow : public QueryS
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		switch (this->HandleEditBoxKey(WID_QS_TEXT, key, keycode, state)) {
 
			default: NOT_REACHED();
 
			case HEBR_EDITING: {
 
				Window *osk = FindWindowById(WC_OSK, 0);
 
				if (osk != NULL && osk->parent == this) osk->InvalidateData();
 
				break;
 
			}
 
			default: break;
 
			case HEBR_CONFIRM: this->OnOk();
 
				/* FALL THROUGH */
 
			case HEBR_CANCEL: delete this; break; // close window, abandon changes
 
			case HEBR_NOT_FOCUSED: break;
 
		}
 
		return state;
 
	}
src/network/network_chat_gui.cpp
Show inline comments
 
@@ -511,17 +511,11 @@ struct NetworkChatWindow : public QueryS
 
		} else {
 
			_chat_tab_completion_active = false;
 
			switch (this->HandleEditBoxKey(WID_NC_TEXTBOX, key, keycode, state)) {
 
				default: NOT_REACHED();
 
				case HEBR_EDITING: {
 
					Window *osk = FindWindowById(WC_OSK, 0);
 
					if (osk != NULL && osk->parent == this) osk->InvalidateData();
 
					break;
 
				}
 
				default: break;
 
				case HEBR_CONFIRM:
 
					SendChat(this->text.buf, this->dtype, this->dest);
 
					/* FALL THROUGH */
 
				case HEBR_CANCEL: delete this; break;
 
				case HEBR_NOT_FOCUSED: break;
 
			}
 
		}
 
		return state;
src/network/network_content_gui.cpp
Show inline comments
 
@@ -766,10 +766,7 @@ public:
 
			default: {
 
				/* Handle editbox input */
 
				EventState state = ES_NOT_HANDLED;
 
				if (this->HandleEditBoxKey(WID_NCL_FILTER, key, keycode, state) == HEBR_EDITING) {
 
					this->OnOSKInput(WID_NCL_FILTER);
 
				}
 

	
 
				this->HandleEditBoxKey(WID_NCL_FILTER, key, keycode, state);
 
				return state;
 
			}
 
		}
src/network/network_gui.cpp
Show inline comments
 
@@ -847,11 +847,7 @@ public:
 
				}
 
				break;
 

	
 
			case HEBR_CONFIRM:
 
				break;
 

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

	
 
@@ -1184,16 +1180,7 @@ struct NetworkStartServerWindow : public
 
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		switch (this->HandleEditBoxKey(WID_NSS_GAMENAME, key, keycode, state)) {
 
			case HEBR_CONFIRM:
 
			case HEBR_NOT_FOCUSED:
 
				break;
 

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

	
 
		this->HandleEditBoxKey(WID_NSS_GAMENAME, key, keycode, state);
 
		return state;
 
	}
 

	
src/newgrf_gui.cpp
Show inline comments
 
@@ -1265,9 +1265,7 @@ struct NewGRFWindow : public QueryString
 
			default: {
 
				/* Handle editbox input */
 
				EventState state = ES_NOT_HANDLED;
 
				if (this->HandleEditBoxKey(WID_NS_FILTER, key, keycode, state) == HEBR_EDITING) {
 
					this->OnOSKInput(WID_NS_FILTER);
 
				}
 
				this->HandleEditBoxKey(WID_NS_FILTER, key, keycode, state);
 
				return state;
 
			}
 
		}
src/settings_gui.cpp
Show inline comments
 
@@ -2410,9 +2410,7 @@ struct GameSettingsWindow : QueryStringB
 
	{
 
		/* Handle editbox input */
 
		EventState state = ES_NOT_HANDLED;
 
		if (this->HandleEditBoxKey(WID_GS_FILTER, key, keycode, state) == HEBR_EDITING) {
 
			this->OnOSKInput(WID_GS_FILTER);
 
		}
 
		this->HandleEditBoxKey(WID_GS_FILTER, key, keycode, state);
 
		return state;
 
	}
 

	
src/signs_gui.cpp
Show inline comments
 
@@ -297,10 +297,6 @@ struct SignListWindow : QueryStringBaseW
 
	{
 
		EventState state = ES_NOT_HANDLED;
 
		switch (this->HandleEditBoxKey(WID_SIL_FILTER_TEXT, key, keycode, state)) {
 
			case HEBR_EDITING:
 
				this->OnOSKInput(WID_SIL_FILTER_TEXT);
 
				break;
 

	
 
			case HEBR_CONFIRM: // Enter pressed -> goto first sign in list
 
				if (this->signs.Length() >= 1) {
 
					const Sign *si = this->signs[0];
 
@@ -322,7 +318,7 @@ struct SignListWindow : QueryStringBaseW
 
				break;
 

	
 
			default:
 
				NOT_REACHED();
 
				break;
 
		}
 

	
 
		return state;
0 comments (0 inline, 0 general)