Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change color of name of temporarily changed settings #952

Merged
merged 3 commits into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions addons/settings/fnc_gui_refresh.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ private _controls = allControls _display select {ctrlIDC _x isEqualTo IDC_SETTIN
private _source = _x getVariable QGVAR(source);

private _value = GET_TEMP_NAMESPACE_VALUE(_setting,_source);
private _wasEdited = false;

if (isNil "_value") then {
_value = [_setting, _source] call FUNC(get);
} else {
_wasEdited = true;
};

[_x, _value] call (_x getVariable QFUNC(updateUI));
Expand All @@ -34,7 +37,15 @@ private _controls = allControls _display select {ctrlIDC _x isEqualTo IDC_SETTIN

if (isNil "_priority") then {
_priority = [_setting, _source] call FUNC(priority);
} else {
_wasEdited = true;
};

[_x, _priority] call (_x getVariable QFUNC(updateUI_priority));

// change color if setting was edited
if (_wasEdited) then {
private _ctrlSettingName = _x controlsGroupCtrl IDC_SETTING_NAME;
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
};
} forEach _controls;
3 changes: 3 additions & 0 deletions addons/settings/fnc_gui_settingDefault.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ _ctrlDefault ctrlAddEventHandler ["ButtonClick", {

private _controlsGroup = ctrlParentControlsGroup _ctrlDefault;
[_controlsGroup, _defaultValue] call (_controlsGroup getVariable QFUNC(updateUI));

private _ctrlSettingName = _controlsGroup controlsGroupCtrl IDC_SETTING_NAME;
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
}];

if (_currentValue isEqualTo _defaultValue) then {
Expand Down
9 changes: 9 additions & 0 deletions addons/settings/fnc_gui_settingOverwrite.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ _ctrlOverwriteClient setVariable [QFUNC(event), {
SET_TEMP_NAMESPACE_PRIORITY(_setting,_state,_source);

_controlsGroup call (_controlsGroup getVariable QFUNC(updateUI_locked));

private _ctrlSettingName = _controlsGroup controlsGroupCtrl IDC_SETTING_NAME;
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
}];

_controlsGroup setVariable [QFUNC(auto_check_overwrite), {
Expand All @@ -44,6 +47,9 @@ _controlsGroup setVariable [QFUNC(auto_check_overwrite), {
[_ctrlOverwriteClient, 1] call (_ctrlOverwriteClient getVariable QFUNC(event));
};
};

private _ctrlSettingName = _controlsGroup controlsGroupCtrl IDC_SETTING_NAME;
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
}];

_ctrlOverwriteMission ctrlAddEventHandler ["CheckedChanged", {
Expand All @@ -69,6 +75,9 @@ _ctrlOverwriteMission ctrlAddEventHandler ["CheckedChanged", {
};

_controlsGroup call (_controlsGroup getVariable QFUNC(updateUI_locked));

private _ctrlSettingName = _controlsGroup controlsGroupCtrl IDC_SETTING_NAME;
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
}];

// update overwrite checkboxes
Expand Down
11 changes: 11 additions & 0 deletions addons/settings/gui_createCategory.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,19 @@ private _lastSubCategory = "$START";
private _source = toLower _x;

private _currentValue = GET_TEMP_NAMESPACE_VALUE(_setting,_source);
private _wasEdited = false;

if (isNil "_currentValue") then {
_currentValue = [_setting, _source] call FUNC(get);
} else {
_wasEdited = true;
};

private _currentPriority = GET_TEMP_NAMESPACE_PRIORITY(_setting,_source);
if (isNil "_currentPriority") then {
_currentPriority = [_setting, _source] call FUNC(priority);
} else {
_wasEdited = true;
};

// ----- create or retrieve options "list" controls group
Expand Down Expand Up @@ -143,6 +149,11 @@ private _lastSubCategory = "$START";
_ctrlSettingName ctrlSetText format ["%1:", _displayName];
_ctrlSettingName ctrlSetTooltip _tooltip;

// change color if setting was edited
if (_wasEdited) then {
_ctrlSettingName ctrlSetTextColor COLOR_TEXT_ENABLED_WAS_EDITED;
};

// ----- execute setting script
private _script = getText (configFile >> ctrlClassName _ctrlSettingGroup >> QGVAR(script));
[_ctrlSettingGroup, _setting, _source, _currentValue, _settingData] call (uiNamespace getVariable _script);
Expand Down
1 change: 1 addition & 0 deletions addons/settings/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
#define TABLE_LINE_SPACING POS_H(0.4)

#define COLOR_TEXT_ENABLED [1, 1, 1, 1]
#define COLOR_TEXT_ENABLED_WAS_EDITED [0.95, 0.95, 0.1, 1]
#define COLOR_TEXT_DISABLED [1, 1, 1, 0.4]
#define COLOR_BUTTON_ENABLED [1, 1, 1, 1]
#define COLOR_BUTTON_DISABLED [0, 0, 0, 1]
Expand Down