mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-13 12:14:18 +01:00
Add two-line automation designs with insufficient width, and toggle for all options at once.
This commit is contained in:
parent
e972ed9f4a
commit
be8ad5b5e5
1 changed files with 64 additions and 16 deletions
|
|
@ -11,6 +11,7 @@ using Glamourer.Services;
|
||||||
using Glamourer.Structs;
|
using Glamourer.Structs;
|
||||||
using Glamourer.Unlocks;
|
using Glamourer.Unlocks;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using Lumina.Excel.GeneratedSheets;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
using OtterGui.Widgets;
|
using OtterGui.Widgets;
|
||||||
|
|
@ -96,18 +97,37 @@ public class SetPanel
|
||||||
DrawDesignTable();
|
DrawDesignTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void DrawDesignTable()
|
private void DrawDesignTable()
|
||||||
{
|
{
|
||||||
using var table = ImRaii.Table("SetTable", 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY);
|
var requiredSizeOneLine = (1 + 6 + 2) * ImGui.GetFrameHeight()
|
||||||
|
+ (30 + 220 + 10 + 4) * ImGuiHelpers.GlobalScale
|
||||||
|
+ 5 * ImGui.GetStyle().CellPadding.X
|
||||||
|
+ 150 * ImGuiHelpers.GlobalScale;
|
||||||
|
|
||||||
|
var singleRow = ImGui.GetContentRegionAvail().X >= requiredSizeOneLine;
|
||||||
|
|
||||||
|
using var table = ImRaii.Table("SetTable", singleRow ? 6 : 5,
|
||||||
|
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);
|
||||||
ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale);
|
if (singleRow)
|
||||||
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 5 * ImGui.GetFrameHeight() + 4 * 2 * ImGuiHelpers.GlobalScale);
|
{
|
||||||
ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch);
|
ImGui.TableSetupColumn("Design", ImGuiTableColumnFlags.WidthFixed, 220 * ImGuiHelpers.GlobalScale);
|
||||||
ImGui.TableSetupColumn("Warnings", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("Warnings").X);
|
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 6 * ImGui.GetFrameHeight() + 10 * ImGuiHelpers.GlobalScale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui.TableSetupColumn("Design / Job Restrictions", ImGuiTableColumnFlags.WidthFixed, 250 * ImGuiHelpers.GlobalScale);
|
||||||
|
ImGui.TableSetupColumn("Application", ImGuiTableColumnFlags.WidthFixed, 3 * ImGui.GetFrameHeight() + 4 * ImGuiHelpers.GlobalScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (singleRow)
|
||||||
|
ImGui.TableSetupColumn("Job Restrictions", ImGuiTableColumnFlags.WidthStretch);
|
||||||
|
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())
|
||||||
|
|
@ -123,10 +143,20 @@ public class SetPanel
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
_designCombo.Draw(Selection, design, idx, _selector.IncognitoMode);
|
_designCombo.Draw(Selection, design, idx, _selector.IncognitoMode);
|
||||||
DrawDragDrop(Selection, idx);
|
DrawDragDrop(Selection, idx);
|
||||||
ImGui.TableNextColumn();
|
if (singleRow)
|
||||||
DrawApplicationTypeBoxes(Selection, design, idx);
|
{
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
_jobGroupCombo.Draw(Selection, design, idx);
|
DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
_jobGroupCombo.Draw(Selection, design, idx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_jobGroupCombo.Draw(Selection, design, idx);
|
||||||
|
ImGui.TableNextColumn();
|
||||||
|
DrawApplicationTypeBoxes(Selection, design, idx, singleRow);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
DrawWarnings(design, idx);
|
DrawWarnings(design, idx);
|
||||||
}
|
}
|
||||||
|
|
@ -249,19 +279,37 @@ public class SetPanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawApplicationTypeBoxes(AutoDesignSet set, AutoDesign design, int autoDesignIndex)
|
private void DrawApplicationTypeBoxes(AutoDesignSet set, AutoDesign design, int autoDesignIndex, bool singleLine)
|
||||||
{
|
{
|
||||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * ImGuiHelpers.GlobalScale));
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(2 * ImGuiHelpers.GlobalScale));
|
||||||
var newType = design.ApplicationType;
|
var newType = design.ApplicationType;
|
||||||
foreach (var (type, description) in Types)
|
var newTypeInt = (uint)newType;
|
||||||
|
if (ImGui.CheckboxFlags("##all", ref newTypeInt, (uint)AutoDesign.Type.All))
|
||||||
|
newType = (AutoDesign.Type)newTypeInt;
|
||||||
|
ImGuiUtil.HoverTooltip("Toggle all modes at once.");
|
||||||
|
|
||||||
|
void Box(int idx)
|
||||||
{
|
{
|
||||||
|
var (type, description) = Types[idx];
|
||||||
var value = design.ApplicationType.HasFlag(type);
|
var value = design.ApplicationType.HasFlag(type);
|
||||||
if (ImGui.Checkbox($"##{(byte)type}", ref value))
|
if (ImGui.Checkbox($"##{(byte)type}", ref value))
|
||||||
newType = value ? newType | type : newType & ~type;
|
newType = value ? newType | type : newType & ~type;
|
||||||
ImGuiUtil.HoverTooltip(description);
|
ImGuiUtil.HoverTooltip(description);
|
||||||
ImGui.SameLine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
Box(0);
|
||||||
|
ImGui.SameLine();
|
||||||
|
Box(1);
|
||||||
|
if (singleLine)
|
||||||
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
Box(2);
|
||||||
|
ImGui.SameLine();
|
||||||
|
Box(3);
|
||||||
|
ImGui.SameLine();
|
||||||
|
Box(4);
|
||||||
|
|
||||||
_manager.ChangeApplicationType(set, autoDesignIndex, newType);
|
_manager.ChangeApplicationType(set, autoDesignIndex, newType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,7 +386,7 @@ public class SetPanel
|
||||||
CurrentSelection = design?.Design ?? (Items.Count > 0 ? Items[0] : null);
|
CurrentSelection = design?.Design ?? (Items.Count > 0 ? Items[0] : null);
|
||||||
CurrentSelectionIdx = design?.Design.Index ?? (Items.Count > 0 ? 0 : -1);
|
CurrentSelectionIdx = design?.Design.Index ?? (Items.Count > 0 ? 0 : -1);
|
||||||
var name = (incognito ? CurrentSelection?.Incognito : CurrentSelection?.Name.Text) ?? string.Empty;
|
var name = (incognito ? CurrentSelection?.Incognito : CurrentSelection?.Name.Text) ?? string.Empty;
|
||||||
if (Draw("##design", name, string.Empty, 220 * ImGuiHelpers.GlobalScale,
|
if (Draw("##design", name, string.Empty, ImGui.GetContentRegionAvail().X,
|
||||||
ImGui.GetTextLineHeight())
|
ImGui.GetTextLineHeight())
|
||||||
&& CurrentSelection != null)
|
&& CurrentSelection != null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue