ACE_Settings: fix option to reset user setable settings to default

This commit is contained in:
Nicolás Badano 2015-02-03 01:03:26 -03:00
parent 99cf0a75ee
commit 857b45453a
6 changed files with 17 additions and 14 deletions

View File

@ -14,6 +14,7 @@
* 4: _localizedDescription
* 5: _possibleValues
* 6: _isForced
* 7: _defaultValue
*
* Public: No
*/

View File

@ -61,7 +61,8 @@ if (isNil _name) then {
_localizedName,
_localizedDescription,
_possibleValues,
_isForced
_isForced,
_defaultValue
];*/
_settingData = [
_name,
@ -70,7 +71,8 @@ if (isNil _name) then {
getText (_optionEntry >> "displayName"),
getText (_optionEntry >> "description"),
getArray (_optionEntry >> "values"),
getNumber (_optionEntry >> "force") > 0
getNumber (_optionEntry >> "force") > 0,
_value
];
GVAR(settings) pushBack _settingData;

View File

@ -13,13 +13,13 @@ private ["_name", "_default", "_lastSelected"];
{
_name = _x select 0;
_default = _x select 5;
_default = _x select 7;
[MENU_TAB_OPTIONS, _name, _default] call FUNC(updateSetting);
} forEach GVAR(clientSideOptions);
{
_name = _x select 0;
_default = _x select 4;
_default = _x select 7;
[MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting);
} forEach GVAR(clientSideColors);

View File

@ -44,7 +44,7 @@ if (count _collection > 0) then {
switch (GVAR(optionMenu_openTab)) do {
case (MENU_TAB_OPTIONS): {
_possibleValues = _setting select 5;
_settingsValue = _setting select 7;
_settingsValue = _setting select 8;
// Created disable/enable options for bools
if ((_setting select 1) == "BOOL") then {
@ -59,7 +59,7 @@ if (count _collection > 0) then {
(_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue;
};
case (MENU_TAB_COLORS): {
_currentColor = _setting select 7;
_currentColor = _setting select 8;
{
sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))];
} forEach [410, 411, 412, 413];

View File

@ -23,7 +23,7 @@ case (MENU_TAB_OPTIONS): {
{
_ctrlList lbadd (_x select 3);
_settingsValue = _x select 7;
_settingsValue = _x select 8;
// Created disable/enable options for bools
_settingsText = if ((_x select 1) == "BOOL") then {
@ -37,14 +37,14 @@ case (MENU_TAB_OPTIONS): {
};
case (MENU_TAB_COLORS): {
{
_color = +(_x select 7);
_color = +(_x select 8);
{
_color set [_forEachIndex, ((round (_x * 100))/100)];
} forEach _color;
_settingsColor = str _color;
_ctrlList lbadd (_x select 3);
_ctrlList lbadd (_settingsColor);
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 7)];
_ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)];
}foreach GVAR(clientSideColors);
};
};

View File

@ -23,9 +23,9 @@ case (MENU_TAB_OPTIONS): {
_newValue = [false, true] select _newValue;
};
if !((_x select 7) isEqualTo _newValue) then {
if !((_x select 8) isEqualTo _newValue) then {
_changed = true;
_x set [7, _newValue];
_x set [8, _newValue];
} ;
};
@ -33,16 +33,16 @@ case (MENU_TAB_OPTIONS): {
};
case (MENU_TAB_COLORS): {
{
if (((_x select 0) == _name) && {!((_x select 7) isEqualTo _newValue)}) then {
if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then {
_changed = true;
_x set [7, _newValue];
_x set [8, _newValue];
};
} foreach GVAR(clientSideColors);
};
};
if (_changed) then {
profileNamespace setvariable [_name, _newValue];
profileNamespace setVariable [_name, _newValue];
missionNameSpace setVariable [_name, _newValue];
["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent);
TRACE_2("Variable Updated",_name,_newValue);