Changeset - r19690:8d473afad5d8
[Not reviewed]
master
0 1 0
frosch - 12 years ago 2012-10-27 15:26:34
frosch@openttd.org
(svn r24633) -Add: Autoexpand the adv. settings tree, if a filter term is entered immediately after opening the window without any manual expanding/collapsing.
1 file changed with 11 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -1896,6 +1896,7 @@ struct GameSettingsWindow : QueryStringB
 
	bool closing_dropdown;             ///< True, if the dropdown list is currently closing.
 

	
 
	StringFilter string_filter;        ///< Text filter for settings.
 
	bool manually_changed_folding;     ///< Whether the user expanded/collapsed something manually.
 

	
 
	Scrollbar *vscroll;
 

	
 
@@ -1918,6 +1919,7 @@ struct GameSettingsWindow : QueryStringB
 
		this->last_clicked = NULL;
 
		this->valuedropdown_entry = NULL;
 
		this->closing_dropdown = false;
 
		this->manually_changed_folding = false;
 

	
 
		this->CreateNestedTree(desc);
 
		this->vscroll = this->GetScrollbar(WID_GS_SCROLLBAR);
 
@@ -2022,11 +2024,13 @@ struct GameSettingsWindow : QueryStringB
 
	{
 
		switch (widget) {
 
			case WID_GS_EXPAND_ALL:
 
				this->manually_changed_folding = true;
 
				_settings_main_page.UnFoldAll();
 
				this->InvalidateData();
 
				break;
 

	
 
			case WID_GS_COLLAPSE_ALL:
 
				this->manually_changed_folding = true;
 
				_settings_main_page.FoldAll();
 
				this->InvalidateData();
 
				break;
 
@@ -2049,6 +2053,8 @@ struct GameSettingsWindow : QueryStringB
 
			this->SetDisplayedHelpText(NULL);
 
			pe->d.sub.folded = !pe->d.sub.folded; // Flip 'folded'-ness of the sub-page
 

	
 
			this->manually_changed_folding = true;
 

	
 
			this->InvalidateData();
 
			return;
 
		}
 
@@ -2278,6 +2284,11 @@ struct GameSettingsWindow : QueryStringB
 
	virtual void OnOSKInput(int wid)
 
	{
 
		string_filter.SetFilterTerm(this->edit_str_buf);
 
		if (!string_filter.IsEmpty() && !this->manually_changed_folding) {
 
			/* User never expanded/collapsed single pages and entered a filter term.
 
			 * Expand everything, to save weird expand clicks, */
 
			_settings_main_page.UnFoldAll();
 
		}
 
		this->InvalidateData();
 
	}
 

	
0 comments (0 inline, 0 general)