Disposal safety
This commit is contained in:
@@ -145,9 +145,8 @@ public abstract unsafe class InventoryAddonBase : NativeAddon, IInventoryWindow
|
||||
if (SearchInputNode != null)
|
||||
{
|
||||
bool atActive = !string.IsNullOrEmpty(HighlightState.SelectedAllaganToolsFilterKey);
|
||||
bool filterModeActive = System.Config.General.SearchMode == SearchMode.Filter;
|
||||
|
||||
SearchInputNode.HintAddColor = (atActive || filterModeActive)
|
||||
SearchInputNode.HintAddColor = (atActive)
|
||||
? new Vector3(0.0f, 0.3f, 0.3f)
|
||||
: Vector3.Zero;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using AetherBags. Configuration;
|
||||
using AetherBags. Inventory;
|
||||
using AetherBags.Configuration;
|
||||
using AetherBags.Inventory;
|
||||
using AetherBags.Inventory.Context;
|
||||
using KamiToolKit.Classes. ContextMenu;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using KamiToolKit.Classes.ContextMenu;
|
||||
|
||||
namespace AetherBags.Addons;
|
||||
|
||||
@@ -24,26 +25,26 @@ public static class InventoryAddonContextMenu
|
||||
|
||||
bool hasActiveAtFilter = !string.IsNullOrEmpty(HighlightState.SelectedAllaganToolsFilterKey);
|
||||
string searchText = parent.GetSearchText();
|
||||
if (HighlightState. IsFilterActive || hasActiveAtFilter || ! string.IsNullOrEmpty(searchText))
|
||||
if (HighlightState.IsFilterActive || hasActiveAtFilter || !string.IsNullOrEmpty(searchText))
|
||||
{
|
||||
menu.AddItem("Clear All Filters", () =>
|
||||
{
|
||||
HighlightState.ClearAll();
|
||||
parent. SetSearchText(string.Empty);
|
||||
parent.SetSearchText(string.Empty);
|
||||
InventoryOrchestrator.RefreshAll(updateMaps: false);
|
||||
});
|
||||
menu.AddItem(Separator);
|
||||
}
|
||||
|
||||
var currentMode = System. Config.General.SearchMode;
|
||||
string modeLabel = currentMode == SearchMode. Filter ? "Mode: Hide Non-Matches" : "Mode: Fade Non-Matches";
|
||||
var currentMode = System.Config.General.SearchMode;
|
||||
string modeLabel = currentMode == SearchMode.Filter ? "Mode: Hide Non-Matches" : "Mode: Fade Non-Matches";
|
||||
menu.AddItem(modeLabel, () =>
|
||||
{
|
||||
System.Config.General.SearchMode = currentMode == SearchMode. Filter ? SearchMode. Highlight : SearchMode.Filter;
|
||||
System.Config.General.SearchMode = currentMode == SearchMode.Filter ? SearchMode.Highlight : SearchMode.Filter;
|
||||
parent.ManualRefresh();
|
||||
});
|
||||
|
||||
if (System.IPC.AllaganTools is { IsReady: true } && System. Config.Categories.AllaganToolsCategoriesEnabled)
|
||||
if (System.IPC.AllaganTools is { IsReady: true } && System.Config.Categories.AllaganToolsCategoriesEnabled)
|
||||
{
|
||||
var atFilters = System.IPC.AllaganTools.GetSearchFilters();
|
||||
if (atFilters is { Count: > 0 })
|
||||
@@ -58,7 +59,7 @@ public static class InventoryAddonContextMenu
|
||||
{
|
||||
var capturedKey = key;
|
||||
bool isActive = HighlightState.SelectedAllaganToolsFilterKey == key;
|
||||
subMenu.AddItem(isActive ? $"✓ {name}" : $" {name}", () =>
|
||||
subMenu.AddItem(isActive ?$"✓ {name}" : $" {name}", () =>
|
||||
{
|
||||
HighlightState.SelectedAllaganToolsFilterKey = isActive ? string.Empty : capturedKey;
|
||||
InventoryOrchestrator.RefreshAll(updateMaps: false);
|
||||
@@ -71,4 +72,13 @@ public static class InventoryAddonContextMenu
|
||||
|
||||
menu.Open();
|
||||
}
|
||||
|
||||
public static unsafe void Close()
|
||||
{
|
||||
var agent = AgentContext.Instance();
|
||||
if (agent != null)
|
||||
{
|
||||
agent->ClearMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user