feat(ui): add SymbolPicker popup with FFXIV icon tab
New popup attached to the chat input lets the user browse and insert Dalamud SeIconChar glyphs (161 PUA codepoints, server-safe by design). Search field filters by enum name. Multi-insert keeps the popup open until the user clicks elsewhere. BMP tab follows in the next commit.
This commit is contained in:
@@ -40,6 +40,7 @@ public sealed class ChatLogWindow : Window
|
||||
|
||||
private readonly CommandWrapper _clearHellionCommand;
|
||||
private readonly CommandWrapper _hellionCommand;
|
||||
private readonly SymbolPicker _symbolPicker;
|
||||
|
||||
internal bool ScreenshotMode;
|
||||
private string Salt { get; }
|
||||
@@ -129,6 +130,8 @@ public sealed class ChatLogWindow : Window
|
||||
_clearHellionCommand.Execute += ClearLog;
|
||||
_hellionCommand.Execute += ToggleChat;
|
||||
|
||||
_symbolPicker = new SymbolPicker();
|
||||
|
||||
Plugin.ClientState.Login += Login;
|
||||
Plugin.ClientState.Logout += Logout;
|
||||
|
||||
@@ -792,6 +795,30 @@ public sealed class ChatLogWindow : Window
|
||||
)
|
||||
inputColour = ecColour;
|
||||
|
||||
// Symbol-picker trigger sits left of the channel indicator. ImRaii.Popup
|
||||
// inside DrawAndConsume pins to the last rendered item, so the call MUST
|
||||
// run immediately after this IconButton — placing it after the channel
|
||||
// picker below would pin the popup under the wrong widget.
|
||||
if (ImGuiUtil.IconButton(
|
||||
FontAwesomeIcon.Smile,
|
||||
"symbol-picker-trigger",
|
||||
"Insert symbol or FFXIV icon"))
|
||||
{
|
||||
_symbolPicker.OpenPopup();
|
||||
}
|
||||
var insertedSymbol = _symbolPicker.DrawAndConsume();
|
||||
if (insertedSymbol is not null)
|
||||
{
|
||||
// Same cursor-aware splice idiom as the AutoComplete commit path at
|
||||
// ChatLogWindow.cs:2487-2493. Clamp because CursorPos can drift if
|
||||
// the user mutates Chat while the popup is open.
|
||||
var pos = Math.Clamp(CursorPos, 0, Chat.Length);
|
||||
Chat = Chat[..pos] + insertedSymbol + Chat[pos..];
|
||||
Activate = true;
|
||||
ActivatePos = pos + insertedSymbol.Length;
|
||||
}
|
||||
ImGui.SameLine();
|
||||
|
||||
var beforeIcon = ImGui.GetCursorPos();
|
||||
|
||||
var tintSelector = Plugin.Config.ColorSelectedInputChannelButton && inputColour.HasValue;
|
||||
|
||||
Reference in New Issue
Block a user