mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Arsenal - Use forceUnicode for search functions (#9605)
* use forceUnicode * Update fnc_attributeAddItems.sqf * Update fnc_handleSearchbar.sqf
This commit is contained in:
parent
6ce625a52f
commit
163d750a0d
@ -18,9 +18,10 @@
|
|||||||
|
|
||||||
params ["_controlsGroup"];
|
params ["_controlsGroup"];
|
||||||
|
|
||||||
|
forceUnicode 0; // handle non-ANSI characters
|
||||||
|
|
||||||
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
|
private _category = lbCurSel (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_CATEGORY);
|
||||||
// Have to use toLower here and displayName to handle non-ANSI characters
|
private _filter = ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
|
||||||
private _filter = toLower ctrlText (_controlsGroup controlsGroupCtrl IDC_ATTRIBUTE_SEARCHBAR);
|
|
||||||
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
private _configItems = uiNamespace getVariable QGVAR(configItems);
|
||||||
private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems);
|
private _magazineMiscItems = uiNamespace getVariable QGVAR(magazineMiscItems);
|
||||||
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
private _attributeValue = uiNamespace getVariable [QGVAR(attributeValue), [[], 0]];
|
||||||
@ -67,7 +68,7 @@ if (_category == IDX_CAT_ALL) exitWith {
|
|||||||
_displayName = getText (_config >> "displayName");
|
_displayName = getText (_config >> "displayName");
|
||||||
|
|
||||||
// Add item if not filtered
|
// Add item if not filtered
|
||||||
if (toLower _displayName regexMatch _filter || {_x regexMatch _filter}) then {
|
if (_displayName regexMatch _filter || {_x regexMatch _filter}) then {
|
||||||
_index = _listbox lnbAddRow ["", _displayName, _modeSymbol];
|
_index = _listbox lnbAddRow ["", _displayName, _modeSymbol];
|
||||||
_listbox lnbSetData [[_index, 1], _x];
|
_listbox lnbSetData [[_index, 1], _x];
|
||||||
_listbox lnbSetPicture [[_index, 0], getText (_config >> "picture")];
|
_listbox lnbSetPicture [[_index, 0], getText (_config >> "picture")];
|
||||||
@ -119,7 +120,7 @@ private _config = _cfgClass;
|
|||||||
_displayName = getText (_config >> _x >> "displayName");
|
_displayName = getText (_config >> _x >> "displayName");
|
||||||
|
|
||||||
// Add item if not filtered
|
// Add item if not filtered
|
||||||
if (toLower _displayName regexMatch _filter || {_x regexMatch _filter}) then {
|
if (_displayName regexMatch _filter || {_x regexMatch _filter}) then {
|
||||||
// Change symbol and alpha if item already selected
|
// Change symbol and alpha if item already selected
|
||||||
if (_x in _attributeItems) then {
|
if (_x in _attributeItems) then {
|
||||||
_symbol = _modeSymbol;
|
_symbol = _modeSymbol;
|
||||||
@ -140,3 +141,6 @@ private _config = _cfgClass;
|
|||||||
|
|
||||||
// Sort alphabetically
|
// Sort alphabetically
|
||||||
_listbox lnbSort [1, false];
|
_listbox lnbSort [1, false];
|
||||||
|
|
||||||
|
// Reset unicode flag
|
||||||
|
forceUnicode -1;
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
|
|
||||||
params ["_display", "_control", ["_animate", true]];
|
params ["_display", "_control", ["_animate", true]];
|
||||||
|
|
||||||
// Have to use toLower here and displayName to handle non-ANSI characters
|
forceUnicode 0; // handle non-ANSI characters
|
||||||
private _searchString = toLower ctrlText _control;
|
|
||||||
|
private _searchString = ctrlText _control;
|
||||||
private _searchPattern = "";
|
private _searchPattern = "";
|
||||||
if (_searchString != "") then {
|
if (_searchString != "") then {
|
||||||
_searchPattern = _searchString call EFUNC(common,escapeRegex);
|
_searchPattern = _searchString call EFUNC(common,escapeRegex);
|
||||||
@ -56,7 +57,7 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {
|
|||||||
|
|
||||||
// Go through all items in panel and see if they need to be deleted or not
|
// Go through all items in panel and see if they need to be deleted or not
|
||||||
for "_lbIndex" from (lbSize _rightPanelCtrl) - 1 to 0 step -1 do {
|
for "_lbIndex" from (lbSize _rightPanelCtrl) - 1 to 0 step -1 do {
|
||||||
_currentDisplayName = toLower (_rightPanelCtrl lbText _lbIndex);
|
_currentDisplayName = _rightPanelCtrl lbText _lbIndex;
|
||||||
_currentClassname = _rightPanelCtrl lbData _lbIndex;
|
_currentClassname = _rightPanelCtrl lbData _lbIndex;
|
||||||
|
|
||||||
// Remove item in panel if it doesn't match search, skip otherwise
|
// Remove item in panel if it doesn't match search, skip otherwise
|
||||||
@ -152,7 +153,7 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {
|
|||||||
|
|
||||||
// Go through all items in panel and see if they need to be deleted or not
|
// Go through all items in panel and see if they need to be deleted or not
|
||||||
for "_lbIndex" from (lbSize _leftPanelCtrl) - 1 to 0 step -1 do {
|
for "_lbIndex" from (lbSize _leftPanelCtrl) - 1 to 0 step -1 do {
|
||||||
_currentDisplayName = toLower (_leftPanelCtrl lbText _lbIndex);
|
_currentDisplayName = _leftPanelCtrl lbText _lbIndex;
|
||||||
_currentClassname = _leftPanelCtrl lbData _lbIndex;
|
_currentClassname = _leftPanelCtrl lbData _lbIndex;
|
||||||
|
|
||||||
// Remove item in panel if it doesn't match search, skip otherwise
|
// Remove item in panel if it doesn't match search, skip otherwise
|
||||||
@ -178,3 +179,6 @@ if ((ctrlIDC _control) == IDC_rightSearchbar) then {
|
|||||||
|
|
||||||
[_display, nil, nil, configNull] call FUNC(itemInfo);
|
[_display, nil, nil, configNull] call FUNC(itemInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Reset unicode flag
|
||||||
|
forceUnicode -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user