Added The ability to override the plugin style

This commit is contained in:
Spider
2024-04-09 17:29:35 -05:00
parent 9feb70d262
commit 9412711050
3 changed files with 37 additions and 0 deletions
+5
View File
@@ -50,6 +50,9 @@ internal class Configuration : IPluginConfiguration {
public Dictionary<ChatType, uint> ChatColours = new();
public List<Tab> 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() {
+13
View File
@@ -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,12 @@ 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];
@@ -140,6 +147,12 @@ 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() {
+19
View File
@@ -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("Override Style", ref Mutable.OverrideStyle);
ImGui.Spacing();
if (Mutable.OverrideStyle)
{
var currentStyle = Mutable.ChosenStyle.Equals("") ? StyleModel.GetConfiguredStyle().Name : Mutable.ChosenStyle;
if (ImGui.BeginCombo("REMOVEME Styles", 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();
}
}