From 38a28871f4083c31ecf2cba883f6c247cb197a5b Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Wed, 27 Sep 2023 02:34:44 +0200 Subject: [PATCH] Add visibility options for automated design application rules and unobtained item warnings. --- Glamourer/Configuration.cs | 34 ++++---- Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs | 87 +++++++++++++------- Glamourer/Gui/Tabs/SettingsTab.cs | 6 ++ 3 files changed, 79 insertions(+), 48 deletions(-) diff --git a/Glamourer/Configuration.cs b/Glamourer/Configuration.cs index a1a680e..3b96249 100644 --- a/Glamourer/Configuration.cs +++ b/Glamourer/Configuration.cs @@ -18,22 +18,24 @@ namespace Glamourer; public class Configuration : IPluginConfiguration, ISavable { - public bool Enabled { get; set; } = true; - public bool UseRestrictedGearProtection { get; set; } = true; - public bool OpenFoldersByDefault { get; set; } = false; - public bool AutoRedrawEquipOnChanges { get; set; } = false; - public bool EnableAutoDesigns { get; set; } = true; - public bool IncognitoMode { get; set; } = false; - public bool UnlockDetailMode { get; set; } = true; - public bool HideApplyCheckmarks { get; set; } = false; - public bool SmallEquip { get; set; } = false; - public bool UnlockedItemMode { get; set; } = false; - public byte DisableFestivals { get; set; } = 1; - public bool EnableGameContextMenu { get; set; } = true; - public bool HideWindowInCutscene { get; set; } = false; - public bool ShowAutomationSetEditing { get; set; } = true; - public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings; - public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift); + public bool Enabled { get; set; } = true; + public bool UseRestrictedGearProtection { get; set; } = true; + public bool OpenFoldersByDefault { get; set; } = false; + public bool AutoRedrawEquipOnChanges { get; set; } = false; + public bool EnableAutoDesigns { get; set; } = true; + public bool IncognitoMode { get; set; } = false; + public bool UnlockDetailMode { get; set; } = true; + public bool HideApplyCheckmarks { get; set; } = false; + public bool SmallEquip { get; set; } = false; + public bool UnlockedItemMode { get; set; } = false; + public byte DisableFestivals { get; set; } = 1; + public bool EnableGameContextMenu { get; set; } = true; + public bool HideWindowInCutscene { get; set; } = false; + public bool ShowAutomationSetEditing { get; set; } = true; + public bool ShowAllAutomatedApplicationRules { get; set; } = true; + public bool ShowUnlockedItemWarnings { get; set; } = true; + public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings; + public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift); public int LastSeenVersion { get; set; } = GlamourerChangelog.LastChangelogVersion; public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New; diff --git a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs index 3fb4465..ba4a872 100644 --- a/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs +++ b/Glamourer/Gui/Tabs/AutomationTab/SetPanel.cs @@ -107,7 +107,7 @@ public class SetPanel "Show options to change the name or the associated character or NPC of this design set."); } - if (_showEditing) + if (_config.ShowAutomationSetEditing) { ImGui.Dummy(Vector2.Zero); ImGui.Separator(); @@ -137,34 +137,53 @@ public class SetPanel private void DrawDesignTable() { - var requiredSizeOneLine = (1 + 6 + 2) * ImGui.GetFrameHeight() - + (30 + 220 + 10 + 4) * ImGuiHelpers.GlobalScale + var (numCheckboxes, numSpacing) = (_config.ShowAllAutomatedApplicationRules, _config.ShowUnlockedItemWarnings) switch + { + (true, true) => (9, 14), + (true, false) => (7, 10), + (false, true) => (4, 4), + (false, false) => (2, 0), + }; + + var requiredSizeOneLine = numCheckboxes * ImGui.GetFrameHeight() + + (30 + 220 + numSpacing) * ImGuiHelpers.GlobalScale + 5 * ImGui.GetStyle().CellPadding.X + 150 * ImGuiHelpers.GlobalScale; - var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine; + var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine || numSpacing == 0; - using var table = ImRaii.Table("SetTable", singleRow ? 6 : 5, + using var table = ImRaii.Table("SetTable", singleRow && _config.ShowUnlockedItemWarnings ? 6 : 5, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY); if (!table) return; ImGui.TableSetupColumn("##del", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight()); ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale); + if (singleRow) { - ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale); - ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale); + ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale); + if (_config.ShowAllAutomatedApplicationRules) + ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, + 6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale); + else + ImGui.TableSetupColumn("Use", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X); } else { ImGui.TableSetupColumn("Design / Job Restrictions", ImGuiTableColumnFlags.WidthFixed, 250 * ImGuiHelpers.GlobalScale); - ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); + if (_config.ShowAllAutomatedApplicationRules) + ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, + 3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); + else + ImGui.TableSetupColumn("Use", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Use").X); } if (singleRow) ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch); - ImGui.TableSetupColumn(string.Empty, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); + + if (_config.ShowUnlockedItemWarnings) + ImGui.TableSetupColumn(string.Empty, ImGuiTableColumnFlags.WidthFixed, 2 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale); ImGui.TableHeadersRow(); foreach (var (design, idx) in Selection.Designs.WithIndex()) { @@ -197,8 +216,11 @@ public class SetPanel DrawApplicationTypeBoxes(Selection, design, idx, singleRow); } - ImGui.TableNextColumn(); - DrawWarnings(design, idx); + if (_config.ShowUnlockedItemWarnings) + { + ImGui.TableNextColumn(); + DrawWarnings(design, idx); + } } ImGui.TableNextColumn(); @@ -207,8 +229,7 @@ public class SetPanel ImGui.TextUnformatted("New"); ImGui.TableNextColumn(); _designCombo.Draw(Selection, null, -1, _selector.IncognitoMode); - ImGui.TableNextColumn(); - ImGui.TableNextColumn(); + ImGui.TableNextRow(); _endAction?.Invoke(); _endAction = null; @@ -334,29 +355,31 @@ public class SetPanel } style.Pop(); - ImGuiUtil.HoverTooltip("Toggle all modes at once."); - - void Box(int idx) + ImGuiUtil.HoverTooltip("Toggle all application modes at once."); + if (_config.ShowAllAutomatedApplicationRules) { - var (type, description) = Types[idx]; - var value = design.ApplicationType.HasFlag(type); - if (ImGui.Checkbox($"##{(byte)type}", ref value)) - newType = value ? newType | type : newType & ~type; - ImGuiUtil.HoverTooltip(description); - } + void Box(int idx) + { + var (type, description) = Types[idx]; + var value = design.ApplicationType.HasFlag(type); + if (ImGui.Checkbox($"##{(byte)type}", ref value)) + newType = value ? newType | type : newType & ~type; + ImGuiUtil.HoverTooltip(description); + } - ImGui.SameLine(); - Box(0); - ImGui.SameLine(); - Box(1); - if (singleLine) ImGui.SameLine(); + Box(0); + ImGui.SameLine(); + Box(1); + if (singleLine) + ImGui.SameLine(); - Box(2); - ImGui.SameLine(); - Box(3); - ImGui.SameLine(); - Box(4); + Box(2); + ImGui.SameLine(); + Box(3); + ImGui.SameLine(); + Box(4); + } _manager.ChangeApplicationType(set, autoDesignIndex, newType); } diff --git a/Glamourer/Gui/Tabs/SettingsTab.cs b/Glamourer/Gui/Tabs/SettingsTab.cs index e0e64f6..1f9fab8 100644 --- a/Glamourer/Gui/Tabs/SettingsTab.cs +++ b/Glamourer/Gui/Tabs/SettingsTab.cs @@ -119,6 +119,12 @@ public class SettingsTab : ITab Checkbox("Auto-Open Design Folders", "Have design folders open or closed as their default state after launching.", _config.OpenFoldersByDefault, v => _config.OpenFoldersByDefault = v); + Checkbox("Show all Application Rule Checkboxes for Automation", + "Show multiple separate application rule checkboxes for automated designs, instead of a single box for enabling or disabling.", + _config.ShowAllAutomatedApplicationRules, v => _config.ShowAllAutomatedApplicationRules = v); + Checkbox("Show Unobtained Item Warnings", + "Show information whether you have unlocked all items and customizations in your automated design or not.", + _config.ShowUnlockedItemWarnings, v => _config.ShowUnlockedItemWarnings = v); Checkbox("Debug Mode", "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general.", _config.DebugMode, v => _config.DebugMode = v); ImGui.NewLine();