diff --git a/Glamourer/Api/GlamourerApi.cs b/Glamourer/Api/GlamourerApi.cs index e4ca224..c176a30 100644 --- a/Glamourer/Api/GlamourerApi.cs +++ b/Glamourer/Api/GlamourerApi.cs @@ -3,7 +3,7 @@ using Luna; namespace Glamourer.Api; -public class GlamourerApi(Configuration config, DesignsApi designs, StateApi state, ItemsApi items) : IGlamourerApi, IApiService +public class GlamourerApi(Configuration.Configuration config, DesignsApi designs, StateApi state, ItemsApi items) : IGlamourerApi, IApiService { public const int CurrentApiVersionMajor = 1; public const int CurrentApiVersionMinor = 7; diff --git a/Glamourer/Automation/AutoDesignApplier.cs b/Glamourer/Automation/AutoDesignApplier.cs index a61a004..71b76a3 100644 --- a/Glamourer/Automation/AutoDesignApplier.cs +++ b/Glamourer/Automation/AutoDesignApplier.cs @@ -16,22 +16,22 @@ namespace Glamourer.Automation; public sealed class AutoDesignApplier : IDisposable { - private readonly Configuration _config; - private readonly AutoDesignManager _manager; - private readonly StateManager _state; - private readonly JobService _jobs; - private readonly EquippedGearset _equippedGearset; - private readonly ActorManager _actors; - private readonly AutomationChanged _event; - private readonly ActorObjectManager _objects; - private readonly WeaponLoading _weapons; - private readonly HumanModelList _humans; - private readonly DesignMerger _designMerger; - private readonly IClientState _clientState; + private readonly Configuration.Configuration _config; + private readonly AutoDesignManager _manager; + private readonly StateManager _state; + private readonly JobService _jobs; + private readonly EquippedGearset _equippedGearset; + private readonly ActorManager _actors; + private readonly AutomationChanged _event; + private readonly ActorObjectManager _objects; + private readonly WeaponLoading _weapons; + private readonly HumanModelList _humans; + private readonly DesignMerger _designMerger; + private readonly IClientState _clientState; private readonly JobChangeState _jobChangeState; - public AutoDesignApplier(Configuration config, AutoDesignManager manager, StateManager state, JobService jobs, ActorManager actors, + public AutoDesignApplier(Configuration.Configuration config, AutoDesignManager manager, StateManager state, JobService jobs, ActorManager actors, AutomationChanged @event, ActorObjectManager objects, WeaponLoading weapons, HumanModelList humans, IClientState clientState, EquippedGearset equippedGearset, DesignMerger designMerger, JobChangeState jobChangeState) { diff --git a/Glamourer/Automation/AutoDesignManager.cs b/Glamourer/Automation/AutoDesignManager.cs index a7e63bd..eb76bd0 100644 --- a/Glamourer/Automation/AutoDesignManager.cs +++ b/Glamourer/Automation/AutoDesignManager.cs @@ -381,7 +381,7 @@ public class AutoDesignManager : ISavable, IReadOnlyList, IDispos _event.Invoke(AutomationChanged.Type.ChangedData, set, (which, data)); } - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.AutomationFile; public void Save(StreamWriter writer) diff --git a/Glamourer/Configuration.cs b/Glamourer/Configuration/Configuration.cs similarity index 86% rename from Glamourer/Configuration.cs rename to Glamourer/Configuration/Configuration.cs index 219e8cf..417850f 100644 --- a/Glamourer/Configuration.cs +++ b/Glamourer/Configuration/Configuration.cs @@ -6,53 +6,21 @@ using Glamourer.Gui; using Glamourer.Gui.Tabs.DesignTab; using Glamourer.Services; using ImSharp; +using Luna; using Newtonsoft.Json; using OtterGui.Filesystem; -using Luna; -using Luna.Generators; using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; -namespace Glamourer; - -[TooltipEnum] -public enum HeightDisplayType -{ - [Tooltip("Do Not Display")] - None, - - [Tooltip("Centimetres (000.0 cm)")] - Centimetre, - - [Tooltip("Metres (0.00 m)")] - Metre, - - [Tooltip("Inches (00.0 in)")] - Wrong, - - [Tooltip("Feet (0'00'')")] - WrongFoot, - - [Tooltip("Corgis (0.0 Corgis)")] - Corgi, - - [Tooltip("Olympic-size swimming Pools (0.000 Pools)")] - OlympicPool, -} - -public class DefaultDesignSettings -{ - public bool AlwaysForceRedrawing = false; - public bool ResetAdvancedDyes = false; - public bool ShowQuickDesignBar = true; - public bool ResetTemporarySettings = false; - public bool Locked = false; -} +namespace Glamourer.Configuration; public class Configuration : IPluginConfiguration, ISavable { [JsonIgnore] public readonly EphemeralConfig Ephemeral; + [JsonIgnore] + public readonly UiConfig Ui; + public bool AttachToPcp { get; set; } = true; public bool UseRestrictedGearProtection { get; set; } = false; public bool OpenFoldersByDefault { get; set; } = false; @@ -120,10 +88,11 @@ public class Configuration : IPluginConfiguration, ISavable [JsonIgnore] private readonly SaveService _saveService; - public Configuration(SaveService saveService, ConfigMigrationService migrator, EphemeralConfig ephemeral) + public Configuration(SaveService saveService, ConfigMigrationService migrator, EphemeralConfig ephemeral, UiConfig ui) { _saveService = saveService; Ephemeral = ephemeral; + Ui = ui; Load(migrator); } @@ -132,13 +101,13 @@ public class Configuration : IPluginConfiguration, ISavable private void Load(ConfigMigrationService migrator) { - if (!File.Exists(_saveService.FileNames.ConfigFile)) + if (!File.Exists(_saveService.FileNames.ConfigurationFile)) return; - if (File.Exists(_saveService.FileNames.ConfigFile)) + if (File.Exists(_saveService.FileNames.ConfigurationFile)) try { - var text = File.ReadAllText(_saveService.FileNames.ConfigFile); + var text = File.ReadAllText(_saveService.FileNames.ConfigurationFile); JsonConvert.PopulateObject(text, this, new JsonSerializerSettings { Error = HandleDeserializationError, @@ -162,8 +131,8 @@ public class Configuration : IPluginConfiguration, ISavable } } - public string ToFilename(FilenameService fileNames) - => fileNames.ConfigFile; + public string ToFilePath(FilenameService fileNames) + => fileNames.ConfigurationFile; public void Save(StreamWriter writer) { diff --git a/Glamourer/Configuration/DefaultDesignSettings.cs b/Glamourer/Configuration/DefaultDesignSettings.cs new file mode 100644 index 0000000..4ed7dfe --- /dev/null +++ b/Glamourer/Configuration/DefaultDesignSettings.cs @@ -0,0 +1,10 @@ +namespace Glamourer.Configuration; + +public class DefaultDesignSettings +{ + public bool AlwaysForceRedrawing = false; + public bool ResetAdvancedDyes = false; + public bool ShowQuickDesignBar = true; + public bool ResetTemporarySettings = false; + public bool Locked = false; +} diff --git a/Glamourer/DesignPanelFlag.cs b/Glamourer/Configuration/DesignPanelFlag.cs similarity index 93% rename from Glamourer/DesignPanelFlag.cs rename to Glamourer/Configuration/DesignPanelFlag.cs index a5a353a..c381222 100644 --- a/Glamourer/DesignPanelFlag.cs +++ b/Glamourer/Configuration/DesignPanelFlag.cs @@ -1,7 +1,7 @@ -using Luna.Generators; -using ImSharp; +using ImSharp; +using Luna.Generators; -namespace Glamourer; +namespace Glamourer.Configuration; [Flags] [NamedEnum(Utf16: false)] @@ -42,7 +42,7 @@ public static partial class DesignPanelFlagExtensions { private static readonly StringU8 Expand = new("Expand"u8); - public static Im.HeaderDisposable Header(this DesignPanelFlag flag, Configuration config) + public static Im.HeaderDisposable Header(this DesignPanelFlag flag, global::Glamourer.Configuration.Configuration config) { if (config.HideDesignPanel.HasFlag(flag)) return default; @@ -55,7 +55,6 @@ public static partial class DesignPanelFlagExtensions Action setterExpand) { var checkBoxWidth = Math.Max(Im.Style.FrameHeight, Expand.CalculateSize().X); - var test = DesignPanelFlag.AdvancedCustomizations.ToNameU8(); var textWidth = AdvancedCustomizations_Name__GenU8.CalculateSize().X; var tableSize = 2 * (textWidth + 2 * checkBoxWidth) + 10 * Im.Style.CellPadding.X diff --git a/Glamourer/EphemeralConfig.cs b/Glamourer/Configuration/EphemeralConfig.cs similarity index 94% rename from Glamourer/EphemeralConfig.cs rename to Glamourer/Configuration/EphemeralConfig.cs index fd76817..ebf1c75 100644 --- a/Glamourer/EphemeralConfig.cs +++ b/Glamourer/Configuration/EphemeralConfig.cs @@ -6,7 +6,7 @@ using Luna.Generators; using Newtonsoft.Json; using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs; -namespace Glamourer; +namespace Glamourer.Configuration; public partial class EphemeralConfig : ISavable { @@ -69,7 +69,7 @@ public partial class EphemeralConfig : ISavable } } - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.EphemeralConfigFile; public void Save(StreamWriter writer) diff --git a/Glamourer/Configuration/HeightDisplayType.cs b/Glamourer/Configuration/HeightDisplayType.cs new file mode 100644 index 0000000..5ff79e0 --- /dev/null +++ b/Glamourer/Configuration/HeightDisplayType.cs @@ -0,0 +1,28 @@ +using Luna.Generators; + +namespace Glamourer.Configuration; + +[TooltipEnum] +public enum HeightDisplayType +{ + [Tooltip("Do Not Display")] + None, + + [Tooltip("Centimetres (000.0 cm)")] + Centimetre, + + [Tooltip("Metres (0.00 m)")] + Metre, + + [Tooltip("Inches (00.0 in)")] + Wrong, + + [Tooltip("Feet (0'00'')")] + WrongFoot, + + [Tooltip("Corgis (0.0 Corgis)")] + Corgi, + + [Tooltip("Olympic-size swimming Pools (0.000 Pools)")] + OlympicPool, +} diff --git a/Glamourer/Configuration/UiConfig.cs b/Glamourer/Configuration/UiConfig.cs new file mode 100644 index 0000000..c1ee1b4 --- /dev/null +++ b/Glamourer/Configuration/UiConfig.cs @@ -0,0 +1,50 @@ +using Glamourer.Services; +using Luna; +using Luna.Generators; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Glamourer.Configuration; + +public sealed partial class UiConfig : ConfigurationFile +{ + public UiConfig(SaveService saveService, MessageService messageService) + : base(saveService, messageService) + { + Load(); + } + + [ConfigProperty] + private TwoPanelWidth _actorsTabScale = new(250, ScalingMode.Absolute); + + [ConfigProperty] + private TwoPanelWidth _designsTabScale = new(0.3f, ScalingMode.Percentage); + + [ConfigProperty] + private TwoPanelWidth _automationTabScale = new(0.3f, ScalingMode.Percentage); + + [ConfigProperty] + private TwoPanelWidth _npcTabScale = new(250, ScalingMode.Absolute); + + public override int CurrentVersion + => 1; + + protected override void AddData(JsonTextWriter j) + { + ActorsTabScale.WriteJson(j, "ActorsTab"); + DesignsTabScale.WriteJson(j, "DesignsTab"); + AutomationTabScale.WriteJson(j, "AutomationTab"); + NpcTabScale.WriteJson(j, "NpcTab"); + } + + protected override void LoadData(JObject j) + { + _actorsTabScale = TwoPanelWidth.ReadJson(j, "ActorsTab", new TwoPanelWidth(250, ScalingMode.Absolute)); + _designsTabScale = TwoPanelWidth.ReadJson(j, "DesignsTab", new TwoPanelWidth(0.3f, ScalingMode.Percentage)); + _automationTabScale = TwoPanelWidth.ReadJson(j, "AutomationTab", new TwoPanelWidth(0.3f, ScalingMode.Percentage)); + _npcTabScale = TwoPanelWidth.ReadJson(j, "NpcTab", new TwoPanelWidth(250, ScalingMode.Absolute)); + } + + public override string ToFilePath(FilenameService fileNames) + => fileNames.UiConfiguration; +} diff --git a/Glamourer/Designs/Design.cs b/Glamourer/Designs/Design.cs index 9ceb8c0..69f4404 100644 --- a/Glamourer/Designs/Design.cs +++ b/Glamourer/Designs/Design.cs @@ -11,7 +11,6 @@ using OtterGui.Classes; using Penumbra.GameData.Structs; using Luna; using Notification = Luna.Notification; -using SaveType = OtterGui.Classes.SaveType; namespace Glamourer.Designs; @@ -232,7 +231,7 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn Glamourer.Messager.AddMessage(new Notification( $"Swapped Gloss and Specular Strength in {materialDesignData.Values.Count} Rows in design {design.Incognito} {reason}", NotificationType.Info)); - saveService.Save(SaveType.ImmediateSync, design); + saveService.Save(Luna.SaveType.ImmediateSync, design); } } @@ -329,15 +328,13 @@ public sealed class Design : DesignBase, ISavable, IDesignStandIn #region ISavable - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.DesignFile(this); public void Save(StreamWriter writer) { - using var j = new JsonTextWriter(writer) - { - Formatting = Formatting.Indented, - }; + using var j = new JsonTextWriter(writer); + j.Formatting = Formatting.Indented; var obj = JsonSerialize(); obj.WriteTo(j); } diff --git a/Glamourer/Designs/DesignColors.cs b/Glamourer/Designs/DesignColors.cs index b5b2c4b..b9200eb 100644 --- a/Glamourer/Designs/DesignColors.cs +++ b/Glamourer/Designs/DesignColors.cs @@ -8,7 +8,7 @@ using Newtonsoft.Json.Linq; namespace Glamourer.Designs; -public class DesignColorUi(DesignColors colors, Configuration config) +public class DesignColorUi(DesignColors colors, Configuration.Configuration config) { private string _newName = string.Empty; @@ -183,7 +183,7 @@ public class DesignColors : ISavable, IReadOnlyDictionary SaveAndInvoke(); } - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.DesignColorFile; public void Save(StreamWriter writer) diff --git a/Glamourer/Designs/DesignEditor.cs b/Glamourer/Designs/DesignEditor.cs index e5c0357..828ed43 100644 --- a/Glamourer/Designs/DesignEditor.cs +++ b/Glamourer/Designs/DesignEditor.cs @@ -16,14 +16,14 @@ public class DesignEditor( DesignChanged designChanged, CustomizeService customizations, ItemManager items, - Configuration config) + Configuration.Configuration config) : IDesignEditor { protected readonly DesignChanged DesignChanged = designChanged; protected readonly SaveService SaveService = saveService; protected readonly ItemManager Items = items; protected readonly CustomizeService Customizations = customizations; - protected readonly Configuration Config = config; + protected readonly Configuration.Configuration Config = config; protected readonly Dictionary UndoStore = []; private bool _forceFullItemOff; diff --git a/Glamourer/Designs/DesignFileSystem.cs b/Glamourer/Designs/DesignFileSystem.cs index 159da19..9aa5fb8 100644 --- a/Glamourer/Designs/DesignFileSystem.cs +++ b/Glamourer/Designs/DesignFileSystem.cs @@ -187,7 +187,7 @@ public sealed class DesignFileSystem : OtterGui.Filesystem.FileSystem, I } } - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.DesignFileSystem; public void Save(StreamWriter writer) diff --git a/Glamourer/Designs/DesignManager.cs b/Glamourer/Designs/DesignManager.cs index 9c9122b..2e1a1f9 100644 --- a/Glamourer/Designs/DesignManager.cs +++ b/Glamourer/Designs/DesignManager.cs @@ -21,7 +21,7 @@ public sealed class DesignManager : DesignEditor private readonly HumanModelList _humans; public DesignManager(SaveService saveService, ItemManager items, CustomizeService customizations, - DesignChanged @event, HumanModelList humans, DesignStorage storage, DesignLinkLoader designLinkLoader, Configuration config) + DesignChanged @event, HumanModelList humans, DesignStorage storage, DesignLinkLoader designLinkLoader, Configuration.Configuration config) : base(saveService, @event, customizations, items, config) { Designs = storage; diff --git a/Glamourer/Designs/Links/DesignMerger.cs b/Glamourer/Designs/Links/DesignMerger.cs index 927a7d7..709ae47 100644 --- a/Glamourer/Designs/Links/DesignMerger.cs +++ b/Glamourer/Designs/Links/DesignMerger.cs @@ -15,7 +15,7 @@ namespace Glamourer.Designs.Links; public class DesignMerger( DesignManager designManager, CustomizeService customizeService, - Configuration config, + Configuration.Configuration config, ItemUnlockManager itemUnlocks, CustomizeUnlockManager customizeUnlocks) : IService { diff --git a/Glamourer/Designs/Special/RandomDesignGenerator.cs b/Glamourer/Designs/Special/RandomDesignGenerator.cs index c5d9124..ab736f4 100644 --- a/Glamourer/Designs/Special/RandomDesignGenerator.cs +++ b/Glamourer/Designs/Special/RandomDesignGenerator.cs @@ -3,7 +3,7 @@ using Luna; namespace Glamourer.Designs.Special; -public class RandomDesignGenerator(DesignStorage designs, DesignFileSystem fileSystem, Configuration config) : IService +public class RandomDesignGenerator(DesignStorage designs, DesignFileSystem fileSystem, Configuration.Configuration config) : IService { private readonly Random _rng = new(); private readonly WeakReference _lastDesign = new(null!, false); diff --git a/Glamourer/Glamourer.cs b/Glamourer/Glamourer.cs index 754914e..c059b4f 100644 --- a/Glamourer/Glamourer.cs +++ b/Glamourer/Glamourer.cs @@ -61,7 +61,7 @@ public class Glamourer : IDalamudPlugin public string GatherSupportInformation() { var sb = new StringBuilder(10240); - var config = _services.GetService(); + var config = _services.GetService(); sb.AppendLine("**Settings**"); sb.Append($"> **`Plugin Version: `** {Version}\n"); sb.Append($"> **`Commit Hash: `** {CommitHash}\n"); diff --git a/Glamourer/Gui/Colors.cs b/Glamourer/Gui/Colors.cs index 12c14f8..dab72db 100644 --- a/Glamourer/Gui/Colors.cs +++ b/Glamourer/Gui/Colors.cs @@ -83,6 +83,6 @@ public static class Colors => _colors.TryGetValue(color, out var value) ? value : color.Data().DefaultColor; /// Set the configurable colors dictionary to a value. - public static void SetColors(Configuration config) + public static void SetColors(Configuration.Configuration config) => _colors = config.Colors; } diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs b/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs index cd7f077..dd8a272 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.Simple.cs @@ -1,4 +1,5 @@ using System.Text.Unicode; +using Glamourer.Configuration; using ImSharp; using Penumbra.GameData.Enums; using Penumbra.GameData.Structs; diff --git a/Glamourer/Gui/Customization/CustomizationDrawer.cs b/Glamourer/Gui/Customization/CustomizationDrawer.cs index 89e5688..d6ebf5d 100644 --- a/Glamourer/Gui/Customization/CustomizationDrawer.cs +++ b/Glamourer/Gui/Customization/CustomizationDrawer.cs @@ -14,7 +14,7 @@ namespace Glamourer.Gui.Customization; public partial class CustomizationDrawer( ITextureProvider textures, CustomizeService service, - Configuration config, + Configuration.Configuration config, FavoriteManager favorites, HeightService heightService) : IDisposable diff --git a/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs b/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs index 07bb9e0..65a4e7d 100644 --- a/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs +++ b/Glamourer/Gui/Customization/CustomizeParameterDrawer.cs @@ -7,7 +7,7 @@ using Luna; namespace Glamourer.Gui.Customization; -public class CustomizeParameterDrawer(Configuration config, PaletteImport import) : IService +public class CustomizeParameterDrawer(Configuration.Configuration config, PaletteImport import) : IService { private readonly Dictionary _lastData = []; private StringU8 _paletteName = StringU8.Empty; diff --git a/Glamourer/Gui/DesignCombo.cs b/Glamourer/Gui/DesignCombo.cs index 36cc5fa..cead406 100644 --- a/Glamourer/Gui/DesignCombo.cs +++ b/Glamourer/Gui/DesignCombo.cs @@ -9,7 +9,7 @@ using Luna; namespace Glamourer.Gui; public abstract class DesignComboBase( - EphemeralConfig config, + Configuration.EphemeralConfig config, DesignManager designs, DesignChanged designChanged, DesignColors designColors, @@ -17,13 +17,13 @@ public abstract class DesignComboBase( DesignFileSystem designFileSystem) : FilterComboBase(new DesignFilter(), ConfigData.Default with { ComputeWidth = true }) { - protected readonly EphemeralConfig Config = config; - protected readonly DesignChanged DesignChanged = designChanged; - protected readonly DesignColors DesignColors = designColors; - protected readonly DesignFileSystem DesignFileSystem = designFileSystem; - protected readonly TabSelected TabSelected = tabSelected; - protected readonly DesignManager Designs = designs; - protected IDesignStandIn? CurrentDesign; + protected readonly Configuration.EphemeralConfig Config = config; + protected readonly DesignChanged DesignChanged = designChanged; + protected readonly DesignColors DesignColors = designColors; + protected readonly DesignFileSystem DesignFileSystem = designFileSystem; + protected readonly TabSelected TabSelected = tabSelected; + protected readonly DesignManager Designs = designs; + protected IDesignStandIn? CurrentDesign; protected CacheItem CreateItem(IDesignStandIn design) { @@ -203,7 +203,7 @@ public sealed class QuickDesignCombo : DesignComboBase, IDisposable, IUiService } - public QuickDesignCombo(EphemeralConfig config, DesignChanged designChanged, DesignColors designColors, TabSelected tabSelected, + public QuickDesignCombo(Configuration.EphemeralConfig config, DesignChanged designChanged, DesignColors designColors, TabSelected tabSelected, DesignFileSystem designFileSystem, DesignManager designs) : base(config, designs, designChanged, designColors, tabSelected, designFileSystem) { @@ -264,7 +264,7 @@ public sealed class LinkDesignCombo : DesignComboBase, IUiService, IDisposable { public Design? NewSelection { get; private set; } - public LinkDesignCombo(EphemeralConfig config, DesignChanged designChanged, DesignColors designColors, TabSelected tabSelected, + public LinkDesignCombo(Configuration.EphemeralConfig config, DesignChanged designChanged, DesignColors designColors, TabSelected tabSelected, DesignFileSystem designFileSystem, DesignManager designs) : base(config, designs, designChanged, designColors, tabSelected, designFileSystem) { @@ -295,7 +295,7 @@ public sealed class LinkDesignCombo : DesignComboBase, IUiService, IDisposable } public sealed class RandomDesignCombo( - EphemeralConfig config, + Configuration.EphemeralConfig config, DesignManager designs, DesignChanged designChanged, DesignColors designColors, @@ -346,7 +346,7 @@ public sealed class SpecialDesignCombo : DesignComboBase, IUiService private readonly CacheItem _revert; private readonly CacheItem _quick; - public SpecialDesignCombo(EphemeralConfig config, + public SpecialDesignCombo(Configuration.EphemeralConfig config, DesignManager designs, DesignChanged designChanged, DesignColors designColors, diff --git a/Glamourer/Gui/DesignQuickBar.cs b/Glamourer/Gui/DesignQuickBar.cs index 9e9fa80..cd76118 100644 --- a/Glamourer/Gui/DesignQuickBar.cs +++ b/Glamourer/Gui/DesignQuickBar.cs @@ -33,19 +33,19 @@ public sealed class DesignQuickBar : Window, IDisposable ? WindowFlags.NoDecoration | WindowFlags.NoDocking | WindowFlags.NoFocusOnAppearing | WindowFlags.NoMove : WindowFlags.NoDecoration | WindowFlags.NoDocking | WindowFlags.NoFocusOnAppearing; - private readonly Configuration _config; - private readonly QuickDesignCombo _designCombo; - private readonly StateManager _stateManager; - private readonly AutoDesignApplier _autoDesignApplier; - private readonly ActorObjectManager _objects; - private readonly PenumbraService _penumbra; - private readonly IKeyState _keyState; - private readonly Im.ColorStyleDisposable _style = new(); - private DateTime _keyboardToggle = DateTime.UnixEpoch; - private int _numButtons; - private readonly StringBuilder _tooltipBuilder = new(512); + private readonly Configuration.Configuration _config; + private readonly QuickDesignCombo _designCombo; + private readonly StateManager _stateManager; + private readonly AutoDesignApplier _autoDesignApplier; + private readonly ActorObjectManager _objects; + private readonly PenumbraService _penumbra; + private readonly IKeyState _keyState; + private readonly Im.ColorStyleDisposable _style = new(); + private DateTime _keyboardToggle = DateTime.UnixEpoch; + private int _numButtons; + private readonly StringBuilder _tooltipBuilder = new(512); - public DesignQuickBar(Configuration config, QuickDesignCombo designCombo, StateManager stateManager, IKeyState keyState, + public DesignQuickBar(Configuration.Configuration config, QuickDesignCombo designCombo, StateManager stateManager, IKeyState keyState, ActorObjectManager objects, AutoDesignApplier autoDesignApplier, PenumbraService penumbra) : base("Glamourer Quick Bar", WindowFlags.NoDecoration | WindowFlags.NoDocking) { diff --git a/Glamourer/Gui/Equipment/EquipmentDrawer.cs b/Glamourer/Gui/Equipment/EquipmentDrawer.cs index 720174a..217d8c4 100644 --- a/Glamourer/Gui/Equipment/EquipmentDrawer.cs +++ b/Glamourer/Gui/Equipment/EquipmentDrawer.cs @@ -22,7 +22,7 @@ public class EquipmentDrawer private readonly BonusItemCombo[] _bonusItemCombo; private readonly Dictionary _weaponCombo; private readonly TextureService _textures; - private readonly Configuration _config; + private readonly Configuration.Configuration _config; private readonly GPoseService _gPose; private readonly AdvancedDyePopup _advancedDyes; private readonly ItemCopyService _itemCopy; @@ -32,7 +32,7 @@ public class EquipmentDrawer private EquipSlot _dragTarget; public EquipmentDrawer(FavoriteManager favorites, IDataManager gameData, ItemManager items, TextureService textures, - Configuration config, GPoseService gPose, AdvancedDyePopup advancedDyes, ItemCopyService itemCopy) + Configuration.Configuration config, GPoseService gPose, AdvancedDyePopup advancedDyes, ItemCopyService itemCopy) { _items = items; _textures = textures; diff --git a/Glamourer/Gui/GenericPopupWindow.cs b/Glamourer/Gui/GenericPopupWindow.cs index fa3c93f..cb13a18 100644 --- a/Glamourer/Gui/GenericPopupWindow.cs +++ b/Glamourer/Gui/GenericPopupWindow.cs @@ -6,12 +6,12 @@ namespace Glamourer.Gui; public class GenericPopupWindow : Luna.Window { - private readonly Configuration _config; - private readonly ICondition _condition; - private readonly IClientState _state; - public bool OpenFestivalPopup { get; internal set; } + private readonly Configuration.Configuration _config; + private readonly ICondition _condition; + private readonly IClientState _state; + public bool OpenFestivalPopup { get; internal set; } - public GenericPopupWindow(Configuration config, IClientState state, ICondition condition) + public GenericPopupWindow(Configuration.Configuration config, IClientState state, ICondition condition) : base("Glamourer Popups", WindowFlags.NoBringToFrontOnFocus | WindowFlags.NoDecoration diff --git a/Glamourer/Gui/GlamourerChangelog.cs b/Glamourer/Gui/GlamourerChangelog.cs index 0c285c3..a30dce6 100644 --- a/Glamourer/Gui/GlamourerChangelog.cs +++ b/Glamourer/Gui/GlamourerChangelog.cs @@ -5,11 +5,11 @@ namespace Glamourer.Gui; public class GlamourerChangelog { - public const int LastChangelogVersion = 0; - private readonly Configuration _config; - public readonly Changelog Changelog; + public const int LastChangelogVersion = 0; + private readonly Configuration.Configuration _config; + public readonly Changelog Changelog; - public GlamourerChangelog(Configuration config) + public GlamourerChangelog(Configuration.Configuration config) { _config = config; Changelog = new Changelog("Glamourer Changelog", ConfigData, Save); diff --git a/Glamourer/Gui/GlamourerWindowSystem.cs b/Glamourer/Gui/GlamourerWindowSystem.cs index 76f107e..6379a4c 100644 --- a/Glamourer/Gui/GlamourerWindowSystem.cs +++ b/Glamourer/Gui/GlamourerWindowSystem.cs @@ -11,7 +11,7 @@ public class GlamourerWindowSystem : IDisposable private readonly MainWindow _ui; public GlamourerWindowSystem(IUiBuilder uiBuilder, MainWindow ui, GenericPopupWindow popups, - Configuration config, UnlocksTab unlocksTab, GlamourerChangelog changelog, DesignQuickBar quick) + Configuration.Configuration config, UnlocksTab unlocksTab, GlamourerChangelog changelog, DesignQuickBar quick) { _uiBuilder = uiBuilder; _ui = ui; diff --git a/Glamourer/Gui/MainTabBar.cs b/Glamourer/Gui/MainTabBar.cs index 2b2b398..0862faa 100644 --- a/Glamourer/Gui/MainTabBar.cs +++ b/Glamourer/Gui/MainTabBar.cs @@ -14,11 +14,11 @@ namespace Glamourer.Gui; public sealed class MainTabBar : TabBar { - private readonly EphemeralConfig _config; - public readonly TabSelected Event; - public readonly SettingsTab Settings; + private readonly Configuration.EphemeralConfig _config; + public readonly TabSelected Event; + public readonly SettingsTab Settings; - public MainTabBar(Logger log, EphemeralConfig config, SettingsTab settings, ActorTab actors, DesignTab designs, + public MainTabBar(Logger log, Configuration.EphemeralConfig config, SettingsTab settings, ActorTab actors, DesignTab designs, AutomationTab automation, UnlocksTab unlocks, NpcTab npcs, MessagesTab messages, DebugTab debug, TabSelected @event) : base("MainTabBar", log, settings, actors, designs, automation, unlocks, npcs, messages, debug) { diff --git a/Glamourer/Gui/MainWindow.cs b/Glamourer/Gui/MainWindow.cs index 49341eb..d1d5e3b 100644 --- a/Glamourer/Gui/MainWindow.cs +++ b/Glamourer/Gui/MainWindow.cs @@ -8,13 +8,13 @@ namespace Glamourer.Gui; public sealed class MainWindow : Window, IDisposable { - private readonly Configuration _config; - private readonly PenumbraService _penumbra; - private readonly DesignQuickBar _quickBar; - private readonly MainTabBar _mainTabBar; - private bool _ignorePenumbra; + private readonly Configuration.Configuration _config; + private readonly PenumbraService _penumbra; + private readonly DesignQuickBar _quickBar; + private readonly MainTabBar _mainTabBar; + private bool _ignorePenumbra; - public MainWindow(IDalamudPluginInterface pi, Configuration config, PenumbraService penumbra, + public MainWindow(IDalamudPluginInterface pi, Configuration.Configuration config, PenumbraService penumbra, MainTabBar mainTabBar, DesignQuickBar quickBar) : base("GlamourerMainWindow") { diff --git a/Glamourer/Gui/Materials/AdvancedDyePopup.cs b/Glamourer/Gui/Materials/AdvancedDyePopup.cs index bdbaa16..20d65dc 100644 --- a/Glamourer/Gui/Materials/AdvancedDyePopup.cs +++ b/Glamourer/Gui/Materials/AdvancedDyePopup.cs @@ -2,6 +2,7 @@ using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; using FFXIVClientStructs.FFXIV.Client.Graphics.Render; using FFXIVClientStructs.FFXIV.Client.System.Resource.Handle; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Interop.Material; using Glamourer.State; @@ -16,7 +17,7 @@ using Notification = Luna.Notification; namespace Glamourer.Gui.Materials; public sealed unsafe class AdvancedDyePopup( - Configuration config, + Configuration.Configuration config, StateManager stateManager, LiveColorTablePreviewer preview, DirectXService directX) : IService diff --git a/Glamourer/Gui/Materials/MaterialDrawer.cs b/Glamourer/Gui/Materials/MaterialDrawer.cs index 766ff20..db9f8ce 100644 --- a/Glamourer/Gui/Materials/MaterialDrawer.cs +++ b/Glamourer/Gui/Materials/MaterialDrawer.cs @@ -7,7 +7,7 @@ using Penumbra.GameData.Files.MaterialStructs; namespace Glamourer.Gui.Materials; -public class MaterialDrawer(DesignManager designManager, Configuration config) : IService +public class MaterialDrawer(DesignManager designManager, Configuration.Configuration config) : IService { public const float GlossWidth = 100; public const float SpecularStrengthWidth = 125; diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs index eff2c5a..0e8ef3c 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs @@ -1,6 +1,7 @@ using Dalamud.Interface.ImGuiNotification; using FFXIVClientStructs.FFXIV.Client.Game; using Glamourer.Automation; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Designs.History; using Glamourer.Gui.Customization; @@ -19,24 +20,24 @@ namespace Glamourer.Gui.Tabs.ActorTab; public sealed class ActorPanel : IPanel { - private readonly ActorSelection _selection; - private readonly StateManager _stateManager; - private readonly CustomizationDrawer _customizationDrawer; - private readonly EquipmentDrawer _equipmentDrawer; - private readonly AutoDesignApplier _autoDesignApplier; - private readonly Configuration _config; - private readonly DesignConverter _converter; - private readonly ActorObjectManager _objects; - private readonly ImportService _importService; - private readonly DictModelChara _modelChara; - private readonly CustomizeParameterDrawer _parameterDrawer; - private readonly AdvancedDyePopup _advancedDyes; + private readonly ActorSelection _selection; + private readonly StateManager _stateManager; + private readonly CustomizationDrawer _customizationDrawer; + private readonly EquipmentDrawer _equipmentDrawer; + private readonly AutoDesignApplier _autoDesignApplier; + private readonly Configuration.Configuration _config; + private readonly DesignConverter _converter; + private readonly ActorObjectManager _objects; + private readonly ImportService _importService; + private readonly DictModelChara _modelChara; + private readonly CustomizeParameterDrawer _parameterDrawer; + private readonly AdvancedDyePopup _advancedDyes; public ActorPanel(StateManager stateManager, CustomizationDrawer customizationDrawer, EquipmentDrawer equipmentDrawer, AutoDesignApplier autoDesignApplier, - Configuration config, + Configuration.Configuration config, DesignConverter converter, ActorObjectManager objects, DesignManager designManager, diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs b/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs index c9ed4b8..82d54ff 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorSelector.cs @@ -14,7 +14,7 @@ public readonly struct ActorCacheItem(ActorIdentifier identifier, ActorData data public readonly StringU8 IncognitoText = new(identifier.Incognito(data.Label)); } -public sealed class ActorSelector(ActorSelection selection, ActorObjectManager objects, ActorFilter filter, PenumbraService penumbra, EphemeralConfig config) : IPanel +public sealed class ActorSelector(ActorSelection selection, ActorObjectManager objects, ActorFilter filter, PenumbraService penumbra, Configuration.EphemeralConfig config) : IPanel { public ReadOnlySpan Id => "ActorSelector"u8; diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs b/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs index f6f0c73..c250d7a 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorTab.cs @@ -1,4 +1,5 @@ -using ImSharp; +using Glamourer.Configuration; +using ImSharp; using Luna; namespace Glamourer.Gui.Tabs.ActorTab; @@ -6,11 +7,13 @@ namespace Glamourer.Gui.Tabs.ActorTab; public sealed class ActorTab : TwoPanelLayout, ITab { private readonly ActorSelection _selection; + private readonly UiConfig _uiConfig; public ActorTab(ActorSelector selector, ActorPanel panel, ActorFilter filter, SelectPlayerButton selectPlayer, - SelectTargetButton selectTarget, ActorsHeader header, ActorSelection selection) + SelectTargetButton selectTarget, ActorsHeader header, ActorSelection selection, UiConfig uiConfig) { _selection = selection; + _uiConfig = uiConfig; LeftPanel = selector; LeftHeader = new FilterHeader(filter, new StringU8("Filter..."u8)); var footer = new ButtonFooter(); @@ -29,9 +32,18 @@ public sealed class ActorTab : TwoPanelLayout, ITab public void DrawContent() { _selection.Update(); - Draw(TwoPanelWidth.IndeterminateRelative); + Draw(_uiConfig.ActorsTabScale); } + protected override void SetWidth(float width, ScalingMode mode) + => _uiConfig.ActorsTabScale = new TwoPanelWidth(width, mode); + + protected override float MinimumWidth + => LeftHeader.MinimumWidth; + + protected override float MaximumWidth + => Im.Window.Width - 500 * Im.Style.GlobalScale; + public MainTabType Identifier => MainTabType.Actors; } diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorsHeader.cs b/Glamourer/Gui/Tabs/ActorTab/ActorsHeader.cs index d3bb802..907c1f4 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorsHeader.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorsHeader.cs @@ -5,11 +5,11 @@ namespace Glamourer.Gui.Tabs.ActorTab; public sealed class ActorsHeader : SplitButtonHeader { - private readonly ActorSelection _selection; - private readonly EphemeralConfig _config; + private readonly ActorSelection _selection; + private readonly Configuration.EphemeralConfig _config; public ActorsHeader(SetFromClipboardButton setFromClipboard, ExportToClipboardButton exportToClipboard, SaveAsDesignButton save, - UndoButton undo, LockedButton locked, IncognitoButton incognito, ActorSelection selection, EphemeralConfig config) + UndoButton undo, LockedButton locked, IncognitoButton incognito, ActorSelection selection, Configuration.EphemeralConfig config) { _selection = selection; _config = config; diff --git a/Glamourer/Gui/Tabs/AutomationTab/AutomationButtons.cs b/Glamourer/Gui/Tabs/AutomationTab/AutomationButtons.cs index 8cc1dfe..6ef6583 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/AutomationButtons.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/AutomationButtons.cs @@ -10,7 +10,7 @@ namespace Glamourer.Gui.Tabs.AutomationTab; public sealed class AutomationButtons : ButtonFooter { - public AutomationButtons(Configuration config, AutoDesignManager manager, AutomationSelection selection, ActorObjectManager objects) + public AutomationButtons(Configuration.Configuration config, AutoDesignManager manager, AutomationSelection selection, ActorObjectManager objects) { Buttons.AddButton(new AddButton(objects, manager), 100); Buttons.AddButton(new DuplicateButton(selection, manager), 90); @@ -134,7 +134,7 @@ public sealed class AutomationButtons : ButtonFooter } } - private sealed class DeleteButton(AutomationSelection selection, Configuration config, AutoDesignManager manager) + private sealed class DeleteButton(AutomationSelection selection, Configuration.Configuration config, AutoDesignManager manager) : BaseIconButton { private bool _enabled; diff --git a/Glamourer/Gui/Tabs/AutomationTab/AutomationHeader.cs b/Glamourer/Gui/Tabs/AutomationTab/AutomationHeader.cs index f0c4cb1..f5381e7 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/AutomationHeader.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/AutomationHeader.cs @@ -3,7 +3,7 @@ using Luna; namespace Glamourer.Gui.Tabs.AutomationTab; -public sealed class AutomationHeader(Configuration config, AutomationSelection selection) : IHeader +public sealed class AutomationHeader(Configuration.Configuration config, AutomationSelection selection) : IHeader { public bool Collapsed => false; diff --git a/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs b/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs index 559d3f7..a2c601b 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/AutomationTab.cs @@ -5,10 +5,10 @@ namespace Glamourer.Gui.Tabs.AutomationTab; public class AutomationTab : TwoPanelLayout, ITab { - private readonly Configuration _config; + private readonly Configuration.Configuration _config; public AutomationTab(AutomationFilter filter, SetSelector selector, SetPanel panel, AutomationButtons buttons, AutomationHeader header, - Configuration config) + Configuration.Configuration config) { _config = config; LeftHeader = new FilterHeader(filter, new StringU8("Filter..."u8)); @@ -30,7 +30,11 @@ public class AutomationTab : TwoPanelLayout, ITab => MainTabType.Automation; public void DrawContent() - { - Draw(TwoPanelWidth.IndeterminateRelative); - } + => Draw(_config.Ui.AutomationTabScale); + + protected override float MinimumWidth + => LeftFooter.MinimumWidth; + + protected override float MaximumWidth + => Im.Window.Width - 500 * Im.Style.GlobalScale; } diff --git a/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs b/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs index df651b5..42cdc9c 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/RandomRestrictionDrawer.cs @@ -13,19 +13,19 @@ public sealed class RandomRestrictionDrawer : IService, IDisposable private AutoDesignSet? _set; private int _designIndex = -1; - private readonly AutomationChanged _automationChanged; - private readonly Configuration _config; - private readonly AutoDesignManager _autoDesignManager; - private readonly RandomDesignCombo _randomDesignCombo; - private readonly AutomationSelection _selection; - private readonly DesignStorage _designs; - private readonly DesignFileSystem _designFileSystem; + private readonly AutomationChanged _automationChanged; + private readonly Configuration.Configuration _config; + private readonly AutoDesignManager _autoDesignManager; + private readonly RandomDesignCombo _randomDesignCombo; + private readonly AutomationSelection _selection; + private readonly DesignStorage _designs; + private readonly DesignFileSystem _designFileSystem; private string _newText = string.Empty; private string? _newDefinition; private Design? _newDesign; - public RandomRestrictionDrawer(AutomationChanged automationChanged, Configuration config, AutoDesignManager autoDesignManager, + public RandomRestrictionDrawer(AutomationChanged automationChanged, Configuration.Configuration config, AutoDesignManager autoDesignManager, RandomDesignCombo randomDesignCombo, AutomationSelection selection, DesignFileSystem designFileSystem, DesignStorage designs) { _automationChanged = automationChanged; diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs index cd676b1..bbd2fe5 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs @@ -19,7 +19,7 @@ public class SetPanel( CustomizeUnlockManager customizeUnlocks, CustomizeService customizations, IdentifierDrawer identifierDrawer, - Configuration config, + Configuration.Configuration config, RandomRestrictionDrawer randomDrawer, AutomationSelection selection) : IPanel { @@ -33,8 +33,7 @@ public class SetPanel( public void Draw() { - using var child = Im.Child.Begin("##Panel"u8, Im.ContentRegion.Available, true); - if (!child || selection.Index < 0) + if (selection.Index < 0) return; using (Im.Group()) diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs b/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs index 595882f..e61fdbc 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetSelector.cs @@ -8,7 +8,7 @@ namespace Glamourer.Gui.Tabs.AutomationTab; public sealed class SetSelector( AutomationSelection selection, - Configuration config, + Configuration.Configuration config, AutoDesignManager manager, AutomationFilter filter, ActorObjectManager objects, diff --git a/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs b/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs index 21ae0fd..0e298bd 100644 --- a/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs +++ b/Glamourer/Gui/Tabs/DebugTab/DebugTab.cs @@ -5,7 +5,7 @@ namespace Glamourer.Gui.Tabs.DebugTab; public sealed class DebugTab(ServiceManager manager) : ITab { - private readonly Configuration _config = manager.GetService(); + private readonly Configuration.Configuration _config = manager.GetService(); public bool IsVisible => _config.DebugMode; diff --git a/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs b/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs index 0bf64bb..10c5b1d 100644 --- a/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs +++ b/Glamourer/Gui/Tabs/DebugTab/FunPanel.cs @@ -4,7 +4,7 @@ using Penumbra.GameData.Gui.Debug; namespace Glamourer.Gui.Tabs.DebugTab; -public sealed class FunPanel(FunModule funModule, Configuration config) : IGameDataDrawer +public sealed class FunPanel(FunModule funModule, Configuration.Configuration config) : IGameDataDrawer { public ReadOnlySpan Label => "Fun Module"u8; diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs b/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs index f69d02b..3c5e6c0 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignDetailTab.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.ImGuiNotification; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Services; using ImSharp; @@ -8,18 +9,18 @@ namespace Glamourer.Gui.Tabs.DesignTab; public class DesignDetailTab { - private readonly SaveService _saveService; - private readonly Configuration _config; - private readonly DesignFileSystemSelector _selector; - private readonly DesignFileSystem _fileSystem; - private readonly DesignManager _manager; - private readonly DesignColors _colors; - private readonly DesignColorCombo _colorCombo; + private readonly SaveService _saveService; + private readonly Configuration.Configuration _config; + private readonly DesignFileSystemSelector _selector; + private readonly DesignFileSystem _fileSystem; + private readonly DesignManager _manager; + private readonly DesignColors _colors; + private readonly DesignColorCombo _colorCombo; private bool _editDescriptionMode; public DesignDetailTab(SaveService saveService, DesignFileSystemSelector selector, DesignManager manager, DesignFileSystem fileSystem, - DesignColors colors, Configuration config) + DesignColors colors, Configuration.Configuration config) { _saveService = saveService; _selector = selector; diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignFileSystemSelector.cs b/Glamourer/Gui/Tabs/DesignTab/DesignFileSystemSelector.cs index 2eb220a..33e35e2 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignFileSystemSelector.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignFileSystemSelector.cs @@ -20,13 +20,13 @@ namespace Glamourer.Gui.Tabs.DesignTab; public sealed class DesignFileSystemSelector : FileSystemSelector, IPanel { - private readonly DesignManager _designManager; - private readonly DesignChanged _event; - private readonly Configuration _config; - private readonly DesignConverter _converter; - private readonly TabSelected _selectionEvent; - private readonly DesignColors _designColors; - private readonly DesignApplier _designApplier; + private readonly DesignManager _designManager; + private readonly DesignChanged _event; + private readonly Configuration.Configuration _config; + private readonly DesignConverter _converter; + private readonly TabSelected _selectionEvent; + private readonly DesignColors _designColors; + private readonly DesignApplier _designApplier; private string? _clipboardText; private Design? _cloneDesign; @@ -62,7 +62,7 @@ public sealed class DesignFileSystemSelector : FileSystemSelector 1) + //if (_selection.DesignPaths.Count > 1) + if (false) { _multiDesignPanel.Draw(); } @@ -597,163 +599,164 @@ public class DesignPanel : IPanel private static unsafe string GetUserPath() => Framework.Instance()->UserPathString; -} -private sealed class LockButton(DesignPanel panel) : Button -{ - public override bool Visible - => panel._selection.Design != null; - protected override string Description - => panel._selection.Design!.WriteProtected() - ? "Make this design editable." - : "Write-protect this design."; - - protected override FontAwesomeIcon Icon - => panel._selection.Design!.WriteProtected() - ? FontAwesomeIcon.Lock - : FontAwesomeIcon.LockOpen; - - protected override void OnClick() - => panel._manager.SetWriteProtection(panel._selection.Design!, !panel._selection.Design!.WriteProtected()); -} - -private sealed class SetFromClipboardButton(DesignPanel panel) : Button -{ - public override bool Visible - => panel._selection.Design != null; - - protected override bool Disabled - => panel._selection.Design?.WriteProtected() ?? true; - - protected override string Description - => "Try to apply a design from your clipboard over this design.\nHold Control to only apply gear.\nHold Shift to only apply customizations."; - - protected override FontAwesomeIcon Icon - => FontAwesomeIcon.Clipboard; - - protected override void OnClick() + private sealed class LockButton(DesignPanel panel) : Button { - try + public override bool Visible + => panel._selection.Design != null; + + protected override string Description + => panel._selection.Design!.WriteProtected() + ? "Make this design editable." + : "Write-protect this design."; + + protected override FontAwesomeIcon Icon + => panel._selection.Design!.WriteProtected() + ? FontAwesomeIcon.Lock + : FontAwesomeIcon.LockOpen; + + protected override void OnClick() + => panel._manager.SetWriteProtection(panel._selection.Design!, !panel._selection.Design!.WriteProtected()); + } + + private sealed class SetFromClipboardButton(DesignPanel panel) : Button + { + public override bool Visible + => panel._selection.Design != null; + + protected override bool Disabled + => panel._selection.Design?.WriteProtected() ?? true; + + protected override string Description + => "Try to apply a design from your clipboard over this design.\nHold Control to only apply gear.\nHold Shift to only apply customizations."; + + protected override FontAwesomeIcon Icon + => FontAwesomeIcon.Clipboard; + + protected override void OnClick() { - var text = ImGui.GetClipboardText(); - var (applyEquip, applyCustomize) = UiHelpers.ConvertKeysToBool(); - var design = panel._converter.FromBase64(text, applyCustomize, applyEquip, out _) - ?? throw new Exception("The clipboard did not contain valid data."); - panel._manager.ApplyDesign(panel._selection.Design!, design); - } - catch (Exception ex) - { - Glamourer.Messager.NotificationMessage(ex, $"Could not apply clipboard to {panel._selection.Design!.Name}.", - $"Could not apply clipboard to design {panel._selection.Design!.Identifier}", NotificationType.Error, false); + try + { + var text = ImGui.GetClipboardText(); + var (applyEquip, applyCustomize) = UiHelpers.ConvertKeysToBool(); + var design = panel._converter.FromBase64(text, applyCustomize, applyEquip, out _) + ?? throw new Exception("The clipboard did not contain valid data."); + panel._manager.ApplyDesign(panel._selection.Design!, design); + } + catch (Exception ex) + { + Glamourer.Messager.NotificationMessage(ex, $"Could not apply clipboard to {panel._selection.Design!.Name}.", + $"Could not apply clipboard to design {panel._selection.Design!.Identifier}", NotificationType.Error, false); + } } } -} -private sealed class DesignUndoButton(DesignPanel panel) : Button -{ - public override bool Visible - => panel._selection.Design != null; - - protected override bool Disabled - => !panel._manager.CanUndo(panel._selection.Design) || (panel._selection.Design?.WriteProtected() ?? true); - - protected override string Description - => "Undo the last time you applied an entire design onto this design, if you accidentally overwrote your design with a different one."; - - protected override FontAwesomeIcon Icon - => FontAwesomeIcon.SyncAlt; - - protected override void OnClick() + private sealed class DesignUndoButton(DesignPanel panel) : Button { - try + public override bool Visible + => panel._selection.Design != null; + + protected override bool Disabled + => !panel._manager.CanUndo(panel._selection.Design) || (panel._selection.Design?.WriteProtected() ?? true); + + protected override string Description + => "Undo the last time you applied an entire design onto this design, if you accidentally overwrote your design with a different one."; + + protected override FontAwesomeIcon Icon + => FontAwesomeIcon.SyncAlt; + + protected override void OnClick() { - panel._manager.UndoDesignChange(panel._selection.Design!); - } - catch (Exception ex) - { - Glamourer.Messager.NotificationMessage(ex, $"Could not undo last changes to {panel._selection.Design!.Name}.", - NotificationType.Error, - false); + try + { + panel._manager.UndoDesignChange(panel._selection.Design!); + } + catch (Exception ex) + { + Glamourer.Messager.NotificationMessage(ex, $"Could not undo last changes to {panel._selection.Design!.Name}.", + NotificationType.Error, + false); + } } } -} -private sealed class ExportToClipboardButton(DesignPanel panel) : Button -{ - public override bool Visible - => panel._selection.Design != null; - - protected override string Description - => "Copy the current design to your clipboard."; - - protected override FontAwesomeIcon Icon - => FontAwesomeIcon.Copy; - - protected override void OnClick() + private sealed class ExportToClipboardButton(DesignPanel panel) : Button { - try + public override bool Visible + => panel._selection.Design != null; + + protected override string Description + => "Copy the current design to your clipboard."; + + protected override FontAwesomeIcon Icon + => FontAwesomeIcon.Copy; + + protected override void OnClick() { - var text = panel._converter.ShareBase64(panel._selection.Design!); - ImGui.SetClipboardText(text); - } - catch (Exception ex) - { - Glamourer.Messager.NotificationMessage(ex, $"Could not copy {panel._selection.Design!.Name} data to clipboard.", - $"Could not copy data from design {panel._selection.Design!.Identifier} to clipboard", NotificationType.Error, false); + try + { + var text = panel._converter.ShareBase64(panel._selection.Design!); + ImGui.SetClipboardText(text); + } + catch (Exception ex) + { + Glamourer.Messager.NotificationMessage(ex, $"Could not copy {panel._selection.Design!.Name} data to clipboard.", + $"Could not copy data from design {panel._selection.Design!.Identifier} to clipboard", NotificationType.Error, false); + } } } -} -private sealed class ApplyCharacterButton(DesignPanel panel) : Button -{ - public override bool Visible - => panel._selection.Design != null && panel._objects.Player.Valid; - - protected override string Description - => "Overwrite this design with your character's current state."; - - protected override bool Disabled - => panel._selection.Design?.WriteProtected() ?? true; - - protected override FontAwesomeIcon Icon - => FontAwesomeIcon.UserEdit; - - protected override void OnClick() + private sealed class ApplyCharacterButton(DesignPanel panel) : Button { - try - { - var (player, actor) = panel._objects.PlayerData; - if (!player.IsValid || !actor.Valid || !panel._state.GetOrCreate(player, actor.Objects[0], out var state)) - throw new Exception("No player state available."); + public override bool Visible + => panel._selection.Design != null && panel._objects.Player.Valid; - var design = panel._converter.Convert(state, ApplicationRules.FromModifiers(state)) - ?? throw new Exception("The clipboard did not contain valid data."); - panel._selection.Design!.GetMaterialDataRef().Clear(); - panel._manager.ApplyDesign(panel._selection.Design!, design); - } - catch (Exception ex) + protected override string Description + => "Overwrite this design with your character's current state."; + + protected override bool Disabled + => panel._selection.Design?.WriteProtected() ?? true; + + protected override FontAwesomeIcon Icon + => FontAwesomeIcon.UserEdit; + + protected override void OnClick() { - Glamourer.Messager.NotificationMessage(ex, $"Could not apply player state to {panel._selection.Design!.Name}.", - $"Could not apply player state to design {panel._selection.Design!.Identifier}", NotificationType.Error, false); + try + { + var (player, actor) = panel._objects.PlayerData; + if (!player.IsValid || !actor.Valid || !panel._state.GetOrCreate(player, actor.Objects[0], out var state)) + throw new Exception("No player state available."); + + var design = panel._converter.Convert(state, ApplicationRules.FromModifiers(state)) + ?? throw new Exception("The clipboard did not contain valid data."); + panel._selection.Design!.GetMaterialDataRef().Clear(); + panel._manager.ApplyDesign(panel._selection.Design!, design); + } + catch (Exception ex) + { + Glamourer.Messager.NotificationMessage(ex, $"Could not apply player state to {panel._selection.Design!.Name}.", + $"Could not apply player state to design {panel._selection.Design!.Identifier}", NotificationType.Error, false); + } } } + + private sealed class UndoButton(DesignPanel panel) : Button + { + protected override string Description + => "Undo the last change."; + + protected override FontAwesomeIcon Icon + => FontAwesomeIcon.Undo; + + public override bool Visible + => panel._selection.Design != null; + + protected override bool Disabled + => (panel._selection.Design?.WriteProtected() ?? true) || !panel._history.CanUndo(panel._selection.Design); + + protected override void OnClick() + => panel._history.Undo(panel._selection.Design!); + } } - -private sealed class UndoButton(DesignPanel panel) : Button -{ - protected override string Description - => "Undo the last change."; - - protected override FontAwesomeIcon Icon - => FontAwesomeIcon.Undo; - - public override bool Visible - => panel._selection.Design != null; - - protected override bool Disabled - => (panel._selection.Design?.WriteProtected() ?? true) || !panel._history.CanUndo(panel._selection.Design); - - protected override void OnClick() - => panel._history.Undo(panel._selection.Design!); -} \ No newline at end of file diff --git a/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs b/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs index 1f018e0..4bef23b 100644 --- a/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/DesignTab.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.ImGuiNotification; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Interop; using ImSharp; @@ -29,4 +30,13 @@ public sealed class DesignTab(DesignFileSystemSelector selector, DesignPanel pan panel.Draw(); importService.CreateCharaSource(); } + + //protected override void SetWidth(float width, ScalingMode mode) + // => _uiConfig.ActorsTabScale = new TwoPanelWidth(width, mode); + // + //protected override float MinimumWidth + // => LeftFooter.MinimumWidth; + // + //protected override float MaximumWidth + // => Im.Window.Width - 500 * Im.Style.GlobalScale; } diff --git a/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs b/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs index 95c3153..cfde48b 100644 --- a/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs +++ b/Glamourer/Gui/Tabs/DesignTab/ModAssociationsTab.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.ImGuiNotification; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Interop.Penumbra; using Glamourer.State; @@ -7,9 +8,9 @@ using Luna; namespace Glamourer.Gui.Tabs.DesignTab; -public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelector selector, DesignManager manager, Configuration config) +public class ModAssociationsTab(PenumbraService penumbra, DesignSelection selection, DesignManager manager, Configuration.Configuration config) { - private readonly ModCombo _modCombo = new(penumbra, Glamourer.Log, selector); + private readonly ModCombo _modCombo = new(penumbra, selection); private (Mod, ModSettings)[]? _copy; public void Draw() @@ -35,7 +36,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect { var size = new Vector2((Im.ContentRegion.Available.X - 2 * Im.Style.ItemSpacing.X) / 3, 0); if (Im.Button("Copy All to Clipboard"u8, size)) - _copy = selector.Selected!.AssociatedMods.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); + _copy = selection.Design!.AssociatedMods.Select(kvp => (kvp.Key, kvp.Value)).ToArray(); Im.Line.Same(); @@ -44,7 +45,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect ? $"Add {_copy.Length} mod association(s) from clipboard." : "Copy some mod associations to the clipboard, first."u8, _copy is null)) foreach (var (mod, setting) in _copy!) - manager.UpdateMod(selector.Selected!, mod, setting); + manager.UpdateMod(selection.Design!, mod, setting); Im.Line.Same(); @@ -53,10 +54,10 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect ? $"Set {_copy.Length} mod association(s) from clipboard and discard existing." : "Copy some mod associations to the clipboard, first."u8, _copy is null)) { - while (selector.Selected!.AssociatedMods.Count > 0) - manager.RemoveMod(selector.Selected!, selector.Selected!.AssociatedMods.Keys[0]); + while (selection.Design!.AssociatedMods.Count > 0) + manager.RemoveMod(selection.Design!, selection.Design!.AssociatedMods.Keys[0]); foreach (var (mod, setting) in _copy!) - manager.AddMod(selector.Selected!, mod, setting); + manager.AddMod(selection.Design!, mod, setting); } } @@ -75,13 +76,13 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect var (id, name) = penumbra.CurrentCollection; if (ImEx.Button("Apply Mod Associations"u8, Vector2.Zero, $"Try to apply all associated mod settings to Penumbras current collection {name}", - selector.Selected!.AssociatedMods.Count is 0 || id == Guid.Empty)) + selection.Design!.AssociatedMods.Count is 0 || id == Guid.Empty)) ApplyAll(); } public void ApplyAll() { - foreach (var (mod, settings) in selector.Selected!.AssociatedMods) + foreach (var (mod, settings) in selection.Design!.AssociatedMods) penumbra.SetMod(mod, settings, StateSource.Manual, false); } @@ -103,7 +104,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect Mod? removedMod = null; (Mod mod, ModSettings settings)? updatedMod = null; - foreach (var (idx, (mod, settings)) in selector.Selected!.AssociatedMods.Index()) + foreach (var (idx, (mod, settings)) in selection.Design!.AssociatedMods.Index()) { using var id = Im.Id.Push(idx); DrawAssociatedModRow(table, mod, settings, out var removedModTmp, out var updatedModTmp); @@ -116,10 +117,10 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect DrawNewModRow(table); if (removedMod.HasValue) - manager.RemoveMod(selector.Selected!, removedMod.Value); + manager.RemoveMod(selection.Design!, removedMod.Value); if (updatedMod.HasValue) - manager.UpdateMod(selector.Selected!, updatedMod.Value.mod, updatedMod.Value.settings); + manager.UpdateMod(selection.Design!, updatedMod.Value.mod, updatedMod.Value.settings); } private void DrawAssociatedModRow(in Im.TableDisposable table, Mod mod, ModSettings settings, out Mod? removedMod, @@ -240,18 +241,17 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect private void DrawNewModRow(in Im.TableDisposable table) { - var currentName = _modCombo.CurrentSelection.Mod.Name; + var currentDir = _modCombo.Selection; table.NextColumn(); - var tt = string.IsNullOrEmpty(currentName) + var tt = currentDir.Length is 0 ? "Please select a mod first."u8 - : selector.Selected!.AssociatedMods.ContainsKey(_modCombo.CurrentSelection.Mod) + : selection.Design!.AssociatedMods.ContainsKey(new Mod(_modCombo.SelectionName, currentDir)) ? "The design already contains an association with the selected mod."u8 : StringU8.Empty; if (ImEx.Icon.Button(LunaStyle.AddObjectIcon, tt, tt.Length > 0)) - manager.AddMod(selector.Selected!, _modCombo.CurrentSelection.Mod, _modCombo.CurrentSelection.Settings); + manager.AddMod(selection.Design!, new Mod(_modCombo.SelectionName, _modCombo.Selection), _modCombo.Settings); table.NextColumn(); - _modCombo.Draw("##new", string.IsNullOrEmpty(currentName) ? "Select new Mod..." : currentName, string.Empty, - Im.ContentRegion.Available.X, Im.Style.TextHeight); + _modCombo.Draw("##new"u8, Im.ContentRegion.Available.X); } } diff --git a/Glamourer/Gui/Tabs/DesignTab/ModCombo.cs b/Glamourer/Gui/Tabs/DesignTab/ModCombo.cs index 96bdb2e..58f5adb 100644 --- a/Glamourer/Gui/Tabs/DesignTab/ModCombo.cs +++ b/Glamourer/Gui/Tabs/DesignTab/ModCombo.cs @@ -3,7 +3,7 @@ using ImSharp; namespace Glamourer.Gui.Tabs.DesignTab; -public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection) : ImSharp.FilterComboBase(new ModFilter()) +public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection) : FilterComboBase(new ModFilter()) { public readonly struct CacheItem(in Mod mod, in ModSettings settings, int count) { @@ -23,6 +23,21 @@ public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection public readonly bool DifferingNames = string.Equals(mod.Name, mod.DirectoryName, StringComparison.CurrentCultureIgnoreCase); } + public StringPair SelectionName { get; private set; } = new("Select new Mod...", new StringU8("Select new Mod..."u8)); + public string Selection { get; private set; } = string.Empty; + public ModSettings Settings { get; private set; } = ModSettings.Empty; + + public bool Draw(Utf8StringHandler label, float previewWidth) + { + if (!Draw(label, SelectionName.Utf8, StringU8.Empty, previewWidth, out var newItem)) + return false; + + SelectionName = newItem.Name; + Selection = newItem.Directory.Utf16; + Settings = newItem.Settings; + return true; + } + protected override float ItemHeight => Im.Style.TextHeightWithSpacing; @@ -48,7 +63,7 @@ public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection using var style = ImStyleSingle.PopupBorderThickness.Push(2 * Im.Style.GlobalScale); using var tt = Im.Tooltip.Begin(); - Im.Dummy(new Vector2(300 * Im.Style.GlobalScale, 0)); + Im.Dummy(ImEx.ScaledVectorX(300)); using (Im.Group()) { if (item.DifferingNames) @@ -71,7 +86,7 @@ public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection } } - private static void DrawSettingsLeft(in ModSettings settings) + public static void DrawSettingsLeft(in ModSettings settings) { foreach (var setting in settings.Settings) { @@ -81,7 +96,7 @@ public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection } } - private static void DrawSettingsRight(in ModSettings settings) + public static void DrawSettingsRight(in ModSettings settings) { foreach (var setting in settings.Settings) { @@ -94,7 +109,7 @@ public sealed class ModCombo(PenumbraService penumbra, DesignSelection selection } protected override bool IsSelected(CacheItem item, int globalIndex) - => throw new NotImplementedException(); + => Selection.Equals(item.Directory.Utf16, StringComparison.OrdinalIgnoreCase); private sealed class ModFilter : TextFilterBase { diff --git a/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs b/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs index 06588fc..472f571 100644 --- a/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs +++ b/Glamourer/Gui/Tabs/DesignTab/MultiDesignPanel.cs @@ -9,7 +9,7 @@ public class MultiDesignPanel( DesignFileSystemSelector selector, DesignManager editor, DesignColors colors, - Configuration config) + Configuration.Configuration config) { private readonly DesignColorCombo _colorCombo = new(colors, true); diff --git a/Glamourer/Gui/Tabs/IncognitoButton.cs b/Glamourer/Gui/Tabs/IncognitoButton.cs index 427d388..a7f3eb9 100644 --- a/Glamourer/Gui/Tabs/IncognitoButton.cs +++ b/Glamourer/Gui/Tabs/IncognitoButton.cs @@ -3,7 +3,7 @@ using Luna; namespace Glamourer.Gui.Tabs; -public sealed class IncognitoButton(Configuration config) : BaseIconButton, IUiService +public sealed class IncognitoButton(Configuration.Configuration config) : BaseIconButton, IUiService { public override AwesomeIcon Icon => config.Ephemeral.IncognitoMode diff --git a/Glamourer/Gui/Tabs/NpcTab/LocalNpcAppearanceData.cs b/Glamourer/Gui/Tabs/NpcTab/LocalNpcAppearanceData.cs index 4caa246..63fcf3c 100644 --- a/Glamourer/Gui/Tabs/NpcTab/LocalNpcAppearanceData.cs +++ b/Glamourer/Gui/Tabs/NpcTab/LocalNpcAppearanceData.cs @@ -93,7 +93,7 @@ public class LocalNpcAppearanceData : ISavable public event Action DataChanged = null!; - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.NpcAppearanceFile; public void Save(StreamWriter writer) diff --git a/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs b/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs index f26e1a4..4b0daa6 100644 --- a/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs +++ b/Glamourer/Gui/Tabs/NpcTab/NpcPanel.cs @@ -1,4 +1,5 @@ using FFXIVClientStructs.FFXIV.Client.Game.Object; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Gui.Customization; using Glamourer.Gui.Equipment; @@ -12,7 +13,7 @@ using Penumbra.GameData.Interop; namespace Glamourer.Gui.Tabs.NpcTab; public sealed class NpcPanel( - Configuration config, + Configuration.Configuration config, NpcSelection selection, CustomizationDrawer customizeDrawer, EquipmentDrawer equipmentDrawer, diff --git a/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs b/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs index 27d8233..60c64a9 100644 --- a/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs +++ b/Glamourer/Gui/Tabs/NpcTab/NpcTab.cs @@ -1,12 +1,16 @@ -using ImSharp; +using Glamourer.Configuration; +using ImSharp; using Luna; namespace Glamourer.Gui.Tabs.NpcTab; public sealed class NpcTab : TwoPanelLayout, ITab { - public NpcTab(NpcFilter filter, NpcSelector selector, NpcPanel panel, NpcHeader header) + private readonly UiConfig _uiConfig; + + public NpcTab(NpcFilter filter, NpcSelector selector, NpcPanel panel, NpcHeader header, UiConfig uiConfig) { + _uiConfig = uiConfig; LeftHeader = new FilterHeader(filter, new StringU8("Filter..."u8)); LeftPanel = selector; LeftFooter = NopHeaderFooter.Instance; @@ -22,5 +26,14 @@ public sealed class NpcTab : TwoPanelLayout, ITab => MainTabType.Npcs; public void DrawContent() - => Draw(TwoPanelWidth.IndeterminateRelative); + => Draw(_uiConfig.NpcTabScale); + + protected override void SetWidth(float width, ScalingMode mode) + => _uiConfig.NpcTabScale = new TwoPanelWidth(width, mode); + + protected override float MinimumWidth + => LeftHeader.MinimumWidth; + + protected override float MaximumWidth + => Im.Window.Width - 500 * Im.Style.GlobalScale; } diff --git a/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs b/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs index de40e4d..ca27f95 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CodeDrawer.cs @@ -10,7 +10,7 @@ using OtterGui.Text.EndObjects; namespace Glamourer.Gui.Tabs.SettingsTab; -public class CodeDrawer(Configuration config, CodeService codeService, FunModule funModule) : IUiService +public class CodeDrawer(Configuration.Configuration config, CodeService codeService, FunModule funModule) : IUiService { private static ReadOnlySpan Tooltip => "Cheat Codes are not actually for cheating in the game, but for 'cheating' in Glamourer. "u8 diff --git a/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs b/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs index 78987e2..99b91a7 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CollectionCombo.cs @@ -8,7 +8,7 @@ using MouseWheelType = OtterGui.Widgets.MouseWheelType; namespace Glamourer.Gui.Tabs.SettingsTab; -public sealed class CollectionCombo(Configuration config, PenumbraService penumbra, Logger log) +public sealed class CollectionCombo(Configuration.Configuration config, PenumbraService penumbra, Logger log) : FilterComboCache<(Guid Id, string IdShort, string Name)>( () => penumbra.GetCollections().Select(kvp => (kvp.Key, kvp.Key.ToString()[..8], kvp.Value)).ToArray(), MouseWheelType.Control, log), IUiService diff --git a/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs b/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs index 0a1620e..a98eb71 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/CollectionOverrideDrawer.cs @@ -10,7 +10,7 @@ namespace Glamourer.Gui.Tabs.SettingsTab; public class CollectionOverrideDrawer( CollectionOverrideService collectionOverrides, - Configuration config, + Configuration.Configuration config, ActorObjectManager objects, ActorManager actors, PenumbraService penumbra, diff --git a/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs b/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs index de30188..97fa1e3 100644 --- a/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs +++ b/Glamourer/Gui/Tabs/SettingsTab/SettingsTab.cs @@ -2,6 +2,7 @@ using Dalamud.Interface; using Dalamud.Plugin.Services; using Glamourer.Automation; +using Glamourer.Configuration; using Glamourer.Designs; using Glamourer.Events; using Glamourer.Gui.Tabs.DesignTab; @@ -14,7 +15,7 @@ using Luna; namespace Glamourer.Gui.Tabs.SettingsTab; public sealed class SettingsTab( - Configuration config, + Configuration.Configuration config, DesignFileSystemSelector selector, ContextMenuService contextMenuService, IUiBuilder uiBuilder, @@ -255,7 +256,7 @@ public sealed class SettingsTab( Im.Line.New(); Im.Text("Show the following panels in their respective tabs:"u8); Im.Dummy(Vector2.Zero); - DesignPanelFlagExtensions.DrawTable("##panelTable"u8, config.HideDesignPanel, config.AutoExpandDesignPanel, v => + Configuration.DesignPanelFlagExtensions.DrawTable("##panelTable"u8, config.HideDesignPanel, config.AutoExpandDesignPanel, v => { config.HideDesignPanel = v; config.Save(); @@ -444,7 +445,7 @@ public sealed class SettingsTab( using (var combo = Im.Combo.Begin("##sortMode"u8, sortMode.Name)) { if (combo) - foreach (var val in Configuration.Constants.ValidSortModes) + foreach (var val in Configuration.Configuration.Constants.ValidSortModes) { if (Im.Selectable(val.Name, val.GetType() == sortMode.GetType()) && val.GetType() != sortMode.GetType()) { diff --git a/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs b/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs index 62a0b41..3be59f7 100644 --- a/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs +++ b/Glamourer/Gui/Tabs/UnlocksTab/UnlocksTab.cs @@ -5,11 +5,11 @@ namespace Glamourer.Gui.Tabs.UnlocksTab; public sealed class UnlocksTab : Window, ITab { - private readonly EphemeralConfig _config; - private readonly UnlockOverview _overview; - private readonly UnlockTable _table; + private readonly Configuration.EphemeralConfig _config; + private readonly UnlockOverview _overview; + private readonly UnlockTable _table; - public UnlocksTab(EphemeralConfig config, UnlockOverview overview, UnlockTable table) + public UnlocksTab(Configuration.EphemeralConfig config, UnlockOverview overview, UnlockTable table) : base("Unlocked Equipment") { _config = config; diff --git a/Glamourer/Interop/ContextMenuService.cs b/Glamourer/Interop/ContextMenuService.cs index 1f85612..32260ec 100644 --- a/Glamourer/Interop/ContextMenuService.cs +++ b/Glamourer/Interop/ContextMenuService.cs @@ -23,7 +23,7 @@ public class ContextMenuService : IDisposable private readonly MenuItem _inventoryItem; - public ContextMenuService(ItemManager items, StateManager state, ActorObjectManager objects, Configuration config, + public ContextMenuService(ItemManager items, StateManager state, ActorObjectManager objects, Configuration.Configuration config, IContextMenu context) { _contextMenu = context; diff --git a/Glamourer/Interop/Material/MaterialManager.cs b/Glamourer/Interop/Material/MaterialManager.cs index 3b99e2c..d8c6ce9 100644 --- a/Glamourer/Interop/Material/MaterialManager.cs +++ b/Glamourer/Interop/Material/MaterialManager.cs @@ -24,7 +24,7 @@ public sealed unsafe class MaterialManager : IRequiredService, IDisposable private readonly ThreadLocal> _deleteList = new(() => []); public MaterialManager(PrepareColorSet prepareColorSet, StateManager stateManager, ActorManager actors, PenumbraService penumbra, - Configuration config) + Configuration.Configuration config) { _stateManager = stateManager; _actors = actors; diff --git a/Glamourer/Interop/Penumbra/ModSettingApplier.cs b/Glamourer/Interop/Penumbra/ModSettingApplier.cs index c8c40db..d12b2be 100644 --- a/Glamourer/Interop/Penumbra/ModSettingApplier.cs +++ b/Glamourer/Interop/Penumbra/ModSettingApplier.cs @@ -7,7 +7,7 @@ using Penumbra.GameData.Structs; namespace Glamourer.Interop.Penumbra; -public class ModSettingApplier(PenumbraService penumbra, PenumbraAutoRedrawSkip autoRedrawSkip, Configuration config, ActorObjectManager objects, CollectionOverrideService overrides) +public class ModSettingApplier(PenumbraService penumbra, PenumbraAutoRedrawSkip autoRedrawSkip, Configuration.Configuration config, ActorObjectManager objects, CollectionOverrideService overrides) : IService { private readonly HashSet _collectionTracker = []; diff --git a/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs b/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs index c480249..406e830 100644 --- a/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs +++ b/Glamourer/Interop/Penumbra/PenumbraAutoRedraw.cs @@ -11,17 +11,17 @@ namespace Glamourer.Interop.Penumbra; public class PenumbraAutoRedraw : IDisposable, IRequiredService { - private const int WaitFrames = 5; - private readonly Configuration _config; - private readonly PenumbraService _penumbra; - private readonly StateManager _state; - private readonly ActorObjectManager _objects; - private readonly IFramework _framework; - private readonly StateChanged _stateChanged; - private readonly PenumbraAutoRedrawSkip _skip; + private const int WaitFrames = 5; + private readonly Configuration.Configuration _config; + private readonly PenumbraService _penumbra; + private readonly StateManager _state; + private readonly ActorObjectManager _objects; + private readonly IFramework _framework; + private readonly StateChanged _stateChanged; + private readonly PenumbraAutoRedrawSkip _skip; - public PenumbraAutoRedraw(PenumbraService penumbra, Configuration config, StateManager state, ActorObjectManager objects, + public PenumbraAutoRedraw(PenumbraService penumbra, Configuration.Configuration config, StateManager state, ActorObjectManager objects, IFramework framework, StateChanged stateChanged, PenumbraAutoRedrawSkip skip) { diff --git a/Glamourer/Interop/Penumbra/PenumbraService.cs b/Glamourer/Interop/Penumbra/PenumbraService.cs index b198f55..6759375 100644 --- a/Glamourer/Interop/Penumbra/PenumbraService.cs +++ b/Glamourer/Interop/Penumbra/PenumbraService.cs @@ -45,7 +45,7 @@ public class PenumbraService : IDisposable private const string NameManual = "Glamourer (Manually)"; private readonly IDalamudPluginInterface _pluginInterface; - private readonly Configuration _config; + private readonly Configuration.Configuration _config; private readonly EventSubscriber _tooltipSubscriber; private readonly EventSubscriber _clickSubscriber; private readonly EventSubscriber _creatingCharacterBase; @@ -96,7 +96,7 @@ public class PenumbraService : IDisposable public int CurrentMinor { get; private set; } public DateTime AttachTime { get; private set; } - public PenumbraService(IDalamudPluginInterface pi, PenumbraReloaded penumbraReloaded, Configuration config) + public PenumbraService(IDalamudPluginInterface pi, PenumbraReloaded penumbraReloaded, Configuration.Configuration config) { _pluginInterface = pi; _penumbraReloaded = penumbraReloaded; diff --git a/Glamourer/Services/BackupService.cs b/Glamourer/Services/BackupService.cs index e9b8d9d..3beac71 100644 --- a/Glamourer/Services/BackupService.cs +++ b/Glamourer/Services/BackupService.cs @@ -14,8 +14,8 @@ public class BackupService : IAsyncService { _logger = logger; _fileNames = GlamourerFiles(fileNames); - _configDirectory = new DirectoryInfo(fileNames.ConfigDirectory); - Awaiter = Task.Run(() => Backup.CreateAutomaticBackup(logger, new DirectoryInfo(fileNames.ConfigDirectory), _fileNames)); + _configDirectory = new DirectoryInfo(fileNames.ConfigurationDirectory); + Awaiter = Task.Run(() => Backup.CreateAutomaticBackup(logger, new DirectoryInfo(fileNames.ConfigurationDirectory), _fileNames)); } /// Create a permanent backup with a given name for migrations. @@ -27,7 +27,8 @@ public class BackupService : IAsyncService { var list = new List(16) { - new(fileNames.ConfigFile), + new(fileNames.ConfigurationFile), + new(fileNames.UiConfiguration), new(fileNames.DesignFileSystem), new(fileNames.MigrationDesignFile), new(fileNames.AutomationFile), diff --git a/Glamourer/Services/CodeService.cs b/Glamourer/Services/CodeService.cs index 783a03d..bd1f9c3 100644 --- a/Glamourer/Services/CodeService.cs +++ b/Glamourer/Services/CodeService.cs @@ -6,8 +6,8 @@ namespace Glamourer.Services; public class CodeService { - private readonly Configuration _config; - private readonly SHA256 _hasher = SHA256.Create(); + private readonly Configuration.Configuration _config; + private readonly SHA256 _hasher = SHA256.Create(); [Flags] public enum CodeFlag : ulong @@ -87,7 +87,7 @@ public class CodeService _ => Race.Unknown, }; - public CodeService(Configuration config) + public CodeService(Configuration.Configuration config) { _config = config; Load(); diff --git a/Glamourer/Services/CollectionOverrideService.cs b/Glamourer/Services/CollectionOverrideService.cs index 0a5c97b..164e4b1 100644 --- a/Glamourer/Services/CollectionOverrideService.cs +++ b/Glamourer/Services/CollectionOverrideService.cs @@ -41,7 +41,7 @@ public sealed class CollectionOverrideService : IService, ISavable public IReadOnlyList<(ActorIdentifier Actor, Guid CollectionId, string DisplayName)> Overrides => _overrides; - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.CollectionOverrideFile; public void AddOverride(IEnumerable identifiers, Guid collectionId, string displayName) diff --git a/Glamourer/Services/CommandService.cs b/Glamourer/Services/CommandService.cs index e078557..8a7c086 100644 --- a/Glamourer/Services/CommandService.cs +++ b/Glamourer/Services/CommandService.cs @@ -24,26 +24,26 @@ public class CommandService : IDisposable, IApiService private const string MainCommandString = "/glamourer"; private const string ApplyCommandString = "/glamour"; - private readonly ICommandManager _commands; - private readonly MainWindow _mainWindow; - private readonly IChatGui _chat; - private readonly ActorManager _actors; - private readonly ActorObjectManager _objects; - private readonly StateManager _stateManager; - private readonly AutoDesignApplier _autoDesignApplier; - private readonly AutoDesignManager _autoDesignManager; - private readonly Configuration _config; - private readonly ModSettingApplier _modApplier; - private readonly ItemManager _items; - private readonly CustomizeService _customizeService; - private readonly DesignManager _designManager; - private readonly DesignConverter _converter; - private readonly DesignResolver _resolver; - private readonly PenumbraService _penumbra; + private readonly ICommandManager _commands; + private readonly MainWindow _mainWindow; + private readonly IChatGui _chat; + private readonly ActorManager _actors; + private readonly ActorObjectManager _objects; + private readonly StateManager _stateManager; + private readonly AutoDesignApplier _autoDesignApplier; + private readonly AutoDesignManager _autoDesignManager; + private readonly Configuration.Configuration _config; + private readonly ModSettingApplier _modApplier; + private readonly ItemManager _items; + private readonly CustomizeService _customizeService; + private readonly DesignManager _designManager; + private readonly DesignConverter _converter; + private readonly DesignResolver _resolver; + private readonly PenumbraService _penumbra; public CommandService(ICommandManager commands, MainWindow mainWindow, IChatGui chat, ActorManager actors, ActorObjectManager objects, AutoDesignApplier autoDesignApplier, StateManager stateManager, DesignManager designManager, DesignConverter converter, - DesignFileSystem designFileSystem, AutoDesignManager autoDesignManager, Configuration config, ModSettingApplier modApplier, + DesignFileSystem designFileSystem, AutoDesignManager autoDesignManager, Configuration.Configuration config, ModSettingApplier modApplier, ItemManager items, RandomDesignGenerator randomDesign, CustomizeService customizeService, DesignFileSystemSelector designSelector, QuickDesignCombo quickDesignCombo, DesignResolver resolver, PenumbraService penumbra) { diff --git a/Glamourer/Services/ConfigMigrationService.cs b/Glamourer/Services/ConfigMigrationService.cs index a0a3914..dc6291f 100644 --- a/Glamourer/Services/ConfigMigrationService.cs +++ b/Glamourer/Services/ConfigMigrationService.cs @@ -8,19 +8,19 @@ namespace Glamourer.Services; public class ConfigMigrationService(SaveService saveService, FixedDesignMigrator fixedDesignMigrator, BackupService backupService) { - private Configuration _config = null!; - private JObject _data = null!; + private Configuration.Configuration _config = null!; + private JObject _data = null!; - public void Migrate(Configuration config) + public void Migrate(Configuration.Configuration config) { _config = config; - if (config.Version >= Configuration.Constants.CurrentVersion || !File.Exists(saveService.FileNames.ConfigFile)) + if (config.Version >= Configuration.Configuration.Constants.CurrentVersion || !File.Exists(saveService.FileNames.ConfigurationFile)) { AddColors(config, false); return; } - _data = JObject.Parse(File.ReadAllText(saveService.FileNames.ConfigFile)); + _data = JObject.Parse(File.ReadAllText(saveService.FileNames.ConfigurationFile)); MigrateV1To2(); MigrateV2To4(); MigrateV4To5(); @@ -103,7 +103,7 @@ public class ConfigMigrationService(SaveService saveService, FixedDesignMigrator _config.Codes = _config.Codes.DistinctBy(c => c.Code).ToList(); } - private static void AddColors(Configuration config, bool forceSave) + private static void AddColors(Configuration.Configuration config, bool forceSave) { var save = false; foreach (var color in ColorId.Values) diff --git a/Glamourer/Services/FilenameService.cs b/Glamourer/Services/FilenameService.cs index cd25c64..60f1773 100644 --- a/Glamourer/Services/FilenameService.cs +++ b/Glamourer/Services/FilenameService.cs @@ -1,40 +1,28 @@ using Dalamud.Plugin; using Glamourer.Designs; +using Luna; namespace Glamourer.Services; -public class FilenameService +public class FilenameService(IDalamudPluginInterface pi) : BaseFilePathProvider(pi) { - public readonly string ConfigDirectory; - public readonly string ConfigFile; - public readonly string DesignFileSystem; - public readonly string MigrationDesignFile; - public readonly string DesignDirectory; - public readonly string AutomationFile; - public readonly string UnlockFileCustomize; - public readonly string UnlockFileItems; - public readonly string FavoriteFile; - public readonly string DesignColorFile; - public readonly string EphemeralConfigFile; - public readonly string NpcAppearanceFile; - public readonly string CollectionOverrideFile; - - public FilenameService(IDalamudPluginInterface pi) - { - ConfigDirectory = pi.ConfigDirectory.FullName; - ConfigFile = pi.ConfigFile.FullName; - AutomationFile = Path.Combine(ConfigDirectory, "automation.json"); - DesignFileSystem = Path.Combine(ConfigDirectory, "sort_order.json"); - MigrationDesignFile = Path.Combine(ConfigDirectory, "Designs.json"); - UnlockFileCustomize = Path.Combine(ConfigDirectory, "unlocks_customize.json"); - UnlockFileItems = Path.Combine(ConfigDirectory, "unlocks_items.json"); - DesignDirectory = Path.Combine(ConfigDirectory, "designs"); - FavoriteFile = Path.Combine(ConfigDirectory, "favorites.json"); - DesignColorFile = Path.Combine(ConfigDirectory, "design_colors.json"); - EphemeralConfigFile = Path.Combine(ConfigDirectory, "ephemeral_config.json"); - NpcAppearanceFile = Path.Combine(ConfigDirectory, "npc_appearance_data.json"); - CollectionOverrideFile = Path.Combine(ConfigDirectory, "collection_overrides.json"); - } + public readonly string DesignFileSystem = Path.Combine(pi.ConfigDirectory.FullName, "sort_order.json"); + public readonly string MigrationDesignFile = Path.Combine(pi.ConfigDirectory.FullName, "Designs.json"); + public readonly string DesignDirectory = Path.Combine(pi.ConfigDirectory.FullName, "designs"); + public readonly string AutomationFile = Path.Combine(pi.ConfigDirectory.FullName, "automation.json"); + public readonly string UnlockFileCustomize = Path.Combine(pi.ConfigDirectory.FullName, "unlocks_customize.json"); + public readonly string UnlockFileItems = Path.Combine(pi.ConfigDirectory.FullName, "unlocks_items.json"); + public readonly string FavoriteFile = Path.Combine(pi.ConfigDirectory.FullName, "favorites.json"); + public readonly string DesignColorFile = Path.Combine(pi.ConfigDirectory.FullName, "design_colors.json"); + public readonly string EphemeralConfigFile = Path.Combine(pi.ConfigDirectory.FullName, "ephemeral_config.json"); + public readonly string NpcAppearanceFile = Path.Combine(pi.ConfigDirectory.FullName, "npc_appearance_data.json"); + public readonly string CollectionOverrideFile = Path.Combine(pi.ConfigDirectory.FullName, "collection_overrides.json"); + public readonly string UiConfiguration = Path.Combine(pi.ConfigDirectory.FullName, "ui_config.json"); + public readonly string FileSystemFolder = Path.Combine(pi.ConfigDirectory.FullName, "design_filesystem"); + public readonly string FileSystemEmptyFolders = Path.Combine(pi.ConfigDirectory.FullName, "design_filesystem", "empty_folders.json"); + public readonly string FileSystemExpandedFolders = Path.Combine(pi.ConfigDirectory.FullName, "design_filesystem", "expanded_folders.json"); + public readonly string FileSystemLockedNodes = Path.Combine(pi.ConfigDirectory.FullName, "design_filesystem", "locked_nodes.json"); + public readonly string FileSystemSelectedNodes = Path.Combine(pi.ConfigDirectory.FullName, "design_filesystem", "selected_nodes.json"); public IEnumerable Designs() { @@ -50,4 +38,8 @@ public class FilenameService public string DesignFile(Design design) => DesignFile(design.Identifier.ToString()); + + // TODO + public override List GetBackupFiles() + => []; } diff --git a/Glamourer/Services/ItemManager.cs b/Glamourer/Services/ItemManager.cs index a885b54..d26a7f3 100644 --- a/Glamourer/Services/ItemManager.cs +++ b/Glamourer/Services/ItemManager.cs @@ -15,7 +15,7 @@ public class ItemManager public const string SmallClothesNpc = "Smallclothes (NPC)"; public const ushort SmallClothesNpcModel = 9903; - private readonly Configuration _config; + private readonly Configuration.Configuration _config; public readonly ObjectIdentification ObjectIdentification; public readonly ExcelSheet ItemSheet; @@ -26,7 +26,7 @@ public class ItemManager public readonly EquipItem DefaultSword; - public ItemManager(Configuration config, IDataManager gameData, ObjectIdentification objectIdentification, + public ItemManager(Configuration.Configuration config, IDataManager gameData, ObjectIdentification objectIdentification, ItemData itemData, DictStain stains, RestrictedGear restrictedGear, DictBonusItems dictBonusItems) { _config = config; diff --git a/Glamourer/Services/PcpService.cs b/Glamourer/Services/PcpService.cs index 6711ce3..639026a 100644 --- a/Glamourer/Services/PcpService.cs +++ b/Glamourer/Services/PcpService.cs @@ -10,14 +10,14 @@ namespace Glamourer.Services; public class PcpService : IRequiredService { - private readonly Configuration _config; - private readonly PenumbraService _penumbra; - private readonly ActorObjectManager _objects; - private readonly StateManager _state; - private readonly DesignConverter _designConverter; - private readonly DesignManager _designManager; + private readonly Configuration.Configuration _config; + private readonly PenumbraService _penumbra; + private readonly ActorObjectManager _objects; + private readonly StateManager _state; + private readonly DesignConverter _designConverter; + private readonly DesignManager _designManager; - public PcpService(Configuration config, PenumbraService penumbra, ActorObjectManager objects, StateManager state, + public PcpService(Configuration.Configuration config, PenumbraService penumbra, ActorObjectManager objects, StateManager state, DesignConverter designConverter, DesignManager designManager) { _config = config; diff --git a/Glamourer/Services/SaveService.cs b/Glamourer/Services/SaveService.cs index 2a96755..1ccaaea 100644 --- a/Glamourer/Services/SaveService.cs +++ b/Glamourer/Services/SaveService.cs @@ -1,17 +1,11 @@ -using OtterGui.Classes; -using OtterGui.Log; +using Luna; namespace Glamourer.Services; /// /// Any file type that we want to save via SaveService. /// -public interface ISavable : ISavable -{ } +public interface ISavable : ISavable; -public sealed class SaveService : SaveServiceBase -{ - public SaveService(Logger log, FrameworkManager framework, FilenameService fileNames) - : base(log, framework, fileNames) - { } -} +public sealed class SaveService(Logger log, FrameworkManager framework, FilenameService fileNames) + : BaseSaveService(log, framework, fileNames); diff --git a/Glamourer/Services/ServiceManager.cs b/Glamourer/Services/ServiceManager.cs index f9e63f9..e65f7ea 100644 --- a/Glamourer/Services/ServiceManager.cs +++ b/Glamourer/Services/ServiceManager.cs @@ -73,8 +73,8 @@ public static class StaticServiceManager .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton() - .AddSingleton() + .AddSingleton() + .AddSingleton() .AddSingleton() .AddSingleton(); diff --git a/Glamourer/State/FunModule.cs b/Glamourer/State/FunModule.cs index fbb6a55..6199d33 100644 --- a/Glamourer/State/FunModule.cs +++ b/Glamourer/State/FunModule.cs @@ -23,19 +23,19 @@ public unsafe class FunModule : IDisposable AprilFirst, } - private readonly WorldSets _worldSets = new(); - private readonly ItemManager _items; - private readonly CustomizeService _customizations; - private readonly Configuration _config; - private readonly CodeService _codes; - private readonly Random _rng; - private readonly GenericPopupWindow _popupWindow; - private readonly StateManager _stateManager; - private readonly DesignConverter _designConverter; - private readonly DesignManager _designManager; - private readonly ActorObjectManager _objects; - private readonly NpcCustomizeSet _npcs; - private readonly StainId[] _stains; + private readonly WorldSets _worldSets = new(); + private readonly ItemManager _items; + private readonly CustomizeService _customizations; + private readonly Configuration.Configuration _config; + private readonly CodeService _codes; + private readonly Random _rng; + private readonly GenericPopupWindow _popupWindow; + private readonly StateManager _stateManager; + private readonly DesignConverter _designConverter; + private readonly DesignManager _designManager; + private readonly ActorObjectManager _objects; + private readonly NpcCustomizeSet _npcs; + private readonly StainId[] _stains; public FestivalType CurrentFestival { get; private set; } = FestivalType.None; private FunEquipSet? _festivalSet; @@ -66,7 +66,7 @@ public unsafe class FunModule : IDisposable internal void ResetFestival() => OnDayChange(DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year); - public FunModule(CodeService codes, CustomizeService customizations, ItemManager items, Configuration config, + public FunModule(CodeService codes, CustomizeService customizations, ItemManager items, Configuration.Configuration config, GenericPopupWindow popupWindow, StateManager stateManager, ActorObjectManager objects, DesignConverter designConverter, DesignManager designManager, NpcCustomizeSet npcs) { diff --git a/Glamourer/State/StateEditor.cs b/Glamourer/State/StateEditor.cs index cbce7d5..305575f 100644 --- a/Glamourer/State/StateEditor.cs +++ b/Glamourer/State/StateEditor.cs @@ -20,18 +20,18 @@ public class StateEditor( StateChanged stateChanged, StateFinalized stateFinalized, JobChangeState jobChange, - Configuration config, + Configuration.Configuration config, ItemManager items, DesignMerger merger, ModSettingApplier modApplier, GPoseService gPose) : IDesignEditor { - protected readonly InternalStateEditor Editor = editor; - protected readonly StateApplier Applier = applier; - protected readonly StateChanged StateChanged = stateChanged; - protected readonly StateFinalized StateFinalized = stateFinalized; - protected readonly Configuration Config = config; - protected readonly ItemManager Items = items; + protected readonly InternalStateEditor Editor = editor; + protected readonly StateApplier Applier = applier; + protected readonly StateChanged StateChanged = stateChanged; + protected readonly StateFinalized StateFinalized = stateFinalized; + protected readonly Configuration.Configuration Config = config; + protected readonly ItemManager Items = items; /// Turn an actor to. public void ChangeModelId(ActorState state, uint modelId, CustomizeArray customize, nint equipData, StateSource source, diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index 241a0b1..85878ed 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -25,31 +25,31 @@ namespace Glamourer.State; /// public class StateListener : IDisposable { - private readonly Configuration _config; - private readonly ActorManager _actors; - private readonly ActorObjectManager _objects; - private readonly StateManager _manager; - private readonly StateApplier _applier; - private readonly ItemManager _items; - private readonly CustomizeService _customizations; - private readonly PenumbraService _penumbra; - private readonly EquipSlotUpdating _equipSlotUpdating; - private readonly BonusSlotUpdating _bonusSlotUpdating; - private readonly GearsetDataLoaded _gearsetDataLoaded; - private readonly WeaponLoading _weaponLoading; - private readonly HeadGearVisibilityChanged _headGearVisibility; - private readonly VisorStateChanged _visorState; - private readonly VieraEarStateChanged _vieraEarState; - private readonly WeaponVisibilityChanged _weaponVisibility; - private readonly StateFinalized _stateFinalized; - private readonly AutoDesignApplier _autoDesignApplier; - private readonly FunModule _funModule; - private readonly HumanModelList _humans; - private readonly MovedEquipment _movedEquipment; - private readonly GPoseService _gPose; - private readonly ChangeCustomizeService _changeCustomizeService; - private readonly CrestService _crestService; - private readonly ICondition _condition; + private readonly Configuration.Configuration _config; + private readonly ActorManager _actors; + private readonly ActorObjectManager _objects; + private readonly StateManager _manager; + private readonly StateApplier _applier; + private readonly ItemManager _items; + private readonly CustomizeService _customizations; + private readonly PenumbraService _penumbra; + private readonly EquipSlotUpdating _equipSlotUpdating; + private readonly BonusSlotUpdating _bonusSlotUpdating; + private readonly GearsetDataLoaded _gearsetDataLoaded; + private readonly WeaponLoading _weaponLoading; + private readonly HeadGearVisibilityChanged _headGearVisibility; + private readonly VisorStateChanged _visorState; + private readonly VieraEarStateChanged _vieraEarState; + private readonly WeaponVisibilityChanged _weaponVisibility; + private readonly StateFinalized _stateFinalized; + private readonly AutoDesignApplier _autoDesignApplier; + private readonly FunModule _funModule; + private readonly HumanModelList _humans; + private readonly MovedEquipment _movedEquipment; + private readonly GPoseService _gPose; + private readonly ChangeCustomizeService _changeCustomizeService; + private readonly CrestService _crestService; + private readonly ICondition _condition; private readonly Dictionary _fistOffhands = []; @@ -58,7 +58,7 @@ public class StateListener : IDisposable private ActorState? _creatingState; private ActorState? _customizeState; - public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorManager actors, Configuration config, + public StateListener(StateManager manager, ItemManager items, PenumbraService penumbra, ActorManager actors, Configuration.Configuration config, EquipSlotUpdating equipSlotUpdating, GearsetDataLoaded gearsetDataLoaded, WeaponLoading weaponLoading, VisorStateChanged visorState, WeaponVisibilityChanged weaponVisibility, HeadGearVisibilityChanged headGearVisibility, AutoDesignApplier autoDesignApplier, FunModule funModule, HumanModelList humans, StateApplier applier, MovedEquipment movedEquipment, ActorObjectManager objects, diff --git a/Glamourer/State/StateManager.cs b/Glamourer/State/StateManager.cs index 633c444..c0fffab 100644 --- a/Glamourer/State/StateManager.cs +++ b/Glamourer/State/StateManager.cs @@ -27,7 +27,7 @@ public sealed class StateManager( InternalStateEditor editor, HumanModelList humans, IClientState clientState, - Configuration config, + Configuration.Configuration config, JobChangeState jobChange, DesignMerger merger, ModSettingApplier modApplier, diff --git a/Glamourer/Unlocks/CustomizeUnlockManager.cs b/Glamourer/Unlocks/CustomizeUnlockManager.cs index 6fcdde0..71e99b3 100644 --- a/Glamourer/Unlocks/CustomizeUnlockManager.cs +++ b/Glamourer/Unlocks/CustomizeUnlockManager.cs @@ -139,7 +139,7 @@ public class CustomizeUnlockManager : IDisposable, ISavable _setUnlockLinkValueHook.Original(uiState, data, value); try { - if (value == 0) + if (value is 0) return; var time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); @@ -159,7 +159,7 @@ public class CustomizeUnlockManager : IDisposable, ISavable } } - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.UnlockFileCustomize; public void Save() @@ -169,7 +169,7 @@ public class CustomizeUnlockManager : IDisposable, ISavable => UnlockDictionaryHelpers.Save(writer, Unlocked); private void Load() - => UnlockDictionaryHelpers.Load(ToFilename(_saveService.FileNames), _unlocked, id => Unlockable.Any(c => c.Value.Data == id), + => UnlockDictionaryHelpers.Load(ToFilePath(_saveService.FileNames), _unlocked, id => Unlockable.Any(c => c.Value.Data == id), "customization"); /// Create a list of all unlockable hairstyles and face paints. diff --git a/Glamourer/Unlocks/FavoriteManager.cs b/Glamourer/Unlocks/FavoriteManager.cs index 6caa6a1..1f6f3f5 100644 --- a/Glamourer/Unlocks/FavoriteManager.cs +++ b/Glamourer/Unlocks/FavoriteManager.cs @@ -94,7 +94,7 @@ public sealed class FavoriteManager : ISavable Save(); } - public string ToFilename(FilenameService fileNames) + public string ToFilePath(FilenameService fileNames) => fileNames.FavoriteFile; private void Save() diff --git a/Glamourer/Unlocks/ItemUnlockManager.cs b/Glamourer/Unlocks/ItemUnlockManager.cs index 6708267..6f8e097 100644 --- a/Glamourer/Unlocks/ItemUnlockManager.cs +++ b/Glamourer/Unlocks/ItemUnlockManager.cs @@ -254,7 +254,7 @@ public class ItemUnlockManager : ISavable, IDisposable, IReadOnlyDictionary fileNames.UnlockFileItems; public void Save() @@ -265,7 +265,7 @@ public class ItemUnlockManager : ISavable, IDisposable, IReadOnlyDictionary _items.ItemData.TryGetValue(id, EquipSlot.MainHand, out _), "item"); UpdateModels(version); } diff --git a/Luna b/Luna index 0ee15af..bff400e 160000 --- a/Luna +++ b/Luna @@ -1 +1 @@ -Subproject commit 0ee15af5c45b6c72df25b972e48b9a57347c25a5 +Subproject commit bff400eb44aeded41fb6b1b3d35948881b578737