feat(command-help-window): full R2 migration (ctor-injected + DI-reg)
J resurrects CommandHelpWindow from the v1.7.0 stub state: - Class header public → internal sealed - Ctor takes 4 DI deps (ChunkRenderer, MainWindow, InputBar, ILogger) via Factory-Lambda DI-reg. NO Lender<PayloadHandler> — command-help chunks are read-only command-description text with no click-targets (per spec §5-J + F W8 consumer audit). - Draw() calls _chunkRenderer.DrawChunks(desc chunks, wrap: true, handler: null, lineWidth: 0f) — null-handler is intentional. - Plugin.cs property visibility flipped public → internal to satisfy CS0053 (analogous to I's InputPreview fix). K (R3 DebuggerWindow counters) and A2 (Lender + handler.Draw fix) are the remaining Phase-3 sub-tasks before Polish-Sweep + Smoke-Gate.
This commit is contained in:
@@ -1,20 +1,37 @@
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility;
|
||||
using HellionChat.Ui.Components;
|
||||
using HellionChat.Util;
|
||||
using Lumina.Text.ReadOnly;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace HellionChat.Ui;
|
||||
|
||||
// Slash-command help popup is offline while the chat input pipeline is
|
||||
// rebuilt. UpdateContent stays callable so the input layer can keep its
|
||||
// integration shape, but it always leaves the window closed for now.
|
||||
public class CommandHelpWindow : Window
|
||||
internal sealed class CommandHelpWindow : Window
|
||||
{
|
||||
private readonly Plugin _plugin;
|
||||
private readonly ChunkRenderer _chunkRenderer;
|
||||
private readonly Windows.MainWindow _mainWindow;
|
||||
private readonly Components.InputBar _inputBar;
|
||||
private readonly ILogger<CommandHelpWindow> _logger;
|
||||
|
||||
internal CommandHelpWindow(Plugin plugin)
|
||||
private ReadOnlySeString? _commandDescription;
|
||||
|
||||
public CommandHelpWindow(
|
||||
ChunkRenderer chunkRenderer,
|
||||
Windows.MainWindow mainWindow,
|
||||
Components.InputBar inputBar,
|
||||
ILogger<CommandHelpWindow> logger
|
||||
)
|
||||
: base("command help##chat2-commandhelp")
|
||||
{
|
||||
_plugin = plugin;
|
||||
_chunkRenderer = chunkRenderer;
|
||||
_mainWindow = mainWindow;
|
||||
_inputBar = inputBar;
|
||||
_logger = logger;
|
||||
|
||||
Flags =
|
||||
ImGuiWindowFlags.NoSavedSettings
|
||||
| ImGuiWindowFlags.NoTitleBar
|
||||
@@ -22,14 +39,59 @@ public class CommandHelpWindow : Window
|
||||
| ImGuiWindowFlags.NoResize
|
||||
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||
| ImGuiWindowFlags.AlwaysAutoResize;
|
||||
|
||||
RespectCloseHotkey = false;
|
||||
DisableWindowSounds = true;
|
||||
|
||||
// Logger injected for future diagnostic hooks (no call-sites yet in R2).
|
||||
_ = _logger;
|
||||
// InputBar injected for future integration (no call-sites yet in R2).
|
||||
_ = _inputBar;
|
||||
}
|
||||
|
||||
public void UpdateContent(ReadOnlySeString commandDesc)
|
||||
{
|
||||
IsOpen = false;
|
||||
_commandDescription = commandDesc;
|
||||
|
||||
var width = 350;
|
||||
var scaledWidth = width * ImGuiHelpers.GlobalScale;
|
||||
var pos = _mainWindow.LastWindowPos;
|
||||
switch (Plugin.Config.CommandHelpSide)
|
||||
{
|
||||
case CommandHelpSide.Right:
|
||||
pos.X += _mainWindow.LastWindowSize.X;
|
||||
break;
|
||||
case CommandHelpSide.Left:
|
||||
pos.X -= scaledWidth;
|
||||
break;
|
||||
case CommandHelpSide.None:
|
||||
default:
|
||||
IsOpen = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Position = pos;
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
// scaledWidth keeps size constraints in the same coordinate space as
|
||||
// Position so the help window stays correct width at non-100% DPI.
|
||||
MinimumSize = new Vector2(scaledWidth, 0),
|
||||
MaximumSize = _mainWindow.LastWindowSize with { X = scaledWidth },
|
||||
};
|
||||
|
||||
IsOpen = true;
|
||||
}
|
||||
|
||||
public override void Draw() { }
|
||||
public override void Draw()
|
||||
{
|
||||
if (_commandDescription == null)
|
||||
return;
|
||||
|
||||
var chunks = ChunkUtil
|
||||
.ToChunks(_commandDescription.Value.ToDalamudString(), ChunkSource.None, null)
|
||||
.ToList();
|
||||
|
||||
// Command-help chunks are read-only description text — no click-targets.
|
||||
_chunkRenderer.DrawChunks(chunks, wrap: true, handler: null, lineWidth: 0f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user