-
Notifications
You must be signed in to change notification settings - Fork 151
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
Keybinding - Highlight individual duplicate keys #972
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ["<t color='#FF0000'>%1</t>", _keyName]; | ||
} else { | ||
_keyNames pushBack format ["<t color='#FFFFFF'>%1</t>", _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]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These already were the values used I believe. Although setting them explicitly may be more robust if future changes happen (e.g. by BI). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
_subcontrols pushBack _subcontrol; | ||
_editableSubcontrols pushBack _subcontrol; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool. Apparently Travis doesn't understand
if findIf
.