Changeset - r13233:9fcdcfbe5992
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-10-10 12:47:04
rubidium@openttd.org
(svn r17752) -Fix [FS#3231]: OSK could reset town name to an already used town name for the 'Generate Town' window
3 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/osk_gui.cpp
Show inline comments
 
@@ -547,3 +547,21 @@ void ShowOnScreenKeyboard(QueryStringBas
 
	GetKeyboardLayout();
 
	new OskWindow(&_osk_desc, parent, button, cancel, ok);
 
}
 

	
 
/**
 
 * Updates the original text of the OSK so when the 'parent' changes the
 
 * original and you press on cancel you won't get the 'old' original text
 
 * but the updated one.
 
 * @param parent window that just updated it's orignal text
 
 * @param button widget number of parent's textbox to update
 
 */
 
void UpdateOSKOriginalText(const QueryStringBaseWindow *parent, int button)
 
{
 
	OskWindow *osk = dynamic_cast<OskWindow *>(FindWindowById(WC_OSK, 0));
 
	if (osk == NULL || osk->qs != parent || osk->text_btn != button) return;
 

	
 
	free(osk->orig_str_buf);
 
	osk->orig_str_buf = strdup(osk->qs->text.buf);
 

	
 
	osk->SetDirty();
 
}
src/querystring_gui.h
Show inline comments
 
@@ -86,5 +86,6 @@ struct QueryStringBaseWindow : public Wi
 
};
 

	
 
void ShowOnScreenKeyboard(QueryStringBaseWindow *parent, int button, int cancel, int ok);
 
void UpdateOSKOriginalText(const QueryStringBaseWindow *parent, int button);
 

	
 
#endif /* QUERYSTRING_GUI_H */
src/town_gui.cpp
Show inline comments
 
@@ -978,6 +978,7 @@ public:
 
			GetTownName(this->edit_str_buf, &this->params, this->townnameparts, &this->edit_str_buf[this->edit_str_size - 1]);
 
		}
 
		UpdateTextBufferSize(&this->text);
 
		UpdateOSKOriginalText(this, TSEW_TOWNNAME_EDITBOX);
 

	
 
		this->SetFocusedWidget(TSEW_TOWNNAME_EDITBOX);
 
		this->SetWidgetDirty(TSEW_TOWNNAME_EDITBOX);
0 comments (0 inline, 0 general)