From 7e9e9489478d7a9376972fc6ca25b765a57bc509 Mon Sep 17 00:00:00 2001 From: karashiiro <49822414+karashiiro@users.noreply.github.com> Date: Thu, 1 Jul 2021 23:03:45 -0700 Subject: [PATCH] Add backend-specific window title colors --- TextToTalk/Backends/Polly/AmazonPollyBackend.cs | 2 ++ TextToTalk/Backends/VoiceBackend.cs | 3 +++ TextToTalk/Backends/VoiceBackendManager.cs | 6 ++++++ TextToTalk/UI/ConfigurationWindow.cs | 7 +++++++ 4 files changed, 18 insertions(+) diff --git a/TextToTalk/Backends/Polly/AmazonPollyBackend.cs b/TextToTalk/Backends/Polly/AmazonPollyBackend.cs index 62f8d27..dd976ff 100644 --- a/TextToTalk/Backends/Polly/AmazonPollyBackend.cs +++ b/TextToTalk/Backends/Polly/AmazonPollyBackend.cs @@ -32,6 +32,8 @@ public class AmazonPollyBackend : VoiceBackend public AmazonPollyBackend(PluginConfiguration config) { + TitleBarColor = ImGui.ColorConvertU32ToFloat4(0xFF0099FF); + var credentials = CredentialManager.GetCredentials(CredentialsTarget); if (credentials != null) diff --git a/TextToTalk/Backends/VoiceBackend.cs b/TextToTalk/Backends/VoiceBackend.cs index 89fc0ca..8ed8f45 100644 --- a/TextToTalk/Backends/VoiceBackend.cs +++ b/TextToTalk/Backends/VoiceBackend.cs @@ -1,10 +1,13 @@ using System; +using System.Numerics; using TextToTalk.GameEnums; namespace TextToTalk.Backends { public abstract class VoiceBackend : IDisposable { + public Vector4 TitleBarColor { get; protected set; } + public abstract void Say(Gender gender, string text); public abstract void CancelSay(); diff --git a/TextToTalk/Backends/VoiceBackendManager.cs b/TextToTalk/Backends/VoiceBackendManager.cs index 449d397..aca59d2 100644 --- a/TextToTalk/Backends/VoiceBackendManager.cs +++ b/TextToTalk/Backends/VoiceBackendManager.cs @@ -1,4 +1,5 @@ using System; +using System.Numerics; using TextToTalk.Backends.Polly; using TextToTalk.Backends.System; using TextToTalk.Backends.Websocket; @@ -39,6 +40,11 @@ public void SetBackend(TTSBackend backendKind) this.backend = CreateBackendFor(backendKind); } + public Vector4 GetBackendTitleBarColor() + { + return this.backend.TitleBarColor; + } + private VoiceBackend CreateBackendFor(TTSBackend backendKind) { return backendKind switch diff --git a/TextToTalk/UI/ConfigurationWindow.cs b/TextToTalk/UI/ConfigurationWindow.cs index 4031b0d..3e45b56 100644 --- a/TextToTalk/UI/ConfigurationWindow.cs +++ b/TextToTalk/UI/ConfigurationWindow.cs @@ -29,6 +29,11 @@ public ConfigurationWindow() public override void Draw(ref bool visible) { + var titleBarColor = BackendManager.GetBackendTitleBarColor(); + ImGui.PushStyleColor(ImGuiCol.TitleBgActive, titleBarColor != default + ? titleBarColor + : ImGui.ColorConvertU32ToFloat4(ImGui.GetColorU32(ImGuiCol.TitleBgActive))); + ImGui.SetNextWindowSize(new Vector2(520, 480)); ImGui.Begin("TextToTalk Configuration", ref visible, ImGuiWindowFlags.NoResize); { @@ -56,6 +61,8 @@ public override void Draw(ref bool visible) ImGui.EndTabBar(); } ImGui.End(); + + ImGui.PopStyleColor(); } private void DrawSynthesizerSettings()