refactor(settings): rebuild the Chat tab and pull in tooltips and novice network

This commit is contained in:
2026-05-23 00:48:03 +02:00
parent 3058e6bc6d
commit d3cea8c6c0
4 changed files with 181 additions and 146 deletions
+8 -7
View File
@@ -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));
+20 -18
View File
@@ -620,24 +620,6 @@
<data name="Settings_Window_Frame_Heading" xml:space="preserve">
<value>Window frame</value>
</data>
<data name="Settings_Window_Tooltips_Heading" xml:space="preserve">
<value>Tooltips</value>
</data>
<!-- Hellion Chat — Chat tab section headings -->
<data name="Settings_Chat_AutoTellTabs_Heading" xml:space="preserve">
<value>Auto-Tell-Tabs</value>
</data>
<data name="Settings_Chat_Behaviour_Heading" xml:space="preserve">
<value>Message behaviour</value>
</data>
<data name="Settings_Chat_Preview_Heading" xml:space="preserve">
<value>Preview</value>
</data>
<data name="Settings_Chat_Emotes_Heading" xml:space="preserve">
<value>Emotes</value>
</data>
<!-- Hellion Chat — Chat tab SymbolPicker -->
<data name="Settings_Chat_SymbolPicker_Enable_Name" xml:space="preserve">
<value>Show symbol-picker button next to chat input</value>
@@ -1135,6 +1117,26 @@
<value>Which sound plays per tab is set in the Channels tab.</value>
</data>
<!-- v1.5.6: Chat tab section titles (collapsible, R6) -->
<data name="Settings_Section_Messages" xml:space="preserve">
<value>Messages</value>
</data>
<data name="Settings_Section_InputPreview" xml:space="preserve">
<value>Input &amp; preview</value>
</data>
<data name="Settings_Section_AutoTellTabs" xml:space="preserve">
<value>Auto-tell tabs</value>
</data>
<data name="Settings_Section_Emotes" xml:space="preserve">
<value>Emotes</value>
</data>
<data name="Settings_Section_LinksTooltips" xml:space="preserve">
<value>Links &amp; tooltips</value>
</data>
<data name="Settings_Section_NoviceNetwork" xml:space="preserve">
<value>Novice network</value>
</data>
<!-- v1.5.6: Appearance tab section titles (collapsible, R6) -->
<data name="Settings_Section_Theme" xml:space="preserve">
<value>Theme</value>
+153 -86
View File
@@ -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);
}
}
}
-35
View File
@@ -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
);
}
}
}
}