(svn r24727) -Fix: In various windows the OSK looked shiny but using it had no effect whatsoever.

pull/155/head
frosch 12 years ago
parent e0f59fb049
commit 6616b70654

@ -1342,9 +1342,7 @@ struct AIDebugWindow : public QueryStringBaseWindow {
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 QueryStringBaseWindow {
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.

@ -697,15 +697,21 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state = ES_NOT_HANDLED;
this->HandleEditBoxKey(WID_GL_RANDOM_EDITBOX, key, keycode, state);
/* 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);
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);
}
}
virtual void OnDropdownSelect(int widget, int index)
{
switch (widget) {

@ -851,18 +851,25 @@ public:
break;
default:
/* 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));
}
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));
}
}
}
virtual void OnQueryTextFinished(char *str)
{
if (!StrEmpty(str)) NetworkAddServer(str);
@ -1183,13 +1190,20 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow {
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};

Loading…
Cancel
Save