ACE3/addons/arsenal/functions/fnc_onPanelDblClick.sqf
Grim d33a158e2e
Arsenal - Favorites System (#9307)
* improve page handling

* drop MAX_STATS_PER_PAGE for now

* hide stats box when empty

* improve hiding

* improve _fnc_hideUnused

* condition

* prevent page overflow

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

* favorites var

* function prep

* favorites only

* improve favorites adding, add include

* fix stupid

* fix color setting (todo: lnb color)

* add button, finalize

* setting tooltip

* stringtable again

* fix setting overwrite, improve tooltip

* fix losing weapon items

* fix macro

* fix setting to intended overwrite

* remove unnecessary private

* docs

* more docs

* is

* improve button text

* docs

* fix tooltip not showing unless menuBar was clicked

* improve weapon accessory lookup

* empty line

* update refresh calls

* fix left panel

* cleanup currentCargo

* use BI string for favorites

* BI strings again

* no favorites for face/voice/insignia

* stringtable again

* add missing setColorRight

* Add comment for favorites setup

---------

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-08-19 23:56:59 -04:00

51 lines
1.2 KiB
Plaintext

#include "script_component.hpp"
#include "..\defines.hpp"
#include "\a3\ui_f\hpp\defineResincl.inc"
/*
* Author: LinkIsGrim
* Add or remove item(s) to favorites when LShift is pressed
*
* Arguments:
* 0: Left panel control <CONTROL>
* 1: Left panel selection <NUMBER>
*
* Return Value:
* None
*
* Public: No
*/
params ["_control", "_curSel"];
if !(GVAR(shiftState)) exitWith {};
if (GVAR(currentLeftPanel) in [IDC_buttonFace, IDC_buttonVoice, IDC_buttonInsigina]) exitWith {};
private _isLnB = (ctrlType _control) == CT_LISTNBOX;
private _favorited = false;
// Favorites/blacklist will always be lowercase to handle configCase changes
private _item = "";
if (_isLnB) then {
_item = toLower (_control lnbData [_curSel, 0]);
} else {
_item = toLower (_control lbData _curSel);
};
if (_item in GVAR(favorites)) then {
GVAR(favorites) deleteAt _item;
} else {
GVAR(favorites) set [_item, nil];
_favorited = true;
};
private _color = ([[1, 1, 1], GVAR(favoritesColor)] select _favorited) + [1];
if (_isLnB) then {
_control lnbSetColor [[_curSel, 1], _color];
_control lnbSetColorRight [[_curSel, 1], _color];
} else {
_control lbSetColor [_curSel, _color];
_control lbSetSelectColor [_curSel, _color];
};