Merge pull request #11
[feat] Allow Users to Override the Popout and ChatLogWindow Styles
This commit is contained in:
@@ -50,6 +50,9 @@ internal class Configuration : IPluginConfiguration {
|
|||||||
public Dictionary<ChatType, uint> ChatColours = new();
|
public Dictionary<ChatType, uint> ChatColours = new();
|
||||||
public List<Tab> Tabs = new();
|
public List<Tab> Tabs = new();
|
||||||
|
|
||||||
|
public bool OverrideStyle = false;
|
||||||
|
public string ChosenStyle = "";
|
||||||
|
|
||||||
public uint DatabaseMigration = LatestDbVersion;
|
public uint DatabaseMigration = LatestDbVersion;
|
||||||
|
|
||||||
internal void UpdateFrom(Configuration other) {
|
internal void UpdateFrom(Configuration other) {
|
||||||
@@ -88,6 +91,8 @@ internal class Configuration : IPluginConfiguration {
|
|||||||
ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value);
|
ChatColours = other.ChatColours.ToDictionary(entry => entry.Key, entry => entry.Value);
|
||||||
Tabs = other.Tabs.Select(t => t.Clone()).ToList();
|
Tabs = other.Tabs.Select(t => t.Clone()).ToList();
|
||||||
DatabaseMigration = other.DatabaseMigration;
|
DatabaseMigration = other.DatabaseMigration;
|
||||||
|
OverrideStyle = other.OverrideStyle;
|
||||||
|
ChosenStyle = other.ChosenStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Migrate() {
|
public void Migrate() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using ChatTwo.Resources;
|
|||||||
using ChatTwo.Ui;
|
using ChatTwo.Ui;
|
||||||
using ChatTwo.Util;
|
using ChatTwo.Util;
|
||||||
using Dalamud.Game.ClientState.Objects;
|
using Dalamud.Game.ClientState.Objects;
|
||||||
|
using Dalamud.Interface.Style;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
@@ -133,6 +134,7 @@ public sealed class Plugin : IDalamudPlugin {
|
|||||||
|
|
||||||
private void Draw()
|
private void Draw()
|
||||||
{
|
{
|
||||||
|
|
||||||
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
|
Interface.UiBuilder.DisableUserUiHide = !Config.HideWhenUiHidden;
|
||||||
ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
ChatLogWindow.DefaultText = ImGui.GetStyle().Colors[(int) ImGuiCol.Text];
|
||||||
|
|
||||||
|
|||||||
Generated
+18
@@ -1958,6 +1958,24 @@ namespace ChatTwo.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Override Style.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Options_OverrideStyle_Name {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Options_OverrideStyle_Name", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Styles.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Options_OverrideStyleDropdown_Name {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Options_OverrideStyleDropdown_Name", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Display messages in a more modern style..
|
/// Looks up a localized string similar to Display messages in a more modern style..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -502,6 +502,12 @@
|
|||||||
<data name="Options_SortAutoTranslate_Description">
|
<data name="Options_SortAutoTranslate_Description">
|
||||||
<value>If this is enabled, the Auto Translate list will be sorted alphabetically.</value>
|
<value>If this is enabled, the Auto Translate list will be sorted alphabetically.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Options_OverrideStyle_Name">
|
||||||
|
<value>Override Style</value>
|
||||||
|
</data>
|
||||||
|
<data name="Options_OverrideStyleDropdown_Name">
|
||||||
|
<value>Styles</value>
|
||||||
|
</data>
|
||||||
<data name="AutoTranslate_Completion_Key">
|
<data name="AutoTranslate_Completion_Key">
|
||||||
<value>Ctrl + {0}</value>
|
<value>Ctrl + {0}</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using Dalamud.Game.Text.SeStringHandling;
|
|||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
using Dalamud.Interface.Internal;
|
using Dalamud.Interface.Internal;
|
||||||
|
using Dalamud.Interface.Style;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using Dalamud.Memory;
|
using Dalamud.Memory;
|
||||||
@@ -96,6 +97,24 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
|||||||
Plugin.AddonLifecycle.RegisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip);
|
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() {
|
public void Dispose() {
|
||||||
Plugin.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip);
|
Plugin.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip);
|
||||||
Plugin.ClientState.Logout -= Logout;
|
Plugin.ClientState.Logout -= Logout;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Dalamud.Interface.Style;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
@@ -22,6 +23,11 @@ internal class Popout : Window
|
|||||||
|
|
||||||
public override void PreDraw()
|
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;
|
Flags = ImGuiWindowFlags.None;
|
||||||
if (!ChatLogWindow.Plugin.Config.ShowPopOutTitleBar)
|
if (!ChatLogWindow.Plugin.Config.ShowPopOutTitleBar)
|
||||||
Flags |= ImGuiWindowFlags.NoTitleBar;
|
Flags |= ImGuiWindowFlags.NoTitleBar;
|
||||||
@@ -49,7 +55,13 @@ internal class Popout : Window
|
|||||||
|
|
||||||
public override void PostDraw()
|
public override void PostDraw()
|
||||||
{
|
{
|
||||||
|
|
||||||
ChatLogWindow.PopOutDocked[Idx] = ImGui.IsWindowDocked();
|
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()
|
public override void OnClose()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using ChatTwo.Resources;
|
using ChatTwo.Resources;
|
||||||
using ChatTwo.Util;
|
using ChatTwo.Util;
|
||||||
|
using Dalamud.Interface.Style;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
namespace ChatTwo.Ui.SettingsTabs;
|
namespace ChatTwo.Ui.SettingsTabs;
|
||||||
@@ -89,6 +90,24 @@ internal sealed class Display : ISettingsTab {
|
|||||||
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
|
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
|
||||||
ImGui.Spacing();
|
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();
|
ImGui.PopTextWrapPos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user