diff --git a/Dalamud/Interface/Internal/Windows/CreditsWindow.cs b/Dalamud/Interface/Internal/Windows/CreditsWindow.cs index fc85c8423..4e2a8d847 100644 --- a/Dalamud/Interface/Internal/Windows/CreditsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/CreditsWindow.cs @@ -46,6 +46,7 @@ Aireil kalilistic MgAl2O4 ascclemens +r00telement @@ -109,8 +110,7 @@ Copyright (c) Nate McMaster Licensed under the Apache License, Version 2.0 See License.txt for license information. -Thanks to everyone in the XIVLauncher -Discord server +Thanks to everyone in the XIVLauncher Discord server Join us at: https://discord.gg/3NMcUV5 diff --git a/Dalamud/Interface/Internal/Windows/DataWindow.cs b/Dalamud/Interface/Internal/Windows/DataWindow.cs index ecb915acf..c9c24b0ff 100644 --- a/Dalamud/Interface/Internal/Windows/DataWindow.cs +++ b/Dalamud/Interface/Internal/Windows/DataWindow.cs @@ -112,6 +112,7 @@ namespace Dalamud.Interface.Internal.Windows // DTR private DtrBarEntry? dtrTest1; private DtrBarEntry? dtrTest2; + private DtrBarEntry? dtrTest3; private uint copyButtonIndex = 0; @@ -1601,61 +1602,12 @@ namespace Dalamud.Interface.Internal.Windows private void DrawDtr() { - var dtrBar = Service.Get(); - - if (this.dtrTest1 != null) - { - ImGui.Text("DtrTest1"); - - var text = this.dtrTest1.Text?.TextValue ?? string.Empty; - if (ImGui.InputText("Text###dtr1t", ref text, 255)) - this.dtrTest1.Text = text; - - var shown = this.dtrTest1.Shown; - if (ImGui.Checkbox("Shown###dtr1s", ref shown)) - this.dtrTest1.Shown = shown; - - if (ImGui.Button("Remove###dtr1r")) - { - this.dtrTest1.Remove(); - this.dtrTest1 = null; - } - } - else - { - if (ImGui.Button("Add #1")) - { - this.dtrTest1 = dtrBar.Get("DTR Test #1"); - } - } - + DrawDtrTestEntry(ref this.dtrTest1, "DTR Test #1"); + ImGui.Separator(); + DrawDtrTestEntry(ref this.dtrTest2, "DTR Test #2"); + ImGui.Separator(); + DrawDtrTestEntry(ref this.dtrTest3, "DTR Test #3"); ImGui.Separator(); - - if (this.dtrTest2 != null) - { - ImGui.Text("DtrTest2"); - - var text = this.dtrTest2.Text?.TextValue ?? string.Empty; - if (ImGui.InputText("Text###dtr2t", ref text, 255)) - this.dtrTest2.Text = text; - - var shown = this.dtrTest2.Shown; - if (ImGui.Checkbox("Shown###dtr2s", ref shown)) - this.dtrTest2.Shown = shown; - - if (ImGui.Button("Remove###dtr2r")) - { - this.dtrTest2.Remove(); - this.dtrTest2 = null; - } - } - else - { - if (ImGui.Button("Add #2")) - { - this.dtrTest2 = dtrBar.Get("DTR Test #2"); - } - } var configuration = Service.Get(); if (configuration.DtrOrder != null) @@ -1669,6 +1621,37 @@ namespace Dalamud.Interface.Internal.Windows } } + private void DrawDtrTestEntry(ref DtrBarEntry? entry, string title) + { + var dtrBar = Service.Get(); + + if (entry != null) + { + ImGui.Text(title); + + var text = entry.Text?.TextValue ?? string.Empty; + if (ImGui.InputText($"Text###{entry.Title}t", ref text, 255)) + entry.Text = text; + + var shown = entry.Shown; + if (ImGui.Checkbox($"Shown###{entry.Title}s", ref shown)) + entry.Shown = shown; + + if (ImGui.Button($"Remove###{entry.Title}r")) + { + entry.Remove(); + entry = null; + } + } + else + { + if (ImGui.Button($"Add###{title}")) + { + entry = dtrBar.Get(title, title); + } + } + } + private async Task TestTaskInTaskDelay() { await Task.Delay(5000); diff --git a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs index 428f25e65..45ee557b8 100644 --- a/Dalamud/Interface/Internal/Windows/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SettingsWindow.cs @@ -324,8 +324,10 @@ namespace Dalamud.Interface.Internal.Windows var configuration = Service.Get(); var dtrBar = Service.Get(); - var order = configuration.DtrOrder!; - var ignore = configuration.DtrIgnore!; + var order = configuration.DtrOrder!.Where(x => dtrBar.HasEntry(x)).ToList(); + var ignore = configuration.DtrIgnore!.Where(x => dtrBar.HasEntry(x)).ToList(); + var orderLeft = configuration.DtrOrder!.Where(x => !order.Contains(x)).ToList(); + var ignoreLeft = configuration.DtrIgnore!.Where(x => !ignore.Contains(x)).ToList(); if (order.Count == 0) { @@ -336,8 +338,6 @@ namespace Dalamud.Interface.Internal.Windows for (var i = 0; i < order.Count; i++) { var title = order[i]; - if (!dtrBar.HasEntry(title)) - continue; // TODO: Maybe we can also resort the rest of the bar in the future? // var isRequired = search is Configuration.SearchSetting.Internal or Configuration.SearchSetting.MacroLinks; @@ -397,8 +397,8 @@ namespace Dalamud.Interface.Internal.Windows // } } - configuration.DtrOrder = order; - configuration.DtrIgnore = ignore; + configuration.DtrOrder = order.Concat(orderLeft).ToList(); + configuration.DtrIgnore = ignore.Concat(ignoreLeft).ToList(); if (isOrderChange) dtrBar.ApplySort();