From d3cea8c6c0639655ef845ecb53b3896d0c055205 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Sat, 23 May 2026 00:48:03 +0200 Subject: [PATCH] refactor(settings): rebuild the Chat tab and pull in tooltips and novice network --- .../Resources/HellionStrings.Designer.cs | 15 +- HellionChat/Resources/HellionStrings.resx | 38 +-- HellionChat/Ui/SettingsTabs/Chat.cs | 239 +++++++++++------- HellionChat/Ui/SettingsTabs/Window.cs | 35 --- 4 files changed, 181 insertions(+), 146 deletions(-) diff --git a/HellionChat/Resources/HellionStrings.Designer.cs b/HellionChat/Resources/HellionStrings.Designer.cs index a130710..1851aa7 100644 --- a/HellionChat/Resources/HellionStrings.Designer.cs +++ b/HellionChat/Resources/HellionStrings.Designer.cs @@ -290,13 +290,6 @@ internal class HellionStrings internal static string Settings_Window_Hide_Heading => Get(nameof(Settings_Window_Hide_Heading)); internal static string Settings_Window_InactivityHide_Heading => Get(nameof(Settings_Window_InactivityHide_Heading)); internal static string Settings_Window_Frame_Heading => Get(nameof(Settings_Window_Frame_Heading)); - internal static string Settings_Window_Tooltips_Heading => Get(nameof(Settings_Window_Tooltips_Heading)); - - // Hellion Chat — Chat-Tab section headings - internal static string Settings_Chat_AutoTellTabs_Heading => Get(nameof(Settings_Chat_AutoTellTabs_Heading)); - internal static string Settings_Chat_Behaviour_Heading => Get(nameof(Settings_Chat_Behaviour_Heading)); - internal static string Settings_Chat_Preview_Heading => Get(nameof(Settings_Chat_Preview_Heading)); - internal static string Settings_Chat_Emotes_Heading => Get(nameof(Settings_Chat_Emotes_Heading)); // Hellion Chat — Chat-Tab SymbolPicker internal static string Settings_Chat_SymbolPicker_Enable_Name => Get(nameof(Settings_Chat_SymbolPicker_Enable_Name)); @@ -489,6 +482,14 @@ internal class HellionStrings internal static string Settings_Section_Performance => Get(nameof(Settings_Section_Performance)); internal static string Settings_Section_Sound_TabsHint => Get(nameof(Settings_Section_Sound_TabsHint)); + // v1.5.6: Chat tab collapsible section titles (R6) + internal static string Settings_Section_Messages => Get(nameof(Settings_Section_Messages)); + internal static string Settings_Section_InputPreview => Get(nameof(Settings_Section_InputPreview)); + internal static string Settings_Section_AutoTellTabs => Get(nameof(Settings_Section_AutoTellTabs)); + internal static string Settings_Section_Emotes => Get(nameof(Settings_Section_Emotes)); + internal static string Settings_Section_LinksTooltips => Get(nameof(Settings_Section_LinksTooltips)); + internal static string Settings_Section_NoviceNetwork => Get(nameof(Settings_Section_NoviceNetwork)); + // v1.5.6: Appearance tab collapsible section titles (R6) internal static string Settings_Section_Theme => Get(nameof(Settings_Section_Theme)); internal static string Settings_Section_Fonts => Get(nameof(Settings_Section_Fonts)); diff --git a/HellionChat/Resources/HellionStrings.resx b/HellionChat/Resources/HellionStrings.resx index 83dd0ba..b3bec84 100644 --- a/HellionChat/Resources/HellionStrings.resx +++ b/HellionChat/Resources/HellionStrings.resx @@ -620,24 +620,6 @@ Window frame - - Tooltips - - - - - Auto-Tell-Tabs - - - Message behaviour - - - Preview - - - Emotes - - Show symbol-picker button next to chat input @@ -1135,6 +1117,26 @@ Which sound plays per tab is set in the Channels tab. + + + Messages + + + Input & preview + + + Auto-tell tabs + + + Emotes + + + Links & tooltips + + + Novice network + + Theme diff --git a/HellionChat/Ui/SettingsTabs/Chat.cs b/HellionChat/Ui/SettingsTabs/Chat.cs index 7a374a3..8653d6a 100644 --- a/HellionChat/Ui/SettingsTabs/Chat.cs +++ b/HellionChat/Ui/SettingsTabs/Chat.cs @@ -9,7 +9,7 @@ using HellionChat.Util; namespace HellionChat.Ui.SettingsTabs; -// Four sections: Auto-Tell Tabs, Behaviour, Preview, Emotes. +// Six sections: Messages, Input & preview, Auto-tell tabs, Emotes, Links & tooltips, Novice network. internal sealed class Chat : ISettingsTab { private Plugin Plugin { get; } @@ -42,95 +42,36 @@ internal sealed class Chat : ISettingsTab public void Draw(bool sectionJustEntered) { - DrawAutoTellTabsSection(); + DrawMessagesSection(sectionJustEntered); ImGui.Spacing(); - DrawBehaviourSection(); + DrawInputPreviewSection(sectionJustEntered); ImGui.Spacing(); - DrawPreviewSection(); + DrawAutoTellTabsSection(sectionJustEntered); ImGui.Spacing(); - DrawEmotesSection(); + DrawEmotesSection(sectionJustEntered); + ImGui.Spacing(); + DrawLinksTooltipsSection(sectionJustEntered); + ImGui.Spacing(); + DrawNoviceNetworkSection(sectionJustEntered); } - private void DrawAutoTellTabsSection() + private void DrawMessagesSection(bool sectionJustEntered) { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_Chat_AutoTellTabs_Heading); - if (!tree.Success) - return; - - using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) - { - ImGui.Checkbox( - HellionStrings.ChatLog_AutoTellTabs_Enable_Name, - ref Mutable.EnableAutoTellTabs - ); - ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_Enable_Description); - - ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); - var limit = Mutable.AutoTellTabsLimit; - if (ImGui.SliderInt(HellionStrings.ChatLog_AutoTellTabs_Limit_Name, ref limit, 1, 50)) - Mutable.AutoTellTabsLimit = limit; - ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_Limit_Description); - - ImGui.Checkbox( - HellionStrings.ChatLog_AutoTellTabs_Compact_Name, - ref Mutable.AutoTellTabsCompactDisplay - ); - ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_Compact_Description); - - ImGui.Checkbox( - HellionStrings.ChatLog_AutoTellTabs_OpenAsPopout_Name, - ref Mutable.AutoTellTabsOpenAsPopout - ); - ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_OpenAsPopout_Description); - - ImGui.Checkbox( - HellionStrings.ChatLog_AutoTellTabs_GreetedToggle_Name, - ref Mutable.AutoTellTabsShowGreetedToggle - ); - ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_GreetedToggle_Description); - - ImGui.Spacing(); - ImGuiUtil.HelpText(HellionStrings.ChatLog_AutoTellTabs_PreloadHint); - - ImGui.Spacing(); - ImGuiUtil.WarningText(HellionStrings.ChatLog_AutoTellTabs_ConflictHint); - - ImGui.Spacing(); - ImGui.Separator(); - ImGui.Spacing(); - - var preload = Mutable.AutoTellTabsHistoryPreload; - ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); - if ( - ImGui.SliderInt( - HellionStrings.Privacy_AutoTellTabs_Preload_Name, - ref preload, - 0, - 100 - ) - ) - Mutable.AutoTellTabsHistoryPreload = preload; - ImGuiUtil.HelpMarker(HellionStrings.Privacy_AutoTellTabs_Preload_Description); - - ImGui.Spacing(); - ImGuiUtil.HelpText(HellionStrings.Privacy_AutoTellTabs_Preload_Hint); - } - } - - private void DrawBehaviourSection() - { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_Chat_Behaviour_Heading); + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_Messages); if (!tree.Success) return; using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) { + // Checkboxes first. ImGui.Checkbox( Language.Options_CollapseDuplicateMessages_Name, ref Mutable.CollapseDuplicateMessages ); ImGuiUtil.HelpMarker(Language.Options_CollapseDuplicateMessages_Description); + // Conditional child: only visible when parent is on (R4). if (Mutable.CollapseDuplicateMessages) { ImGui.Checkbox( @@ -140,12 +81,6 @@ internal sealed class Chat : ISettingsTab ImGuiUtil.HelpMarker(Language.Options_CollapseDuplicateMsgUniqueLink_Description); } - ImGui.Checkbox( - HellionStrings.Settings_Chat_SymbolPicker_Enable_Name, - ref Mutable.SymbolPickerEnabled - ); - ImGuiUtil.HelpMarker(HellionStrings.Settings_Chat_SymbolPicker_Enable_Description); - ImGui.Checkbox( HellionStrings.Settings_Chat_NotifyFailedTell_Name, ref Mutable.NotifyFailedTell @@ -158,6 +93,7 @@ internal sealed class Chat : ISettingsTab ); ImGuiUtil.HelpMarker(HellionStrings.Settings_Chat_NotifyPluginDisclosure_Description); + // Dropdowns after checkboxes (R3). // UI-7: name display options. using ( var combo = ImGuiUtil.BeginComboVertical( @@ -197,14 +133,26 @@ internal sealed class Chat : ISettingsTab } } - private void DrawPreviewSection() + private void DrawInputPreviewSection(bool sectionJustEntered) { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_Chat_Preview_Heading); + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_InputPreview); if (!tree.Success) return; using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) { + // Checkboxes first. + ImGui.Checkbox( + HellionStrings.Settings_Chat_SymbolPicker_Enable_Name, + ref Mutable.SymbolPickerEnabled + ); + ImGuiUtil.HelpMarker(HellionStrings.Settings_Chat_SymbolPicker_Enable_Description); + + ImGui.Checkbox(Language.Options_PreviewOnlyIf_Name, ref Mutable.OnlyPreviewIf); + ImGuiUtil.HelpMarker(Language.Options_PreviewOnlyIf_Description); + + // Dropdown after checkboxes (R3). using ( var combo = ImGuiUtil.BeginComboVertical( Language.Options_Preview_Name, @@ -223,6 +171,7 @@ internal sealed class Chat : ISettingsTab } ImGuiUtil.HelpMarker(Language.Options_Preview_Description); + // Number input last (R3). if ( ImGuiUtil.InputIntVertical( Language.Options_PreviewMinimum_Name, @@ -231,20 +180,88 @@ internal sealed class Chat : ISettingsTab ) ) Mutable.PreviewMinimum = Math.Clamp(Mutable.PreviewMinimum, 1, 250); - - ImGui.Checkbox(Language.Options_PreviewOnlyIf_Name, ref Mutable.OnlyPreviewIf); - ImGuiUtil.HelpMarker(Language.Options_PreviewOnlyIf_Description); } } - private void DrawEmotesSection() + private void DrawAutoTellTabsSection(bool sectionJustEntered) { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_Chat_Emotes_Heading); + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_AutoTellTabs); if (!tree.Success) return; using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) { + // Checkboxes first (R3). + ImGui.Checkbox( + HellionStrings.ChatLog_AutoTellTabs_Enable_Name, + ref Mutable.EnableAutoTellTabs + ); + ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_Enable_Description); + + ImGui.Checkbox( + HellionStrings.ChatLog_AutoTellTabs_Compact_Name, + ref Mutable.AutoTellTabsCompactDisplay + ); + ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_Compact_Description); + + ImGui.Checkbox( + HellionStrings.ChatLog_AutoTellTabs_OpenAsPopout_Name, + ref Mutable.AutoTellTabsOpenAsPopout + ); + ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_OpenAsPopout_Description); + + ImGui.Checkbox( + HellionStrings.ChatLog_AutoTellTabs_GreetedToggle_Name, + ref Mutable.AutoTellTabsShowGreetedToggle + ); + ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_GreetedToggle_Description); + + // Sliders after checkboxes (R3). + ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); + var limit = Mutable.AutoTellTabsLimit; + if (ImGui.SliderInt(HellionStrings.ChatLog_AutoTellTabs_Limit_Name, ref limit, 1, 50)) + Mutable.AutoTellTabsLimit = limit; + ImGuiUtil.HelpMarker(HellionStrings.ChatLog_AutoTellTabs_Limit_Description); + + ImGui.Spacing(); + ImGuiUtil.HelpText(HellionStrings.ChatLog_AutoTellTabs_PreloadHint); + + ImGui.Spacing(); + ImGuiUtil.WarningText(HellionStrings.ChatLog_AutoTellTabs_ConflictHint); + + ImGui.Spacing(); + ImGui.Separator(); + ImGui.Spacing(); + + var preload = Mutable.AutoTellTabsHistoryPreload; + ImGui.SetNextItemWidth(200f * ImGuiHelpers.GlobalScale); + if ( + ImGui.SliderInt( + HellionStrings.Privacy_AutoTellTabs_Preload_Name, + ref preload, + 0, + 100 + ) + ) + Mutable.AutoTellTabsHistoryPreload = preload; + ImGuiUtil.HelpMarker(HellionStrings.Privacy_AutoTellTabs_Preload_Description); + + ImGui.Spacing(); + ImGuiUtil.HelpText(HellionStrings.Privacy_AutoTellTabs_Preload_Hint); + } + } + + private void DrawEmotesSection(bool sectionJustEntered) + { + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_Emotes); + if (!tree.Success) + return; + + using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) + { + // Checkbox first (R3). ImGui.Checkbox(Language.Options_ShowEmotes_Name, ref Mutable.ShowEmotes); ImGuiUtil.HelpMarker(Language.Options_ShowEmotes_Desc); @@ -262,6 +279,7 @@ internal sealed class Chat : ISettingsTab WordPopupOptionsBuiltFor = EmoteCache.LoadingState.Done; } + // Button to add blocked emotes (R3 — button before table). var buttonWidth = ImGui.GetContentRegionAvail().X / 3; using (Plugin.FontManager.FontAwesome.Push()) ImGui.Button(FontAwesomeIcon.Plus.ToIconString(), new Vector2(buttonWidth, 0)); @@ -322,6 +340,7 @@ internal sealed class Chat : ISettingsTab $"{Language.Options_Emote_Loaded} {EmoteCache.SortedCodeArray.Length}" ); + // 5-column loaded-emotes display table. using ( var emoteTable = ImRaii.Table( "##LoadedEmotes", @@ -347,4 +366,52 @@ internal sealed class Chat : ISettingsTab } } } + + private void DrawLinksTooltipsSection(bool sectionJustEntered) + { + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_LinksTooltips); + if (!tree.Success) + return; + + using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) + { + ImGui.Checkbox( + Language.Options_NativeItemTooltips_Name, + ref Mutable.NativeItemTooltips + ); + ImGuiUtil.HelpMarker( + string.Format(Language.Options_NativeItemTooltips_Description, Plugin.PluginName) + ); + + // Conditional slider: only shown when native tooltips are enabled (R4). + 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 + ); + } + } + } + + private void DrawNoviceNetworkSection(bool sectionJustEntered) + { + if (sectionJustEntered) ImGui.SetNextItemOpen(false); + using var tree = ImRaii.TreeNode(HellionStrings.Settings_Section_NoviceNetwork); + if (!tree.Success) + return; + + using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) + { + ImGui.Checkbox(Language.Options_ShowNoviceNetwork_Name, ref Mutable.ShowNoviceNetwork); + ImGuiUtil.HelpMarker(Language.Options_ShowNoviceNetwork_Description); + } + } } diff --git a/HellionChat/Ui/SettingsTabs/Window.cs b/HellionChat/Ui/SettingsTabs/Window.cs index 9bf1288..6bee1ad 100644 --- a/HellionChat/Ui/SettingsTabs/Window.cs +++ b/HellionChat/Ui/SettingsTabs/Window.cs @@ -25,8 +25,6 @@ internal sealed class Window : ISettingsTab DrawInactivityHideSection(); ImGui.Spacing(); DrawFrameSection(); - ImGui.Spacing(); - DrawTooltipsSection(); } private void DrawHideSection() @@ -192,37 +190,4 @@ internal sealed class Window : ISettingsTab } } - private void DrawTooltipsSection() - { - using var tree = ImRaii.TreeNode(HellionStrings.Settings_Window_Tooltips_Heading); - if (!tree.Success) - { - return; - } - - using (ImRaii.PushIndent(ImGui.GetStyle().IndentSpacing, false)) - { - ImGui.Checkbox( - Language.Options_NativeItemTooltips_Name, - ref Mutable.NativeItemTooltips - ); - ImGuiUtil.HelpMarker( - string.Format(Language.Options_NativeItemTooltips_Description, Plugin.PluginName) - ); - - 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 - ); - } - } - } }