(svn r24672) -Add [FS#5356]: Remember the basic/advanced/expert filter selection.

This commit is contained in:
frosch 2012-11-08 11:20:32 +00:00
parent 69a62452be
commit dc930b6689
3 changed files with 21 additions and 7 deletions

View File

@ -1977,7 +1977,7 @@ struct GameSettingsWindow : QueryStringBaseWindow {
Scrollbar *vscroll; Scrollbar *vscroll;
GameSettingsWindow(const WindowDesc *desc) : QueryStringBaseWindow(50), cur_restriction_mode(RM_BASIC) GameSettingsWindow(const WindowDesc *desc) : QueryStringBaseWindow(50), cur_restriction_mode((RestrictionMode)_settings_client.gui.settings_restriction_mode)
{ {
static bool first_time = true; static bool first_time = true;
@ -2337,14 +2337,19 @@ struct GameSettingsWindow : QueryStringBaseWindow {
{ {
if (widget == WID_GS_RESTRICT_DROPDOWN) { if (widget == WID_GS_RESTRICT_DROPDOWN) {
this->cur_restriction_mode = (RestrictionMode)index; this->cur_restriction_mode = (RestrictionMode)index;
if (!this->manually_changed_folding && if (this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT ||
(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_DEFAULT_WO_LOCAL ||
this->cur_restriction_mode == RM_CHANGED_AGAINST_NEW)) { this->cur_restriction_mode == RM_CHANGED_AGAINST_NEW) {
if (!this->manually_changed_folding) {
/* Expand all when selecting 'changes'. Update the filter state first, in case it becomes less restrictive in some cases. */ /* 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.UpdateFilterState(string_filter, false, this->cur_restriction_mode);
_settings_main_page.UnFoldAll(); _settings_main_page.UnFoldAll();
} }
} else {
/* Non-'changes' filter. Save as default. */
_settings_client.gui.settings_restriction_mode = this->cur_restriction_mode;
}
this->InvalidateData(); this->InvalidateData();
return; return;
} }

View File

@ -131,6 +131,7 @@ struct GUISettings {
bool newgrf_developer_tools; ///< activate NewGRF developer tools and allow modifying NewGRFs in an existing game bool newgrf_developer_tools; ///< activate NewGRF developer tools and allow modifying NewGRFs in an existing game
bool ai_developer_tools; ///< activate AI developer tools bool ai_developer_tools; ///< activate AI developer tools
bool scenario_developer; ///< activate scenario developer: allow modifying NewGRFs in an existing game bool scenario_developer; ///< activate scenario developer: allow modifying NewGRFs in an existing game
uint8 settings_restriction_mode; ///< selected restriction mode in adv. settings GUI. @see RestrictionMode
bool newgrf_show_old_versions; ///< whether to show old versions in the NewGRF list bool newgrf_show_old_versions; ///< whether to show old versions in the NewGRF list
uint8 newgrf_default_palette; ///< default palette to use for NewGRFs without action 14 palette information uint8 newgrf_default_palette; ///< default palette to use for NewGRFs without action 14 palette information

View File

@ -2814,6 +2814,14 @@ var = gui.show_date_in_logs
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false def = false
[SDTC_VAR]
var = gui.settings_restriction_mode
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = 0
min = 0
max = 2
[SDTC_VAR] [SDTC_VAR]
var = gui.developer var = gui.developer
type = SLE_UINT8 type = SLE_UINT8