diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index b36ae12..6f7a2b0 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -50,6 +50,9 @@ internal class Configuration : IPluginConfiguration { public Dictionary ChatColours = new(); public List Tabs = new(); + public bool OverrideStyle = false; + public string ChosenStyle = ""; + public uint DatabaseMigration = LatestDbVersion; internal void UpdateFrom(Configuration other) { @@ -88,6 +91,8 @@ internal class Configuration : IPluginConfiguration { ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value); Tabs = other.Tabs.Select(t => t.Clone()).ToList(); DatabaseMigration = other.DatabaseMigration; + OverrideStyle = other.OverrideStyle; + ChosenStyle = other.ChosenStyle; } public void Migrate() { diff --git a/ChatTwo/Plugin.cs b/ChatTwo/Plugin.cs index 8aadb58..158f53e 100755 --- a/ChatTwo/Plugin.cs +++ b/ChatTwo/Plugin.cs @@ -6,6 +6,7 @@ using ChatTwo.Resources; using ChatTwo.Ui; using ChatTwo.Util; using Dalamud.Game.ClientState.Objects; +using Dalamud.Interface.Style; using Dalamud.Interface.Windowing; using Dalamud.IoC; using Dalamud.Plugin; @@ -133,6 +134,7 @@ public sealed class Plugin : IDalamudPlugin { private void Draw() { + Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden; ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text]; diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index c4faac5..d6749bd 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -1958,6 +1958,24 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Override Style. + /// + internal static string Options_OverrideStyle_Name { + get { + return ResourceManager.GetString("Options_OverrideStyle_Name", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Styles. + /// + internal static string Options_OverrideStyleDropdown_Name { + get { + return ResourceManager.GetString("Options_OverrideStyleDropdown_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Display messages in a more modern style.. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index 33959a2..5fe2004 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -502,6 +502,12 @@ If this is enabled, the Auto Translate list will be sorted alphabetically. + + Override Style + + + Styles + Ctrl + {0} 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() diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs index 4f54571..662d3a5 100755 --- a/ChatTwo/Ui/SettingsTabs/Display.cs +++ b/ChatTwo/Ui/SettingsTabs/Display.cs @@ -1,5 +1,6 @@ using ChatTwo.Resources; using ChatTwo.Util; +using Dalamud.Interface.Style; using ImGuiNET; namespace ChatTwo.Ui.SettingsTabs; @@ -89,6 +90,24 @@ internal sealed class Display : ISettingsTab { ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name); ImGui.Spacing(); + ImGui.Checkbox(Language.Options_OverrideStyle_Name, ref Mutable.OverrideStyle); + ImGui.Spacing(); + + if (Mutable.OverrideStyle) + { + var currentStyle = Mutable.ChosenStyle.Equals("") ? StyleModel.GetConfiguredStyle().Name : Mutable.ChosenStyle; + if (ImGui.BeginCombo(Language.Options_OverrideStyleDropdown_Name, currentStyle)) { + foreach (var style in StyleModel.GetConfiguredStyles()) { + if (ImGui.Selectable(style.Name, this.Mutable.ChosenStyle == style.Name)) { + Mutable.ChosenStyle = style.Name; + } + } + + ImGui.EndCombo(); + } + } + ImGui.Spacing(); + ImGui.PopTextWrapPos(); } }