mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Add QOL improvement for the ACE Arsenal loadouts screen (#5973)
* Add search bar in loadouts screen * Add onKeyDown support for the loadouts display * Add ctrl+key support to both editbox in the loadouts screen * Fix syntax error
This commit is contained in:
parent
65fe101aaf
commit
1b332129e6
@ -14,6 +14,7 @@ PREP(clearSearchbar);
|
|||||||
PREP(fillLeftPanel);
|
PREP(fillLeftPanel);
|
||||||
PREP(fillLoadoutsList);
|
PREP(fillLoadoutsList);
|
||||||
PREP(fillRightPanel);
|
PREP(fillRightPanel);
|
||||||
|
PREP(handleLoadoutsSearchbar);
|
||||||
PREP(handleMouse);
|
PREP(handleMouse);
|
||||||
PREP(handleScrollWheel);
|
PREP(handleScrollWheel);
|
||||||
PREP(handleSearchbar);
|
PREP(handleSearchbar);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
GVAR(EH_ID) = 0;
|
GVAR(EH_ID) = 0;
|
||||||
GVAR(lastSearchTextLeft) = "";
|
GVAR(lastSearchTextLeft) = "";
|
||||||
GVAR(lastSearchTextRight) = "";
|
GVAR(lastSearchTextRight) = "";
|
||||||
|
GVAR(lastSearchTextLoadouts) = "";
|
||||||
|
|
||||||
[QGVAR(initBox), {_this call FUNC(initBox)}] call CBA_fnc_addEventHandler;
|
[QGVAR(initBox), {_this call FUNC(initBox)}] call CBA_fnc_addEventHandler;
|
||||||
[QGVAR(removeBox), {_this call FUNC(removeBox)}] call CBA_fnc_addEventHandler;
|
[QGVAR(removeBox), {_this call FUNC(removeBox)}] call CBA_fnc_addEventHandler;
|
||||||
|
@ -107,6 +107,7 @@
|
|||||||
#define IDC_buttonShare 306
|
#define IDC_buttonShare 306
|
||||||
#define IDC_buttonDelete 307
|
#define IDC_buttonDelete 307
|
||||||
#define IDC_buttonRename 308
|
#define IDC_buttonRename 308
|
||||||
|
#define IDC_loadoutsSearchbar 309
|
||||||
#define IDC_buttonMyLoadoutsBackground 401
|
#define IDC_buttonMyLoadoutsBackground 401
|
||||||
#define IDC_buttonMyLoadouts 402
|
#define IDC_buttonMyLoadouts 402
|
||||||
#define IDC_buttonDefaultLoadoutsBackground 403
|
#define IDC_buttonDefaultLoadoutsBackground 403
|
||||||
|
45
addons/arsenal/functions/fnc_handleLoadoutsSearchbar.sqf
Normal file
45
addons/arsenal/functions/fnc_handleLoadoutsSearchbar.sqf
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Author: Alganthe
|
||||||
|
* Handles keyboard inputs inside the searchbars text boxes.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: Loadouts display <DISPLAY>
|
||||||
|
* 1: Searchbar control <CONTROL>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
#include "script_component.hpp"
|
||||||
|
#include "..\defines.hpp"
|
||||||
|
|
||||||
|
params ["_display", "_control"];
|
||||||
|
|
||||||
|
private _textString = ctrlText _control;
|
||||||
|
|
||||||
|
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||||
|
|
||||||
|
if !(GVAR(lastSearchTextLoadouts) isEqualTo "" || {(_textString find GVAR(lastSearchTextLoadouts)) == 0}) then {//don't refill if there is no need
|
||||||
|
[_display, _display displayCtrl GVAR(currentLoadoutsTab)] call FUNC(fillLoadoutsList);
|
||||||
|
};
|
||||||
|
|
||||||
|
GVAR(lastSearchTextLoadouts) = _textString;
|
||||||
|
if (count _textString == 0) exitWith {};
|
||||||
|
|
||||||
|
private _contentPanelCtrl = _display displayCtrl IDC_contentPanel;
|
||||||
|
|
||||||
|
private _itemsToGo = (lnbSize _contentPanelCtrl) select 0;
|
||||||
|
private _lbIndex = 0;
|
||||||
|
while {_itemsToGo > 0} do {
|
||||||
|
private _currentData = _contentPanelCtrl lnbText [_lbIndex, 1];
|
||||||
|
private _currentClassname = _contentPanelCtrl lnbData [_lbIndex, 0];
|
||||||
|
|
||||||
|
if ((_currentData isEqualTo "") || {(((toUpper _currentData) find (toUpper _textString)) == -1) && {((toUpper _currentClassname) find (toUpper _textString)) == -1}}) then {
|
||||||
|
_contentPanelCtrl lnbDeleteRow _lbIndex;
|
||||||
|
} else {
|
||||||
|
_lbIndex = _lbIndex + 1;
|
||||||
|
};
|
||||||
|
_itemsToGo = _itemsToGo - 1;
|
||||||
|
};
|
||||||
|
_contentPanelCtrl lnbSetCurSelRow -1;
|
@ -21,83 +21,41 @@
|
|||||||
params ["", "_args"];
|
params ["", "_args"];
|
||||||
_args params ["_display", "_keyPressed", "_shiftState", "_ctrlState", "_altState"];
|
_args params ["_display", "_keyPressed", "_shiftState", "_ctrlState", "_altState"];
|
||||||
|
|
||||||
if !((findDisplay IDD_loadouts_display) isEqualTo displayNull) exitWith {};
|
|
||||||
|
|
||||||
GVAR(shiftState) = _shiftState;
|
GVAR(shiftState) = _shiftState;
|
||||||
|
|
||||||
private _return = true;
|
private _return = true;
|
||||||
|
private _loadoutsDisplay = findDisplay IDD_loadouts_display;
|
||||||
|
|
||||||
if (!GVAR(leftSearchbarFocus) && {!GVAR(rightSearchbarFocus)}) then {
|
if !(_loadoutsDisplay isEqualTo displayNull) then {
|
||||||
|
if !(GVAR(loadoutsSearchbarFocus)) then {
|
||||||
switch true do {
|
switch true do {
|
||||||
// Close button
|
// Close button
|
||||||
case (_keyPressed == DIK_ESCAPE): {
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
_display closeDisplay 2;
|
_display closeDisplay 2;
|
||||||
};
|
|
||||||
// Hide button
|
|
||||||
case (_keyPressed == DIK_BACKSPACE): {
|
|
||||||
[_display] call FUNC(buttonHide);
|
|
||||||
};
|
|
||||||
// Export button
|
|
||||||
case (_keyPressed == DIK_C && {_ctrlState}): {
|
|
||||||
[_display] call FUNC(buttonExport);
|
|
||||||
};
|
|
||||||
// Import button
|
|
||||||
case (_keyPressed == DIK_V && {_ctrlState}): {
|
|
||||||
[_display] call FUNC(buttonImport);
|
|
||||||
};
|
|
||||||
// Search fields
|
|
||||||
case (_keyPressed == DIK_F && {_ctrlState}): {
|
|
||||||
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
|
||||||
};
|
|
||||||
// Switch vision mode
|
|
||||||
case (_keyPressed in (actionkeys "nightvision")): {
|
|
||||||
if (isNil QGVAR(visionMode)) then {
|
|
||||||
GVAR(visionMode) = 0;
|
|
||||||
};
|
};
|
||||||
GVAR(visionMode) = (GVAR(visionMode) + 1) % 3;
|
// Search field
|
||||||
|
case (_keyPressed == DIK_F && {_ctrlState}): {
|
||||||
switch GVAR(visionMode) do {
|
ctrlSetFocus (_loadoutsDisplay displayCtrl IDC_loadoutsSearchbar);
|
||||||
//--- Normal
|
};
|
||||||
case 0: {
|
};
|
||||||
camusenvg false;
|
} else {
|
||||||
false setCamUseTi 0;
|
switch true do {
|
||||||
};
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
//--- NVG
|
_display closeDisplay 2;
|
||||||
case 1: {
|
};
|
||||||
camusenvg true;
|
case (_keyPressed == DIK_BACKSPACE): {
|
||||||
false setCamUseTi 0;
|
_return = false;
|
||||||
};
|
};
|
||||||
//--- TI
|
case (_keyPressed == DIK_NUMPADENTER);
|
||||||
default {
|
case (_keyPressed == DIK_RETURN): {
|
||||||
camusenvg false;
|
[_loadoutsDisplay, _loadoutsDisplay displayCtrl IDC_loadoutsSearchbar] call FUNC(handleLoadoutsSearchBar);
|
||||||
true setCamUseTi 0;
|
};
|
||||||
};
|
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
|
||||||
|
_return = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
playsound ["RscDisplayCurator_visionMode",true];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
switch true do {
|
switch true do {
|
||||||
case (_keyPressed == DIK_ESCAPE): {
|
|
||||||
_display closeDisplay 2;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_BACKSPACE): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_NUMPADENTER);
|
|
||||||
case (_keyPressed == DIK_RETURN): {
|
|
||||||
if (GVAR(leftSearchbarFocus)) then {
|
|
||||||
[_display, _display displayCtrl IDC_leftSearchbar] call FUNC(handleSearchBar);
|
|
||||||
};
|
|
||||||
if (GVAR(rightSearchbarFocus)) then {
|
|
||||||
[_display, _display displayCtrl IDC_rightSearchbar] call FUNC(handleSearchBar);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
|
|
||||||
_return = false;
|
|
||||||
};
|
|
||||||
case (_keyPressed == DIK_C && {_ctrlState}): {
|
case (_keyPressed == DIK_C && {_ctrlState}): {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
@ -110,31 +68,121 @@ if (!GVAR(leftSearchbarFocus) && {!GVAR(rightSearchbarFocus)}) then {
|
|||||||
case (_keyPressed == DIK_X && {_ctrlState}): {
|
case (_keyPressed == DIK_X && {_ctrlState}): {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
// Search fields
|
case (GVAR(loadoutsPanelFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}): {
|
||||||
case (_keyPressed == DIK_F && {_ctrlState}): {
|
_return = false;
|
||||||
if (GVAR(rightSearchbarFocus)) then {
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (!GVAR(leftSearchbarFocus) && {!GVAR(rightSearchbarFocus)}) then {
|
||||||
|
|
||||||
|
switch true do {
|
||||||
|
// Close button
|
||||||
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
|
_display closeDisplay 2;
|
||||||
|
};
|
||||||
|
// Hide button
|
||||||
|
case (_keyPressed == DIK_BACKSPACE): {
|
||||||
|
[_display] call FUNC(buttonHide);
|
||||||
|
};
|
||||||
|
// Export button
|
||||||
|
case (_keyPressed == DIK_C && {_ctrlState}): {
|
||||||
|
[_display] call FUNC(buttonExport);
|
||||||
|
};
|
||||||
|
// Import button
|
||||||
|
case (_keyPressed == DIK_V && {_ctrlState}): {
|
||||||
|
[_display] call FUNC(buttonImport);
|
||||||
|
};
|
||||||
|
// Search fields
|
||||||
|
case (_keyPressed == DIK_F && {_ctrlState}): {
|
||||||
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
||||||
} else {
|
};
|
||||||
ctrlSetFocus (_display displayCtrl IDC_rightSearchbar);
|
// Switch vision mode
|
||||||
|
case (_keyPressed in (actionkeys "nightvision")): {
|
||||||
|
if (isNil QGVAR(visionMode)) then {
|
||||||
|
GVAR(visionMode) = 0;
|
||||||
|
};
|
||||||
|
GVAR(visionMode) = (GVAR(visionMode) + 1) % 3;
|
||||||
|
|
||||||
|
switch GVAR(visionMode) do {
|
||||||
|
//--- Normal
|
||||||
|
case 0: {
|
||||||
|
camusenvg false;
|
||||||
|
false setCamUseTi 0;
|
||||||
|
};
|
||||||
|
//--- NVG
|
||||||
|
case 1: {
|
||||||
|
camusenvg true;
|
||||||
|
false setCamUseTi 0;
|
||||||
|
};
|
||||||
|
//--- TI
|
||||||
|
default {
|
||||||
|
camusenvg false;
|
||||||
|
true setCamUseTi 0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
playsound ["RscDisplayCurator_visionMode",true];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
switch true do {
|
||||||
|
case (_keyPressed == DIK_ESCAPE): {
|
||||||
|
_display closeDisplay 2;
|
||||||
|
};
|
||||||
|
case (_keyPressed == DIK_BACKSPACE): {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
case (_keyPressed == DIK_NUMPADENTER);
|
||||||
|
case (_keyPressed == DIK_RETURN): {
|
||||||
|
if (GVAR(leftSearchbarFocus)) then {
|
||||||
|
[_display, _display displayCtrl IDC_leftSearchbar] call FUNC(handleSearchBar);
|
||||||
|
};
|
||||||
|
if (GVAR(rightSearchbarFocus)) then {
|
||||||
|
[_display, _display displayCtrl IDC_rightSearchbar] call FUNC(handleSearchBar);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
case (_keyPressed in [DIK_LEFT, DIK_RIGHT]): {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
case (_keyPressed == DIK_C && {_ctrlState}): {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
case (_keyPressed == DIK_V && {_ctrlState}): {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
case (_keyPressed == DIK_A && {_ctrlState}): {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
case (_keyPressed == DIK_X && {_ctrlState}): {
|
||||||
|
_return = false;
|
||||||
|
};
|
||||||
|
// Search fields
|
||||||
|
case (_keyPressed == DIK_F && {_ctrlState}): {
|
||||||
|
if (GVAR(rightSearchbarFocus)) then {
|
||||||
|
ctrlSetFocus (_display displayCtrl IDC_leftSearchbar);
|
||||||
|
} else {
|
||||||
|
ctrlSetFocus (_display displayCtrl IDC_rightSearchbar);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
if (GVAR(leftTabFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}) then {
|
if (GVAR(leftTabFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}) then {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(rightTabFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}) then {
|
if (GVAR(rightTabFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}) then {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(rightTabLnBFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}) then {
|
if (GVAR(rightTabLnBFocus) && {_keyPressed in [DIK_UP, DIK_DOWN]}) then {
|
||||||
_return = false;
|
_return = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (GVAR(rightTabLnBFocus) && {_keyPressed in [DIK_LEFT, DIK_RIGHT]}) then {
|
if (GVAR(rightTabLnBFocus) && {_keyPressed in [DIK_LEFT, DIK_RIGHT]}) then {
|
||||||
[_display, [1, 0] select (_keyPressed == DIK_LEFT)] call FUNC(buttonCargo);
|
[_display, [1, 0] select (_keyPressed == DIK_LEFT)] call FUNC(buttonCargo);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
_return
|
_return
|
||||||
|
@ -20,6 +20,8 @@ private _mouseBlockCtrl = _arsenalDisplay displayCtrl IDC_mouseBlock;
|
|||||||
|
|
||||||
GVAR(cameraPosition) = GVAR(previousCameraPos);
|
GVAR(cameraPosition) = GVAR(previousCameraPos);
|
||||||
GVAR(previousCameraPos) = nil;
|
GVAR(previousCameraPos) = nil;
|
||||||
|
GVAR(loadoutsSearchbarFocus) = nil;
|
||||||
|
GVAR(loadoutsPanelFocus) = nil;
|
||||||
|
|
||||||
_mouseBlockCtrl ctrlEnable false;
|
_mouseBlockCtrl ctrlEnable false;
|
||||||
_mouseBlockCtrl ctrlCommit 0;
|
_mouseBlockCtrl ctrlCommit 0;
|
||||||
|
@ -27,6 +27,8 @@ _mouseBlockCtrl ctrlCommit 0;
|
|||||||
[_arsenalDisplay] call FUNC(buttonHide);
|
[_arsenalDisplay] call FUNC(buttonHide);
|
||||||
|
|
||||||
GVAR(currentLoadoutsTab) = -1;
|
GVAR(currentLoadoutsTab) = -1;
|
||||||
|
GVAR(loadoutsSearchbarFocus) = false;
|
||||||
|
GVAR(loadoutsPanelFocus) = false;
|
||||||
|
|
||||||
GVAR(previousCameraPos) = GVAR(cameraPosition);
|
GVAR(previousCameraPos) = GVAR(cameraPosition);
|
||||||
GVAR(cameraPosition) = [5,0,20,[-0.85,0,0.85]];
|
GVAR(cameraPosition) = [5,0,20,[-0.85,0,0.85]];
|
||||||
|
@ -775,6 +775,8 @@ class GVAR(loadoutsDisplay) {
|
|||||||
columns[]={0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90};
|
columns[]={0, 0.05, 0.40, 0.50, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90};
|
||||||
drawSideArrows=0;
|
drawSideArrows=0;
|
||||||
disableOverflow=1;
|
disableOverflow=1;
|
||||||
|
onSetFocus = QUOTE(GVAR(loadoutsPanelFocus) = true);
|
||||||
|
onKillFocus = QUOTE(GVAR(loadoutsPanelFocus) = false);
|
||||||
onLBSelChanged = QUOTE([ARR_3(ctrlParent (_this select 0), _this select 0, _this select 1)] call FUNC(onSelChangedLoadouts));
|
onLBSelChanged = QUOTE([ARR_3(ctrlParent (_this select 0), _this select 0, _this select 1)] call FUNC(onSelChangedLoadouts));
|
||||||
onLBDblClick = QUOTE([ARR_2(ctrlparent (_this select 0), (ctrlParent (_this select 0)) displayCtrl IDC_buttonLoad)] call FUNC(buttonLoadoutsLoad));
|
onLBDblClick = QUOTE([ARR_2(ctrlparent (_this select 0), (ctrlParent (_this select 0)) displayCtrl IDC_buttonLoad)] call FUNC(buttonLoadoutsLoad));
|
||||||
x = QUOTE(0);
|
x = QUOTE(0);
|
||||||
@ -786,7 +788,7 @@ class GVAR(loadoutsDisplay) {
|
|||||||
class textTitle: RscText {
|
class textTitle: RscText {
|
||||||
idc= -1;
|
idc= -1;
|
||||||
text="$STR_DISP_GAME_NAME";
|
text="$STR_DISP_GAME_NAME";
|
||||||
x = QUOTE(1 * GRID_W);
|
x = QUOTE(0 * GRID_W);
|
||||||
y = QUOTE(safezoneH - (51 * GRID_H));
|
y = QUOTE(safezoneH - (51 * GRID_H));
|
||||||
w = QUOTE(15 * GRID_W);
|
w = QUOTE(15 * GRID_W);
|
||||||
h = QUOTE(5 * GRID_H);
|
h = QUOTE(5 * GRID_H);
|
||||||
@ -795,9 +797,29 @@ class GVAR(loadoutsDisplay) {
|
|||||||
};
|
};
|
||||||
class textEditBox: ctrlEdit {
|
class textEditBox: ctrlEdit {
|
||||||
idc= IDC_textEditBox;
|
idc= IDC_textEditBox;
|
||||||
x = QUOTE(16 * GRID_W);
|
x = QUOTE(15 * GRID_W);
|
||||||
y = QUOTE(safezoneH - (51 * GRID_H));
|
y = QUOTE(safezoneH - (51 * GRID_H));
|
||||||
w = QUOTE(80 * GRID_W);
|
w = QUOTE(65 * GRID_W);
|
||||||
|
h = QUOTE(5 * GRID_H);
|
||||||
|
};
|
||||||
|
class loadoutsSearchbar: ctrlEdit {
|
||||||
|
idc = IDC_loadoutsSearchbar;
|
||||||
|
onSetFocus = QUOTE(GVAR(loadoutsSearchbarFocus) = true);
|
||||||
|
onKillFocus = QUOTE(GVAR(loadoutsSearchbarFocus) = false);
|
||||||
|
onMouseButtonClick = QUOTE([ARR_3(ctrlParent (_this select 0), _this select 0, _this select 1)] call FUNC(clearSearchbar));
|
||||||
|
x = QUOTE(83 * GRID_W);
|
||||||
|
y = QUOTE(safezoneH - (51 * GRID_H));
|
||||||
|
w = QUOTE(72 * GRID_W);
|
||||||
|
h = QUOTE(5 * GRID_H);
|
||||||
|
};
|
||||||
|
class loadoutsSearchbarButton: ctrlButtonPicture {
|
||||||
|
idc = -1;
|
||||||
|
text = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_start_ca.paa";
|
||||||
|
colorBackground[]={0,0,0,0.5};
|
||||||
|
onButtonClick = QUOTE([ARR_2(ctrlparent (_this select 0), ctrlparent (_this select 0) displayCtrl IDC_loadoutsSearchbar)] call FUNC(handleLoadoutsSearchbar));
|
||||||
|
x = QUOTE(155 * GRID_W);
|
||||||
|
y = QUOTE(safezoneH - (51 * GRID_H));
|
||||||
|
w = QUOTE(5 * GRID_W);
|
||||||
h = QUOTE(5 * GRID_H);
|
h = QUOTE(5 * GRID_H);
|
||||||
};
|
};
|
||||||
class buttonSave: ctrlButton {
|
class buttonSave: ctrlButton {
|
||||||
|
Loading…
Reference in New Issue
Block a user