diff options
author | frosch <frosch@openttd.org> | 2012-10-27 15:26:34 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2012-10-27 15:26:34 +0000 |
commit | d33439721c6d7f5b7de62d7e32f50c18bccb7c3d (patch) | |
tree | 17c10a3f1d17fd23437255c03a84cb36960e86bb | |
parent | 2d550a7579841adc0d0fe6664bee0375363e6066 (diff) | |
download | openttd-d33439721c6d7f5b7de62d7e32f50c18bccb7c3d.tar.xz |
(svn r24633) -Add: Autoexpand the adv. settings tree, if a filter term is entered immediately after opening the window without any manual expanding/collapsing.
-rw-r--r-- | src/settings_gui.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 28c17c639..707b3d664 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1896,6 +1896,7 @@ struct GameSettingsWindow : QueryStringBaseWindow { 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 : QueryStringBaseWindow { 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 : QueryStringBaseWindow { { 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 : QueryStringBaseWindow { 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 : QueryStringBaseWindow { 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(); } |