From fd08ec20ef09f28bcb3b2ad44231f135a16c1e06 Mon Sep 17 00:00:00 2001 From: Infi Date: Fri, 3 May 2024 10:34:41 +0200 Subject: [PATCH] Split Display tab --- ChatTwo/ChatTwo.csproj | 2 +- ChatTwo/Resources/Language.Designer.cs | 9 +++ ChatTwo/Resources/Language.resx | 3 + ChatTwo/Ui/Settings.cs | 1 + ChatTwo/Ui/SettingsTabs/ChatLog.cs | 84 ++++++++++++++++++++++++++ ChatTwo/Ui/SettingsTabs/Display.cs | 59 ------------------ 6 files changed, 98 insertions(+), 60 deletions(-) create mode 100644 ChatTwo/Ui/SettingsTabs/ChatLog.cs diff --git a/ChatTwo/ChatTwo.csproj b/ChatTwo/ChatTwo.csproj index 2afe5a1..8263e85 100755 --- a/ChatTwo/ChatTwo.csproj +++ b/ChatTwo/ChatTwo.csproj @@ -1,6 +1,6 @@ - 1.23.4 + 1.23.5 net8.0-windows enable enable diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index 5ff840f..ebe2a0a 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -1652,6 +1652,15 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Chat log. + /// + internal static string Options_ChatLog_Tab { + get { + return ResourceManager.GetString("Options_ChatLog_Tab", resourceCulture); + } + } + /// /// Looks up a localized string similar to Clear the message history database. /// diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index bc70254..52f9384 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -1018,4 +1018,7 @@ Input is disabled for this tab + + Chat log + diff --git a/ChatTwo/Ui/Settings.cs b/ChatTwo/Ui/Settings.cs index 52d9bad..552b35c 100755 --- a/ChatTwo/Ui/Settings.cs +++ b/ChatTwo/Ui/Settings.cs @@ -34,6 +34,7 @@ public sealed class SettingsWindow : Window Tabs = new List { new Display(Mutable), + new ChatLog(Mutable), new Ui.SettingsTabs.Fonts(Mutable), new ChatColours(Mutable, Plugin), new Tabs(Plugin, Mutable), diff --git a/ChatTwo/Ui/SettingsTabs/ChatLog.cs b/ChatTwo/Ui/SettingsTabs/ChatLog.cs new file mode 100644 index 0000000..55dbbb9 --- /dev/null +++ b/ChatTwo/Ui/SettingsTabs/ChatLog.cs @@ -0,0 +1,84 @@ +using ChatTwo.Resources; +using ChatTwo.Util; +using Dalamud.Interface.Style; +using Dalamud.Interface.Utility.Raii; +using ImGuiNET; + +namespace ChatTwo.Ui.SettingsTabs; + +internal sealed class ChatLog : ISettingsTab +{ + private Configuration Mutable { get; } + + public string Name => Language.Options_ChatLog_Tab + "###tabs-chatlog"; + + internal ChatLog(Configuration mutable) + { + Mutable = mutable; + } + + public void Draw(bool changed) + { + ImGui.PushTextWrapPos(); + + ImGuiUtil.OptionCheckbox(ref Mutable.PlaySounds, Language.Options_PlaySounds_Name, Language.Options_PlaySounds_Description); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.SidebarTabView, Language.Options_SidebarTabView_Name, string.Format(Language.Options_SidebarTabView_Description, Plugin.PluginName)); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.ShowNoviceNetwork, Language.Options_ShowNoviceNetwork_Name, Language.Options_ShowNoviceNetwork_Description); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name, string.Format(Language.Options_NativeItemTooltips_Description, Plugin.PluginName)); + ImGui.Spacing(); + + if (Mutable.NativeItemTooltips) + { + ImGuiUtil.DragFloatVertical(Language.Options_TooltipOffset_Name, Language.Options_TooltipOffset_Desc, ref Mutable.TooltipOffset, 1, 0f, 400f, $"{Mutable.TooltipOffset:N0}px", ImGuiSliderFlags.AlwaysClamp); + ImGui.Spacing(); + } + + ImGuiUtil.DragFloatVertical(Language.Options_WindowOpacity_Name, ref Mutable.WindowAlpha, .25f, 0f, 100f, $"{Mutable.WindowAlpha:N2}%%", ImGuiSliderFlags.AlwaysClamp); + ImGui.Spacing(); + + if (ImGuiUtil.InputIntVertical(Language.Options_MaxLinesToShow_Name, Language.Options_MaxLinesToShow_Description, ref Mutable.MaxLinesToRender)) Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.CanMove, Language.Options_CanMove_Name); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.CanResize, Language.Options_CanResize_Name); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.ShowTitleBar, Language.Options_ShowTitleBar_Name); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name); + ImGui.Spacing(); + + ImGuiUtil.OptionCheckbox(ref Mutable.OverrideStyle, Language.Options_OverrideStyle_Name, Language.Options_OverrideStyle_Name_Desc); + ImGui.Spacing(); + ImGui.PopTextWrapPos(); + + if (!Mutable.OverrideStyle) + return; + + var styles = StyleModel.GetConfiguredStyles(); + if (styles == null) + { + ImGui.TextUnformatted(Language.Options_OverrideStyle_NotAvailable); + ImGui.Spacing(); + return; + } + + var currentStyle = Mutable.ChosenStyle ?? Language.Options_OverrideStyle_NotSelected; + using var combo = ImRaii.Combo(Language.Options_OverrideStyleDropdown_Name, currentStyle); + if (combo) + foreach (var style in styles) + if (ImGui.Selectable(style.Name, Mutable.ChosenStyle == style.Name)) + Mutable.ChosenStyle = style.Name; + + ImGui.Spacing(); + } +} diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs index 07ad72e..e01182b 100755 --- a/ChatTwo/Ui/SettingsTabs/Display.cs +++ b/ChatTwo/Ui/SettingsTabs/Display.cs @@ -21,9 +21,6 @@ internal sealed class Display : ISettingsTab { ImGui.PushTextWrapPos(); - ImGuiUtil.OptionCheckbox(ref Mutable.PlaySounds, Language.Options_PlaySounds_Name, Language.Options_PlaySounds_Description); - ImGui.Spacing(); - ImGuiUtil.OptionCheckbox(ref Mutable.HideChat, Language.Options_HideChat_Name, Language.Options_HideChat_Description); ImGui.Spacing(); @@ -39,12 +36,6 @@ internal sealed class Display : ISettingsTab ImGuiUtil.OptionCheckbox(ref Mutable.HideInLoadingScreens, Language.Options_HideInLoadingScreens_Name, string.Format(Language.Options_HideInLoadingScreens_Description, Plugin.PluginName)); ImGui.Spacing(); - ImGuiUtil.OptionCheckbox(ref Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name, string.Format(Language.Options_NativeItemTooltips_Description, Plugin.PluginName)); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.SidebarTabView, Language.Options_SidebarTabView_Name, string.Format(Language.Options_SidebarTabView_Description, Plugin.PluginName)); - ImGui.Spacing(); - ImGuiUtil.OptionCheckbox(ref Mutable.PrettierTimestamps, Language.Options_PrettierTimestamps_Name, Language.Options_PrettierTimestamps_Description); if (Mutable.PrettierTimestamps) @@ -58,55 +49,5 @@ internal sealed class Display : ISettingsTab ImGuiUtil.OptionCheckbox(ref Mutable.CollapseDuplicateMessages, Language.Options_CollapseDuplicateMessages_Name, Language.Options_CollapseDuplicateMessages_Description); ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.ShowNoviceNetwork, Language.Options_ShowNoviceNetwork_Name, Language.Options_ShowNoviceNetwork_Description); - ImGui.Spacing(); - - ImGuiUtil.DragFloatVertical(Language.Options_TooltipOffset_Name, Language.Options_TooltipOffset_Desc, ref Mutable.TooltipOffset, 1, 0f, 400f, $"{Mutable.TooltipOffset:N0}px", ImGuiSliderFlags.AlwaysClamp); - ImGui.Spacing(); - - ImGuiUtil.DragFloatVertical(Language.Options_WindowOpacity_Name, ref Mutable.WindowAlpha, .25f, 0f, 100f, $"{Mutable.WindowAlpha:N2}%%", ImGuiSliderFlags.AlwaysClamp); - ImGui.Spacing(); - - - if (ImGuiUtil.InputIntVertical(Language.Options_MaxLinesToShow_Name, Language.Options_MaxLinesToShow_Description, ref Mutable.MaxLinesToRender)) - Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.CanMove, Language.Options_CanMove_Name); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.CanResize, Language.Options_CanResize_Name); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.ShowTitleBar, Language.Options_ShowTitleBar_Name); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.OverrideStyle, Language.Options_OverrideStyle_Name, Language.Options_OverrideStyle_Name_Desc); - ImGui.Spacing(); - ImGui.PopTextWrapPos(); - - if (!Mutable.OverrideStyle) - return; - - var styles = StyleModel.GetConfiguredStyles(); - if (styles == null) - { - ImGui.TextUnformatted(Language.Options_OverrideStyle_NotAvailable); - ImGui.Spacing(); - return; - } - - var currentStyle = Mutable.ChosenStyle ?? Language.Options_OverrideStyle_NotSelected; - using var combo = ImRaii.Combo(Language.Options_OverrideStyleDropdown_Name, currentStyle); - if (combo) - foreach (var style in styles) - if (ImGui.Selectable(style.Name, Mutable.ChosenStyle == style.Name)) - Mutable.ChosenStyle = style.Name; - - ImGui.Spacing(); } }