Changeset - r19717:5e647f4e3df1
[Not reviewed]
master
0 3 0
frosch - 12 years ago 2012-11-08 11:20:32
frosch@openttd.org
(svn r24672) -Add [FS#5356]: Remember the basic/advanced/expert filter selection.
3 files changed with 21 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/settings_gui.cpp
Show inline comments
 
@@ -1974,13 +1974,13 @@ struct GameSettingsWindow : QueryStringB
 
	bool manually_changed_folding;     ///< Whether the user expanded/collapsed something manually.
 

	
 
	RestrictionMode cur_restriction_mode; ///< Currently selected index of the drop down list for the restrict drop down.
 

	
 
	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;
 

	
 
		settings_ptr = &GetGameSettings();
 

	
 
		/* Build up the dynamic settings-array only once per OpenTTD session */
 
@@ -2334,19 +2334,24 @@ struct GameSettingsWindow : QueryStringB
 
	}
 

	
 
	virtual void OnDropdownSelect(int widget, int index)
 
	{
 
		if (widget == WID_GS_RESTRICT_DROPDOWN) {
 
			this->cur_restriction_mode = (RestrictionMode)index;
 
			if (!this->manually_changed_folding &&
 
					(this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT ||
 
			if (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->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. */
 
					_settings_main_page.UpdateFilterState(string_filter, false, this->cur_restriction_mode);
 
					_settings_main_page.UnFoldAll();
 
				}
 
			} else {
 
				/* Non-'changes' filter. Save as default. */
 
				_settings_client.gui.settings_restriction_mode = this->cur_restriction_mode;
 
			}
 
			this->InvalidateData();
 
			return;
 
		}
 

	
 
		/* Deal with drop down boxes on the panel. */
src/settings_type.h
Show inline comments
 
@@ -128,12 +128,13 @@ struct GUISettings {
 

	
 
	uint8  developer;                        ///< print non-fatal warnings in console (>= 1), copy debug output to console (== 2)
 
	bool   show_date_in_logs;                ///< whether to show dates in console logs
 
	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   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
 
	uint8  newgrf_default_palette;           ///< default palette to use for NewGRFs without action 14 palette information
 

	
 
	/**
 
	 * Returns true when the user has sufficient privileges to edit newgrfs on a running game
 
	 * @return whether the user has sufficient privileges to edit newgrfs in an existing game
src/table/settings.ini
Show inline comments
 
@@ -2812,12 +2812,20 @@ def      = true
 
ifndef   = DEDICATED
 
var      = gui.show_date_in_logs
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
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]
 
var      = gui.developer
 
type     = SLE_UINT8
 
flags    = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
 
def      = 1
 
min      = 0
 
max      = 2
0 comments (0 inline, 0 general)