Merge pull request #11
[feat] Allow Users to Override the Popout and ChatLogWindow Styles
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user