Add visibility options for automated design application rules and unobtained item warnings.

This commit is contained in:
Ottermandias 2023-09-27 02:34:44 +02:00
parent 2e9a30427d
commit 38a28871f4
3 changed files with 79 additions and 48 deletions

View file

@ -18,22 +18,24 @@ namespace Glamourer;
public class Configuration : IPluginConfiguration, ISavable public class Configuration : IPluginConfiguration, ISavable
{ {
public bool Enabled { get; set; } = true; public bool Enabled { get; set; } = true;
public bool UseRestrictedGearProtection { get; set; } = true; public bool UseRestrictedGearProtection { get; set; } = true;
public bool OpenFoldersByDefault { get; set; } = false; public bool OpenFoldersByDefault { get; set; } = false;
public bool AutoRedrawEquipOnChanges { get; set; } = false; public bool AutoRedrawEquipOnChanges { get; set; } = false;
public bool EnableAutoDesigns { get; set; } = true; public bool EnableAutoDesigns { get; set; } = true;
public bool IncognitoMode { get; set; } = false; public bool IncognitoMode { get; set; } = false;
public bool UnlockDetailMode { get; set; } = true; public bool UnlockDetailMode { get; set; } = true;
public bool HideApplyCheckmarks { get; set; } = false; public bool HideApplyCheckmarks { get; set; } = false;
public bool SmallEquip { get; set; } = false; public bool SmallEquip { get; set; } = false;
public bool UnlockedItemMode { get; set; } = false; public bool UnlockedItemMode { get; set; } = false;
public byte DisableFestivals { get; set; } = 1; public byte DisableFestivals { get; set; } = 1;
public bool EnableGameContextMenu { get; set; } = true; public bool EnableGameContextMenu { get; set; } = true;
public bool HideWindowInCutscene { get; set; } = false; public bool HideWindowInCutscene { get; set; } = false;
public bool ShowAutomationSetEditing { get; set; } = true; public bool ShowAutomationSetEditing { get; set; } = true;
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings; public bool ShowAllAutomatedApplicationRules { get; set; } = true;
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift); 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 int LastSeenVersion { get; set; } = GlamourerChangelog.LastChangelogVersion;
public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New; public ChangeLogDisplayType ChangeLogDisplayType { get; set; } = ChangeLogDisplayType.New;

View file

@ -107,7 +107,7 @@ public class SetPanel
"Show options to change the name or the associated character or NPC of this design set."); "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.Dummy(Vector2.Zero);
ImGui.Separator(); ImGui.Separator();
@ -137,34 +137,53 @@ public class SetPanel
private void DrawDesignTable() private void DrawDesignTable()
{ {
var requiredSizeOneLine = (1 + 6 + 2) * ImGui.GetFrameHeight() var (numCheckboxes, numSpacing) = (_config.ShowAllAutomatedApplicationRules, _config.ShowUnlockedItemWarnings) switch
+ (30 + 220 + 10 + 4) * ImGuiHelpers.GlobalScale {
(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 + 5 * ImGui.GetStyle().CellPadding.X
+ 150 * ImGuiHelpers.GlobalScale; + 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); ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY);
if (!table) if (!table)
return; return;
ImGui.TableSetupColumn("##del", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight()); ImGui.TableSetupColumn("##del", ImGuiTableColumnFlags.WidthFixed, ImGui.GetFrameHeight());
ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("##Index", ImGuiTableColumnFlags.WidthFixed, 30 * ImGuiHelpers.GlobalScale);
if (singleRow) if (singleRow)
{ {
ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale); ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale);
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 6 * ImGui.GetFrameHeight() + 10 * 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 else
{ {
ImGui.TableSetupColumn("Design / Job Restrictions", ImGuiTableColumnFlags.WidthFixed, 250 * ImGuiHelpers.GlobalScale); 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) if (singleRow)
ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch); 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(); ImGui.TableHeadersRow();
foreach (var (design, idx) in Selection.Designs.WithIndex()) foreach (var (design, idx) in Selection.Designs.WithIndex())
{ {
@ -197,8 +216,11 @@ public class SetPanel
DrawApplicationTypeBoxes(Selection, design, idx, singleRow); DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
} }
ImGui.TableNextColumn(); if (_config.ShowUnlockedItemWarnings)
DrawWarnings(design, idx); {
ImGui.TableNextColumn();
DrawWarnings(design, idx);
}
} }
ImGui.TableNextColumn(); ImGui.TableNextColumn();
@ -207,8 +229,7 @@ public class SetPanel
ImGui.TextUnformatted("New"); ImGui.TextUnformatted("New");
ImGui.TableNextColumn(); ImGui.TableNextColumn();
_designCombo.Draw(Selection, null, -1, _selector.IncognitoMode); _designCombo.Draw(Selection, null, -1, _selector.IncognitoMode);
ImGui.TableNextColumn(); ImGui.TableNextRow();
ImGui.TableNextColumn();
_endAction?.Invoke(); _endAction?.Invoke();
_endAction = null; _endAction = null;
@ -334,29 +355,31 @@ public class SetPanel
} }
style.Pop(); style.Pop();
ImGuiUtil.HoverTooltip("Toggle all modes at once."); ImGuiUtil.HoverTooltip("Toggle all application modes at once.");
if (_config.ShowAllAutomatedApplicationRules)
void Box(int idx)
{ {
var (type, description) = Types[idx]; void Box(int idx)
var value = design.ApplicationType.HasFlag(type); {
if (ImGui.Checkbox($"##{(byte)type}", ref value)) var (type, description) = Types[idx];
newType = value ? newType | type : newType & ~type; var value = design.ApplicationType.HasFlag(type);
ImGuiUtil.HoverTooltip(description); 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(); ImGui.SameLine();
Box(0);
ImGui.SameLine();
Box(1);
if (singleLine)
ImGui.SameLine();
Box(2); Box(2);
ImGui.SameLine(); ImGui.SameLine();
Box(3); Box(3);
ImGui.SameLine(); ImGui.SameLine();
Box(4); Box(4);
}
_manager.ChangeApplicationType(set, autoDesignIndex, newType); _manager.ChangeApplicationType(set, autoDesignIndex, newType);
} }

View file

@ -119,6 +119,12 @@ public class SettingsTab : ITab
Checkbox("Auto-Open Design Folders", Checkbox("Auto-Open Design Folders",
"Have design folders open or closed as their default state after launching.", _config.OpenFoldersByDefault, "Have design folders open or closed as their default state after launching.", _config.OpenFoldersByDefault,
v => _config.OpenFoldersByDefault = v); 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, Checkbox("Debug Mode", "Show the debug tab. Only useful for debugging or advanced use. Not recommended in general.", _config.DebugMode,
v => _config.DebugMode = v); v => _config.DebugMode = v);
ImGui.NewLine(); ImGui.NewLine();