mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
d33a158e2e
* 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>
64 lines
2.6 KiB
Plaintext
64 lines
2.6 KiB
Plaintext
#include "script_component.hpp"
|
|
#include "..\defines.hpp"
|
|
/*
|
|
* Author: Dedmen, johnb43
|
|
* Add a listbox row.
|
|
*
|
|
* Arguments:
|
|
* 0: Config category, must be "CfgWeapons", "CfgVehicles", "CfgMagazines", "CfgVoice" or "CfgUnitInsignia" <STRING>
|
|
* 1: Classname <STRING>
|
|
* 2: Panel control <CONTROL>
|
|
* 3: Name of the picture entry in that Cfg class <STRING> (default: "picture")
|
|
*
|
|
* Return Value:
|
|
* None
|
|
*
|
|
* Example:
|
|
* ["CfgWeapons", "launch_NLAW_F", _ctrl, "icon"] call ace_arsenal_fnc_addListBoxItem
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params ["_configCategory", "_className", "_ctrlPanel", ["_pictureEntryName", "picture", [""]]];
|
|
|
|
private _skip = GVAR(favoritesOnly) && {!(_className in GVAR(currentItems))} && {!((toLower _className) in GVAR(favorites))};
|
|
if (_skip) then {
|
|
switch (GVAR(currentLeftPanel)) do {
|
|
case IDC_buttonPrimaryWeapon: {
|
|
_skip = !(_className in (GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS));
|
|
};
|
|
case IDC_buttonHandgun: {
|
|
_skip = !(_className in (GVAR(currentItems) select IDX_CURR_HANDGUN_WEAPON_ITEMS));
|
|
};
|
|
case IDC_buttonSecondaryWeapon: {
|
|
_skip = !(_className in (GVAR(currentItems) select IDX_CURR_PRIMARY_WEAPON_ITEMS));
|
|
};
|
|
case IDC_buttonBinoculars: {
|
|
_skip = !(_className in (GVAR(currentItems) select IDX_CURR_BINO_ITEMS));
|
|
};
|
|
};
|
|
};
|
|
|
|
if (_skip) exitWith {};
|
|
|
|
// Sanitise key, as it's public; If not in cache, find info and cache it for later use
|
|
((uiNamespace getVariable QGVAR(addListBoxItemCache)) getOrDefaultCall [_configCategory + _className, {
|
|
// Get classname (config case), display name, picture and DLC
|
|
private _configPath = configFile >> _configCategory >> _className;
|
|
private _dlcName = _configPath call EFUNC(common,getAddon);
|
|
|
|
// If _pictureEntryName is empty, then this item has no picture (e.g. faces)
|
|
[configName _configPath, getText (_configPath >> "displayName"), if (_pictureEntryName == "") then {""} else {getText (_configPath >> _pictureEntryName)}, if (_dlcName != "") then {(modParams [_dlcName, ["logo"]]) param [0, ""]} else {""}]
|
|
}, true]) params ["_className", "_displayName", "_itemPicture", "_modPicture"];
|
|
|
|
private _lbAdd = _ctrlPanel lbAdd _displayName;
|
|
_ctrlPanel lbSetData [_lbAdd, _className];
|
|
_ctrlPanel lbSetPicture [_lbAdd, _itemPicture];
|
|
_ctrlPanel lbSetPictureRight [_lbAdd, ["", _modPicture] select GVAR(enableModIcons)];
|
|
_ctrlPanel lbSetTooltip [_lbAdd, format ["%1\n%2", _displayName, _className]];
|
|
|
|
if ((toLower _className) in GVAR(favorites)) then {
|
|
_ctrlPanel lbSetColor [_lbAdd, FAVORITES_COLOR];
|
|
_ctrlPanel lbSetSelectColor [_lbAdd, FAVORITES_COLOR];
|
|
};
|