diff --git a/LLib b/LLib index 3792244..b5125d4 160000 --- a/LLib +++ b/LLib @@ -1 +1 @@ -Subproject commit 3792244261a9f5426a7916f5a6dd1966238ba84a +Subproject commit b5125d4b3f7cdc0c7514a01764e5b5d4d85f80a7 diff --git a/Workshoppa/Configuration.cs b/Workshoppa/Configuration.cs index 5b9189e..91429c1 100644 --- a/Workshoppa/Configuration.cs +++ b/Workshoppa/Configuration.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using Dalamud.Configuration; +using LLib.ImGui; using Workshoppa.GameData; namespace Workshoppa; @@ -16,6 +17,9 @@ internal sealed class Configuration : IPluginConfiguration public bool EnableCeruleumTankCalculator { get; set; } = true; public List Presets { get; set; } = new(); + public WindowConfig MainWindowConfig { get; } = new(); + public WindowConfig ConfigWindowConfig { get; } = new(); + internal sealed class QueuedItem { public uint WorkshopItemId { get; set; } diff --git a/Workshoppa/Windows/ConfigWindow.cs b/Workshoppa/Windows/ConfigWindow.cs index 8579a43..cb07558 100644 --- a/Workshoppa/Windows/ConfigWindow.cs +++ b/Workshoppa/Windows/ConfigWindow.cs @@ -5,7 +5,7 @@ using LLib.ImGui; namespace Workshoppa.Windows; -internal sealed class ConfigWindow : LWindow +internal sealed class ConfigWindow : LWindow, IPersistableWindowConfig { private readonly DalamudPluginInterface _pluginInterface; private readonly Configuration _configuration; @@ -27,6 +27,8 @@ internal sealed class ConfigWindow : LWindow }; } + public WindowConfig WindowConfig => _configuration.ConfigWindowConfig; + public override void Draw() { bool enableRepairKitCalculator = _configuration.EnableRepairKitCalculator; @@ -43,4 +45,6 @@ internal sealed class ConfigWindow : LWindow _pluginInterface.SavePluginConfig(_configuration); } } + + public void SaveWindowConfig() => _pluginInterface.SavePluginConfig(_configuration); } diff --git a/Workshoppa/Windows/MainWindow.cs b/Workshoppa/Windows/MainWindow.cs index 9628ff2..14901ac 100644 --- a/Workshoppa/Windows/MainWindow.cs +++ b/Workshoppa/Windows/MainWindow.cs @@ -19,7 +19,7 @@ using Workshoppa.GameData; namespace Workshoppa.Windows; // FIXME The close button doesn't work near the workshop, either hide it or make it work -internal sealed class MainWindow : LWindow +internal sealed class MainWindow : LWindow, IPersistableWindowConfig { private static readonly Regex CountAndName = new(@"^(\d{1,5})x?\s+(.*)$", RegexOptions.Compiled); @@ -72,6 +72,8 @@ internal sealed class MainWindow : LWindow private bool IsDiscipleOfHand => _clientState.LocalPlayer != null && _clientState.LocalPlayer.ClassJob.Id is >= 8 and <= 15; + public WindowConfig WindowConfig => _configuration.MainWindowConfig; + public override void Draw() { if (ImGui.BeginMenuBar()) @@ -617,6 +619,8 @@ internal sealed class MainWindow : LWindow ImGui.TextColored(ImGuiColors.DalamudRed, "You need to be a Disciple of the Hand to start crafting."); } + public void SaveWindowConfig() => Save(); + public enum ButtonState { None,