-
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
add keybinding menu subcategories #966
Changes from all commits
b990160
bd3acaa
aa06cd8
bb91d85
3d41554
e4c1ec6
1a2536b
690ad9f
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 |
---|---|---|
|
@@ -6,7 +6,18 @@ if (isNull _display) exitWith {}; | |
private _ctrlAddonList = _display displayCtrl IDC_ADDON_LIST; | ||
private _ctrlKeyList = _display displayCtrl IDC_KEY_LIST; | ||
|
||
lnbClear _ctrlKeyList; | ||
// clear key list | ||
private _subcontrols = _ctrlKeyList getVariable [QGVAR(KeyListSubcontrols), []]; | ||
|
||
{ | ||
ctrlDelete _x; | ||
} forEach _subcontrols; | ||
|
||
_subcontrols = []; | ||
_ctrlKeyList setVariable [QGVAR(KeyListSubcontrols), _subcontrols]; | ||
|
||
private _editableSubcontrols = []; | ||
_ctrlKeyList setVariable [QGVAR(KeyListEditableSubcontrols), _editableSubcontrols]; | ||
|
||
private _index = lbCurSel _ctrlAddonList; | ||
private _addon = _ctrlAddonList lbData _index; | ||
|
@@ -17,8 +28,29 @@ uiNamespace setVariable [QGVAR(addonIndex), _index]; | |
|
||
private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds); | ||
|
||
private _categoryKeyActions = []; | ||
|
||
{ | ||
private _action = format ["%1$%2", _addon, _x]; | ||
private _subcategory = (GVAR(actions) getVariable _action) param [8, "", [""]]; | ||
|
||
_categoryKeyActions pushBack [_subcategory, _forEachIndex, _x]; | ||
} forEach _addonActions; | ||
|
||
_categoryKeyActions sort true; | ||
private _lastSubcategory = "$START"; | ||
private _tablePosY = 0; | ||
|
||
{ | ||
_x params ["_subcategory", "", "_keyAction"]; | ||
|
||
private _createHeader = false; | ||
if (_subcategory != _lastSubcategory) then { | ||
_lastSubcategory = _subcategory; | ||
_createHeader = _subcategory != ""; | ||
}; | ||
|
||
private _action = format ["%1$%2", _addon, _keyAction]; | ||
(GVAR(actions) getVariable _action) params ["_displayName", "_tooltip", "_keybinds", "_defaultKeybind"]; | ||
|
||
if (isLocalized _displayName) then { | ||
|
@@ -59,16 +91,44 @@ private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds); | |
}; | ||
} forEach _keybinds; | ||
|
||
// add keybinds to action list | ||
private _index = _ctrlKeyList lnbAddRow [_displayName, _keyNames joinString ", "]; | ||
// add subcategory header | ||
if (_createHeader) then { | ||
private _header = _display ctrlCreate [QGVAR(subCat), -1, _ctrlKeyList]; | ||
|
||
if (isLocalized _subcategory) then { | ||
_subcategory = localize _subcategory; | ||
}; | ||
|
||
(_header controlsGroupCtrl IDC_SUBCATEGORY_NAME) ctrlSetText format ["%1:", _subcategory]; | ||
_header ctrlSetPosition [POS_W(0), _tablePosY]; | ||
_header ctrlCommit 0; | ||
|
||
_tablePosY = _tablePosY + getNumber (configFile >> QGVAR(subCat) >> "h"); | ||
_subcontrols pushBack _header; | ||
}; | ||
|
||
// tooltips bugged for lnb | ||
_ctrlKeyList lbSetTooltip [2 * _index, _tooltip]; | ||
_ctrlKeyList lbSetTooltip [2 * _index + 1, _tooltip]; | ||
private _subcontrol = _display ctrlCreate [QGVAR(key), -1, _ctrlKeyList]; | ||
|
||
_ctrlKeyList lnbSetData [[_index, 0], str [_action, _displayName, _keybinds, _defaultKeybind]]; | ||
_subcontrol ctrlSetPosition [POS_W(0), _tablePosY]; | ||
_subcontrol ctrlCommit 0; | ||
|
||
_tablePosY = _tablePosY + POS_H(1); | ||
|
||
private _edit = _subcontrol controlsGroupCtrl IDC_KEY_EDIT; | ||
_edit ctrlSetText _displayName; | ||
_edit ctrlSetTooltip _tooltip; | ||
_edit ctrlSetTooltipColorShade [0,0,0,0.5]; | ||
_edit setVariable [QGVAR(data), [_action, _displayName, _keybinds, _defaultKeybind, _forEachIndex]]; | ||
|
||
private _assigned = _subcontrol controlsGroupCtrl IDC_KEY_ASSIGNED; | ||
_assigned ctrlSetText (_keyNames joinString ", "); | ||
|
||
if (_isDuplicated) then { | ||
_ctrlKeyList lnbSetColor [[_index, 1], [1, 0, 0, 1]]; | ||
_edit ctrlSetTextColor [1,0,0,1]; | ||
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. A lot of red on screen, like before, have only the keys turn to red when duplicate? 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. Will go with whatever the base game does. Will check. 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. Yep, Vanilla only highlights the keys. |
||
_assigned ctrlSetTextColor [1,0,0,1]; | ||
}; | ||
} forEach _addonActions; | ||
|
||
_subcontrols pushBack _subcontrol; | ||
_editableSubcontrols pushBack _subcontrol; | ||
} forEach _categoryKeyActions; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,79 @@ | ||
class RscButtonMenu; | ||
class RscControlsGroup; | ||
class RscControlsGroupNoScrollbars; | ||
class RscText; | ||
class RscButton; | ||
class RscButtonMenu; | ||
class RscCombo; | ||
class RscListNBox; | ||
|
||
class GVAR(key): RscControlsGroupNoScrollbars { | ||
idc = -1; | ||
enableDisplay = 0; | ||
x = POS_W(0); | ||
y = POS_H(0); | ||
w = POS_W(37); | ||
h = POS_H(1); | ||
|
||
class controls { | ||
class EditButton: RscButton { | ||
idc = IDC_KEY_EDIT; | ||
onButtonClick = QUOTE(_this call (uiNamespace getVariable 'FUNC(gui_editKey)')); | ||
style = ST_LEFT; | ||
colorBackground[] = {0,0,0,0}; | ||
colorBackgroundActive[] = {1,1,1,1}; | ||
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. When hovered, the text can only be read because of the shadow. Remove the shadow, 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. 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. Yeah, that is what I was thinking. |
||
colorFocused[] = {1,1,1,1}; | ||
x = POS_W(0); | ||
y = POS_H(0); | ||
w = POS_W(17); | ||
h = POS_H(1); | ||
}; | ||
|
||
class AssignedKey: RscText { | ||
idc = IDC_KEY_ASSIGNED; | ||
shadow = 2; | ||
colorShadow[] = {0,0,0,0}; | ||
x = POS_W(17); | ||
y = POS_H(0); | ||
w = POS_W(20); | ||
h = POS_H(1); | ||
}; | ||
}; | ||
}; | ||
|
||
class GVAR(subCat): RscControlsGroupNoScrollbars { | ||
x = POS_W(1); | ||
y = POS_H(0); | ||
w = POS_W(37); | ||
h = POS_H(0.75); | ||
|
||
class controls { | ||
class Background: RscText { | ||
colorBackground[] = {0.25,0.25,0.25,0.4}; | ||
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. 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. This would have to be changed for the settings as well, for consistency. It's carbon coby atm. 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. 👍 Should change both then. |
||
x = POS_W(0); | ||
y = POS_H(0); | ||
w = POS_W(36); | ||
h = POS_H(0.75); | ||
}; | ||
|
||
class Name: RscText { | ||
idc = IDC_SUBCATEGORY_NAME; | ||
style = ST_LEFT; | ||
SizeEx = POS_H(0.75); | ||
x = POS_W(0); | ||
y = POS_H(0); | ||
w = POS_W(15.5); | ||
h = POS_H(0.75); | ||
}; | ||
|
||
class Bar: RscText { | ||
colorBackground[] = {1,1,1,1}; | ||
style = ST_LEFT; | ||
x = POS_W(0); | ||
y = POS_H(0.75) - 2 * pixelH; | ||
w = POS_W(36); | ||
h = pixelH; | ||
}; | ||
}; | ||
}; | ||
|
||
class RscDisplayConfigure { | ||
class controls { | ||
|
@@ -58,9 +129,8 @@ class RscDisplayConfigure { | |
h = POS_H(1); | ||
wholeHeight = POS_H(12); | ||
}; | ||
class CA_ValueKeys: RscListNBox { | ||
class KeyList: RscControlsGroup { | ||
idc = IDC_KEY_LIST; | ||
columns[] = {0, 0.459459459}; //17/37 | ||
x = POS_W(0.5); | ||
y = POS_H(3.5); | ||
w = POS_W(37); | ||
|
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.
Like before and vanilla, have the tooltip be shown for both the name and the keys.
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.
ok