feat: update elements and swaps to use tables
This commit is contained in:
parent
a04e685d3e
commit
dac91cb5ee
|
@ -8,27 +8,27 @@
|
|||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Dalamud, Version=5.2.4.2, Culture=neutral, PublicKeyToken=null">
|
||||
<Reference Include="Dalamud">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGui.NET, Version=1.72.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<Reference Include="ImGui.NET">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImGuiScene, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<Reference Include="ImGuiScene">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<Reference Include="Lumina">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina.Excel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<Reference Include="Lumina.Excel">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
public bool ShowIndependently {
|
||||
get => this._options[0] == 1;
|
||||
set => this._options[0] = value ? 1 : 0;
|
||||
set => this._options[0] = value ? (byte) 1 : (byte) 0;
|
||||
}
|
||||
|
||||
public TargetBarOptions(byte[] options) {
|
||||
|
|
|
@ -84,23 +84,23 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
continue;
|
||||
}
|
||||
|
||||
var maxSettingWidth = 0f;
|
||||
|
||||
void DrawSettingName(string name) {
|
||||
maxSettingWidth = Math.Max(maxSettingWidth, ImGui.CalcTextSize(name).X);
|
||||
ImGui.TextUnformatted(name);
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
}
|
||||
|
||||
ImGui.Columns(3);
|
||||
ImGui.SetColumnWidth(0, ImGui.CalcTextSize("Enabled").X + ImGui.GetStyle().ItemSpacing.X * 2);
|
||||
const ImGuiTableFlags flags = ImGuiTableFlags.BordersInner
|
||||
| ImGuiTableFlags.PadOuterX
|
||||
| ImGuiTableFlags.SizingFixedFit
|
||||
| ImGuiTableFlags.RowBg;
|
||||
if (!ImGui.BeginTable($"uimanager-element-table-{kind}", 3, flags)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted("Enabled");
|
||||
ImGui.NextColumn();
|
||||
|
||||
DrawSettingName("Setting");
|
||||
|
||||
ImGui.TextUnformatted("Control");
|
||||
ImGui.TableSetupColumn("Enabled");
|
||||
ImGui.TableSetupColumn("Setting");
|
||||
ImGui.TableSetupColumn("Control", ImGuiTableColumnFlags.WidthStretch);
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
ImGui.SameLine(ImGui.GetContentRegionAvail().X - ImGui.GetStyle().ItemInnerSpacing.X - ImGui.GetStyle().ItemSpacing.X * 6);
|
||||
if (ImGuiExt.IconButton(FontAwesomeIcon.Search, $"uimanager-preview-element-{kind}")) {
|
||||
|
@ -120,10 +120,12 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
|
||||
ImGuiExt.HoverTooltip("Remove this element from this layout");
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
void DrawEnabledCheckbox(ElementKind kind, ElementComponent component, ref bool update) {
|
||||
ImGui.NextColumn();
|
||||
void DrawEnabledCheckbox(ElementKind kind, ElementComponent component, ref bool update, bool nextCol = true) {
|
||||
if (nextCol) {
|
||||
ImGui.TableNextColumn();
|
||||
}
|
||||
|
||||
var enabled = element[component];
|
||||
if (ImGui.Checkbox($"###{component}-enabled-{kind}", ref enabled)) {
|
||||
|
@ -133,11 +135,13 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
update = true;
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
}
|
||||
|
||||
ImGui.TableSetColumnIndex(0);
|
||||
|
||||
if (!kind.IsJobGauge()) {
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.Visibility, ref update);
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.Visibility, ref update, false);
|
||||
DrawSettingName("Visibility");
|
||||
|
||||
var keyboard = element[VisibilityFlags.Keyboard];
|
||||
|
@ -152,10 +156,12 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
element[VisibilityFlags.Gamepad] = gamepad;
|
||||
update = true;
|
||||
}
|
||||
|
||||
ImGui.TableNextRow();
|
||||
ImGui.TableSetColumnIndex(0);
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
DrawSettingName("Measured from");
|
||||
|
||||
|
@ -175,6 +181,7 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.X, ref update);
|
||||
DrawSettingName("X");
|
||||
|
@ -191,6 +198,7 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.Y, ref update);
|
||||
DrawSettingName("Y");
|
||||
|
@ -220,6 +228,7 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.Y, ref update);
|
||||
DrawSettingName("Y");
|
||||
|
@ -237,6 +246,8 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
ImGui.PopItemWidth();
|
||||
}
|
||||
|
||||
ImGui.TableNextRow();
|
||||
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.Scale, ref update);
|
||||
DrawSettingName("Scale");
|
||||
|
||||
|
@ -256,6 +267,7 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
if (!kind.IsJobGauge()) {
|
||||
DrawEnabledCheckbox(element.Id, ElementComponent.Opacity, ref update);
|
||||
|
@ -269,13 +281,14 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
|
||||
if (kind == ElementKind.TargetBar) {
|
||||
var targetBarOpts = new TargetBarOptions(element.Options);
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Display target information independently");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -286,13 +299,14 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
|
||||
if (kind == ElementKind.StatusEffects) {
|
||||
var statusOpts = new StatusOptions(element.Options);
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Style");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -310,13 +324,14 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
|
||||
if (kind == ElementKind.StatusInfoEnhancements || kind == ElementKind.StatusInfoEnfeeblements || kind == ElementKind.StatusInfoOther) {
|
||||
var statusOpts = new StatusInfoOptions(kind, element.Options);
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Layout");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -334,9 +349,10 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Alignment");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -354,9 +370,10 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Focusable by gamepad");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -373,8 +390,8 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
var hotbarOpts = new HotbarOptions(element);
|
||||
|
||||
if (kind != ElementKind.PetHotbar) {
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Hotbar number");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -385,13 +402,13 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Hotbar layout");
|
||||
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
if (ImGui.BeginCombo($"##hotbar-layout-{kind}", hotbarOpts.Layout.Name())) {
|
||||
foreach (var hotbarLayout in (HotbarLayout[]) Enum.GetValues(typeof(HotbarLayout))) {
|
||||
|
@ -407,13 +424,14 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
|
||||
if (kind.IsJobGauge()) {
|
||||
var gaugeOpts = new GaugeOptions(element.Options);
|
||||
|
||||
ImGui.NextColumn();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
DrawSettingName("Simple");
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -424,11 +442,10 @@ namespace HUD_Manager.Ui.Editor.Tabs {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
|
||||
ImGui.SetColumnWidth(1, maxSettingWidth + ImGui.GetStyle().ItemSpacing.X * 2);
|
||||
|
||||
ImGui.Columns();
|
||||
ImGui.EndTable();
|
||||
}
|
||||
|
||||
foreach (var remove in toRemove) {
|
||||
|
|
|
@ -72,31 +72,32 @@ namespace HUD_Manager.Ui {
|
|||
return;
|
||||
}
|
||||
|
||||
ImGui.Columns(4);
|
||||
const ImGuiTableFlags flags = ImGuiTableFlags.Borders
|
||||
& ~ImGuiTableFlags.BordersOuterV
|
||||
| ImGuiTableFlags.PadOuterX
|
||||
| ImGuiTableFlags.RowBg;
|
||||
if (!ImGui.BeginTable("uimanager-swaps-table", 4, flags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var conditions = new List<HudConditionMatch>(this.Plugin.Config.HudConditionMatches);
|
||||
if (this._editingConditionIndex == conditions.Count) {
|
||||
conditions.Add(new HudConditionMatch());
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted("Job");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.TextUnformatted("State");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.TextUnformatted("Layout");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.TextUnformatted("Options");
|
||||
ImGui.NextColumn();
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.TableSetupColumn("Job");
|
||||
ImGui.TableSetupColumn("State");
|
||||
ImGui.TableSetupColumn("Layout");
|
||||
ImGui.TableSetupColumn("Options");
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var addCondition = false;
|
||||
var actionedItemIndex = -1;
|
||||
var action = 0; // 0 for delete, otherwise move.
|
||||
foreach (var item in conditions.Select((cond, i) => new {cond, i})) {
|
||||
ImGui.TableNextRow();
|
||||
ImGui.TableSetColumnIndex(0);
|
||||
|
||||
if (this._editingConditionIndex == item.i) {
|
||||
this._editingCondition ??= new HudConditionMatch();
|
||||
ImGui.PushItemWidth(-1);
|
||||
|
@ -115,7 +116,7 @@ namespace HUD_Manager.Ui {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
if (ImGui.BeginCombo("##condition-edit-status", this._editingCondition.Status?.Name() ?? "Any")) {
|
||||
|
@ -133,7 +134,7 @@ namespace HUD_Manager.Ui {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
ImGui.PushItemWidth(-1);
|
||||
var comboPreview = this._editingCondition.LayoutId == Guid.Empty ? string.Empty : this.Plugin.Config.Layouts[this._editingCondition.LayoutId].Name;
|
||||
|
@ -148,7 +149,7 @@ namespace HUD_Manager.Ui {
|
|||
}
|
||||
|
||||
ImGui.PopItemWidth();
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
if (this._editingCondition.LayoutId != Guid.Empty) {
|
||||
if (ImGuiExt.IconButton(FontAwesomeIcon.Check, "condition-edit")) {
|
||||
|
@ -168,14 +169,14 @@ namespace HUD_Manager.Ui {
|
|||
}
|
||||
} else {
|
||||
ImGui.TextUnformatted(item.cond.ClassJob ?? string.Empty);
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
ImGui.TextUnformatted(item.cond.Status?.Name() ?? string.Empty);
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
this.Plugin.Config.Layouts.TryGetValue(item.cond.LayoutId, out var condLayout);
|
||||
ImGui.TextUnformatted(condLayout?.Name ?? string.Empty);
|
||||
ImGui.NextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
if (ImGuiExt.IconButton(FontAwesomeIcon.PencilAlt, $"{item.i}")) {
|
||||
this._editingConditionIndex = item.i;
|
||||
|
@ -199,13 +200,9 @@ namespace HUD_Manager.Ui {
|
|||
action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.NextColumn();
|
||||
}
|
||||
|
||||
ImGui.Columns(1);
|
||||
|
||||
ImGui.Separator();
|
||||
ImGui.EndTable();
|
||||
|
||||
ImGui.EndChild();
|
||||
|
||||
|
|
Loading…
Reference in New Issue