diff --git a/Penumbra/Services/FilenameService.cs b/Penumbra/Services/FilenameService.cs index 20794f12..2de4bff0 100644 --- a/Penumbra/Services/FilenameService.cs +++ b/Penumbra/Services/FilenameService.cs @@ -14,7 +14,7 @@ public class FilenameService(DalamudPluginInterface pi) : IService public readonly string EphemeralConfigFile = Path.Combine(pi.ConfigDirectory.FullName, "ephemeral_config.json"); public readonly string FilesystemFile = Path.Combine(pi.ConfigDirectory.FullName, "sort_order.json"); public readonly string ActiveCollectionsFile = Path.Combine(pi.ConfigDirectory.FullName, "active_collections.json"); - public readonly string SharedTagFile = Path.Combine(pi.ConfigDirectory.FullName, "shared_tags.json"); + public readonly string PredefinedTagFile = Path.Combine(pi.ConfigDirectory.FullName, "predefined_tags.json"); public readonly string CrashHandlerExe = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "Penumbra.CrashHandler.exe"); @@ -44,7 +44,7 @@ public class FilenameService(DalamudPluginInterface pi) : IService get { var directory = new DirectoryInfo(CollectionDirectory); - return directory.Exists ? directory.EnumerateFiles("*.json") : Array.Empty(); + return directory.Exists ? directory.EnumerateFiles("*.json") : []; } } @@ -54,7 +54,7 @@ public class FilenameService(DalamudPluginInterface pi) : IService get { var directory = new DirectoryInfo(LocalDataDirectory); - return directory.Exists ? directory.EnumerateFiles("*.json") : Array.Empty(); + return directory.Exists ? directory.EnumerateFiles("*.json") : []; } } diff --git a/Penumbra/Services/ServiceManagerA.cs b/Penumbra/Services/ServiceManagerA.cs index cb2032a2..39ef0560 100644 --- a/Penumbra/Services/ServiceManagerA.cs +++ b/Penumbra/Services/ServiceManagerA.cs @@ -105,7 +105,7 @@ public static class ServiceManagerA private static ServiceManager AddConfiguration(this ServiceManager services) => services.AddSingleton() .AddSingleton() - .AddSingleton(); + .AddSingleton(); private static ServiceManager AddCollections(this ServiceManager services) => services.AddSingleton() diff --git a/Penumbra/UI/Classes/Colors.cs b/Penumbra/UI/Classes/Colors.cs index 50096696..4d0c62af 100644 --- a/Penumbra/UI/Classes/Colors.cs +++ b/Penumbra/UI/Classes/Colors.cs @@ -28,8 +28,8 @@ public enum ColorId ResTreePlayer, ResTreeNetworked, ResTreeNonNetworked, - SharedTagAdd, - SharedTagRemove + PredefinedTagAdd, + PredefinedTagRemove, } public static class Colors @@ -75,8 +75,8 @@ public static class Colors ColorId.ResTreePlayer => ( 0xFFC0FFC0, "On-Screen: Other Players", "Other players and what they own, in the On-Screen tab." ), ColorId.ResTreeNetworked => ( 0xFFFFFFFF, "On-Screen: Non-Players (Networked)", "Non-player entities handled by the game server, in the On-Screen tab." ), ColorId.ResTreeNonNetworked => ( 0xFFC0C0FF, "On-Screen: Non-Players (Local)", "Non-player entities handled locally, in the On-Screen tab." ), - ColorId.SharedTagAdd => ( 0xFF44AA44, "Shared Tags: Add Tag", "A shared tag that is not present on the current mod and can be added." ), - ColorId.SharedTagRemove => ( 0xFF2222AA, "Shared Tags: Remove Tag", "A shared tag that is already present on the current mod and can be removed." ), + ColorId.PredefinedTagAdd => ( 0xFF44AA44, "Predefined Tags: Add Tag", "A predefined tag that is not present on the current mod and can be added." ), + ColorId.PredefinedTagRemove => ( 0xFF2222AA, "Predefined Tags: Remove Tag", "A predefined tag that is already present on the current mod and can be removed." ), _ => throw new ArgumentOutOfRangeException( nameof( color ), color, null ), // @formatter:on }; diff --git a/Penumbra/UI/ModsTab/ModPanelDescriptionTab.cs b/Penumbra/UI/ModsTab/ModPanelDescriptionTab.cs index 5f2687c3..4c5e68ff 100644 --- a/Penumbra/UI/ModsTab/ModPanelDescriptionTab.cs +++ b/Penumbra/UI/ModsTab/ModPanelDescriptionTab.cs @@ -7,22 +7,15 @@ using Penumbra.Mods.Manager; namespace Penumbra.UI.ModsTab; -public class ModPanelDescriptionTab : ITab +public class ModPanelDescriptionTab( + ModFileSystemSelector selector, + TutorialService tutorial, + ModManager modManager, + PredefinedTagManager predefinedTagsConfig) + : ITab { - private readonly ModFileSystemSelector _selector; - private readonly TutorialService _tutorial; - private readonly ModManager _modManager; - private readonly SharedTagManager _sharedTagManager; - private readonly TagButtons _localTags = new(); - private readonly TagButtons _modTags = new(); - - public ModPanelDescriptionTab(ModFileSystemSelector selector, TutorialService tutorial, ModManager modManager, SharedTagManager sharedTagsConfig) - { - _selector = selector; - _tutorial = tutorial; - _modManager = modManager; - _sharedTagManager = sharedTagsConfig; - } + private readonly TagButtons _localTags = new(); + private readonly TagButtons _modTags = new(); public ReadOnlySpan Label => "Description"u8; @@ -36,29 +29,28 @@ public class ModPanelDescriptionTab : ITab ImGui.Dummy(ImGuiHelpers.ScaledVector2(2)); ImGui.Dummy(ImGuiHelpers.ScaledVector2(2)); - var sharedTagsEnabled = _sharedTagManager.SharedTags.Count > 0; + var sharedTagsEnabled = predefinedTagsConfig.SharedTags.Count > 0; var sharedTagButtonOffset = sharedTagsEnabled ? ImGui.GetFrameHeight() + ImGui.GetStyle().FramePadding.X : 0; var tagIdx = _localTags.Draw("Local Tags: ", "Custom tags you can set personally that will not be exported to the mod data but only set for you.\n" - + "If the mod already contains a local tag in its own tags, the local tag will be ignored.", _selector.Selected!.LocalTags, + + "If the mod already contains a local tag in its own tags, the local tag will be ignored.", selector.Selected!.LocalTags, out var editedTag, rightEndOffset: sharedTagButtonOffset); - _tutorial.OpenTutorial(BasicTutorialSteps.Tags); + tutorial.OpenTutorial(BasicTutorialSteps.Tags); if (tagIdx >= 0) - _modManager.DataEditor.ChangeLocalTag(_selector.Selected!, tagIdx, editedTag); + modManager.DataEditor.ChangeLocalTag(selector.Selected!, tagIdx, editedTag); if (sharedTagsEnabled) - { - _sharedTagManager.DrawAddFromSharedTagsAndUpdateTags(_selector.Selected!.LocalTags, _selector.Selected!.ModTags, true, _selector.Selected!); - } + predefinedTagsConfig.DrawAddFromSharedTagsAndUpdateTags(selector.Selected!.LocalTags, selector.Selected!.ModTags, true, + selector.Selected!); - if (_selector.Selected!.ModTags.Count > 0) + if (selector.Selected!.ModTags.Count > 0) _modTags.Draw("Mod Tags: ", "Tags assigned by the mod creator and saved with the mod data. To edit these, look at Edit Mod.", - _selector.Selected!.ModTags, out var _, false, + selector.Selected!.ModTags, out _, false, ImGui.CalcTextSize("Local ").X - ImGui.CalcTextSize("Mod ").X); ImGui.Dummy(ImGuiHelpers.ScaledVector2(2)); ImGui.Separator(); - ImGuiUtil.TextWrapped(_selector.Selected!.Description); + ImGuiUtil.TextWrapped(selector.Selected!.Description); } } diff --git a/Penumbra/UI/ModsTab/ModPanelEditTab.cs b/Penumbra/UI/ModsTab/ModPanelEditTab.cs index 9b4a582f..275c89ef 100644 --- a/Penumbra/UI/ModsTab/ModPanelEditTab.cs +++ b/Penumbra/UI/ModsTab/ModPanelEditTab.cs @@ -17,18 +17,20 @@ using Penumbra.UI.AdvancedWindow; namespace Penumbra.UI.ModsTab; -public class ModPanelEditTab : ITab +public class ModPanelEditTab( + ModManager modManager, + ModFileSystemSelector selector, + ModFileSystem fileSystem, + Services.MessageService messager, + ModEditWindow editWindow, + ModEditor editor, + FilenameService filenames, + ModExportManager modExportManager, + Configuration config, + PredefinedTagManager predefinedTagManager) + : ITab { - private readonly Services.MessageService _messager; - private readonly FilenameService _filenames; - private readonly ModManager _modManager; - private readonly ModExportManager _modExportManager; - private readonly ModFileSystem _fileSystem; - private readonly ModFileSystemSelector _selector; - private readonly ModEditWindow _editWindow; - private readonly ModEditor _editor; - private readonly Configuration _config; - private readonly SharedTagManager _sharedTagManager; + private readonly ModManager _modManager = modManager; private readonly TagButtons _modTags = new(); @@ -37,22 +39,6 @@ public class ModPanelEditTab : ITab private ModFileSystem.Leaf _leaf = null!; private Mod _mod = null!; - public ModPanelEditTab(ModManager modManager, ModFileSystemSelector selector, ModFileSystem fileSystem, Services.MessageService messager, - ModEditWindow editWindow, ModEditor editor, FilenameService filenames, ModExportManager modExportManager, Configuration config, - SharedTagManager sharedTagManager) - { - _modManager = modManager; - _selector = selector; - _fileSystem = fileSystem; - _messager = messager; - _editWindow = editWindow; - _editor = editor; - _filenames = filenames; - _modExportManager = modExportManager; - _config = config; - _sharedTagManager = sharedTagManager; - } - public ReadOnlySpan Label => "Edit Mod"u8; @@ -62,8 +48,8 @@ public class ModPanelEditTab : ITab if (!child) return; - _leaf = _selector.SelectedLeaf!; - _mod = _selector.Selected!; + _leaf = selector.SelectedLeaf!; + _mod = selector.Selected!; _cellPadding = ImGui.GetStyle().CellPadding with { X = 2 * UiHelpers.Scale }; _itemSpacing = ImGui.GetStyle().CellPadding with { X = 4 * UiHelpers.Scale }; @@ -75,15 +61,15 @@ public class ModPanelEditTab : ITab if (Input.Text("Mod Path", Input.Path, Input.None, _leaf.FullName(), out var newPath, 256, UiHelpers.InputTextWidth.X)) try { - _fileSystem.RenameAndMove(_leaf, newPath); + fileSystem.RenameAndMove(_leaf, newPath); } catch (Exception e) { - _messager.NotificationMessage(e.Message, NotificationType.Warning, false); + messager.NotificationMessage(e.Message, NotificationType.Warning, false); } UiHelpers.DefaultLineSpace(); - var sharedTagsEnabled = _sharedTagManager.SharedTags.Count > 0; + var sharedTagsEnabled = predefinedTagManager.SharedTags.Count > 0; var sharedTagButtonOffset = sharedTagsEnabled ? ImGui.GetFrameHeight() + ImGui.GetStyle().FramePadding.X : 0; var tagIdx = _modTags.Draw("Mod Tags: ", "Edit tags by clicking them, or add new tags. Empty tags are removed.", _mod.ModTags, out var editedTag, rightEndOffset: sharedTagButtonOffset); @@ -91,12 +77,11 @@ public class ModPanelEditTab : ITab _modManager.DataEditor.ChangeModTag(_mod, tagIdx, editedTag); if (sharedTagsEnabled) - { - _sharedTagManager.DrawAddFromSharedTagsAndUpdateTags(_selector.Selected!.LocalTags, _selector.Selected!.ModTags, false, _selector.Selected!); - } + predefinedTagManager.DrawAddFromSharedTagsAndUpdateTags(selector.Selected!.LocalTags, selector.Selected!.ModTags, false, + selector.Selected!); UiHelpers.DefaultLineSpace(); - AddOptionGroup.Draw(_filenames, _modManager, _mod, _config.ReplaceNonAsciiOnImport); + AddOptionGroup.Draw(filenames, _modManager, _mod, config.ReplaceNonAsciiOnImport); UiHelpers.DefaultLineSpace(); for (var groupIdx = 0; groupIdx < _mod.Groups.Count; ++groupIdx) @@ -144,11 +129,11 @@ public class ModPanelEditTab : ITab { if (ImGui.Button("Update Bibo Material", buttonSize)) { - _editor.LoadMod(_mod); - _editor.MdlMaterialEditor.ReplaceAllMaterials("bibo", "b"); - _editor.MdlMaterialEditor.ReplaceAllMaterials("bibopube", "c"); - _editor.MdlMaterialEditor.SaveAllModels(_editor.Compactor); - _editWindow.UpdateModels(); + editor.LoadMod(_mod); + editor.MdlMaterialEditor.ReplaceAllMaterials("bibo", "b"); + editor.MdlMaterialEditor.ReplaceAllMaterials("bibopube", "c"); + editor.MdlMaterialEditor.SaveAllModels(editor.Compactor); + editWindow.UpdateModels(); } ImGuiUtil.HoverTooltip( @@ -160,7 +145,7 @@ public class ModPanelEditTab : ITab private void BackupButtons(Vector2 buttonSize) { - var backup = new ModBackup(_modExportManager, _mod); + var backup = new ModBackup(modExportManager, _mod); var tt = ModBackup.CreatingBackup ? "Already exporting a mod." : backup.Exists @@ -171,16 +156,16 @@ public class ModPanelEditTab : ITab ImGui.SameLine(); tt = backup.Exists - ? $"Delete existing mod export \"{backup.Name}\" (hold {_config.DeleteModModifier} while clicking)." + ? $"Delete existing mod export \"{backup.Name}\" (hold {config.DeleteModModifier} while clicking)." : $"Exported mod \"{backup.Name}\" does not exist."; - if (ImGuiUtil.DrawDisabledButton("Delete Export", buttonSize, tt, !backup.Exists || !_config.DeleteModModifier.IsActive())) + if (ImGuiUtil.DrawDisabledButton("Delete Export", buttonSize, tt, !backup.Exists || !config.DeleteModModifier.IsActive())) backup.Delete(); tt = backup.Exists - ? $"Restore mod from exported file \"{backup.Name}\" (hold {_config.DeleteModModifier} while clicking)." + ? $"Restore mod from exported file \"{backup.Name}\" (hold {config.DeleteModModifier} while clicking)." : $"Exported mod \"{backup.Name}\" does not exist."; ImGui.SameLine(); - if (ImGuiUtil.DrawDisabledButton("Restore From Export", buttonSize, tt, !backup.Exists || !_config.DeleteModModifier.IsActive())) + if (ImGuiUtil.DrawDisabledButton("Restore From Export", buttonSize, tt, !backup.Exists || !config.DeleteModModifier.IsActive())) backup.Restore(_modManager); if (backup.Exists) { @@ -218,13 +203,13 @@ public class ModPanelEditTab : ITab _delayedActions.Enqueue(() => DescriptionEdit.OpenPopup(_mod, Input.Description)); ImGui.SameLine(); - var fileExists = File.Exists(_filenames.ModMetaPath(_mod)); + var fileExists = File.Exists(filenames.ModMetaPath(_mod)); var tt = fileExists ? "Open the metadata json file in the text editor of your choice." : "The metadata json file does not exist."; if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.FileExport.ToIconString()}##metaFile", UiHelpers.IconButtonSize, tt, !fileExists, true)) - Process.Start(new ProcessStartInfo(_filenames.ModMetaPath(_mod)) { UseShellExecute = true }); + Process.Start(new ProcessStartInfo(filenames.ModMetaPath(_mod)) { UseShellExecute = true }); } /// Do some edits outside of iterations. @@ -448,7 +433,7 @@ public class ModPanelEditTab : ITab _delayedActions.Enqueue(() => DescriptionEdit.OpenPopup(_mod, groupIdx)); ImGui.SameLine(); - var fileName = _filenames.OptionGroupFile(_mod, groupIdx, _config.ReplaceNonAsciiOnImport); + var fileName = filenames.OptionGroupFile(_mod, groupIdx, config.ReplaceNonAsciiOnImport); var fileExists = File.Exists(fileName); tt = fileExists ? $"Open the {group.Name} json file in the text editor of your choice." diff --git a/Penumbra/UI/SharedTagManager.cs b/Penumbra/UI/PredefinedTagManager.cs similarity index 83% rename from Penumbra/UI/SharedTagManager.cs rename to Penumbra/UI/PredefinedTagManager.cs index 23196319..fafca101 100644 --- a/Penumbra/UI/SharedTagManager.cs +++ b/Penumbra/UI/PredefinedTagManager.cs @@ -1,6 +1,5 @@ using Dalamud.Interface; using Dalamud.Interface.Internal.Notifications; -using Dalamud.Utility; using ImGuiNET; using Newtonsoft.Json; using OtterGui; @@ -12,44 +11,45 @@ using Penumbra.UI.Classes; using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; namespace Penumbra.UI; -public sealed class SharedTagManager : ISavable + +public sealed class PredefinedTagManager : ISavable { - private readonly ModManager _modManager; + private readonly ModManager _modManager; private readonly SaveService _saveService; - private static uint _tagButtonAddColor = ColorId.SharedTagAdd.Value(); - private static uint _tagButtonRemoveColor = ColorId.SharedTagRemove.Value(); + private static uint _tagButtonAddColor = ColorId.PredefinedTagAdd.Value(); + private static uint _tagButtonRemoveColor = ColorId.PredefinedTagRemove.Value(); private static float _minTagButtonWidth = 15; private const string PopupContext = "SharedTagsPopup"; - private bool _isPopupOpen = false; + private bool _isPopupOpen = false; // Operations on this list assume that it is sorted and will keep it sorted if that is the case. // The list also gets re-sorted when first loaded from config in case the config was modified. [JsonRequired] private readonly List _sharedTags = []; + [JsonIgnore] - public IReadOnlyList SharedTags => _sharedTags; + public IReadOnlyList SharedTags + => _sharedTags; public int ConfigVersion = 1; - public SharedTagManager(ModManager modManager, SaveService saveService) + public PredefinedTagManager(ModManager modManager, SaveService saveService) { - _modManager = modManager; + _modManager = modManager; _saveService = saveService; Load(); } public string ToFilename(FilenameService fileNames) - { - return fileNames.SharedTagFile; - } + => fileNames.PredefinedTagFile; public void Save(StreamWriter writer) { - using var jWriter = new JsonTextWriter(writer) { Formatting = Formatting.Indented }; - var serializer = new JsonSerializer { Formatting = Formatting.Indented }; + using var jWriter = new JsonTextWriter(writer) { Formatting = Formatting.Indented }; + var serializer = new JsonSerializer { Formatting = Formatting.Indented }; serializer.Serialize(jWriter, this); } @@ -65,12 +65,12 @@ public sealed class SharedTagManager : ISavable errorArgs.ErrorContext.Handled = true; } - if (!File.Exists(_saveService.FileNames.SharedTagFile)) + if (!File.Exists(_saveService.FileNames.PredefinedTagFile)) return; try { - var text = File.ReadAllText(_saveService.FileNames.SharedTagFile); + var text = File.ReadAllText(_saveService.FileNames.PredefinedTagFile); JsonConvert.PopulateObject(text, this, new JsonSerializerSettings { Error = HandleDeserializationError, @@ -94,9 +94,7 @@ public sealed class SharedTagManager : ISavable // In the case of editing a tag, remove what's there prior to doing an insert. if (tagIdx != SharedTags.Count) - { _sharedTags.RemoveAt(tagIdx); - } if (!string.IsNullOrEmpty(tag)) { @@ -109,7 +107,8 @@ public sealed class SharedTagManager : ISavable Save(); } - public void DrawAddFromSharedTagsAndUpdateTags(IReadOnlyCollection localTags, IReadOnlyCollection modTags, bool editLocal, Mods.Mod mod) + public void DrawAddFromSharedTagsAndUpdateTags(IReadOnlyCollection localTags, IReadOnlyCollection modTags, bool editLocal, + Mods.Mod mod) { ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetFrameHeightWithSpacing()); ImGui.SetCursorPosX(ImGui.GetWindowWidth() - ImGui.GetFrameHeight() - ImGui.GetStyle().FramePadding.X); @@ -131,7 +130,8 @@ public sealed class SharedTagManager : ISavable { _modManager.DataEditor.ChangeLocalTag(mod, index, string.Empty); } - } else + } + else { if (index < 0) { @@ -143,15 +143,16 @@ public sealed class SharedTagManager : ISavable _modManager.DataEditor.ChangeModTag(mod, index, string.Empty); } } - } } public string DrawAddFromSharedTags(IReadOnlyCollection localTags, IReadOnlyCollection modTags, bool editLocal) { var tagToAdd = string.Empty; - if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Tags.ToIconString(), new Vector2(ImGui.GetFrameHeight()), "Add Shared Tag... (Right-click to close popup)", - false, true) || _isPopupOpen) + if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Tags.ToIconString(), new Vector2(ImGui.GetFrameHeight()), + "Add Shared Tag... (Right-click to close popup)", + false, true) + || _isPopupOpen) return DrawSharedTagsPopup(localTags, modTags, editLocal); return tagToAdd; @@ -167,9 +168,9 @@ public sealed class SharedTagManager : ISavable } var display = ImGui.GetIO().DisplaySize; - var height = Math.Min(display.Y / 4, 10 * ImGui.GetFrameHeightWithSpacing()); - var width = display.X / 6; - var size = new Vector2(width, height); + var height = Math.Min(display.Y / 4, 10 * ImGui.GetFrameHeightWithSpacing()); + var width = display.X / 6; + var size = new Vector2(width, height); ImGui.SetNextWindowSize(size); using var popup = ImRaii.Popup(PopupContext); if (!popup) @@ -182,26 +183,23 @@ public sealed class SharedTagManager : ISavable foreach (var (tag, idx) in SharedTags.WithIndex()) { if (DrawColoredButton(localTags, modTags, tag, editLocal, idx)) - { selected = tag; - } ImGui.SameLine(); } if (ImGui.IsMouseClicked(ImGuiMouseButton.Right)) - { _isPopupOpen = false; - } return selected; } - private static bool DrawColoredButton(IReadOnlyCollection localTags, IReadOnlyCollection modTags, string buttonLabel, bool editLocal, int index) + private static bool DrawColoredButton(IReadOnlyCollection localTags, IReadOnlyCollection modTags, string buttonLabel, + bool editLocal, int index) { var ret = false; var isLocalTagPresent = localTags.Contains(buttonLabel); - var isModTagPresent = modTags.Contains(buttonLabel); + var isModTagPresent = modTags.Contains(buttonLabel); var buttonWidth = CalcTextButtonWidth(buttonLabel); // Would prefer to be able to fit at least 2 buttons per line so the popup doesn't look sparse with lots of long tags. Thus long tags will be trimmed. @@ -210,7 +208,7 @@ public sealed class SharedTagManager : ISavable if (buttonWidth >= maxButtonWidth) { displayedLabel = TrimButtonTextToWidth(buttonLabel, maxButtonWidth); - buttonWidth = CalcTextButtonWidth(displayedLabel); + buttonWidth = CalcTextButtonWidth(displayedLabel); } // Prevent adding a new tag past the right edge of the popup @@ -247,9 +245,8 @@ public sealed class SharedTagManager : ISavable // An ellipsis will be used to indicate trimmed tags if (CalcTextButtonWidth(nextTrim + "...") < maxWidth) - { return nextTrim + "..."; - } + trimmedText = nextTrim; } @@ -257,7 +254,5 @@ public sealed class SharedTagManager : ISavable } private static float CalcTextButtonWidth(string text) - { - return ImGui.CalcTextSize(text).X + 2 * ImGui.GetStyle().FramePadding.X; - } + => ImGui.CalcTextSize(text).X + 2 * ImGui.GetStyle().FramePadding.X; } diff --git a/Penumbra/UI/Tabs/SettingsTab.cs b/Penumbra/UI/Tabs/SettingsTab.cs index b311bb93..c36c63b2 100644 --- a/Penumbra/UI/Tabs/SettingsTab.cs +++ b/Penumbra/UI/Tabs/SettingsTab.cs @@ -42,7 +42,7 @@ public class SettingsTab : ITab private readonly DalamudConfigService _dalamudConfig; private readonly DalamudPluginInterface _pluginInterface; private readonly IDataManager _gameData; - private readonly SharedTagManager _sharedTagManager; + private readonly PredefinedTagManager _predefinedTagManager; private int _minimumX = int.MaxValue; private int _minimumY = int.MaxValue; @@ -53,7 +53,7 @@ public class SettingsTab : ITab Penumbra penumbra, FileDialogService fileDialog, ModManager modManager, ModFileSystemSelector selector, CharacterUtility characterUtility, ResidentResourceManager residentResources, ModExportManager modExportManager, HttpApi httpApi, DalamudSubstitutionProvider dalamudSubstitutionProvider, FileCompactor compactor, DalamudConfigService dalamudConfig, - IDataManager gameData, SharedTagManager sharedTagConfig) + IDataManager gameData, PredefinedTagManager predefinedTagConfig) { _pluginInterface = pluginInterface; _config = config; @@ -73,7 +73,7 @@ public class SettingsTab : ITab _gameData = gameData; if (_compactor.CanCompact) _compactor.Enabled = _config.UseFileSystemCompression; - _sharedTagManager = sharedTagConfig; + _predefinedTagManager = predefinedTagConfig; } public void DrawHeader() @@ -101,7 +101,7 @@ public class SettingsTab : ITab DrawGeneralSettings(); DrawColorSettings(); DrawAdvancedSettings(); - DrawSharedTagsSection(); + DrawPredefinedTagsSection(); DrawSupportButtons(); } @@ -239,7 +239,7 @@ public class SettingsTab : ITab } var selected = ImGui.IsItemActive(); - using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(UiHelpers.ScaleX3, 0)); + using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(UiHelpers.ScaleX3, 0)); ImGui.SameLine(); DrawDirectoryPickerButton(); style.Pop(); @@ -388,7 +388,7 @@ public class SettingsTab : ITab "Hide the Penumbra main window when you manually hide the in-game user interface.", _config.HideUiWhenUiHidden, v => { - _config.HideUiWhenUiHidden = v; + _config.HideUiWhenUiHidden = v; _pluginInterface.UiBuilder.DisableUserUiHide = !v; }); Checkbox("Hide Config Window when in Cutscenes", @@ -917,18 +917,16 @@ public class SettingsTab : ITab _penumbra.ForceChangelogOpen(); } - private void DrawSharedTagsSection() + private void DrawPredefinedTagsSection() { if (!ImGui.CollapsingHeader("Tags")) return; - var tagIdx = _sharedTags.Draw("Shared Tags: ", - "Predefined tags that can be added or removed from mods with a single click.", _sharedTagManager.SharedTags, + var tagIdx = _sharedTags.Draw("Predefined Tags: ", + "Predefined tags that can be added or removed from mods with a single click.", _predefinedTagManager.SharedTags, out var editedTag); if (tagIdx >= 0) - { - _sharedTagManager.ChangeSharedTag(tagIdx, editedTag); - } + _predefinedTagManager.ChangeSharedTag(tagIdx, editedTag); } }