feat(themes): restore the header theme/tab quick-picker
Brings back the 1.5.4 quick-picker lost in the v1.6.0 rewrite: a palette button in the input-bar button row (left of the cog) opens a popup that switches the theme (built-in + custom, active row checked) and jumps between chat tabs without opening settings. Theme switch mirrors the settings ThemePicker; the tab jump routes through a new MainWindow.ActivateTab that replays the click path (previous -> set -> OnTabActivated) so tell/unread handling is unchanged. Main window only -- pop-out InputBars get a null picker. Adds QuickPickerSelfTestStep.
This commit is contained in:
@@ -40,6 +40,11 @@ internal sealed class InputBar
|
||||
private readonly Action _onOpenSettings;
|
||||
private readonly CommandHelpWindow _commandHelpWindow;
|
||||
|
||||
// Null in pop-out windows: the theme/tab quick-picker only belongs in the
|
||||
// main window (1.5.4 had no pop-outs, and a tab jump from a channel-bound
|
||||
// pop-out would be confusing). The main window's InputBar gets the instance.
|
||||
private readonly ThemeQuickPicker? _themeQuickPicker;
|
||||
|
||||
private string _pendingMessage = string.Empty;
|
||||
private bool _isFocused;
|
||||
private bool _wasInputTextHovered;
|
||||
@@ -75,7 +80,8 @@ internal sealed class InputBar
|
||||
TokenResolver resolver,
|
||||
ILogger<InputBar> logger,
|
||||
Action onOpenSettings,
|
||||
CommandHelpWindow commandHelpWindow
|
||||
CommandHelpWindow commandHelpWindow,
|
||||
ThemeQuickPicker? themeQuickPicker = null
|
||||
)
|
||||
{
|
||||
_symbolPicker = symbolPicker;
|
||||
@@ -85,6 +91,7 @@ internal sealed class InputBar
|
||||
_logger = logger;
|
||||
_onOpenSettings = onOpenSettings;
|
||||
_commandHelpWindow = commandHelpWindow;
|
||||
_themeQuickPicker = themeQuickPicker;
|
||||
}
|
||||
|
||||
public string PendingMessage => _pendingMessage;
|
||||
@@ -188,6 +195,9 @@ internal sealed class InputBar
|
||||
if (inserted is not null && _pendingMessage.Length + inserted.Length <= BufferCapacity)
|
||||
_pendingMessage += inserted;
|
||||
|
||||
// Theme/tab quick-picker popup (main window only; null in pop-outs).
|
||||
_themeQuickPicker?.Draw();
|
||||
|
||||
// Auto-translate popup runs after all other popups so the OpenPopup
|
||||
// anchor lands on the InputText item we just drew.
|
||||
DrawAutoCompletePopup();
|
||||
@@ -507,6 +517,18 @@ internal sealed class InputBar
|
||||
ImGui.SetTooltip("Insert symbol");
|
||||
}
|
||||
|
||||
if (_themeQuickPicker is not null)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button(FontAwesomeIcon.Palette.ToIconString()))
|
||||
_themeQuickPicker.OpenPopup();
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
using (ImRaii.DefaultFont())
|
||||
ImGui.SetTooltip(HellionStrings.Settings_QuickPicker_Tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button(FontAwesomeIcon.Cog.ToIconString()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user