1
0
Fork 0

(svn r24633) -Add: Autoexpand the adv. settings tree, if a filter term is entered immediately after opening the window without any manual expanding/collapsing.

release/1.3
frosch 2012-10-27 15:26:34 +00:00
parent 2d550a7579
commit d33439721c
1 changed files with 11 additions and 0 deletions

View File

@ -1896,6 +1896,7 @@ struct GameSettingsWindow : QueryStringBaseWindow {
bool closing_dropdown; ///< True, if the dropdown list is currently closing. bool closing_dropdown; ///< True, if the dropdown list is currently closing.
StringFilter string_filter; ///< Text filter for settings. StringFilter string_filter; ///< Text filter for settings.
bool manually_changed_folding; ///< Whether the user expanded/collapsed something manually.
Scrollbar *vscroll; Scrollbar *vscroll;
@ -1918,6 +1919,7 @@ struct GameSettingsWindow : QueryStringBaseWindow {
this->last_clicked = NULL; this->last_clicked = NULL;
this->valuedropdown_entry = NULL; this->valuedropdown_entry = NULL;
this->closing_dropdown = false; this->closing_dropdown = false;
this->manually_changed_folding = false;
this->CreateNestedTree(desc); this->CreateNestedTree(desc);
this->vscroll = this->GetScrollbar(WID_GS_SCROLLBAR); this->vscroll = this->GetScrollbar(WID_GS_SCROLLBAR);
@ -2022,11 +2024,13 @@ struct GameSettingsWindow : QueryStringBaseWindow {
{ {
switch (widget) { switch (widget) {
case WID_GS_EXPAND_ALL: case WID_GS_EXPAND_ALL:
this->manually_changed_folding = true;
_settings_main_page.UnFoldAll(); _settings_main_page.UnFoldAll();
this->InvalidateData(); this->InvalidateData();
break; break;
case WID_GS_COLLAPSE_ALL: case WID_GS_COLLAPSE_ALL:
this->manually_changed_folding = true;
_settings_main_page.FoldAll(); _settings_main_page.FoldAll();
this->InvalidateData(); this->InvalidateData();
break; break;
@ -2049,6 +2053,8 @@ struct GameSettingsWindow : QueryStringBaseWindow {
this->SetDisplayedHelpText(NULL); this->SetDisplayedHelpText(NULL);
pe->d.sub.folded = !pe->d.sub.folded; // Flip 'folded'-ness of the sub-page pe->d.sub.folded = !pe->d.sub.folded; // Flip 'folded'-ness of the sub-page
this->manually_changed_folding = true;
this->InvalidateData(); this->InvalidateData();
return; return;
} }
@ -2278,6 +2284,11 @@ struct GameSettingsWindow : QueryStringBaseWindow {
virtual void OnOSKInput(int wid) virtual void OnOSKInput(int wid)
{ {
string_filter.SetFilterTerm(this->edit_str_buf); 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(); this->InvalidateData();
} }