From 004f4ae451834220c45fc11f56bea6ec18dd8889 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 31 Aug 2018 13:21:45 -0400 Subject: [PATCH 1/6] Highlight individual duplicate keys --- addons/keybinding/fnc_gui_update.sqf | 24 ++++++++++-------------- addons/keybinding/gui.hpp | 5 +++-- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf index 4e5e14deb..ee348fa9f 100644 --- a/addons/keybinding/fnc_gui_update.sqf +++ b/addons/keybinding/fnc_gui_update.sqf @@ -64,8 +64,6 @@ private _tablePosY = 0; _keybinds = _tempNamespace getVariable [_action, _keybinds]; private _keyNames = []; - private _isDuplicated = false; - { private _keybind = _x; private _keyName = _keybind call CBA_fnc_localizeKey; @@ -77,17 +75,17 @@ private _tablePosY = 0; // search the addon for any other keybinds using this key. if (_keybind select 0 > DIK_ESCAPE) then { - { + if (_addonActions findIf { private _duplicateAction = format ["%1$%2", _addon, _x]; private _duplicateKeybinds = GVAR(actions) getVariable _duplicateAction select 2; _duplicateKeybinds = _tempNamespace getVariable [_duplicateAction, _duplicateKeybinds]; - if (_keybind in _duplicateKeybinds && {_action != _duplicateAction}) exitWith { - _isDuplicated = true; - }; - } forEach _addonActions; - - _keyNames pushBack _keyName; + _keybind in _duplicateKeybinds && {_action != _duplicateAction} + } > -1) then { + _keyNames pushBack format ["%1", _keyName]; + } else { + _keyNames pushBack format ["%1", _keyName]; + }; }; } forEach _keybinds; @@ -123,12 +121,10 @@ private _tablePosY = 0; _edit setVariable [QGVAR(data), [_action, _displayName, _keybinds, _defaultKeybind, _forEachIndex]]; private _assigned = _subcontrol controlsGroupCtrl IDC_KEY_ASSIGNED; - _assigned ctrlSetText (_keyNames joinString ", "); + _assigned ctrlSetStructuredText parseText (_keyNames joinString ", "); _assigned ctrlSetTooltip _tooltip; - - if (_isDuplicated) then { - _assigned ctrlSetTextColor [1,0,0,1]; - }; + _assigned ctrlSetTooltipColorBox [1,1,1,1]; + _assigned ctrlSetTooltipColorShade [0,0,0,0.7]; _subcontrols pushBack _subcontrol; _editableSubcontrols pushBack _subcontrol; diff --git a/addons/keybinding/gui.hpp b/addons/keybinding/gui.hpp index 9e8dbd82f..634fc4bb6 100644 --- a/addons/keybinding/gui.hpp +++ b/addons/keybinding/gui.hpp @@ -4,6 +4,7 @@ class RscText; class RscButton; class RscButtonMenu; class RscCombo; +class RscStructuredText; class GVAR(key): RscControlsGroupNoScrollbars { idc = -1; @@ -30,9 +31,9 @@ class GVAR(key): RscControlsGroupNoScrollbars { h = POS_H(1); }; - class AssignedKey: RscText { + class AssignedKey: RscStructuredText { idc = IDC_KEY_ASSIGNED; - colorShadow[] = {0,0,0,0}; + shadow = 0; x = POS_W(17); y = POS_H(0); w = POS_W(20); From 3be2c6d8b603d61cde144e2a02e9262bb2db8968 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 31 Aug 2018 19:51:37 -0400 Subject: [PATCH 2/6] Move tooltip color changes to config --- addons/keybinding/fnc_gui_update.sqf | 4 ---- addons/keybinding/gui.hpp | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf index ee348fa9f..aab24b2ca 100644 --- a/addons/keybinding/fnc_gui_update.sqf +++ b/addons/keybinding/fnc_gui_update.sqf @@ -116,15 +116,11 @@ private _tablePosY = 0; private _edit = _subcontrol controlsGroupCtrl IDC_KEY_EDIT; _edit ctrlSetText _displayName; _edit ctrlSetTooltip _tooltip; - _edit ctrlSetTooltipColorBox [1,1,1,1]; - _edit ctrlSetTooltipColorShade [0,0,0,0.7]; _edit setVariable [QGVAR(data), [_action, _displayName, _keybinds, _defaultKeybind, _forEachIndex]]; private _assigned = _subcontrol controlsGroupCtrl IDC_KEY_ASSIGNED; _assigned ctrlSetStructuredText parseText (_keyNames joinString ", "); _assigned ctrlSetTooltip _tooltip; - _assigned ctrlSetTooltipColorBox [1,1,1,1]; - _assigned ctrlSetTooltipColorShade [0,0,0,0.7]; _subcontrols pushBack _subcontrol; _editableSubcontrols pushBack _subcontrol; diff --git a/addons/keybinding/gui.hpp b/addons/keybinding/gui.hpp index 634fc4bb6..4f071c6fe 100644 --- a/addons/keybinding/gui.hpp +++ b/addons/keybinding/gui.hpp @@ -25,6 +25,9 @@ class GVAR(key): RscControlsGroupNoScrollbars { colorBackground[] = {0,0,0,0}; colorBackgroundActive[] = {1,1,1,1}; colorFocused[] = {0.5,0.5,0.5,0.5}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.7}; + tooltipColorText[] = {1,1,1,1}; x = POS_W(0); y = POS_H(0); w = POS_W(17); @@ -34,6 +37,9 @@ class GVAR(key): RscControlsGroupNoScrollbars { class AssignedKey: RscStructuredText { idc = IDC_KEY_ASSIGNED; shadow = 0; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.7}; + tooltipColorText[] = {1,1,1,1}; x = POS_W(17); y = POS_H(0); w = POS_W(20); From 5860845a068ad0211204594339127d2fee2810a2 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 1 Sep 2018 06:30:48 +0200 Subject: [PATCH 3/6] Travis --- addons/keybinding/fnc_gui_update.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf index aab24b2ca..78565fa69 100644 --- a/addons/keybinding/fnc_gui_update.sqf +++ b/addons/keybinding/fnc_gui_update.sqf @@ -75,13 +75,15 @@ private _tablePosY = 0; // search the addon for any other keybinds using this key. if (_keybind select 0 > DIK_ESCAPE) then { - if (_addonActions findIf { + private _isDuplicated = _addonActions findIf { private _duplicateAction = format ["%1$%2", _addon, _x]; private _duplicateKeybinds = GVAR(actions) getVariable _duplicateAction select 2; _duplicateKeybinds = _tempNamespace getVariable [_duplicateAction, _duplicateKeybinds]; _keybind in _duplicateKeybinds && {_action != _duplicateAction} - } > -1) then { + } > -1; + + if (_isDuplicated) then { _keyNames pushBack format ["%1", _keyName]; } else { _keyNames pushBack format ["%1", _keyName]; From 76f640d23d5c50361fa16667dbf013855e6313a4 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 1 Sep 2018 06:34:47 +0200 Subject: [PATCH 4/6] Travis --- addons/keybinding/fnc_gui_update.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf index 78565fa69..258a57edf 100644 --- a/addons/keybinding/fnc_gui_update.sqf +++ b/addons/keybinding/fnc_gui_update.sqf @@ -80,7 +80,7 @@ private _tablePosY = 0; private _duplicateKeybinds = GVAR(actions) getVariable _duplicateAction select 2; _duplicateKeybinds = _tempNamespace getVariable [_duplicateAction, _duplicateKeybinds]; - _keybind in _duplicateKeybinds && {_action != _duplicateAction} + _keybind in _duplicateKeybinds && {_action != _duplicateAction}; } > -1; if (_isDuplicated) then { From 134fc24ad720a855c26b9bd893b0cc028e3bcd63 Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 1 Sep 2018 06:37:47 +0200 Subject: [PATCH 5/6] Travis --- addons/keybinding/fnc_gui_update.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf index 258a57edf..0305cbc28 100644 --- a/addons/keybinding/fnc_gui_update.sqf +++ b/addons/keybinding/fnc_gui_update.sqf @@ -81,9 +81,9 @@ private _tablePosY = 0; _duplicateKeybinds = _tempNamespace getVariable [_duplicateAction, _duplicateKeybinds]; _keybind in _duplicateKeybinds && {_action != _duplicateAction}; - } > -1; + }; - if (_isDuplicated) then { + if (_isDuplicated > -1) then { _keyNames pushBack format ["%1", _keyName]; } else { _keyNames pushBack format ["%1", _keyName]; From 5de6921d180ba9bdfd5378e906285519ef3178cf Mon Sep 17 00:00:00 2001 From: commy2 Date: Sat, 1 Sep 2018 06:39:37 +0200 Subject: [PATCH 6/6] Travis --- addons/keybinding/fnc_gui_update.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf index 0305cbc28..fa36f108a 100644 --- a/addons/keybinding/fnc_gui_update.sqf +++ b/addons/keybinding/fnc_gui_update.sqf @@ -80,7 +80,7 @@ private _tablePosY = 0; private _duplicateKeybinds = GVAR(actions) getVariable _duplicateAction select 2; _duplicateKeybinds = _tempNamespace getVariable [_duplicateAction, _duplicateKeybinds]; - _keybind in _duplicateKeybinds && {_action != _duplicateAction}; + _keybind in _duplicateKeybinds && {_action != _duplicateAction} }; if (_isDuplicated > -1) then {