changeset 19736:cf0b8551dc17 draft

(svn r24669) -Fix: Auto-expand advanced settings only when selecting a 'deviation' filter.
author frosch <frosch@openttd.org>
date Thu, 08 Nov 2012 09:58:37 +0000
parents 07400c1821a2
children 36a9e6ac4809
files src/settings_gui.cpp
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -2331,8 +2331,15 @@
 	{
 		if (widget == WID_GS_RESTRICT_DROPDOWN) {
 			this->cur_restriction_mode = (RestrictionMode)index;
-			_settings_main_page.UpdateFilterState(string_filter, false, this->cur_restriction_mode);
-			this->SetDirty();
+			if (!this->manually_changed_folding &&
+					(this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT ||
+					this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT_WO_LOCAL ||
+					this->cur_restriction_mode == RM_CHANGED_AGAINST_NEW)) {
+				/* Expand all when selecting 'changes'. Update the filter state first, in case it becomes less restrictive in some cases. */
+				_settings_main_page.UpdateFilterState(string_filter, false, this->cur_restriction_mode);
+				_settings_main_page.UnFoldAll();
+			}
+			this->InvalidateData();
 			return;
 		}
 
@@ -2358,10 +2365,6 @@
 			 * "normal" dropdown box. The special dropdown boxes added for every
 			 * setting that needs one can't have this call. */
 			Window::OnDropdownClose(pt, widget, index, instant_close);
-
-			if (!this->manually_changed_folding) _settings_main_page.UnFoldAll();
-
-			this->InvalidateData();
 			return;
 		}