From 63c948e0eebd6ba665901d83b16501aed68a48d7 Mon Sep 17 00:00:00 2001 From: Julien Etelain Date: Mon, 23 Dec 2024 10:25:37 +0100 Subject: [PATCH] Restore model name on the right --- addons/arsenal/XEH_PREP.hpp | 3 ++- addons/arsenal/config.cpp | 10 ++++++++ .../functions/fnc_onLeftPanelFilled.sqf | 3 --- addons/arsenal/functions/fnc_sortPanel.sqf | 25 +++++++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 addons/arsenal/functions/fnc_sortPanel.sqf diff --git a/addons/arsenal/XEH_PREP.hpp b/addons/arsenal/XEH_PREP.hpp index 9265f43c..0b9cecf2 100644 --- a/addons/arsenal/XEH_PREP.hpp +++ b/addons/arsenal/XEH_PREP.hpp @@ -8,4 +8,5 @@ PREP(generateOptionsUI); PREP(filterVirtualItems); PREP(toggleUI); PREP(onArsenalClose); -PREP(onTextChange); \ No newline at end of file +PREP(onTextChange); +PREP(sortPanel); \ No newline at end of file diff --git a/addons/arsenal/config.cpp b/addons/arsenal/config.cpp index aa4f2e4e..cb2b1d02 100644 --- a/addons/arsenal/config.cpp +++ b/addons/arsenal/config.cpp @@ -24,6 +24,7 @@ class RscPicture; class RscButton; class RscPictureKeepAspect; class RscEdit; +class RscCombo; class ace_arsenal_display { @@ -88,6 +89,15 @@ class ace_arsenal_display { }; }; }; + class sortLeftTab: RscCombo { // Config forked from ACE3 Arsenal to intercept calls to sortPanel + idc = IDC_sortLeftTab; + x = QUOTE(safeZoneX + 13 * GRID_W); + y = QUOTE(safeZoneY + 8 * GRID_H); + w = QUOTE(40 * GRID_W); + h = QUOTE(6 * GRID_H); + onLBSelChanged = QUOTE(_this call FUNC(sortPanel)); + sizeEx = QUOTE(5 * GRID_H); + }; }; }; diff --git a/addons/arsenal/functions/fnc_onLeftPanelFilled.sqf b/addons/arsenal/functions/fnc_onLeftPanelFilled.sqf index 0ebeebf2..9cf14b1f 100644 --- a/addons/arsenal/functions/fnc_onLeftPanelFilled.sqf +++ b/addons/arsenal/functions/fnc_onLeftPanelFilled.sqf @@ -18,8 +18,6 @@ for "_i" from 0 to (_size -1) do { private _config = _ctrlPanel lbData _i; private _model = [_classRoot, _config] call EFUNC(gearinfo,getConfigModel); if ( _model != "" ) then { - _ctrlPanel lbSetTextRight [_i, getText(configFile >> "XtdGearModels" >> _classRoot >> _model >> "label")]; - if ( _selectedModel == _model && _config != _selectedConfig) then { // Current value must match this list item, but it is out-of-sync // Update the list and the filtered virtual items @@ -36,6 +34,5 @@ for "_i" from 0 to (_size -1) do { _ctrlPanel lbSetTooltip [_i, format ["%1\n%2", _displayName, _selectedConfig]]; _ctrlPanel lbSetPicture [_i, getText (_match >> "picture")]; }; - }; }; diff --git a/addons/arsenal/functions/fnc_sortPanel.sqf b/addons/arsenal/functions/fnc_sortPanel.sqf new file mode 100644 index 00000000..4daa4db9 --- /dev/null +++ b/addons/arsenal/functions/fnc_sortPanel.sqf @@ -0,0 +1,25 @@ +#include "script_component.hpp" +#include "..\defines.hpp" + +params ["_control"]; + +[_control] call ace_arsenal_fnc_sortPanel; // will erase lbSetTextRight of items (will left them to "") + +if ((ctrlIDC _control) in [IDC_sortRightTab, IDC_sortRightTabDirection]) exitWith {}; + +(call FUNC(leftPanelConfig)) params ["", "", "", "_index", "_classRoot"]; + +if ( _index == -1 ) exitWith {}; + +private _display = ctrlParent _control; +private _ctrlPanel = _display displayCtrl IDC_leftTabContent; +private _size = lbSize _ctrlPanel; + +for "_i" from 0 to (_size -1) do { + private _config = _ctrlPanel lbData _i; + private _model = [_classRoot, _config] call EFUNC(gearinfo,getConfigModel); + if ( _model != "" ) then { + // Set our own lbSetTextRight + _ctrlPanel lbSetTextRight [_i, getText(configFile >> "XtdGearModels" >> _classRoot >> _model >> "label")]; + }; + };