Add debugger window
This commit is contained in:
@@ -49,6 +49,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
public ChatLogWindow ChatLogWindow { get; }
|
public ChatLogWindow ChatLogWindow { get; }
|
||||||
public CommandHelpWindow CommandHelpWindow { get; }
|
public CommandHelpWindow CommandHelpWindow { get; }
|
||||||
public SeStringDebugger SeStringDebugger { get; }
|
public SeStringDebugger SeStringDebugger { get; }
|
||||||
|
public DebuggerWindow DebuggerWindow { get; }
|
||||||
internal LegacyMessageImporterWindow LegacyMessageImporterWindow { get; }
|
internal LegacyMessageImporterWindow LegacyMessageImporterWindow { get; }
|
||||||
|
|
||||||
internal Configuration Config { get; }
|
internal Configuration Config { get; }
|
||||||
@@ -94,11 +95,13 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
SettingsWindow = new SettingsWindow(this);
|
SettingsWindow = new SettingsWindow(this);
|
||||||
CommandHelpWindow = new CommandHelpWindow(ChatLogWindow);
|
CommandHelpWindow = new CommandHelpWindow(ChatLogWindow);
|
||||||
SeStringDebugger = new SeStringDebugger(this);
|
SeStringDebugger = new SeStringDebugger(this);
|
||||||
|
DebuggerWindow = new DebuggerWindow(this);
|
||||||
|
|
||||||
WindowSystem.AddWindow(ChatLogWindow);
|
WindowSystem.AddWindow(ChatLogWindow);
|
||||||
WindowSystem.AddWindow(SettingsWindow);
|
WindowSystem.AddWindow(SettingsWindow);
|
||||||
WindowSystem.AddWindow(CommandHelpWindow);
|
WindowSystem.AddWindow(CommandHelpWindow);
|
||||||
WindowSystem.AddWindow(SeStringDebugger);
|
WindowSystem.AddWindow(SeStringDebugger);
|
||||||
|
WindowSystem.AddWindow(DebuggerWindow);
|
||||||
FontManager.BuildFonts();
|
FontManager.BuildFonts();
|
||||||
|
|
||||||
Interface.UiBuilder.DisableCutsceneUiHide = true;
|
Interface.UiBuilder.DisableCutsceneUiHide = true;
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ public sealed class ChatLogWindow : Window
|
|||||||
private int AutoCompleteSelection;
|
private int AutoCompleteSelection;
|
||||||
private bool AutoCompleteShouldScroll;
|
private bool AutoCompleteShouldScroll;
|
||||||
|
|
||||||
|
public int CursorPos;
|
||||||
|
|
||||||
public Vector2 LastWindowPos { get; private set; } = Vector2.Zero;
|
public Vector2 LastWindowPos { get; private set; } = Vector2.Zero;
|
||||||
public Vector2 LastWindowSize { get; private set; } = Vector2.Zero;
|
public Vector2 LastWindowSize { get; private set; } = Vector2.Zero;
|
||||||
|
|
||||||
@@ -1341,6 +1343,8 @@ public sealed class ChatLogWindow : Window
|
|||||||
}
|
}
|
||||||
|
|
||||||
var ptr = new ImGuiInputTextCallbackDataPtr(data);
|
var ptr = new ImGuiInputTextCallbackDataPtr(data);
|
||||||
|
|
||||||
|
CursorPos = ptr.CursorPos;
|
||||||
if (data->EventFlag == ImGuiInputTextFlags.CallbackCompletion)
|
if (data->EventFlag == ImGuiInputTextFlags.CallbackCompletion)
|
||||||
{
|
{
|
||||||
if (ptr.CursorPos == 0)
|
if (ptr.CursorPos == 0)
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
using Dalamud.Interface.Windowing;
|
||||||
|
using ImGuiNET;
|
||||||
|
|
||||||
|
namespace ChatTwo.Ui;
|
||||||
|
|
||||||
|
public class DebuggerWindow : Window
|
||||||
|
{
|
||||||
|
private readonly Plugin Plugin;
|
||||||
|
private readonly ChatLogWindow ChatLogWindow;
|
||||||
|
|
||||||
|
public DebuggerWindow(Plugin plugin) : base($"Debugger###chat2-debugger")
|
||||||
|
{
|
||||||
|
Plugin = plugin;
|
||||||
|
ChatLogWindow = plugin.ChatLogWindow;
|
||||||
|
|
||||||
|
SizeConstraints = new WindowSizeConstraints
|
||||||
|
{
|
||||||
|
MinimumSize = new Vector2(475, 600),
|
||||||
|
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
||||||
|
};
|
||||||
|
|
||||||
|
RespectCloseHotkey = false;
|
||||||
|
DisableWindowSounds = true;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
Plugin.Commands.Register("/chat2Debugger").Execute += Toggle;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
Plugin.Commands.Register("/chat2Debugger").Execute -= Toggle;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Toggle(string _, string __) => Toggle();
|
||||||
|
|
||||||
|
public override void Draw()
|
||||||
|
{
|
||||||
|
ImGui.TextUnformatted($"Current Cursor Pos: {ChatLogWindow.CursorPos}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,14 +27,14 @@ public class SeStringDebugger : Window
|
|||||||
DisableWindowSounds = true;
|
DisableWindowSounds = true;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Plugin.Commands.Register("/chat2Debugger").Execute += Toggle;
|
Plugin.Commands.Register("/chat2SeString").Execute += Toggle;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Plugin.Commands.Register("/chat2Debugger").Execute -= Toggle;
|
Plugin.Commands.Register("/chat2SeString").Execute -= Toggle;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user