diff --git a/addons/help/XEH_postClientInit.sqf b/addons/help/XEH_postClientInit.sqf
index e8af041ab..4eca49545 100644
--- a/addons/help/XEH_postClientInit.sqf
+++ b/addons/help/XEH_postClientInit.sqf
@@ -32,16 +32,16 @@ if (!isNil QGVAR(keys)) then {
0 spawn {
private _text = GVAR(keys);
- private _activeMods = allVariables EGVAR(keybinding,activeMods);
+ private _activeMods = allVariables EGVAR(keybinding,addons);
_activeMods sort true;
{
- (EGVAR(keybinding,activeMods) getVariable _x) params ["_addonName", "_addonActions"];
+ (EGVAR(keybinding,addons) getVariable _x) params ["_addonName", "_addonActions"];
_text = _text + format ["%1:
", _addonName];
{
- (EGVAR(keybinding,activeBinds) getVariable (_addonName + "$" + _x)) params ["_displayName", "", "_registryKeybinds"];
+ (EGVAR(keybinding,actions) getVariable (_addonName + "$" + _x)) params ["_displayName", "", "_registryKeybinds"];
private _keybind = _registryKeybinds select 0;
diff --git a/addons/keybinding/CfgEventHandlers.hpp b/addons/keybinding/CfgEventHandlers.hpp
index bf32cea7a..6022b801b 100644
--- a/addons/keybinding/CfgEventHandlers.hpp
+++ b/addons/keybinding/CfgEventHandlers.hpp
@@ -13,6 +13,6 @@ class Extended_PreInit_EventHandlers {
class Extended_DisplayLoad_EventHandlers {
class RscDisplayConfigure {
- ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(configureDisplayLoad)'));
+ ADDON = QUOTE(_this call (uiNamespace getVariable 'FUNC(initDisplayConfigure)'));
};
};
diff --git a/addons/keybinding/XEH_PREP.sqf b/addons/keybinding/XEH_PREP.sqf
new file mode 100644
index 000000000..f15aedd17
--- /dev/null
+++ b/addons/keybinding/XEH_PREP.sqf
@@ -0,0 +1,6 @@
+
+PREP(initDisplayConfigure);
+
+PREP(gui_configure);
+PREP(gui_update);
+PREP(gui_editKey);
diff --git a/addons/keybinding/XEH_preInit.sqf b/addons/keybinding/XEH_preInit.sqf
index de5b78da6..0b060d509 100644
--- a/addons/keybinding/XEH_preInit.sqf
+++ b/addons/keybinding/XEH_preInit.sqf
@@ -3,6 +3,8 @@ SCRIPT(XEH_preInit);
if (!hasInterface) exitWith {};
+#include "XEH_PREP.sqf"
+
ADDON = false;
// Load DIK to string conversion table.
@@ -13,41 +15,13 @@ with uiNamespace do {
GVAR(keyNames) = uiNamespace getVariable QGVAR(keyNames);
GVAR(forbiddenKeys) = uiNamespace getVariable QGVAR(forbiddenKeys);
-// Prepare GUI functions and variables.
-PREP_SUB(gui,onButtonClick_configure);
-PREP_SUB(gui,onButtonClick_delete);
-PREP_SUB(gui,onButtonClick_default);
-PREP_SUB(gui,onButtonClick_cancel);
-PREP_SUB(gui,onComboChanged);
-PREP_SUB(gui,onKeyDown);
-PREP_SUB(gui,onKeyUp);
-//PREP_SUB(gui,onKeyDownNextGen);
-//PREP_SUB(gui,onKeyUpNextGen);
-PREP_SUB(gui,onLBDblClick);
-PREP_SUB(gui,updateGUI);
-
-GVAR(input) = [];
-GVAR(frameNoKeyPress) = diag_frameNo;
-GVAR(modifiers) = [];
-GVAR(firstKey) = [];
-GVAR(secondKey) = [];
-GVAR(thirdKey) = [];
-GVAR(waitingForInput) = false;
-GVAR(defaultKeybinds) = [[],[]];
-
-if (isNil QGVAR(activeMods)) then {
- GVAR(activeMods) = [] call CBA_fnc_createNamespace;
- GVAR(activeBinds) = [] call CBA_fnc_createNamespace;
+if (isNil QGVAR(addons)) then {
+ GVAR(addons) = [] call CBA_fnc_createNamespace;
+ GVAR(actions) = [] call CBA_fnc_createNamespace;
};
if (isNil QGVAR(modPrettyNames)) then {
GVAR(modPrettyNames) = [] call CBA_fnc_createNamespace;
};
-// Counter for indexing added key handlers.
-GVAR(ehCounter) = 512;
-
-/////////////////////////////////////////////////////////////////////////////////
-
-// Announce initialization complete
ADDON = true;
diff --git a/addons/keybinding/XEH_preStart.sqf b/addons/keybinding/XEH_preStart.sqf
index dc98b589b..c4ffd2048 100644
--- a/addons/keybinding/XEH_preStart.sqf
+++ b/addons/keybinding/XEH_preStart.sqf
@@ -1,6 +1,8 @@
#include "script_component.hpp"
-PREP(configureDisplayLoad);
+if (!hasInterface) exitWith {};
+
+#include "XEH_PREP.sqf"
private _supportedKeys = [
DIK_ESCAPE,
@@ -176,16 +178,18 @@ GVAR(keyNamesHash) = [_supportedKeys] call CBA_fnc_hashCreate;
{
[GVAR(keyNamesHash), str (_x select 0), parseSimpleArray format ["[%1]", keyName (_x select 1)] select 0] call CBA_fnc_hashSet;
} forEach [
- [0xF0, 0x10000],
- [0xF1, 0x10081],
- [0xF2, 0x10002],
- [0xF3, 0x10003],
- [0xF4, 0x10004],
- [0xF5, 0x10005],
- [0xF6, 0x10006],
- [0xF7, 0x10007],
- [0xF8, 0x100004],
- [0xF9, 0x100005]
+ [0xF0, 0x10000], // LMB
+ [0xF1, 0x10081], // RMB
+ [0xF2, 0x10002], // MMB
+ [0xF3, 0x10003], // Mouse #4
+ [0xF4, 0x10004], // Mouse #5
+ [0xF5, 0x10005], // Mouse #6
+ [0xF6, 0x10006], // Mouse #7
+ [0xF7, 0x10007], // Mouse #8
+ [0xF8, 0x100004], // Mouse wheel up
+ [0xF9, 0x100005], // Mouse wheel down
+ [84, DIK_SYSRQ],
+ [198, DIK_PAUSE]
];
GVAR(forbiddenKeys) = [
diff --git a/addons/keybinding/config.cpp b/addons/keybinding/config.cpp
index ccb273e25..6906a7930 100644
--- a/addons/keybinding/config.cpp
+++ b/addons/keybinding/config.cpp
@@ -16,4 +16,4 @@ class CfgPatches {
#include "CfgEventHandlers.hpp"
#include "CfgFunctions.hpp"
-#include "gui\gui.hpp"
+#include "gui.hpp"
diff --git a/addons/keybinding/fnc_addKeybind.sqf b/addons/keybinding/fnc_addKeybind.sqf
index 8a6400577..e55b96a7c 100644
--- a/addons/keybinding/fnc_addKeybind.sqf
+++ b/addons/keybinding/fnc_addKeybind.sqf
@@ -69,18 +69,18 @@ if (canSuspend) exitWith {
params [
["_addon", "", [""]],
- ["_action", "", [""]],
+ ["_addonAction", "", [""]],
["_title", "", ["", []]],
["_downCode", {}, [{}]],
["_upCode", {}, [{}]],
["_defaultKeybind", KEYBIND_NULL, [KEYBIND_NULL]],
- ["_holdKey", true, [false]],
+ ["_holdKey", false, [false]],
["_holdDelay", 0, [0]],
["_overwrite", false, [false]]
];
-_title params [["_displayName", _action, [""]], ["_tooltip", "", [""]]];
-_action = toLower _action;
+_title params [["_displayName", _addonAction, [""]], ["_tooltip", "", [""]]];
+private _action = toLower format ["%1$%2", _addon, _addonAction];
// support old format
if (_defaultKeybind isEqualTypeParams [0, false, false, false]) then {
@@ -92,6 +92,8 @@ if (_defaultKeybind isEqualTypeParams [0, false, false, false]) then {
_defaultKeybind params [["_defaultKey", 0, [0]], ["_defaultModifiers", [], [[]]]];
_defaultModifiers params [["_defaultShift", false, [false]], ["_defaultControl", false, [false]], ["_defaultAlt", false, [false]]];
+_defaultKey = _defaultKey max 0;
+
if (_defaultKey in [DIK_LSHIFT, DIK_RSHIFT]) then {
_defaultShift = true;
};
@@ -114,43 +116,46 @@ if (isNil "_registry") then {
profileNamespace setVariable [QGVAR(registry_v3), _registry];
};
-private _registryKeybinds = [_registry, _action] call CBA_fnc_hashGet;
+private _keybinds = [_registry, _action] call CBA_fnc_hashGet;
// action doesn't exist in registry yet, create it and store default keybinding
-if (isNil "_registryKeybinds" || {_overwrite}) then {
- _registryKeybinds = [_keybind];
- [_registry, _action, _registryKeybinds] call CBA_fnc_hashSet;
+if (isNil "_keybinds" || {_overwrite}) then {
+ _keybinds = [_keybind];
+ [_registry, _action, _keybinds] call CBA_fnc_hashSet;
};
+// filter out null binds
+_keybinds = _keybinds select {_x select 0 > DIK_ESCAPE};
+
// make list of active mods and keybinds for gui
-if (isNil QGVAR(activeMods)) then {
- GVAR(activeMods) = [] call CBA_fnc_createNamespace;
- GVAR(activeBinds) = [] call CBA_fnc_createNamespace;
+if (isNil QGVAR(addons)) then {
+ GVAR(addons) = [] call CBA_fnc_createNamespace;
+ GVAR(actions) = [] call CBA_fnc_createNamespace;
};
-private _addonInfo = GVAR(activeMods) getVariable _addon;
+private _addonInfo = GVAR(addons) getVariable _addon;
if (isNil "_addonInfo") then {
_addonInfo = [_addon, []];
- GVAR(activeMods) setVariable [_addon, _addonInfo];
+ GVAR(addons) setVariable [_addon, _addonInfo];
};
-(_addonInfo select 1) pushBackUnique toLower _action;
+(_addonInfo select 1) pushBackUnique toLower _addonAction;
-GVAR(activeBinds) setVariable [_addon + "$" + _action, [_displayName, _tooltip, _registryKeybinds, _defaultKeybind]];
+GVAR(actions) setVariable [_action, [_displayName, _tooltip, _keybinds, _defaultKeybind, _downCode, _upCode, _holdKey, _holdDelay]];
// add this action to all keybinds
{
_keybind = _x;
if !(_downCode isEqualTo {}) then {
- [_keybind select 0, _keybind select 1, _downCode, "keyDown", format ["%1$%2$down", _addon, _action], _holdKey, _holdDelay] call CBA_fnc_addKeyHandler;
+ [_keybind select 0, _keybind select 1, _downCode, "keyDown", format ["%1_down_%2", _action, _forEachIndex], _holdKey, _holdDelay] call CBA_fnc_addKeyHandler;
};
if !(_upCode isEqualTo {}) then {
- [_keybind select 0, _keybind select 1, _upCode, "keyUp", format ["%1$%2$up", _addon, _action]] call CBA_fnc_addKeyHandler;
+ [_keybind select 0, _keybind select 1, _upCode, "keyUp", format ["%1_up_%2", _action, _forEachIndex]] call CBA_fnc_addKeyHandler;
};
-} forEach _registryKeybinds;
+} forEach _keybinds;
// Emit an event that a key has been registered.
[QGVAR(registerKeybind), _this] call CBA_fnc_localEvent;
diff --git a/addons/keybinding/fnc_configureDisplayLoad.sqf b/addons/keybinding/fnc_configureDisplayLoad.sqf
deleted file mode 100644
index 9f7fb8e45..000000000
--- a/addons/keybinding/fnc_configureDisplayLoad.sqf
+++ /dev/null
@@ -1,55 +0,0 @@
-// Extra initialization steps for the vanilla RscDisplayConfigure dialog
-// needed to support mod keybinding system.
-
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-private ["_addonsGroup", "_fakeKeyboardButton", "_lb", "_text"];
-params ["_display"];
-
-// Hide addons group on display init.
-_addonsGroup = _display displayctrl 4301;
-_addonsGroup ctrlShow false;
-_addonsGroup ctrlEnable false;
-
-// Hide fake keyboard button on display init.
-_fakeKeyboardButton = _display displayctrl 4303;
-_fakeKeyboardButton ctrlShow false;
-_fakeKeyboardButton ctrlEnable false;
-
-// Check if a mission has been started and functions initialized. We can't do anything from this dialog if not,
-// because CBA does not (can not) run init scripts until mission start, and CfgFunctions will not run preInit = 1
-// scripts until mission start as well.
-//
-// It could all be hardcoded into the displayInit, but that eliminates modularity and compatibility.
-//
-// This is a non-issue for most users, who will have a 'mission' loaded by the background of the
-// main menu. Only people (devs) using an ocean world load to save time will be affected.
-
-//if in eden editor, postInit will not run, so there won't be any valid keybinds to modify
-if (is3DEN) exitWith {
- _lb = _display displayCtrl 202;
- _lb lnbAddRow [localize LSTRING(canNotEdit)];
-};
-
-if (isNil "cba_fnc_registerKeybind") then {
- // XEH PreInit has not run yet, so we need to prepare this function right now.
- FUNC(onButtonClick_configure) = compile preprocessFileLineNumbers "\x\cba\addons\keybinding\gui\fnc_onButtonClick_configure.sqf";
- FUNC(onButtonClick_cancel) = {};
-
- _lb = _display displayCtrl 202;
- _lb lnbAddRow [localize LSTRING(canNotEdit)];
-
-} else {
- [true] call FUNC(updateGUI); // true means first-run
-
- // Do this here to avoid automatic uppercasing by BI RscDisplayConfigure.sqf onLoad.
- _text = _display displayCtrl 206;
- _text ctrlSetText "Double click any action to change its binding";
-
- // Add handler to prevent key passthrough when waiting for input for binding (to block Esc).
- _display displayAddEventHandler ["KeyDown", "_this call cba_keybinding_fnc_onKeyDown"];
- _display displayAddEventHandler ["KeyUp", "_this call cba_keybinding_fnc_onKeyUp"];
-
-
-};
diff --git a/addons/keybinding/fnc_gui_configure.sqf b/addons/keybinding/fnc_gui_configure.sqf
new file mode 100644
index 000000000..a1dadbf0c
--- /dev/null
+++ b/addons/keybinding/fnc_gui_configure.sqf
@@ -0,0 +1,68 @@
+#include "script_component.hpp"
+
+// get button
+params ["_control"];
+
+// get dialog
+private _display = ctrlParent _control;
+
+_ctrlKeyboardGroup = _display displayCtrl 2300;
+_ctrlMouseGroup = _display displayCtrl 2301;
+_ctrlKeyboardButton = _display displayCtrl 2400;
+_ctrlMouseButton = _display displayCtrl 2401;
+_ctrlControllerButton = _display displayCtrl 106;
+_ctrlPresetButton = _display displayCtrl 114;
+_ctrlDefaultButton = _display displayCtrl 101;
+
+_ctrlKeyboardButtonFake = _display displayCtrl IDC_BTN_KEYBOARD_FAKE;
+_ctrlAddonsGroup = _display displayCtrl IDC_ADDONS_GROUP;
+_ctrlToggleButton = _display displayCtrl IDC_BTN_CONFIGURE_ADDONS;
+
+// Toggle displayed groups and buttons.
+if !(ctrlShown _ctrlAddonsGroup) then {
+ //--- disable and hide default menu
+ _ctrlKeyboardGroup ctrlEnable false;
+ _ctrlKeyboardGroup ctrlShow false;
+ _ctrlMouseGroup ctrlEnable false;
+ _ctrlMouseGroup ctrlShow false;
+ _ctrlKeyboardButton ctrlEnable false;
+ _ctrlKeyboardButton ctrlShow false;
+ _ctrlMouseButton ctrlEnable false;
+ _ctrlMouseButton ctrlShow false;
+ _ctrlControllerButton ctrlEnable false;
+ _ctrlControllerButton ctrlShow false;
+ _ctrlPresetButton ctrlEnable false;
+ _ctrlPresetButton ctrlShow false;
+ _ctrlDefaultButton ctrlEnable false;
+ _ctrlDefaultButton ctrlShow false;
+
+ //--- show and enable custom buttons
+ _ctrlKeyboardButtonFake ctrlEnable true;
+ _ctrlKeyboardButtonFake ctrlShow true;
+ _ctrlAddonsGroup ctrlEnable true;
+ _ctrlAddonsGroup ctrlShow true;
+
+ //--- change button text
+ _ctrlToggleButton ctrlSetText localize LSTRING(configureBase);
+} else {
+ //--- enable and show default menu
+ _ctrlKeyboardGroup ctrlEnable true;
+ _ctrlKeyboardGroup ctrlShow true;
+ _ctrlKeyboardButton ctrlEnable true;
+ _ctrlKeyboardButton ctrlShow true;
+ _ctrlMouseButton ctrlEnable true;
+ _ctrlMouseButton ctrlShow true;
+ _ctrlControllerButton ctrlEnable true;
+ _ctrlControllerButton ctrlShow true;
+ _ctrlPresetButton ctrlEnable true;
+ _ctrlPresetButton ctrlShow true;
+
+ //--- hide and disable custom buttons
+ _ctrlKeyboardButtonFake ctrlEnable false;
+ _ctrlKeyboardButtonFake ctrlShow false;
+ _ctrlAddonsGroup ctrlEnable false;
+ _ctrlAddonsGroup ctrlShow false;
+
+ //--- change button text
+ _ctrlToggleButton ctrlSetText localize LSTRING(configureAddons);
+};
diff --git a/addons/keybinding/fnc_gui_editKey.sqf b/addons/keybinding/fnc_gui_editKey.sqf
new file mode 100644
index 000000000..56aa350b9
--- /dev/null
+++ b/addons/keybinding/fnc_gui_editKey.sqf
@@ -0,0 +1,368 @@
+#include "script_component.hpp"
+
+params ["_control", "_index"];
+
+private _parentDisplay = ctrlParent _control;
+parseSimpleArray (_control lnbData [_index, 0]) params ["_action", "_displayName", "_keybinds", "_defaultKeybind"];
+
+private _display = _parentDisplay createDisplay "RscDisplayConfigureAction";
+
+// --- key lists
+private _ctrlAction = _display displayCtrl IDC_CONFIGURE_ACTION_TITLE;
+private _ctrlKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+private _ctrlSpecialKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_SPECIAL;
+
+_ctrlAction ctrlSetText _displayName;
+
+{
+ _ctrlKeyList lbSetData [_ctrlKeyList lbAdd (_x call CBA_fnc_localizeKey), str _x];
+} forEach _keybinds;
+
+_ctrlKeyList setVariable [QGVAR(index), _index];
+_ctrlKeyList setVariable [QGVAR(action), _action];
+_ctrlKeyList setVariable [QGVAR(undoKeybinds), _keybinds];
+_ctrlKeyList setVariable [QGVAR(defaultKeybind), _defaultKeybind];
+
+// --- record keys
+_display displayAddEventHandler ["KeyDown", {
+ params ["_display", "_key", "_shift", "_control", "_alt"];
+ private _ctrlKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+ if (_key <= DIK_ESCAPE) exitWith {};
+ if (_key in [DIK_LSHIFT, DIK_RSHIFT, DIK_LCONTROL, DIK_RCONTROL, DIK_LMENU, DIK_RMENU]) exitWith {};
+ if (!isNil {_ctrlKeyList getVariable QGVAR(lock)}) exitWith {};
+
+ private _keybind = [_key, [_shift, _control, _alt]];
+ private _keyName = _keybind call CBA_fnc_localizeKey;
+
+ // if key already in list, remove instead
+ private _doAdd = true;
+
+ for "_index" from 0 to (lbSize _ctrlKeyList - 1) do {
+ if (_ctrlKeyList lbData _index == str _keybind) exitWith {
+ _ctrlKeyList lbDelete _index;
+ _doAdd = false;
+ };
+ };
+
+ if (_doAdd) then {
+ private _index = _ctrlKeyList lbAdd _keyName;
+ _ctrlKeyList lbSetData [_index, str _keybind];
+ _ctrlKeyList lbSetCurSel _index;
+ };
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+
+ _ctrlKeyList setVariable [QGVAR(lock), true];
+}];
+
+_display displayAddEventHandler ["KeyUp", {
+ params ["_display", "_key"];
+ private _ctrlKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+ if (_key in [DIK_LSHIFT, DIK_RSHIFT, DIK_LCONTROL, DIK_RCONTROL, DIK_LMENU, DIK_RMENU]) exitWith {};
+
+ _ctrlKeyList setVariable [QGVAR(lock), nil];
+}];
+
+// --- special binds not handled by keydown
+private _specialKeys = [
+ [DIK_LSHIFT, [true, false, false]],
+ [DIK_RSHIFT, [true, false, false]],
+ [DIK_LCONTROL, [false, true, false]],
+ [DIK_RCONTROL, [false, true, false]],
+ [DIK_LMENU, [false, false, true]],
+ [DIK_RMENU, [false, false, true]]
+];
+
+{
+ for "_keyCode" from 0xF0 to 0xF9 do {
+ _specialKeys pushBack [_keyCode, _x];
+ };
+} forEach [
+ [false, false, false],
+ [true, false, false],
+ [false, true, false],
+ [false, false, true],
+ [true, true, false],
+ [true, false, true],
+ [false, true, true],
+ [true, true, true]
+];
+
+{
+ _ctrlSpecialKeyList lbSetData [_ctrlSpecialKeyList lbAdd (_x call CBA_fnc_localizeKey), str _x];
+} forEach _specialKeys;
+
+// add special key if dropped on keylist
+_ctrlKeyList ctrlAddEventHandler ["LBDrop", {
+ params ["_ctrlKeyList", "", "", "_originIDC", "_info"];
+ (_info select 0) params ["_text", "_value", "_data"];
+
+ if (ctrlIDC _ctrlKeyList == _originIDC) exitWith {};
+
+ // if special key already in list, remove instead
+ private _doAdd = true;
+
+ for "_index" from 0 to (lbSize _ctrlKeyList - 1) do {
+ if (_ctrlKeyList lbData _index == _data) exitWith {
+ _ctrlKeyList lbDelete _index;
+ _doAdd = false;
+ };
+ };
+
+ if (_doAdd) then {
+ private _index = _ctrlKeyList lbAdd _text;
+ _ctrlKeyList lbSetData [_index, _data];
+ _ctrlKeyList lbSetCurSel _index;
+ };
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+}];
+
+// remove item from keylist if dropped into special keylist
+_ctrlSpecialKeyList ctrlAddEventHandler ["LBDrop", {
+ params ["_ctrlSpecialKeyList", "", "", "_originIDC", "_info"];
+ (_info select 0) params ["_text", "_value", "_data"];
+
+ if (ctrlIDC _ctrlSpecialKeyList == _originIDC) exitWith {};
+
+ private _ctrlKeyList = ctrlParent _ctrlSpecialKeyList displayCtrl _originIDC;
+
+ for "_index" from 0 to (lbSize _ctrlKeyList - 1) do {
+ if (_ctrlKeyList lbData _index == _data) exitWith {
+ _ctrlKeyList lbDelete _index;
+ };
+ };
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+}];
+
+// make preview show up as green if target lb is different from origin lb
+private _fnc_dragging = {
+ params ["_control", "", "", "_originIDC"];
+ ctrlIDC _control != _originIDC
+};
+
+_ctrlKeyList ctrlAddEventHandler ["LBDragging", _fnc_dragging];
+_ctrlSpecialKeyList ctrlAddEventHandler ["LBDragging", _fnc_dragging];
+
+// --- OK
+private _ctrlButtonOK = _display displayCtrl IDC_OK;
+
+private _fnc_save = {
+ params ["_control"];
+ private _display = ctrlParent _control;
+
+ private _ctrlKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+ private _keybinds = [];
+
+ for "_index" from 0 to (lbSize _ctrlKeyList - 1) do {
+ _keybinds pushBack parseSimpleArray (_ctrlKeyList lbData _index);
+ };
+
+ private _action = _ctrlKeyList getVariable QGVAR(action);
+ private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds);
+
+ _tempNamespace setVariable [_action, _keybinds];
+};
+
+_ctrlButtonOK ctrlAddEventHandler ["ButtonClick", _fnc_save];
+
+// --- cancel
+private _ctrlButtonCancel = _display displayCtrl IDC_CONFIGURE_ACTION_CANCEL;
+
+_ctrlButtonCancel ctrlAddEventHandler ["ButtonClick", {
+ params ["_control"];
+ private _display = ctrlParent _control;
+
+ _display closeDisplay IDC_CANCEL;
+}];
+
+// --- show previous or next button
+private _ctrlButtonPrev = _display displayCtrl IDC_CONFIGURE_ACTION_PREV;
+private _ctrlButtonNext = _display displayCtrl IDC_CONFIGURE_ACTION_NEXT;
+
+_ctrlButtonPrev ctrlAddEventHandler ["ButtonClick", _fnc_save];
+_ctrlButtonNext ctrlAddEventHandler ["ButtonClick", _fnc_save];
+
+_ctrlButtonPrev ctrlAddEventHandler ["ButtonClick", {
+ _this spawn {
+ isNil {
+ params ["_control"];
+ private _display = ctrlParent _control;
+ private _parentDisplay = displayParent _display;
+
+ private _ctrlActionList = _parentDisplay displayCtrl IDC_KEY_LIST;
+ private _ctrlAction = _display displayCtrl IDC_CONFIGURE_ACTION_TITLE;
+ private _ctrlKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+
+ private _index = (_ctrlKeyList getVariable QGVAR(index)) - 1;
+
+ if (_index < 0) then {
+ _index = (lnbSize _ctrlActionList select 0) - 1
+ };
+
+ parseSimpleArray (_ctrlActionList lnbData [_index, 0]) params ["_action", "_displayName", "_keybinds", "_defaultKeybind"];
+
+ private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds);
+ _keybinds = _tempNamespace getVariable [_action, _keybinds];
+
+ // update list with new keybinds
+ _ctrlAction ctrlSetText _displayName;
+
+ lbClear _ctrlKeyList;
+
+ {
+ _ctrlKeyList lbSetData [_ctrlKeyList lbAdd (_x call CBA_fnc_localizeKey), str _x];
+ } forEach _keybinds;
+
+ _ctrlKeyList setVariable [QGVAR(index), _index];
+ _ctrlKeyList setVariable [QGVAR(action), _action];
+ _ctrlKeyList setVariable [QGVAR(undoKeybinds), _keybinds];
+ _ctrlKeyList setVariable [QGVAR(defaultKeybind), _defaultKeybind];
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+ };
+ };
+}];
+
+_ctrlButtonNext ctrlAddEventHandler ["ButtonClick", {
+ _this spawn {
+ isNil {
+ params ["_control"];
+ private _display = ctrlParent _control;
+ private _parentDisplay = displayParent _display;
+
+ private _ctrlActionList = _parentDisplay displayCtrl IDC_KEY_LIST;
+ private _ctrlAction = _display displayCtrl IDC_CONFIGURE_ACTION_TITLE;
+ private _ctrlKeyList = _display displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+
+ private _index = (_ctrlKeyList getVariable QGVAR(index)) + 1;
+
+ if (_index >= lnbSize _ctrlActionList select 0) then {
+ _index = 0;
+ };
+
+ parseSimpleArray (_ctrlActionList lnbData [_index, 0]) params ["_action", "_displayName", "_keybinds", "_defaultKeybind"];
+
+ private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds);
+ _keybinds = _tempNamespace getVariable [_action, _keybinds];
+
+ // update list with new keybinds
+ _ctrlAction ctrlSetText _displayName;
+
+ lbClear _ctrlKeyList;
+
+ {
+ _ctrlKeyList lbSetData [_ctrlKeyList lbAdd (_x call CBA_fnc_localizeKey), str _x];
+ } forEach _keybinds;
+
+ _ctrlKeyList setVariable [QGVAR(index), _index];
+ _ctrlKeyList setVariable [QGVAR(action), _action];
+ _ctrlKeyList setVariable [QGVAR(undoKeybinds), _keybinds];
+ _ctrlKeyList setVariable [QGVAR(defaultKeybind), _defaultKeybind];
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+ };
+ };
+}];
+
+// --- misc. buttons
+private _ctrlButtonDefault = _display displayCtrl IDC_CONFIGURE_ACTION_DEFAULT;
+private _ctrlButtonDelete = _display displayCtrl IDC_CONFIGURE_ACTION_DELETE;
+private _ctrlButtonUndo = _display displayCtrl IDC_CONFIGURE_ACTION_CLEAR;
+
+// delete currenty selected and select last item
+_ctrlButtonDelete ctrlAddEventHandler ["ButtonClick", {
+ params ["_control"];
+ private _ctrlKeyList = ctrlParent _control displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+ private _index = lbCurSel _ctrlKeyList;
+
+ if (_index >= 0) then {
+ _ctrlKeyList lbDelete _index;
+ _ctrlKeyList lbSetCurSel (lbSize _ctrlKeyList - 1);
+ };
+}];
+
+// clear lb and add default keybind
+_ctrlButtonDefault ctrlAddEventHandler ["ButtonClick", {
+ params ["_control"];
+ private _ctrlKeyList = ctrlParent _control displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+ lbClear _ctrlKeyList;
+
+ private _keybind = _ctrlKeyList getVariable QGVAR(defaultKeybind);
+
+ if (_keybind select 0 > DIK_ESCAPE) then {
+ _ctrlKeyList lbSetData [_ctrlKeyList lbAdd (_keybind call CBA_fnc_localizeKey), str _keybind];
+ };
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+}];
+
+// clear lb and add current temporary keybinds
+_ctrlButtonUndo ctrlAddEventHandler ["ButtonClick", {
+ params ["_control"];
+ private _ctrlKeyList = ctrlParent _control displayCtrl IDC_CONFIGURE_ACTION_KEYS;
+
+ lbClear _ctrlKeyList;
+
+ {
+ _ctrlKeyList lbSetData [_ctrlKeyList lbAdd (_x call CBA_fnc_localizeKey), str _x];
+ } forEach (_ctrlKeyList getVariable QGVAR(undoKeybinds));
+
+ _ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
+}];
+
+// --- update parent display if this one is closed
+_display displayAddEventHandler ["unload", {
+ [] call FUNC(gui_update);
+}];
+
+// --- function to highlight duplicates
+_ctrlKeyList setVariable [QFUNC(showDuplicates), {
+ params ["_ctrlKeyList"];
+
+ private _action = _ctrlKeyList getVariable QGVAR(action);
+ private _addon = _action splitString "$" select 0;
+
+ private _addonActions = GVAR(addons) getVariable [_addon, [nil, []]] select 1;
+ private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds);
+
+ for "-" from 0 to (lbSize _ctrlKeyList - 1) do {
+ private _keybind = parseSimpleArray (_ctrlKeyList lbData 0);
+ private _keyName = _keybind call CBA_fnc_localizeKey;
+
+ _ctrlKeyList lbDelete 0;
+
+ private _isDuplicated = false;
+
+ {
+ 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}) then {
+ private _duplicateActionName = GVAR(actions) getVariable _duplicateAction select 0;
+ _keyName = _keyName + format [" [%1]", _duplicateActionName];
+ _isDuplicated = true;
+ };
+ } forEach _addonActions;
+
+ private _index = _ctrlKeyList lbAdd _keyName;
+
+ _ctrlKeyList lbSetData [_index, str _keybind];
+
+ if (_isDuplicated) then {
+ _ctrlKeyList lbSetColor [_index, [1,0,0,1]];
+ _ctrlKeyList lbSetSelectColor [_index, [1,0,0,1]];
+ };
+ };
+}];
+
+_ctrlKeyList call (_ctrlKeyList getVariable QFUNC(showDuplicates));
diff --git a/addons/keybinding/fnc_gui_update.sqf b/addons/keybinding/fnc_gui_update.sqf
new file mode 100644
index 000000000..4058bea74
--- /dev/null
+++ b/addons/keybinding/fnc_gui_update.sqf
@@ -0,0 +1,61 @@
+#include "script_component.hpp"
+
+private _display = uiNamespace getVariable [QGVAR(display), displayNull];
+if (isNull _display) exitWith {};
+
+private _ctrlAddonList = _display displayCtrl IDC_ADDON_LIST;
+private _ctrlKeyList = _display displayCtrl IDC_KEY_LIST;
+
+lnbClear _ctrlKeyList;
+
+private _addon = _ctrlAddonList lbData lbCurSel _ctrlAddonList;
+private _addonActions = GVAR(addons) getVariable [_addon, [nil, []]] select 1;
+
+private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds);
+
+{
+ private _action = format ["%1$%2", _addon, _x];
+ (GVAR(actions) getVariable _action) params ["_displayName", "_tooltip", "_keybinds", "_defaultKeybind"];
+ _keybinds = _tempNamespace getVariable [_action, _keybinds];
+
+ private _keyNames = [];
+ private _isDuplicated = false;
+
+ {
+ private _keybind = _x;
+ private _keyName = _keybind call CBA_fnc_localizeKey;
+
+ // add quotes around string.
+ if (_keyName != "") then {
+ _keyName = str _keyName;
+ };
+
+ // search the addon for any other keybinds using this key.
+ if (_keybind select 0 > DIK_ESCAPE) then {
+ {
+ 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;
+ };
+ } forEach _keybinds;
+
+ // add keybinds to action list
+ private _index = _ctrlKeyList lnbAddRow [_displayName, _keyNames joinString ", "];
+
+ // tooltips bugged for lnb
+ _ctrlKeyList lbSetTooltip [2 * _index, _tooltip];
+ _ctrlKeyList lbSetTooltip [2 * _index + 1, _tooltip];
+
+ _ctrlKeyList lnbSetData [[_index, 0], str [_action, _displayName, _keybinds, _defaultKeybind]];
+
+ if (_isDuplicated) then {
+ _ctrlKeyList lnbSetColor [[_index, 1], [1,0,0,1]];
+ };
+} forEach _addonActions;
diff --git a/addons/keybinding/fnc_initDisplayConfigure.sqf b/addons/keybinding/fnc_initDisplayConfigure.sqf
new file mode 100644
index 000000000..08e85505b
--- /dev/null
+++ b/addons/keybinding/fnc_initDisplayConfigure.sqf
@@ -0,0 +1,91 @@
+#include "script_component.hpp"
+
+params ["_display"];
+uiNamespace setVariable [QGVAR(display), _display];
+
+private _ctrlAddonsGroup = _display displayCtrl IDC_ADDONS_GROUP;
+
+_ctrlAddonsGroup ctrlShow false;
+_ctrlAddonsGroup ctrlEnable false;
+
+// Hide addons group on display init.
+private _ctrlKeyboardButtonFake = _display displayCtrl IDC_BTN_KEYBOARD_FAKE;
+
+// Always highlight fake button
+_ctrlKeyboardButtonFake ctrlSetTextColor [0,0,0,1];
+_ctrlKeyboardButtonFake ctrlSetBackgroundColor [1,1,1,1];
+
+_ctrlKeyboardButtonFake ctrlShow false;
+_ctrlKeyboardButtonFake ctrlEnable false;
+
+// ----- disable in main menu
+if (isNil QUOTE(ADDON)) exitWith {
+ private _ctrlToggleButton = _display displayCtrl IDC_BTN_CONFIGURE_ADDONS;
+
+ _ctrlToggleButton ctrlEnable false;
+};
+
+// ----- fill addon combo box
+private _ctrlAddonList = _display displayCtrl IDC_ADDON_LIST;
+
+{
+ private _addonInfo = GVAR(addons) getVariable _x;
+ private _addonName = GVAR(modPrettyNames) getVariable [_x, _addonInfo select 0];
+
+ _ctrlAddonList lbSetData [_ctrlAddonList lbAdd _addonName, _x];
+} forEach allVariables GVAR(addons);
+
+lbSort _ctrlAddonList;
+
+_ctrlAddonList lbSetCurSel 0;
+_ctrlAddonList ctrlAddEventHandler ["LBSelChanged", {_this call (uiNamespace getVariable QFUNC(gui_update))}];
+
+private _ctrlKeyList = _display displayCtrl IDC_KEY_LIST;
+
+_ctrlKeyList ctrlSetTooltipColorShade [0,0,0,0.5];
+_ctrlKeyList ctrlAddEventHandler ["LBSelChanged", {_this call (uiNamespace getVariable QFUNC(gui_editKey))}];
+
+// ----- namespace for temp changed keybinds
+uiNamespace setVariable [QGVAR(tempKeybinds), _display ctrlCreate ["RscText", -1]];
+
+// ----- save changes
+private _ctrlButtonOK = _display displayCtrl IDC_OK;
+
+_ctrlButtonOK ctrlAddEventHandler ["ButtonClick", {
+ private _registry = profileNamespace getVariable QGVAR(registry_v3);
+ private _tempNamespace = uiNamespace getVariable QGVAR(tempKeybinds);
+ private _changedActions = allVariables GVAR(actions) select {!isNil {_tempNamespace getVariable _x}};
+
+ {
+ private _action = toLower _x;
+ private _keybinds = _tempNamespace getVariable _action;
+
+ (GVAR(actions) getVariable _action) params ["", "", "_oldKeybinds", "", "_downCode", "_upCode", "_holdKey", "_holdDelay"];
+ (GVAR(actions) getVariable _action) set [2, _keybinds];
+
+ // overwrite with new keyhandlers
+ {
+ _keybind = _x;
+
+ if !(_downCode isEqualTo {}) then {
+ [_keybind select 0, _keybind select 1, _downCode, "keyDown", format ["%1_down_%2", _action, _forEachIndex], _holdKey, _holdDelay] call CBA_fnc_addKeyHandler;
+ };
+
+ if !(_upCode isEqualTo {}) then {
+ [_keybind select 0, _keybind select 1, _upCode, "keyUp", format ["%1_up_%2", _action, _forEachIndex]] call CBA_fnc_addKeyHandler;
+ };
+ } forEach _keybinds;
+
+ // remove no longer used keyhandlers
+ for "_index" from (count _keybinds) to (count _oldKeybinds - 1) do {
+ [format ["%1_down_%2", _action, _index], "keydown"] call CBA_fnc_removeKeyHandler;
+ [format ["%1_up_%2", _action, _index], "keyup"] call CBA_fnc_removeKeyHandler;
+ };
+
+ // save in profile
+ [_registry, _action, _keybinds] call CBA_fnc_hashSet;
+ } forEach _changedActions;
+}];
+
+// ----- update gui
+[] call FUNC(gui_update);
diff --git a/addons/keybinding/fnc_registerKeybind.sqf b/addons/keybinding/fnc_registerKeybind.sqf
index a2e357a44..16cef96bc 100644
--- a/addons/keybinding/fnc_registerKeybind.sqf
+++ b/addons/keybinding/fnc_registerKeybind.sqf
@@ -39,6 +39,9 @@ _defaultKeybind params ["_dikCode", "_shift", "_ctrl", "_alt"];
if(_dikCode > -1 && !isNil {_code}) then { // A DIK code of -1 signifies "no key set"
+ if (isNil QGVAR(ehCounter)) then {
+ GVAR(ehCounter) = 512;
+ };
GVAR(ehCounter) = GVAR(ehCounter) + 1;
if(toLower _keypressType == "keydown") then {
[_dikCode, [_shift, _ctrl, _alt], _code, "keydown", format ["%1", GVAR(ehCounter)]] call cba_fnc_addKeyHandler;
diff --git a/addons/keybinding/gui.hpp b/addons/keybinding/gui.hpp
new file mode 100644
index 000000000..34a10d4ed
--- /dev/null
+++ b/addons/keybinding/gui.hpp
@@ -0,0 +1,91 @@
+
+class RscButtonMenu;
+class RscControlsGroupNoScrollbars;
+class RscText;
+class RscCombo;
+class RscListNBox;
+
+class RscDisplayConfigure {
+ class controls {
+ class CBA_ButtonConfigureAddons: RscButtonMenu {
+ onButtonClick = QUOTE(_this call (uiNamespace getVariable 'FUNC(gui_configure)'));
+ idc = IDC_BTN_CONFIGURE_ADDONS;
+ text = CSTRING(configureAddons);
+ x = POS_X(20.15);
+ y = POS_Y(23);
+ w = POS_W(12.5);
+ h = POS_H(1);
+ };
+
+ class CBA_ButtonKeyboardFake: RscButtonMenu {
+ idc = IDC_BTN_KEYBOARD_FAKE;
+ text = "$STR_A3_RscDisplayConfigure_ButtonKeyboard";
+ x = POS_X(1);
+ y = POS_Y(2.1);
+ w = POS_W(8);
+ h = POS_H(1);
+ };
+
+ class CBA_AddonsGroup: RscControlsGroupNoScrollbars {
+ idc = IDC_ADDONS_GROUP;
+ enableDisplay = 0;
+ x = POS_X(1);
+ y = POS_Y(3.1);
+ w = POS_W(38);
+ h = POS_H(19.6);
+
+ class controls {
+ class Background: RscText {
+ colorBackground[] = {0,0,0,0.4};
+ x = POS_W(0.5);
+ y = POS_H(3.5);
+ w = POS_W(37);
+ h = POS_H(15.8);
+ };
+ class AddonText: RscText {
+ style = ST_RIGHT;
+ text = "ADDON:";
+ x = POS_W(0.5);
+ y = POS_H(1);
+ w = POS_W(4);
+ h = POS_H(1);
+ sizeEx = POS_H(1);
+ };
+ class AddonsList: RscCombo {
+ idc = IDC_ADDON_LIST;
+ x = POS_W(4.5);
+ y = POS_H(1);
+ w = POS_W(21);
+ h = POS_H(1);
+ wholeHeight = POS_H(12);
+ };
+ class CA_ValueKeys: RscListNBox {
+ idc = IDC_KEY_LIST;
+ columns[] = {0,0.459459459}; //17/37
+ x = POS_W(0.5);
+ y = POS_H(3.5);
+ w = POS_W(37);
+ h = POS_H(15.8);
+ };
+ class TextAction: RscText {
+ onLoad = "(_this select 0) ctrlSetText toUpper ctrlText (_this select 0)";
+ text = "$STR_A3_RscDisplayConfigure_TextAction";
+ x = POS_W(0.5);
+ y = POS_H(2.5);
+ w = POS_W(17);
+ h = POS_H(1);
+ colorBackground[] = {0,0,0,1};
+ };
+ class TextAssignedKeys: RscText {
+ onLoad = "(_this select 0) ctrlSetText toUpper ctrlText (_this select 0)";
+ text = "$STR_A3_RscDisplayConfigure_TextAssignedKeys";
+ x = POS_W(17.5);
+ y = POS_H(2.5);
+ w = POS_W(20);
+ h = POS_H(1);
+ colorBackground[] = {0,0,0,1};
+ };
+ };
+ };
+ };
+};
diff --git a/addons/keybinding/gui/fnc_onButtonClick_cancel.sqf b/addons/keybinding/gui/fnc_onButtonClick_cancel.sqf
deleted file mode 100644
index ff675639d..000000000
--- a/addons/keybinding/gui/fnc_onButtonClick_cancel.sqf
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-
-GVAR(waitingForInput) = false;
-GVAR(input) = [1, [false, false, false]];
-GVAR(frameNoKeyPress) = diag_frameNo;
-
-nil
diff --git a/addons/keybinding/gui/fnc_onButtonClick_configure.sqf b/addons/keybinding/gui/fnc_onButtonClick_configure.sqf
deleted file mode 100644
index c690e0e5c..000000000
--- a/addons/keybinding/gui/fnc_onButtonClick_configure.sqf
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-// This button, when clicked, toggles between vanilla and addon control config in RscDisplayConfigure.
-disableSerialization;
-private ["_KeyboardGroup", "_MouseGroup", "_addonsGroup", "_toggleButton", "_fakeKeyboardButton", "_keyboardButton", "_mouseButton", "_controllerButton", "_title"];
-// Get button
-params ["_ctrl"];
-// Get dialog
-_display = uiNamespace getVariable "RscDisplayConfigure";
-
-_KeyboardGroup = _display displayctrl 2300;
-_MouseGroup = _display displayctrl 2301;
-_addonsGroup = _display displayctrl 4301;
-_toggleButton = _display displayCtrl 4302;
-_fakeKeyboardButton = _display displayctrl 4303;
-
-_keyboardButton = _display displayctrl 2400;
-_mouseButton = _display displayCtrl 2401;
-_controllerButton = _display displayCtrl 106;
-_title = _display displayCtrl 1000;
-
-// Toggle displayed groups and buttons.
-if !(ctrlEnabled _addonsGroup) then {
- // Hide keyboard group
- _KeyboardGroup ctrlenable false;
- _KeyboardGroup ctrlshow false;
-
- // Hide mouse group
- _MouseGroup ctrlenable false;
- _MouseGroup ctrlshow false;
-
- // Hide Presets button
- _control = _display displayctrl 114;
- _control ctrlenable false;
- _control ctrlshow false;
-
- // Hide Default button
- _control = _display displayctrl 101;
- _control ctrlenable false;
- _control ctrlshow false;
-
- // Hide mouse, keyboard, and controllers buttons
- _mouseButton ctrlenable false;
- _mouseButton ctrlshow false;
- _controllerButton ctrlenable false;
- _controllerButton ctrlshow false;
- _keyboardButton ctrlenable false;
- _keyboardButton ctrlshow false;
-
- // Show fake keyboard button
- _fakeKeyboardButton ctrlShow true;
- _fakeKeyboardButton ctrlEnable true;
-
- // Show Addons group
- _addonsGroup ctrlenable true;
- _addonsGroup ctrlshow true;
-
- // Change button text
- _toggleButton ctrlSetText localize LSTRING(configureBase);
-} else {
- // Switch back to vanilla keyboard config.
- // Hide Addons group
- _addonsGroup ctrlenable false;
- _addonsGroup ctrlshow false;
- _toggleButton ctrlSetText localize LSTRING(configureAddons);
-
- //--- Enable Keyboard
- _KeyboardGroup ctrlenable true;
- _KeyboardGroup ctrlshow true;
-
- //--- Disable Mouse
- _MouseGroup ctrlenable false;
- _MouseGroup ctrlshow false;
-
- // Hide fake keyboard button
- _fakeKeyboardButton ctrlShow false;
- _fakeKeyboardButton ctrlEnable false;
-
- // Terminate any waiting input actions
- GVAR(waitingForInput) = false;
- GVAR(input) = [];
-
- // Show mouse, keyboard, and controllers buttons
- _mouseButton ctrlenable true;
- _mouseButton ctrlshow true;
- _controllerButton ctrlenable true;
- _controllerButton ctrlshow true;
- _keyboardButton ctrlenable true;
- _keyboardButton ctrlshow true;
-
- //--- Show Presets button
- _control = _display displayctrl 114;
- _control ctrlenable true;
- _control ctrlshow true;
-
- //--- Hide Default button
- _control = _display displayctrl 101;
- _control ctrlenable false;
- _control ctrlshow false;
-};
diff --git a/addons/keybinding/gui/fnc_onButtonClick_default.sqf b/addons/keybinding/gui/fnc_onButtonClick_default.sqf
deleted file mode 100644
index ecf4b0d8b..000000000
--- a/addons/keybinding/gui/fnc_onButtonClick_default.sqf
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-private ["_display", "_combo", "_comboMod", "_lnb", "_lnbIndex", "_actionId", "_modId", "_modRegistry", "_actionEntryId", "_actionEntry", "_hashDown", "_entryIndex", "_defaultEntry"];
-// Get button
-params ["_button"];
-// Get dialog
-_display = uiNamespace getVariable "RscDisplayConfigure";
-
-_combo = _display displayCtrl 208;
-// Get the mod selected in the comobo
-_comboMod = _combo lbData (lbCurSel _combo);
-
-// Get listnbox
-_lnb = _display displayCtrl 202;
-// Get currently selected index
-_lnbIndex = lnbCurSelRow _lnb;
-// Get handler tracker index array for keys stored in listbox data string
-_actionId = _lnb lnbData [_lnbIndex, 0];
-
-_modId = (GVAR(handlers) select 0) find _comboMod;
-if(_modId == -1) exitWith {};
-
-_modRegistry = (GVAR(handlers) select 1) select _modId;
-
-_actionEntryId = (_modRegistry select 0) find _actionId;
-if(_actionEntryId == -1) exitWith {};
-_actionEntry = (_modRegistry select 1) select _actionEntryId;
-
-_hashDown = format["%1_%2_down", _comboMod, _actionId];
-_entryIndex = (GVAR(defaultKeybinds) select 0) find _hashDown;
-if(_entryIndex == -1) exitWith {};
-_defaultEntry = (GVAR(defaultKeybinds) select 1) select _entryIndex;
-
-
-[
- _comboMod,
- _actionId,
- _actionEntry select 0,
- _defaultEntry select 0,
- _defaultEntry select 1,
- _actionEntry select 2,
- _defaultEntry select 2,
- _defaultEntry select 3,
- true
-] call cba_fnc_addKeybind;
-
-// Clear any input actions.
-GVAR(waitingForInput) = false;
-
-// Update the main dialog.
-[] call FUNC(updateGUI);
diff --git a/addons/keybinding/gui/fnc_onButtonClick_delete.sqf b/addons/keybinding/gui/fnc_onButtonClick_delete.sqf
deleted file mode 100644
index 036f2af46..000000000
--- a/addons/keybinding/gui/fnc_onButtonClick_delete.sqf
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-private ["_display", "_combo", "_comboMod", "_lnb", "_lnbIndex", "_actionId", "_modId", "_modRegistry", "_actionEntryId", "_actionEntry", "_hashDown", "_entryIndex", "_defaultEntry"]
-// Get button
-params ["_button"];
-// Get dialog
-_display = uiNamespace getVariable "RscDisplayConfigure";
-
-_combo = _display displayCtrl 208;
-// Get the mod selected in the comobo
-_comboMod = _combo lbData (lbCurSel _combo);
-
-// Get listnbox
-_lnb = _display displayCtrl 202;
-// Get currently selected index
-_lnbIndex = lnbCurSelRow _lnb;
-// Get handler tracker index array for keys stored in listbox data string
-_actionId = _lnb lnbData [_lnbIndex, 0];
-
-_modId = (GVAR(handlers) select 0) find _comboMod;
-if(_modId == -1) exitWith {};
-
-_modRegistry = (GVAR(handlers) select 1) select _modId;
-
-_actionEntryId = (_modRegistry select 0) find _actionId;
-if(_actionEntryId == -1) exitWith {};
-_actionEntry = (_modRegistry select 1) select _actionEntryId;
-
-_hashDown = format["%1_%2_down", _comboMod, _actionId];
-_entryIndex = (GVAR(defaultKeybinds) select 0) find _hashDown;
-if(_entryIndex == -1) exitWith {};
-_defaultEntry = (GVAR(defaultKeybinds) select 1) select _entryIndex;
-
-
-[
- _comboMod,
- _actionId,
- _actionEntry select 0,
- _defaultEntry select 0,
- _defaultEntry select 1,
- [-1,[false,false,false]],
- _defaultEntry select 2,
- _defaultEntry select 3,
- true
-] call cba_fnc_addKeybind;
-
-// Clear any input actions.
-GVAR(waitingForInput) = false;
-
-// Update the main dialog.
-[] call FUNC(updateGUI);
diff --git a/addons/keybinding/gui/fnc_onComboChanged.sqf b/addons/keybinding/gui/fnc_onComboChanged.sqf
deleted file mode 100644
index 5fcb8628d..000000000
--- a/addons/keybinding/gui/fnc_onComboChanged.sqf
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-
-// Update the main dialog.
-[] call FUNC(updateGUI);
diff --git a/addons/keybinding/gui/fnc_onKeyDown.sqf b/addons/keybinding/gui/fnc_onKeyDown.sqf
deleted file mode 100644
index 05a15d539..000000000
--- a/addons/keybinding/gui/fnc_onKeyDown.sqf
+++ /dev/null
@@ -1,95 +0,0 @@
-//#define DEBUG_MODE_FULL
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-// GVAR()
-
-disableSerialization;
-params ["_display", "_dikCode", "_shift", "_ctrl", "_alt"];
-
-if(_dikCode == 0) exitWith {false};
-
-
-if (GVAR(waitingForInput)) then {
-
- // Check for firstKey
- if (count GVAR(firstKey)<1) then {
-
- TRACE_4("KEY DOWN: Update Input",_dikCode,_shift,_ctrl,_alt);
- TRACE_4("KEY DOWN: 1st Key Before",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- GVAR(firstKey) = [];
- if(!(_dikCode in GVAR(firstKey))) then {
- GVAR(firstKey) pushBack _dikCode;
- };
- _shift = false;
- _ctrl = false;
- _alt = false;
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) = [_dikCode, [_shift, _ctrl, _alt]];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- TRACE_4("KEY DOWN: 1st Key After",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- TRACE_4("KEY DOWN: Update Modifiers",_dikCode,_shift,_ctrl,_alt);
-
- } else {
-
- // Check for secondKey
- if (count GVAR(firstKey)>0 && {(count GVAR(secondKey)<1)}) then {
- // Check for secondKey only when firstKey is detected
- TRACE_4("KEY DOWN: Update Input",_dikCode,_shift,_ctrl,_alt);
- TRACE_4("KEY DOWN: 2nd Key Before",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
-
- if(!(_dikCode in GVAR(firstKey))) then {
- GVAR(secondKey) = [_dikCode];
- if (GVAR(frameNoKeyPress) != diag_frameNo || _shift || _ctrl || _alt) then {
- GVAR(input) = [_dikCode, [_shift, _ctrl, _alt]];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- };
-
- TRACE_4("KEY DOWN: 2nd Key After",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- TRACE_4("KEY DOWN: Update Modifiers",_dikCode,_shift,_ctrl,_alt);
-
- } else {
- // Check for thirdKey
- if (count GVAR(secondKey)>0 && {count GVAR(firstKey)>0}) then {
- // Check for ThirdKey only when first and Second Key is detected
- TRACE_4("KEY DOWN: Update Input",_dikCode,_shift,_ctrl,_alt);
- TRACE_4("KEY DOWN: 3rd Key Before",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
-
- if( ( !(_dikCode in GVAR(secondKey)) && { !(_dikCode in GVAR(firstKey)) })) then {
- GVAR(thirdKey) = [_dikCode];
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) = [_dikCode, [_shift, _ctrl, _alt]];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- };
- TRACE_4("KEY DOWN: 3rd Key After",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- TRACE_4("KEY DOWN: Update Modifiers",_dikCode,_shift,_ctrl,_alt);
- };
- };
- };
-
-
-
-};
-
-
-TRACE_1("KEY DOWN: Checking Current Input",GVAR(input));
-private "_return";
-// Prevent key passthrough when waiting for input for binding (to prevent escape).
-_return = false;
-if (GVAR(waitingForInput)) then {
- _return = true;
-};
-
-if (_dikCode == 1 && !GVAR(waitingForInput)) then {
- // Esc was pressed to close menu, revert changes.
- [] call FUNC(onButtonClick_cancel);
-} else {
- if(_dikCode == 1) then {
- GVAR(waitingForInput) = false;
- };
-};
-
-
-_return;
diff --git a/addons/keybinding/gui/fnc_onKeyDownNextGen.sqf b/addons/keybinding/gui/fnc_onKeyDownNextGen.sqf
deleted file mode 100644
index 267c9adfe..000000000
--- a/addons/keybinding/gui/fnc_onKeyDownNextGen.sqf
+++ /dev/null
@@ -1,97 +0,0 @@
-#define DEBUG_MODE_FULL
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-
-// GVAR()
-
-disableSerialization;
-params ["_display", "_dikCode", "_shift", "_ctrl", "_alt"];
-
-if(_dikCode == 0) exitWith {false};
-
-
-if (GVAR(waitingForInput)) then {
-
- // Check for firstKey
-
- if (count GVAR(firstKey)<1) then {
-
- TRACE_4("KEY DOWN: Update Input",_dikCode,_shift,_ctrl,_alt);
- TRACE_4("KEY DOWN: 1st Key Before",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- GVAR(firstKey) = [];
- if(!(_dikCode in GVAR(firstKey))) then {
- GVAR(firstKey) pushBack _dikCode;
- };
- _shift = false;
- _ctrl = false;
- _alt = false;
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) = [_dikCode, [_shift, _ctrl, _alt]];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- TRACE_4("KEY DOWN: 1st Key After",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- TRACE_4("KEY DOWN: Update Modifiers",_dikCode,_shift,_ctrl,_alt);
-
- } else{
-
- // Check for secondKey
- if (count GVAR(firstKey)>0 && {(count GVAR(secondKey)<1)}) then {
- // Check for secondKey only when firstKey is detected
- TRACE_4("KEY DOWN: Update Input",_dikCode,_shift,_ctrl,_alt);
- TRACE_4("KEY DOWN: 2nd Key Before",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
-
- if(!(_dikCode in GVAR(firstKey))) then {
- GVAR(secondKey) = [_dikCode];
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) = [_dikCode, [_shift, _ctrl, _alt]];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- };
-
- TRACE_4("KEY DOWN: 2nd Key After",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- TRACE_4("KEY DOWN: Update Modifiers",_dikCode,_shift,_ctrl,_alt);
-
- } else {
- // Check for thirdKey
- if (count GVAR(secondKey)>0 && {count GVAR(firstKey)>0}) then {
- // Check for ThirdKey only when first and Second Key is detected
- TRACE_4("KEY DOWN: Update Input",_dikCode,_shift,_ctrl,_alt);
- TRACE_4("KEY DOWN: 3rd Key Before",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
-
- if( ( !(_dikCode in GVAR(secondKey)) && { !(_dikCode in GVAR(firstKey)) })) then {
- GVAR(thirdKey) = [_dikCode];
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) = [_dikCode, [_shift, _ctrl, _alt]];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- };
- TRACE_4("KEY DOWN: 3rd Key After",GVAR(firstKey),GVAR(secondKey),GVAR(thirdKey), GVAR(input));
- TRACE_4("KEY DOWN: Update Modifiers",_dikCode,_shift,_ctrl,_alt);
- };
- };
- };
-
-
-
-};
-
-
-TRACE_1("KEY DOWN: Checking Current Input",GVAR(input));
-private "_return";
-// Prevent key passthrough when waiting for input for binding (to prevent escape).
-_return = false;
-if (GVAR(waitingForInput)) then {
- _return = true;
-};
-
-if (_dikCode == 1 && !GVAR(waitingForInput)) then {
- // Esc was pressed to close menu, revert changes.
- [] call FUNC(onButtonClick_cancel);
-} else {
- if(_dikCode == 1) then {
- GVAR(waitingForInput) = false;
- };
-};
-
-
-_return;
diff --git a/addons/keybinding/gui/fnc_onKeyUp.sqf b/addons/keybinding/gui/fnc_onKeyUp.sqf
deleted file mode 100644
index 6139186b4..000000000
--- a/addons/keybinding/gui/fnc_onKeyUp.sqf
+++ /dev/null
@@ -1,77 +0,0 @@
-//#define DEBUG_MODE_FULL
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-params ["_display", "_dikCode"];
-
-TRACE_1("KEY UP",_dikCode);
-TRACE_5("KEY UP",GVAR(modifiers), GVAR(input), GVAR(firstKey), GVAR(secondKey),GVAR(thirdKey));
-
-if(_dikCode == 0) exitWith {false};
-if((count GVAR(firstKey)) > 0) then {
-
- if(_dikCode in GVAR(firstKey) && { (count GVAR(input)) > 0 }) then {
-
- _dikCode = GVAR(firstKey) select 0;
-
- GVAR(firstKey) = GVAR(firstKey);
-
- TRACE_2("KEY UP: 1st key After",GVAR(firstKey), GVAR(input));
- };
-};
-
-TRACE_5("KEY UP",GVAR(modifiers), GVAR(input), GVAR(firstKey), GVAR(secondKey),GVAR(thirdKey));
-//if GVAR(secondKey) is empty then this is a Single-Key Event
-if ( (count GVAR(secondKey)) < 1 ) then {
- GVAR(secondKey) = GVAR(firstKey);
- GVAR(firstKey) = [];
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(secondKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
-} else {
-
- // Check for secondKey
- if (count GVAR(firstKey)>0 && {(count GVAR(secondKey)<1)}) then {
- // if it is a Multiple-Key Event then modifiers must be recorded.
-
- TRACE_1("KEY UP: Update Modifiers before",_dikCode);
- TRACE_2("KEY UP: 2nd key Before",GVAR(secondKey), GVAR(input));
-
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(secondKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
-
- TRACE_1("KEY UP: Update modifiers after",_dikCode);
- TRACE_2("KEY UP: 2nd key After",GVAR(secondKey), GVAR(input));
- } else {
- // Check for thirdKey
- if (count GVAR(secondKey)>0 && {count GVAR(firstKey)>0}) then {
- // if it is a Multiple-Key Event then modifiers must be recorded.
- TRACE_1("KEY UP: Update Modifiers before",_dikCode);
- TRACE_2("KEY UP: 3rd Key Before",GVAR(thirdKey), GVAR(input));
-
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(thirdKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
- TRACE_1("KEY UP: Update modifiers after",_dikCode);
- TRACE_2("KEY UP: Third key After",GVAR(thirdKey), GVAR(input));
- };
- };
-};
-
-if (count GVAR(thirdKey) < 1) then {
- GVAR(thirdKey) = [_dikCode];
-};
-
-if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(thirdKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
-};
-TRACE_5("KEY UP",GVAR(modifiers), GVAR(input), GVAR(firstKey), GVAR(secondKey), GVAR(thirdKey));
-GVAR(modifiers) = GVAR(firstKey) + GVAR(secondKey);
-TRACE_1("KEY UP: Modifires",_dikCode);
-TRACE_2("KEY UP: final",GVAR(modifiers), GVAR(input));
-false;
diff --git a/addons/keybinding/gui/fnc_onKeyUpNextGen.sqf b/addons/keybinding/gui/fnc_onKeyUpNextGen.sqf
deleted file mode 100644
index 1e4b3b2cd..000000000
--- a/addons/keybinding/gui/fnc_onKeyUpNextGen.sqf
+++ /dev/null
@@ -1,77 +0,0 @@
-#define DEBUG_MODE_FULL
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-params ["_display", "_dikCode"];
-
-TRACE_1("KEY UP",_dikCode);
-TRACE_5("KEY UP",GVAR(modifiers), GVAR(input), GVAR(firstKey), GVAR(secondKey),GVAR(thirdKey));
-
-if(_dikCode == 0) exitWith {false};
-if((count GVAR(firstKey)) > 0) then {
-
- if(_dikCode in GVAR(firstKey) && { (count GVAR(input)) > 0 }) then {
-
- _dikCode = GVAR(firstKey) select 0;
-
- GVAR(firstKey) = GVAR(firstKey);
-
- TRACE_2("KEY UP: 1st key After",GVAR(firstKey), GVAR(input));
- };
-};
-
-TRACE_5("KEY UP",GVAR(modifiers), GVAR(input), GVAR(firstKey), GVAR(secondKey),GVAR(thirdKey));
-//if GVAR(secondKey) is empty then this is a Single-Key Event
-if ( (count GVAR(secondKey)) < 1 ) then {
- GVAR(secondKey) = GVAR(firstKey);
- GVAR(firstKey) = [];
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(secondKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
-
-} else {
-
- // Check for secondKey
- if (count GVAR(firstKey)>0 && {(count GVAR(secondKey)<1)}) then {
- // if it is a Multiple-Key Event then modifiers must be recorded.
-
- TRACE_1("KEY UP: Update Modifiers before",_dikCode);
- TRACE_2("KEY UP: 2nd key Before",GVAR(secondKey), GVAR(input));
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(secondKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
-
- TRACE_1("KEY UP: Update modifiers after",_dikCode);
- TRACE_2("KEY UP: 2nd key After",GVAR(secondKey), GVAR(input));
- } else {
- // Check for thirdKey
- if (count GVAR(secondKey)>0 && {count GVAR(firstKey)>0}) then {
- // if it is a Multiple-Key Event then modifiers must be recorded.
- TRACE_1("KEY UP: Update Modifiers before",_dikCode);
- TRACE_2("KEY UP: 3rd Key Before",GVAR(thirdKey), GVAR(input));
- if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(thirdKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
- };
-
- TRACE_1("KEY UP: Update modifiers after",_dikCode);
- TRACE_2("KEY UP: Third key After",GVAR(thirdKey), GVAR(input));
- };
- };
-};
-
-if (count GVAR(thirdKey) < 1) then {
- GVAR(thirdKey) = [_dikCode];
-};
-
-if (!(GVAR(frameNoKeyPress) == diag_frameNo) || (_shift || _ctrl || _alt)) then {
- GVAR(input) set [0, GVAR(thirdKey) select 0];
- GVAR(frameNoKeyPress) = diag_frameNo;
-};
-TRACE_5("KEY UP",GVAR(modifiers), GVAR(input), GVAR(firstKey), GVAR(secondKey), GVAR(thirdKey));
-GVAR(modifiers) = GVAR(firstKey) + GVAR(secondKey);
-TRACE_1("KEY UP: Modifires",_dikCode);
-TRACE_2("KEY UP: final",GVAR(modifiers), GVAR(input));
-false;
diff --git a/addons/keybinding/gui/fnc_onLBDblClick.sqf b/addons/keybinding/gui/fnc_onLBDblClick.sqf
deleted file mode 100644
index a15cacdde..000000000
--- a/addons/keybinding/gui/fnc_onLBDblClick.sqf
+++ /dev/null
@@ -1,94 +0,0 @@
-//#define DEBUG_MODE_FULL
-#include "\x\cba\addons\keybinding\script_component.hpp"
-
-disableSerialization;
-private ["_display", "_lnb", "_lnbIndex", "_combo", "_comboMod", "_actionId"];
-_display = uiNamespace getVariable "RscDisplayConfigure";
-
-// Get listnbox
-_lnb = _display displayCtrl 202;
-// Get currently selected index
-_lnbIndex = lnbCurSelRow _lnb;
-// Get combobox
-_combo = _display displayCtrl 208;
-// Get the mod selected in the comobo
-_comboMod = _combo lbData (lbCurSel _combo);
-
-// Don't allow multiple keys to be changed at once.
-if (GVAR(waitingForInput)) exitWith {};
-
-// Get handler tracker index array for keys stored in listbox data string
-_actionId = _lnb lnbData [_lnbIndex, 0];
-
-
-
-// Clear keypress data.
-GVAR(input) = [];
-GVAR(frameNoKeyPress) = diag_frameNo;
-
-GVAR(modifiers) = [];
-GVAR(firstKey) = [];
-GVAR(secondKey) = [];
-GVAR(thirdKey) = [];
-
-// Mark that we're waiting so that onKeyDown handler blocks input (Esc key)
-GVAR(waitingForInput) = true;
-
-// Update box content to indicate that we're waiting for input.
-_lnb lnbSetText [[_lnbIndex, 1], "Press key or Esc to cancel"];
-_lnb lnbSetColor [[_lnbIndex, 1], [0,1,0,1]];
-
-// Wait for input, selection, or mod change.
-_fnc = {
- params ["_args", "_idPFH"];
- _args params ["_actionId", "_lnb", "_lnbIndex", "_comboMod", "_combo", "_display"];
- if (count GVAR(thirdKey) > 0 || !GVAR(waitingForInput) || lnbCurSelRow _lnb != _lnbIndex || _comboMod != (_combo lbData (lbCurSel _combo))) then {
- if ((GVAR(input) select 0) in GVAR(forbiddenKeys)) exitWith {};
- [_idPFH] call cba_fnc_removePerFrameHandler;
- if (GVAR(waitingForInput)) then {
- // Tell the onKeyDown handler that we're not waiting anymore, so it stops blocking input.
- GVAR(waitingForInput) = false;
-
- if (!isNull _display) then { // Make sure user hasn't exited dialog before continuing.
- private ["_newKeycode", "_modId", "_modRegistry", "_actionEntryId", "_actionEntry", "_hashDown", "_entryIndex", "_defaultEntry"];
- // Get stored keypress data.
- if (GVAR(frameNoKeyPress) == diag_frameNo) exitWith {};
- _newKeycode = GVAR(input);
- TRACE_4("",_newKeycode,GVAR(handlers),_comboMod,GVAR(defaultKeybinds));
- // If a valid key other than Escape was pressed,
- if (_newKeycode select 0 != 1) then {
- _modId = (GVAR(handlers) select 0) find _comboMod;
- if(_modId == -1) exitWith {};
-
- _modRegistry = (GVAR(handlers) select 1) select _modId;
-
- _actionEntryId = (_modRegistry select 0) find _actionId;
- if(_actionEntryId == -1) exitWith {};
- _actionEntry = (_modRegistry select 1) select _actionEntryId;
-
- _hashDown = format["%1_%2_down", _comboMod, _actionId];
- _entryIndex = (GVAR(defaultKeybinds) select 0) find _hashDown;
- if(_entryIndex == -1) exitWith {};
- _defaultEntry = (GVAR(defaultKeybinds) select 1) select _entryIndex;
-
- [
- _comboMod,
- _actionId,
- _actionEntry select 0,
- _defaultEntry select 0,
- _defaultEntry select 1,
- _newKeycode,
- _defaultEntry select 2,
- _defaultEntry select 3,
- true
- ] call cba_fnc_addKeybind;
- // Update the main dialog.
- saveProfileNamespace;
- };
-
- };
- };
- [] call FUNC(updateGUI);
- };
-};
-[_fnc, 0, [_actionId, _lnb, _lnbIndex, _comboMod, _combo, _display]] call cba_fnc_addPerFrameHandler;
diff --git a/addons/keybinding/gui/fnc_updateGUI.sqf b/addons/keybinding/gui/fnc_updateGUI.sqf
deleted file mode 100644
index 868adf58a..000000000
--- a/addons/keybinding/gui/fnc_updateGUI.sqf
+++ /dev/null
@@ -1,131 +0,0 @@
-//#define DEBUG_MODE_FULL
-#include "\x\cba\addons\keybinding\script_component.hpp"
-private ["_firstRun", "_display", "_combo", "_lnb", "_modName", "_modActions"];
-disableSerialization;
-
-
-// Pass any parameter to the function for full initialization behavior.
-_firstRun = (count _this == 1);
-
-_display = uiNamespace getVariable "RscDisplayConfigure";
-
-if !(isNull _display) then {
- _combo = _display displayCtrl 208;
- _lnb = _display displayCtrl 202;
-
- _lnb ctrlSetTooltipColorShade [0,0,0,0.5];
-
- // First run only actions.
- if (_firstRun) then {
- lbClear _combo;
-
- {
- private _addonInfo = GVAR(activeMods) getVariable _x;
- private _addonName = GVAR(modPrettyNames) getVariable [_x, _addonInfo select 0];
-
- _combo lbSetData [_combo lbAdd _addonName, _x];
- } forEach allVariables GVAR(activeMods);
-
- lbSort _combo;
- _combo lbSetCurSel 0;
- };
-
- // Fill the listnbox with actions.
- if (count allVariables GVAR(activeMods) > 0) then {
- // Get the selected mod.
- _modName = _combo lbData (lbCurSel _combo);
- // Get the actions associated with the current mod.
- _modActions = GVAR(activeMods) getVariable _modName select 1;
-
- // Clear the listbox.
- lnbClear _lnb;
-
- // Add the actions to the listbox and associate their data.
- // of keybinds due to keyup/keydown.
- {
- private ["_actionId", "_action", "_keybind", "_isDuplicated", "_dupeActionName", "_lbCount", "_indexArray"];
- _actionId = _x;
- if((toLower format ["%1$%2", _modName, _actionId]) in allVariables GVAR(activeBinds)) then {
- _action = GVAR(activeBinds) getVariable format ["%1$%2", _modName, _actionId];
- _action params ["_displayName", "_tooltip", "_registryKeybinds"];
- _keybind = _registryKeybinds select 0;
-
- TRACE_4("",_modName,_action,_displayName,_keybind);
- if(IS_ARRAY(_keybind) && {IS_ARRAY(_keybind select 1)}) then {
- _keybind params ["_key", "_modifier"];
- _modifier params ["_shift", "_ctrl", "_alt"];
-
- // Try to convert dik code to a human key code.
- private _keyName = GVAR(keyNames) getVariable str _key;
-
- if (isNil "_keyName") then {
- _keyName = format [localize LSTRING(unkownKey), _key];
- };
-
- // Build the full key combination name.
- if (_shift && {!(_key in [DIK_LSHIFT, DIK_RSHIFT])}) then {
- _keyName = localize "str_dik_shift" + "+" + _keyName;
- };
-
- if (_alt && {!(_key in [DIK_LMENU, DIK_RMENU])}) then {
- _keyName = localize "str_dik_alt" + "+" + _keyName;
- };
-
- if (_ctrl && {!(_key in [DIK_LCONTROL, DIK_RCONTROL])}) then {
- _keyName = localize "str_dik_control" + "+" + _keyName;
- };
-
- // Add quotes around whole string.
- if (_keyName != "") then {
- _keyName = str _keyName;
- };
-
- TRACE_1("",_keyName);
- // Search the handler array for any other keybinds using this key.
- _isDuplicated = false;
- if (_key > 0) then {
- _dupeActionName = "";
- {
- private _dupeActionId = _x;
- private _dupeKeybinds = GVAR(activeBinds) getVariable format ["%1$%2", _modName, _dupeActionId] select 2;
-
- if (_keybind in _dupeKeybinds && {_actionId != _dupeActionId}) exitWith {
- _isDuplicated = true;
- _dupeActionName = GVAR(activeBinds) getVariable format ["%1$%2", _modName, _dupeActionId] select 0;
- };
- } forEach _modActions;
-
- if (_isDuplicated) then {
- // Add the name of the action that dupes the keybinding to the
- // end of the readable bind string.
- _keyName = format ["%1 [%2]", _keyName, _dupeActionName];
- };
- } else {
- //(dikCode <= 0): so it's unbound, leave string blank
- _keyName = "";
- };
-
- // Add the row.
- _lbCount = _lnb lnbAddRow [_displayName, _keyName];
- _lnb lbSetTooltip [2*_lbCount, _toolTip];
- _lnb lbSetTooltip [2*_lbCount + 1, _toolTip];
-
- // Format the array containing the indexes referred to by the action name.
- // It is stored as a string.
- _indexArray = [_index];
- if (_foundIndex > -1) then {
- _indexArray pushBack _foundIndex;
- };
-
- // Set row data to the index of the action in the handler tracker.
- _lnb lnbSetData [[_lbCount, 0], _actionId];
-
- // Set the row color to red if a duplicate keybind exists.
- if (_isDuplicated) then {
- _lnb lnbSetColor [[_lbCount, 1], [1,0,0,1]];
- };
- };
- };
- } foreach _modActions;
- };
-};
diff --git a/addons/keybinding/gui/gui.hpp b/addons/keybinding/gui/gui.hpp
deleted file mode 100644
index e69ac530c..000000000
--- a/addons/keybinding/gui/gui.hpp
+++ /dev/null
@@ -1,174 +0,0 @@
-#define true 1
-#define false 0
-
-// Import needed base classes.
-class RscText;
-class RscVignette;
-class RscControlsGroup {
- class VScrollbar;
- class HScrollbar;
-};
-class RscControlsGroupNoScrollbars;
-class RscFrame;
-class RscTitle;
-class RscButtonMenu;
-class RscButtonMenuCancel;
-class RscButtonMenuOK;
-class RscCombo;
-class RscListBox;
-class RscListNBox;
-class RscListBoxKeys;
-
-///////////////////////////////////////////////////////////////////////////////
-// ADD CONFIGURE ADDONS BUTTON TO DEFAULT CONTROLS DIALOG
-// !!! This overloads the BI onLoad value !!!
-///////////////////////////////////////////////////////////////////////////////
-
-class RscDisplayConfigure {
- class controls {
- class CA_ButtonCancel: RscButtonMenuCancel {
- onButtonClick = "_this call cba_keybinding_fnc_onButtonClick_cancel";
- };
-
- class CBA_ButtonConfigureAddons : RscButtonMenuOK {
- idc = 4302;
- text = CSTRING(configureAddons);
- onButtonClick = "_this call cba_keybinding_fnc_onButtonClick_configure";
- x = "20.15 * (((safezoneW / safezoneH) min 1.2) / 40) + safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2";
- y = "23 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
- w = "12.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
-
- class CBA_FakeButtonKeyboard: RscButtonMenu
- {
- idc = 4303;
- text = "$STR_A3_RscDisplayConfigure_ButtonKeyboard";
- x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2";
- y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
- w = "8 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
-
- class CBA_AddonsGroup : RscControlsGroup {
- class VScrollbar : VScrollbar {
- width = 0;
- };
- class HScrollbar : HScrollbar {
- height = 0;
- };
- idc = 4301;
- enableDisplay = 0;
- x = "1 * (((safezoneW / safezoneH) min 1.2) / 40) + safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2";
- y = "3.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
- w = "38 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "19.6 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
-
- class controls {
- class CBA_AddonsEmptyText : RscText {
- idc = -1;
- type = 0;
- x = "0 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "0 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "1 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- text = "";
- };
- class CBA_AddonsEmptyBackground : RscText {
- idc = -1;
- type = 0;
- text = "";
- colorBackground[] = {0,0,0,0.4};
- x = "0.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "3.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "35 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "13.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
- class CBA_AddonsCA_ControlsPageText : RscText {
- sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
- style = 1;
- idc = 2002;
- text = "Addon:";
- x = "0.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "4 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
- class CBA_AddonsCA_ControlsPage : RscCombo {
- idc = 208;
- linespacing = 1;
- text = "";
-
- onLBSelChanged = "_this call cba_keybinding_fnc_onComboChanged";
-
- wholeHeight = "12 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- x = "4.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "21 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
- class CBA_AddonsCA_ValueKeys : RscListNBox {
- idc = 202;
- columns[] = {0,0.54285};
- drawSideArrows = false;
- idcLeft = -1;
- idcRight = -1;
-
- onLBDblClick = "_this call cba_keybinding_fnc_onLBDblClick";
-
- rowHeight = 0.042;
- x = "0.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "3.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "35 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "13.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
- class CBA_AddonsTextAction : RscText {
- idc = 2003;
- text = "$STR_A3_RscDisplayConfigure_TextAction";
- x = "0.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "19 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- colorBackground[] = {0,0,0,1};
- };
- class CBA_AddonsTextAssignedKeys : RscText {
- idc = 2004;
- text = "$STR_A3_RscDisplayConfigure_TextAssignedKeys";
- x = "19.48 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "16 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- colorBackground[] = {0,0,0,1};
- };
- class CBA_B_Delete : RscButtonMenu {
- idc = 204;
- text = "$STR_DISP_DELETE";
- x = "6.85 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "17.45 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "6.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
-
- onButtonClick = "_this call cba_keybinding_fnc_onButtonClick_delete";
- };
- class CBA_ButtonDefault : RscButtonMenu {
- idc = 205;
- text = "$STR_DISP_DEFAULT";
- x = "0.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "17.45 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "6.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
-
- onButtonClick = "_this call cba_keybinding_fnc_onButtonClick_default";
- };
- class CBA_TextHelp: RscText {
- idc = 206;
- text = ""; // Set in script to avoid automatic uppercasing
- x = "13.5 * (((safezoneW / safezoneH) min 1.2) / 40)";
- y = "17.45 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- w = "21 * (((safezoneW / safezoneH) min 1.2) / 40)";
- h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
- };
- };
- };
- };
-};
diff --git a/addons/keybinding/script_component.hpp b/addons/keybinding/script_component.hpp
index f78e44766..d44b98543 100644
--- a/addons/keybinding/script_component.hpp
+++ b/addons/keybinding/script_component.hpp
@@ -1,10 +1,5 @@
#define COMPONENT keybinding
#include "\x\cba\addons\main\script_mod.hpp"
-#include "\x\cba\addons\main\script_macros.hpp"
-
-#include "\a3\ui_f\hpp\defineDIKCodes.inc"
-
-//#define DEBUG_ENABLED_KEYBINDING
#ifdef DEBUG_ENABLED_KEYBINDING
#define DEBUG_MODE_FULL
@@ -14,10 +9,22 @@
#define DEBUG_SETTINGS DEBUG_SETTINGS_KEYBINDING
#endif
-#define PATHTO_SUB(var1,var2,var3,var4) MAINPREFIX\##var1\SUBPREFIX\##var2\##var3\##var4.sqf
-#define COMPILE_FILE_SUB(var1,var2,var3,var4) COMPILE_FILE2(PATHTO_SUB(var1,var2,var3,var4))
-#define PREP_SYS_SUB(var1,var2,var3,var4) ##var1##_##var2##_fnc_##var4 = COMPILE_FILE_SUB(var1,var2,var3,DOUBLES(fnc,var4))
-#define PREP_SUB(var1,var2) PREP_SYS_SUB(PREFIX,COMPONENT_F,var1,var2)
+#include "\x\cba\addons\main\script_macros.hpp"
+
+#include "\a3\ui_f\hpp\defineCommonGrids.inc"
+#include "\a3\ui_f\hpp\defineDIKCodes.inc"
+#include "\a3\ui_f\hpp\defineResincl.inc"
+
+#define IDC_ADDONS_GROUP 4301
+#define IDC_BTN_CONFIGURE_ADDONS 4302
+#define IDC_BTN_KEYBOARD_FAKE 8000
+#define IDC_ADDON_LIST 9000
+#define IDC_KEY_LIST 9001
+
+#define POS_X(N) ((N) * GUI_GRID_W + GUI_GRID_CENTER_X)
+#define POS_Y(N) ((N) * GUI_GRID_H + GUI_GRID_CENTER_Y)
+#define POS_W(N) ((N) * GUI_GRID_W)
+#define POS_H(N) ((N) * GUI_GRID_H)
#define DIK_XBOX_A 327680
#define DIK_XBOX_B 327681
diff --git a/addons/keybinding/stringtable.xml b/addons/keybinding/stringtable.xml
index 0cb895cb1..b8a4ae084 100644
--- a/addons/keybinding/stringtable.xml
+++ b/addons/keybinding/stringtable.xml
@@ -1,34 +1,25 @@
-
-
-
- Community Base Addons - Keybinding
- Community Base Addons - キー割り当て
-
-
- Configure Addons
- Konfiguracja addonów
- アドオンの設定
-
-
- Configure Base
- Konfiguracja bazy
- 基本設定
-
-
- Unknown Code %1
- Nieznany klawisz %1
- %1のコードは不明です
-
-
- You must load an intro/world/mission to view/change.
- Musisz wczytać intro/świat/misję by móc zmieniać/podglądać klawisze.
- 閲覧や変更にはイントロかワールド、ミッションを読み込む必要があります。
-
-
- Double click any action to change its binding
- Naciśnij dwukrotnie na daną akcję aby zmienić jej klawisz
- ダブル クリックで割り当てを変更できます
-
-
+
+
+ Community Base Addons - Keybinding
+ Community Base Addons - キー割り当て
+
+
+ Configure Addons
+ Modifikationen anpassen
+ Konfiguracja addonów
+ アドオンの設定
+
+
+ Configure Base
+ Hauptspiel anpassen
+ Konfiguracja bazy
+ 基本設定
+
+
+ Unknown Key %1
+ Unbekannte Taste %1
+ Nieznany klawisz %1
+ %1のコードは不明です
+