From eb7b8b96ea0625a0fc6386f50df2dea9f36377f8 Mon Sep 17 00:00:00 2001 From: Spider <29214314+spide-r@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:05:34 -0500 Subject: [PATCH] Fix to prevent overriden style from appling to the config window --- ChatTwo/Plugin.cs | 11 ----------- ChatTwo/Ui/ChatLogWindow.cs | 19 +++++++++++++++++++ ChatTwo/Ui/Popout.cs | 12 ++++++++++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/ChatTwo/Plugin.cs b/ChatTwo/Plugin.cs index 9da9925..158f53e 100755 --- a/ChatTwo/Plugin.cs +++ b/ChatTwo/Plugin.cs @@ -134,11 +134,6 @@ public sealed class Plugin : IDalamudPlugin { private void Draw() { - if (Config.OverrideStyle) - { - var styles = StyleModel.GetConfiguredStyles(); - styles?.First(style => style.Name.Equals(Config.ChosenStyle)).Push(); - } Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden; ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text]; @@ -147,12 +142,6 @@ public sealed class Plugin : IDalamudPlugin { { WindowSystem.Draw(); } - - if (Config.OverrideStyle) - { - var styles = StyleModel.GetConfiguredStyles(); - styles?.First(style => style.Name.Equals(Config.ChosenStyle)).Pop(); - } } internal void SaveConfig() { diff --git a/ChatTwo/Ui/ChatLogWindow.cs b/ChatTwo/Ui/ChatLogWindow.cs index 193985b..3c12d81 100644 --- a/ChatTwo/Ui/ChatLogWindow.cs +++ b/ChatTwo/Ui/ChatLogWindow.cs @@ -13,6 +13,7 @@ using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling.Payloads; using Dalamud.Interface; using Dalamud.Interface.Internal; +using Dalamud.Interface.Style; using Dalamud.Interface.Utility; using Dalamud.Interface.Windowing; using Dalamud.Memory; @@ -96,6 +97,24 @@ public sealed class ChatLogWindow : Window, IUiComponent { Plugin.AddonLifecycle.RegisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip); } + public override void PreDraw() + { + if (Plugin.Config.OverrideStyle) + { + var styles = StyleModel.GetConfiguredStyles(); + styles?.First(style => style.Name.Equals(Plugin.Config.ChosenStyle)).Push(); + } + } + + public override void PostDraw() + { + if (Plugin.Config.OverrideStyle) + { + var styles = StyleModel.GetConfiguredStyles(); + styles?.First(style => style.Name.Equals(Plugin.Config.ChosenStyle)).Pop(); + } + } + public void Dispose() { Plugin.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip); Plugin.ClientState.Logout -= Logout; diff --git a/ChatTwo/Ui/Popout.cs b/ChatTwo/Ui/Popout.cs index a3ff375..96c0dfa 100644 --- a/ChatTwo/Ui/Popout.cs +++ b/ChatTwo/Ui/Popout.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Dalamud.Interface.Style; using Dalamud.Interface.Windowing; using ImGuiNET; @@ -22,6 +23,11 @@ internal class Popout : Window public override void PreDraw() { + if (ChatLogWindow.Plugin.Config.OverrideStyle) + { + var styles = StyleModel.GetConfiguredStyles(); + styles?.First(style => style.Name.Equals(ChatLogWindow.Plugin.Config.ChosenStyle)).Push(); + } Flags = ImGuiWindowFlags.None; if (!ChatLogWindow.Plugin.Config.ShowPopOutTitleBar) Flags |= ImGuiWindowFlags.NoTitleBar; @@ -49,7 +55,13 @@ internal class Popout : Window public override void PostDraw() { + ChatLogWindow.PopOutDocked[Idx] = ImGui.IsWindowDocked(); + if (ChatLogWindow.Plugin.Config.OverrideStyle) + { + var styles = StyleModel.GetConfiguredStyles(); + styles?.First(style => style.Name.Equals(ChatLogWindow.Plugin.Config.ChosenStyle)).Pop(); + } } public override void OnClose()