Skip to content

Commit

Permalink
Merge pull request #66 from jetelain/category-text
Browse files Browse the repository at this point in the history
Restore model name on the right
  • Loading branch information
jetelain authored Dec 23, 2024
2 parents 91f1fb1 + 63c948e commit 27ebf83
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
3 changes: 2 additions & 1 deletion addons/arsenal/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ PREP(generateOptionsUI);
PREP(filterVirtualItems);
PREP(toggleUI);
PREP(onArsenalClose);
PREP(onTextChange);
PREP(onTextChange);
PREP(sortPanel);
10 changes: 10 additions & 0 deletions addons/arsenal/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class RscPicture;
class RscButton;
class RscPictureKeepAspect;
class RscEdit;
class RscCombo;

class ace_arsenal_display {

Expand Down Expand Up @@ -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);
};
};
};

Expand Down
3 changes: 0 additions & 3 deletions addons/arsenal/functions/fnc_onLeftPanelFilled.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")];
};

};
};
25 changes: 25 additions & 0 deletions addons/arsenal/functions/fnc_sortPanel.sqf
Original file line number Diff line number Diff line change
@@ -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")];
};
};

0 comments on commit 27ebf83

Please sign in to comment.