diff --git a/addons/arsenal/XEH_PREP.hpp b/addons/arsenal/XEH_PREP.hpp index 6f737aed4c..d0cdae5c6b 100644 --- a/addons/arsenal/XEH_PREP.hpp +++ b/addons/arsenal/XEH_PREP.hpp @@ -5,9 +5,9 @@ PREP(buttonClearAll); PREP(buttonExport); PREP(buttonHide); PREP(buttonImport); +PREP(buttonLoadoutsDelete); PREP(buttonLoadoutsLoad); PREP(buttonLoadoutsSave); -PREP(buttonLoadoutsSaveAs); PREP(buttonLoadoutsShare); PREP(clearSearchbar); PREP(fillLeftPanel); diff --git a/addons/arsenal/defines.hpp b/addons/arsenal/defines.hpp index 5be152560c..f6cc9e5d14 100644 --- a/addons/arsenal/defines.hpp +++ b/addons/arsenal/defines.hpp @@ -99,9 +99,9 @@ #define IDC_centerTitle 301 #define IDC_contentPanel 302 #define IDC_buttonSave 303 -#define IDC_buttonSaveAs 304 -#define IDC_buttonLoad 305 -#define IDC_buttonShare 306 +#define IDC_buttonLoad 304 +#define IDC_buttonShare 305 +#define IDC_buttonDelete 306 #define IDC_buttonMyLoadouts 401 #define IDC_buttonDefaultLoadouts 402 #define IDC_buttonSharedLoadouts 403 @@ -261,3 +261,4 @@ [hmd GVAR(center)],\ [binocular GVAR(center)]\ ] + diff --git a/addons/arsenal/functions/fnc_buttonLoadoutsDelete.sqf b/addons/arsenal/functions/fnc_buttonLoadoutsDelete.sqf new file mode 100644 index 0000000000..af51407759 --- /dev/null +++ b/addons/arsenal/functions/fnc_buttonLoadoutsDelete.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" +#include "..\defines.hpp" + +params ["_display", "_control"]; \ No newline at end of file diff --git a/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf b/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf index f58686b75c..eddb33e101 100644 --- a/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf +++ b/addons/arsenal/functions/fnc_buttonLoadoutsLoad.sqf @@ -6,3 +6,4 @@ params ["_display", "_control"]; systemChat str [_display, _control]; if !(ctrlEnabled _control) exitWith {}; + diff --git a/addons/arsenal/functions/fnc_buttonLoadoutsSave.sqf b/addons/arsenal/functions/fnc_buttonLoadoutsSave.sqf index f58686b75c..9ca160f791 100644 --- a/addons/arsenal/functions/fnc_buttonLoadoutsSave.sqf +++ b/addons/arsenal/functions/fnc_buttonLoadoutsSave.sqf @@ -6,3 +6,9 @@ params ["_display", "_control"]; systemChat str [_display, _control]; if !(ctrlEnabled _control) exitWith {}; + +private _contentPanelCtrl = _display displayCtrl IDC_contentPanel; +private _contentPanelRow = lnbCurSelRow _contentPanelCtrl; +private _loadoutName = _contentPanelCtrl lnbText [_contentPanelRow, 1]; + +profileNamespace setVariable [QGVAR(saved_loadouts), [_loadoutName, getUnitLoadout GVAR(center)]]; \ No newline at end of file diff --git a/addons/arsenal/functions/fnc_buttonLoadoutsSaveAs.sqf b/addons/arsenal/functions/fnc_buttonLoadoutsSaveAs.sqf deleted file mode 100644 index f58686b75c..0000000000 --- a/addons/arsenal/functions/fnc_buttonLoadoutsSaveAs.sqf +++ /dev/null @@ -1,8 +0,0 @@ -#include "script_component.hpp" -#include "..\defines.hpp" - -params ["_display", "_control"]; - -systemChat str [_display, _control]; - -if !(ctrlEnabled _control) exitWith {}; diff --git a/addons/arsenal/functions/fnc_fillLoadoutsList.sqf b/addons/arsenal/functions/fnc_fillLoadoutsList.sqf index 711d7c4f4c..e6b7a750d5 100644 --- a/addons/arsenal/functions/fnc_fillLoadoutsList.sqf +++ b/addons/arsenal/functions/fnc_fillLoadoutsList.sqf @@ -1,2 +1,38 @@ #include "script_component.hpp" -#include "..\defines.hpp" \ No newline at end of file +#include "..\defines.hpp" + +params ["_display", "_control"]; + +private _contentListCtrl = _display displayCtrl IDC_contentPanel; + +_contentListCtrl lnbSetCurSelRow -1; +lnbClear _contentListCtrl; + +private _data = profileNamespace getvariable [QGVAR(saved_loadouts),[]]; + +if (ctrlIDC _control == IDC_buttonMyLoadouts) then { + + { + _x params ["_loadoutName", "_loadoutData"]; + + private _newRow = _contentListCtrl lnbAddRow ["",_loadoutName]; + + _contentListCtrl lnbSetPicture [[_newRow, 2], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 0) select 0) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 3], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 1) select 0) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 4], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 2) select 0) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 5], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 3) select 0) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadoutData select 4) select 0) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadoutData select 5) select 0) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadoutData select 6) >> "picture")]; + _contentListCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadoutData select 7) >> "picture")]; + + if (false) then { + _contentListCtrl lnbSetColor [[_newRow, 0], [1, 1, 1, 0.25]]; + _contentListCtrl lbSetValue [_newRow, -1]; + }; + + _contentListCtrl lnbSort [1, false]; + } foreach _data; +} else { + +}; \ No newline at end of file diff --git a/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf b/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf index e8ef576551..fcc05252d0 100644 --- a/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf +++ b/addons/arsenal/functions/fnc_loadoutsChangeTab.sqf @@ -5,48 +5,33 @@ params ["_display", "_control"]; systemChat str [_display, _control]; -if !(ctrlEnabled _control) exitWith {}; +if !(ctrlEnabled _control || {GVAR(currentLoadoutsTab) == ctrlIDC _control}) exitWith {}; private _centerBoxTitleCtrl = _display displayCtrl IDC_centerTitle; private _shareButtonCtrl = _display displayCtrl IDC_buttonShare; private _saveButtonCtrl = _display displayCtrl IDC_buttonSave; -private _saveAsButtonCtrl = _display displayCtrl IDC_buttonSaveAs; +private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad; +private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete; switch (ctrlIDC _control) do { - case IDC_buttonMyLoadouts: { - _centerBoxTitleCtrl ctrlSetText "My loadouts"; // TBL - _shareButtonCtrl ctrlEnable ([false, true] select (GVAR(allowSharedLoadouts))); - _saveButtonCtrl ctrlEnable true; - - _shareButtonCtrl ctrlCommit 0; - _saveButtonCtrl ctrlCommit 0; - - // Call filling func }; case IDC_buttonDefaultLoadouts: { - _centerBoxTitleCtrl ctrlSetText "Default loadouts"; // TBL - - { - _x ctrlEnable false; - _x ctrlCommit 0; - } foreach [_shareButtonCtrl, _saveButtonCtrl]; - - // Call filling func }; case IDC_buttonSharedLoadouts: { - _centerBoxTitleCtrl ctrlSetText "Shared loadouts"; // TBL - - { - _x ctrlEnable false; - _x ctrlCommit 0; - } foreach [_shareButtonCtrl, _saveButtonCtrl]; - - // Call filling func }; -}; \ No newline at end of file +}; + +{ + _x ctrlEnable false; + _x ctrlCommit 0; +} foreach [_saveButtonCtrl, _shareButtonCtrl, _loadButtonCtrl, _deleteButtonCtrl]; + +[_display, _control] call FUNC(fillLoadoutsList); + +GVAR(currentLoadoutsTab) = ctrlIDC _control; diff --git a/addons/arsenal/functions/fnc_onKeyDown.sqf b/addons/arsenal/functions/fnc_onKeyDown.sqf index 039f6a3a60..6bcc622cc4 100644 --- a/addons/arsenal/functions/fnc_onKeyDown.sqf +++ b/addons/arsenal/functions/fnc_onKeyDown.sqf @@ -5,6 +5,8 @@ params ["", "_args"]; _args params ["_display", "_keyPressed", "_shiftState", "_ctrlState", "_altState"]; +if !((findDisplay IDD_loadouts_display) isEqualTo displayNull) exitWith {}; + GVAR(shiftState) = _shiftState; private _return = true; diff --git a/addons/arsenal/functions/fnc_onLoadoutsClose.sqf b/addons/arsenal/functions/fnc_onLoadoutsClose.sqf index 37b99d41b2..a3d0e7ce38 100644 --- a/addons/arsenal/functions/fnc_onLoadoutsClose.sqf +++ b/addons/arsenal/functions/fnc_onLoadoutsClose.sqf @@ -2,4 +2,14 @@ #include "..\defines.hpp" params ["", "_args"]; -_args params ["_display"]; \ No newline at end of file +_args params ["_display"]; + +GVAR(currentLoadoutsTab) = nil; + +private _arsenalDisplay = findDisplay IDD_ace_arsenal; +private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock; + +_mouseBlockCtrl ctrlEnable false; +_mouseBlockCtrl ctrlCommit 0; + +[_arsenalDisplay] call FUNC(buttonHide); \ No newline at end of file diff --git a/addons/arsenal/functions/fnc_onLoadoutsOpen.sqf b/addons/arsenal/functions/fnc_onLoadoutsOpen.sqf index 54fa444050..b26ad039ea 100644 --- a/addons/arsenal/functions/fnc_onLoadoutsOpen.sqf +++ b/addons/arsenal/functions/fnc_onLoadoutsOpen.sqf @@ -4,7 +4,19 @@ params ["", "_args"]; _args params ["_display"]; -systemChat str _display; +private _arsenalDisplay = findDisplay IDD_ace_arsenal; +private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock; + +_mouseBlockCtrl ctrlEnable true; +_mouseBlockCtrl ctrlCommit 0; + +[_arsenalDisplay] call FUNC(buttonHide); + +GVAR(currentLoadoutsTab) = -1; + +private _panelContentCtrl = _display displayCtrl IDC_contentPanel; +_panelContentCtrl ctrlSetFontHeight (GVAR(fontHeight) * GRID_H); +_panelContentCtrl ctrlCommit 0; if !(GVAR(allowDefaultLoadouts)) then { private _buttonDefaultLoadoutsCtrl = _display displayCtrl IDC_buttonDefaultLoadouts; diff --git a/addons/arsenal/functions/fnc_onSelChangedLoadouts.sqf b/addons/arsenal/functions/fnc_onSelChangedLoadouts.sqf index 711d7c4f4c..56d24981f0 100644 --- a/addons/arsenal/functions/fnc_onSelChangedLoadouts.sqf +++ b/addons/arsenal/functions/fnc_onSelChangedLoadouts.sqf @@ -1,2 +1,54 @@ #include "script_component.hpp" -#include "..\defines.hpp" \ No newline at end of file +#include "..\defines.hpp" + +params ["_display", "_control", "_curSel"]; + +systemChat str _curSel; + +private _shareButtonCtrl = _display displayCtrl IDC_buttonShare; +private _saveButtonCtrl = _display displayCtrl IDC_buttonSave; +private _loadButtonCtrl = _display displayCtrl IDC_buttonLoad; +private _deleteButtonCtrl = _display displayCtrl IDC_buttonDelete; + +switch (GVAR(currentLoadoutsTab)) do { + + case IDC_buttonMyLoadouts: { + + _loadButtonCtrl ctrlEnable ([false, true] select ((_control lbValue _curSel) >= 0)); + _loadButtonCtrl ctrlCommit 0; + + _shareButtonCtrl ctrlEnable ([false, true] select (GVAR(allowSharedLoadouts))); + _shareButtonCtrl ctrlCommit 0; + + _saveButtonCtrl ctrlEnable true; + _saveButtonCtrl ctrlCommit 0; + + { + _x ctrlEnable (_curSel >= 0); + _x ctrlCommit 0; + } foreach [_saveButtonCtrl, _deleteButtonCtrl]; + }; + + case IDC_buttonDefaultLoadouts: { + + + _loadButtonCtrl ctrlEnable ([false, true] select ((_control lbValue _curSel) >= 0)); + _loadButtonCtrl ctrlCommit 0; + + { + _x ctrlEnable false; + _x ctrlCommit 0; + } foreach [_shareButtonCtrl, _saveButtonCtrl, _deleteButtonCtrl]; + }; + + case IDC_buttonSharedLoadouts: { + + _loadButtonCtrl ctrlEnable ([false, true] select ((_control lbValue _curSel) >= 0)); + _loadButtonCtrl ctrlCommit 0; + + { + _x ctrlEnable false; + _x ctrlCommit 0; + } foreach [_shareButtonCtrl, _saveButtonCtrl, _deleteButtonCtrl]; + }; +}; \ No newline at end of file diff --git a/addons/arsenal/ui/RscAttributes.hpp b/addons/arsenal/ui/RscAttributes.hpp index 2c5e2999be..838dfe0883 100644 --- a/addons/arsenal/ui/RscAttributes.hpp +++ b/addons/arsenal/ui/RscAttributes.hpp @@ -173,7 +173,7 @@ class GVAR(display) { x = QUOTE(25 * GRID_W); text="Loadouts"; // TBL tooltip="Displays loadouts screen"; // TBL - onButtonClick = QUOTE(ctrlparent (_this select 0) createDisplay QQGVAR(loadoutsDisplay)); + onButtonClick = QUOTE(createDialog QQGVAR(loadoutsDisplay)); }; class buttonExport: buttonHide { idc = -1; @@ -747,7 +747,7 @@ class GVAR(loadoutsDisplay) { h = QUOTE(5 * GRID_H); }; class contentPanel: RscListnBox { - idc = IDC_contentPanel + idc = IDC_contentPanel; colorBackground[]={0,0,0,0}; colorSelectBackground[]={1,1,1,0.5}; colorSelectBackground2[]={1,1,1,0.5}; @@ -755,10 +755,10 @@ class GVAR(loadoutsDisplay) { colorSelect[]={1,1,1,1}; colorSelect2[]={1,1,1,1}; colorPictureRightSelected[]={1,1,1,1}; - columns[]={0.10, 0.20, 0.75}; + columns[]={0, 0.10, 0.45, 0.55, 0.65, 0.75, 0.80, 0.85, 0.90, 0.95}; drawSideArrows=0; disableOverflow=1; - onLBSelChanged = QUOTE(_this call FUNC(onSelChangedLoadouts)); + onLBSelChanged = QUOTE([ARR_3(ctrlParent (_this select 0), _this select 0, _this select 1)] call FUNC(onSelChangedLoadouts)); x = QUOTE(0); y = QUOTE(5 * GRID_H); w = QUOTE(160 * GRID_W); @@ -776,27 +776,27 @@ class GVAR(loadoutsDisplay) { onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsSave)); colorBackground[] = {0,0,0,0.8}; }; - class buttonSaveAs: buttonSave { - idc = IDC_buttonSaveAs; - x = QUOTE(45 * GRID_W); - text="Save as"; // TBL - tooltip="Save loadout as"; // TBL - onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsSaveAs)); - }; class buttonLoad: buttonSave { idc = IDC_buttonLoad; - x = QUOTE(85 * GRID_W); + x = QUOTE(45 * GRID_W); text="Load"; // TBL tooltip="Load selected loadout"; // TBL onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsLoad)); }; class buttonShare: buttonSave { idc = IDC_buttonShare; - x = QUOTE(125 * GRID_W); + x = QUOTE(85 * GRID_W); text="Share"; // TBL tooltip="Share selected loadout"; // TBL onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsShare)); }; + class buttonDelete: buttonSave { + idc = IDC_buttonDelete; + x = QUOTE(125 * GRID_W); + text="Delete"; // TBL + tooltip="Delete loadout"; // TBL + onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), _this select 0)] call FUNC(buttonLoadoutsDelete)); + }; }; }; class buttonBar: ctrlControlsGroupNoScrollbars {