2015-01-11 16:42:31 +00:00
|
|
|
// by commy2
|
2015-01-13 21:32:56 +00:00
|
|
|
#include "script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
#define OFFSET_1 100
|
|
|
|
#define OFFSET_2 200
|
|
|
|
|
|
|
|
closeDialog 0;
|
2015-01-11 18:20:14 +00:00
|
|
|
createDialog QGVAR(OptionsMenu_Dialog);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
GVAR(keyNew) = [];
|
|
|
|
GVAR(keySet) = -1;
|
|
|
|
GVAR(keySave) = 0;
|
|
|
|
GVAR(keyNames) = [];
|
|
|
|
GVAR(MenuPage) = 0;
|
|
|
|
GVAR(OptionNames) = [];
|
|
|
|
GVAR(OptionNamesNew) = [];
|
|
|
|
GVAR(OptionStatesNew) = [];
|
|
|
|
|
|
|
|
disableSerialization;
|
2015-01-11 18:20:14 +00:00
|
|
|
_dlgMenuDialog = uiNamespace getVariable QGVAR(MenuDialog);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_ehid_keydown = _dlgMenuDialog displayAddEventHandler ["KeyDown", "_this select 1 > 1"];
|
|
|
|
_ehid_keyup = _dlgMenuDialog displayAddEventHandler ["KeyUp", "_this select 1 > 1"];
|
|
|
|
|
2015-01-15 17:41:22 +00:00
|
|
|
_config = configFile >> "ACE_Default_Keys";
|
2015-01-11 16:42:31 +00:00
|
|
|
_count = count _config;
|
|
|
|
|
|
|
|
_countPages = ceil (_count / 20) + 1;
|
|
|
|
(_dlgMenuDialog displayCtrl 14) ctrlSetText format ["%1/%2", GVAR(MenuPage) + 1, _countPages];
|
|
|
|
|
|
|
|
for "_index" from 0 to (_count - 1 min 19) do {
|
|
|
|
_configFile = _config select _index;
|
|
|
|
_keyName = configName _configFile;
|
|
|
|
_displayName = getText (_configFile >> "displayName");
|
|
|
|
_isDisabled = getNumber (_configFile >> "disabled") == 1;
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
_keyCode = profileNamespace getVariable format ["ACE_Key_%1", _keyName];
|
2015-01-11 18:20:14 +00:00
|
|
|
_description = [_keyCode] call FUNC(revertKeyCodeLocalized);
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
_control1 = _dlgMenuDialog displayCtrl (OFFSET_1 + _index);
|
|
|
|
_control2 = _dlgMenuDialog displayCtrl (OFFSET_2 + _index);
|
|
|
|
|
|
|
|
_control1 ctrlSetText _displayName;
|
|
|
|
_control2 ctrlSetText _description;
|
|
|
|
|
|
|
|
_control1 ctrlShow true;
|
|
|
|
_control2 ctrlShow true;
|
|
|
|
|
|
|
|
GVAR(keyNames) set [_index, _keyName];
|
|
|
|
};
|
|
|
|
|
|
|
|
for "_index" from _count to 19 do {
|
|
|
|
_control1 = _dlgMenuDialog displayCtrl (OFFSET_1 + _index);
|
|
|
|
_control2 = _dlgMenuDialog displayCtrl (OFFSET_2 + _index);
|
|
|
|
|
|
|
|
_control1 ctrlShow false;
|
|
|
|
_control2 ctrlShow false;
|
|
|
|
};
|
|
|
|
|
|
|
|
waitUntil {!dialog};
|
|
|
|
|
|
|
|
_dlgMenuDialog displayRemoveEventHandler ["KeyDown", _ehid_keydown];
|
|
|
|
_dlgMenuDialog displayRemoveEventHandler ["KeyUp", _ehid_keyup];
|
|
|
|
|
|
|
|
if (GVAR(keySave) == 1) then {
|
|
|
|
_count0 = count GVAR(keyNew);
|
|
|
|
|
|
|
|
for "_index" from 0 to (_count0 - 1) do {
|
|
|
|
_key = GVAR(keyNew) select _index;
|
|
|
|
_keyName = _key select 0;
|
|
|
|
_keyCode = _key select 1;
|
|
|
|
|
2015-01-12 04:02:33 +00:00
|
|
|
profileNamespace setVariable [format ["ACE_Key_%1", _keyName], _keyCode];
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
_count1 = count GVAR(OptionNamesNew);
|
|
|
|
|
|
|
|
for "_index" from 0 to (_count1 - 1) do {
|
|
|
|
_name = GVAR(OptionNamesNew) select _index;
|
|
|
|
_state = GVAR(OptionStatesNew) select _index;
|
|
|
|
|
|
|
|
profileNamespace setVariable [_name, _state];
|
|
|
|
};
|
|
|
|
|
|
|
|
if (_count0 > 0 || {_count1 > 0}) then {
|
|
|
|
saveProfileNamespace;
|
2015-01-11 18:20:14 +00:00
|
|
|
[localize QUOTE(DOUBLES(STR,GVAR(ProfileSaved)))] call FUNC(displayTextStructured);
|
2015-01-11 16:42:31 +00:00
|
|
|
} else {
|
2015-01-11 18:20:14 +00:00
|
|
|
[localize QUOTE(DOUBLES(STR,GVAR(ProfileNotSaved)))] call FUNC(displayTextStructured);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
} else {
|
2015-01-11 18:20:14 +00:00
|
|
|
[localize QUOTE(DOUBLES(STR,GVAR(ProfileNotSaved)))] call FUNC(displayTextStructured);
|
2015-01-11 16:42:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GVAR(keyNewTemp) = nil;
|
|
|
|
GVAR(keyNames) = nil;
|
|
|
|
GVAR(MenuPage) = nil;
|
|
|
|
GVAR(OptionNames) = nil;
|
|
|
|
GVAR(OptionNamesNew) = nil;
|
|
|
|
GVAR(OptionStatesNew) = nil;
|