Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror committed Jul 26, 2016
1 parent 9fc8756 commit 1242e74
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions addons/settings/gui_createMenu_color.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ for "_index" from 0 to (((count _defaultValue max 3) min 4) - 1) do {
(_control getVariable QGVAR(data)) params ["_setting", "_source", "_currentValue", "_color"];
private _index = _control getVariable QGVAR(index);

(_control getVariable QGVAR(linkedControls)) params ["_ctrlSettingPreview", "_linkedControls"];
(_control getVariable QGVAR(linkedControls)) params ["_ctrlSettingPreview", "_linkedControls", "_defaultControl"];
private _linkedControl = _linkedControls select _index select 1;
_linkedControl ctrlSetText ([_value, 1, 2] call CBA_fnc_formatNumber);

Expand All @@ -62,7 +62,6 @@ for "_index" from 0 to (((count _defaultValue max 3) min 4) - 1) do {
SET_TEMP_NAMESPACE_VALUE(_setting,_currentValue,_source);

//If new setting is same as default value, grey out the default button
(_control getVariable QGVAR(linkedControls)) params ["", "", "_defaultControl"];
(_defaultControl getVariable QGVAR(data)) params ["", "", "_defaultValue"];
_defaultControl ctrlEnable (!(_currentValue isEqualTo _defaultValue));
}];
Expand Down Expand Up @@ -94,7 +93,7 @@ for "_index" from 0 to (((count _defaultValue max 3) min 4) - 1) do {
(_control getVariable QGVAR(data)) params ["_setting", "_source", "_currentValue", "_color"];
private _index = _control getVariable QGVAR(index);

(_control getVariable QGVAR(linkedControls)) params ["_ctrlSettingPreview", "_linkedControls"];
(_control getVariable QGVAR(linkedControls)) params ["_ctrlSettingPreview", "_linkedControls", "_defaultControl"];

private _linkedControl = _linkedControls select _index select 0;
_linkedControl sliderSetPosition _value;
Expand All @@ -105,7 +104,6 @@ for "_index" from 0 to (((count _defaultValue max 3) min 4) - 1) do {
SET_TEMP_NAMESPACE_VALUE(_setting,_currentValue,_source);

//If new setting is same as default value, grey out the default button
(_control getVariable QGVAR(linkedControls)) params ["", "", "_defaultControl"];
(_defaultControl getVariable QGVAR(data)) params ["", "", "_defaultValue"];
_defaultControl ctrlEnable (!(_currentValue isEqualTo _defaultValue));
}];
Expand Down
1 change: 1 addition & 0 deletions addons/settings/gui_createMenu_default.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ _ctrlSettingDefault ctrlAddEventHandler ["ButtonClick", {
(_control getVariable QGVAR(data)) params ["_setting", "_source", "_defaultValue", "_settingType", "_settingData"];
SET_TEMP_NAMESPACE_VALUE(_setting,_defaultValue,_source);

// Can disable button as the setting will now be the default
_control ctrlEnable false;

private _linkedControls = _control getVariable QGVAR(linkedControls);
Expand Down
6 changes: 2 additions & 4 deletions addons/settings/gui_createMenu_slider.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ _ctrlSetting ctrlAddEventHandler ["SliderPosChanged", {

(_control getVariable QGVAR(data)) params ["_setting", "_source", "_trailingDecimals"];

private _linkedControl = _control getVariable QGVAR(linkedControls) select 1;
(_control getVariable QGVAR(linkedControls)) params ["", "_linkedControl", "_defaultControl"];
_linkedControl ctrlSetText ([_value, 1, _trailingDecimals] call CBA_fnc_formatNumber);

SET_TEMP_NAMESPACE_VALUE(_setting,_value,_source);

//If new setting is same as default value, grey out the default button
(_control getVariable QGVAR(linkedControls)) params ["", "", "_defaultControl"];
(_defaultControl getVariable QGVAR(data)) params ["", "", "_defaultValue"];
_defaultControl ctrlEnable (!(_value isEqualTo _defaultValue));
}];
Expand All @@ -59,14 +58,13 @@ _ctrlSettingEdit ctrlAddEventHandler ["KeyUp", {

private _value = parseNumber ctrlText _control;

private _linkedControl = _control getVariable QGVAR(linkedControls) select 0;
(_control getVariable QGVAR(linkedControls)) params ["_linkedControl", "", "_defaultControl"];
_linkedControl sliderSetPosition _value;

_value = sliderPosition _linkedControl;
SET_TEMP_NAMESPACE_VALUE(_setting,_value,_source);

//If new setting is same as default value, grey out the default button
(_control getVariable QGVAR(linkedControls)) params ["", "", "_defaultControl"];
(_defaultControl getVariable QGVAR(data)) params ["", "", "_defaultValue"];
_defaultControl ctrlEnable (!(_value isEqualTo _defaultValue));
}];
Expand Down

0 comments on commit 1242e74

Please sign in to comment.