- API 13
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
internal class AutoCompleteInfo {
|
||||
internal class AutoCompleteInfo
|
||||
{
|
||||
internal string ToComplete;
|
||||
internal int StartPos { get; }
|
||||
internal int EndPos { get; }
|
||||
|
||||
internal AutoCompleteInfo(string toComplete, int startPos, int endPos) {
|
||||
internal AutoCompleteInfo(string toComplete, int startPos, int endPos)
|
||||
{
|
||||
ToComplete = toComplete;
|
||||
StartPos = startPos;
|
||||
EndPos = endPos;
|
||||
|
||||
+33
-35
@@ -18,7 +18,7 @@ using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Memory;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
@@ -443,10 +443,10 @@ public sealed class ChatLogWindow : Window
|
||||
if (!Plugin.Config.ShowTitleBar)
|
||||
Flags |= ImGuiWindowFlags.NoTitleBar;
|
||||
|
||||
if (LastViewport == ImGuiHelpers.MainViewport.NativePtr && !WasDocked)
|
||||
if (LastViewport == ImGuiHelpers.MainViewport.Handle && !WasDocked)
|
||||
BgAlpha = Plugin.Config.WindowAlpha / 100f;
|
||||
|
||||
LastViewport = ImGui.GetWindowViewport().NativePtr;
|
||||
LastViewport = ImGui.GetWindowViewport().Handle;
|
||||
WasDocked = ImGui.IsWindowDocked();
|
||||
}
|
||||
|
||||
@@ -530,7 +530,7 @@ public sealed class ChatLogWindow : Window
|
||||
if (resized)
|
||||
LastResize.Restart();
|
||||
|
||||
LastViewport = ImGui.GetWindowViewport().NativePtr;
|
||||
LastViewport = ImGui.GetWindowViewport().Handle;
|
||||
WasDocked = ImGui.IsWindowDocked();
|
||||
|
||||
if (IsChatMode && Plugin.InputPreview.IsDrawable)
|
||||
@@ -1430,7 +1430,7 @@ public sealed class ChatLogWindow : Window
|
||||
for (var i = 0; i < 10 && i < AutoCompleteList.Count; i++)
|
||||
{
|
||||
var num = (i + 1) % 10;
|
||||
var key = ImGuiKey._0 + num;
|
||||
var key = ImGuiKey.Key0 + num;
|
||||
var key2 = ImGuiKey.Keypad0 + num;
|
||||
if (ImGui.IsKeyDown(key) || ImGui.IsKeyDown(key2))
|
||||
selected = i;
|
||||
@@ -1460,7 +1460,7 @@ public sealed class ChatLogWindow : Window
|
||||
if (!child.Success)
|
||||
return;
|
||||
|
||||
var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper_ImGuiListClipper());
|
||||
var clipper = new ImGuiListClipperPtr(ImGuiNative.ImGuiListClipper());
|
||||
|
||||
clipper.Begin(AutoCompleteList.Count);
|
||||
while (clipper.Step())
|
||||
@@ -1503,19 +1503,19 @@ public sealed class ChatLogWindow : Window
|
||||
ImGui.SetScrollFromPosY(selectedPos - ImGui.GetWindowPos().Y);
|
||||
}
|
||||
|
||||
private unsafe int AutoCompleteCallback(ImGuiInputTextCallbackData* data)
|
||||
private int AutoCompleteCallback(scoped ref ImGuiInputTextCallbackData data)
|
||||
{
|
||||
if (FixCursor && AutoCompleteInfo != null)
|
||||
{
|
||||
FixCursor = false;
|
||||
data->CursorPos = AutoCompleteInfo.ToComplete.Length;
|
||||
data->SelectionStart = data->SelectionEnd = data->CursorPos;
|
||||
data.CursorPos = AutoCompleteInfo.ToComplete.Length;
|
||||
data.SelectionStart = data.SelectionEnd = data.CursorPos;
|
||||
}
|
||||
|
||||
if (AutoCompleteList == null)
|
||||
return 0;
|
||||
|
||||
switch (data->EventKey)
|
||||
switch (data.EventKey)
|
||||
{
|
||||
case ImGuiKey.UpArrow:
|
||||
if (AutoCompleteSelection == 0)
|
||||
@@ -1550,7 +1550,7 @@ public sealed class ChatLogWindow : Window
|
||||
return 0;
|
||||
}
|
||||
|
||||
private unsafe int Callback(ImGuiInputTextCallbackData* data)
|
||||
private unsafe int Callback(scoped ref ImGuiInputTextCallbackData data)
|
||||
{
|
||||
// We play the opening sound here only if closing sound has been played before
|
||||
if (Plugin.Config.PlaySounds && PlayedClosingSound)
|
||||
@@ -1559,22 +1559,20 @@ public sealed class ChatLogWindow : Window
|
||||
UIGlobals.PlaySoundEffect(ChatOpenSfx);
|
||||
}
|
||||
|
||||
var ptr = new ImGuiInputTextCallbackDataPtr(data);
|
||||
|
||||
// Set the cursor pos to the user selected
|
||||
if (Plugin.InputPreview.SelectedCursorPos != -1)
|
||||
ptr.CursorPos = Plugin.InputPreview.SelectedCursorPos;
|
||||
data.CursorPos = Plugin.InputPreview.SelectedCursorPos;
|
||||
Plugin.InputPreview.SelectedCursorPos = -1;
|
||||
|
||||
CursorPos = ptr.CursorPos;
|
||||
if (data->EventFlag == ImGuiInputTextFlags.CallbackCompletion)
|
||||
CursorPos = data.CursorPos;
|
||||
if (data.EventFlag == ImGuiInputTextFlags.CallbackCompletion)
|
||||
{
|
||||
if (ptr.CursorPos == 0)
|
||||
if (data.CursorPos == 0)
|
||||
{
|
||||
AutoCompleteInfo = new AutoCompleteInfo(
|
||||
string.Empty,
|
||||
ptr.CursorPos,
|
||||
ptr.CursorPos
|
||||
data.CursorPos,
|
||||
data.CursorPos
|
||||
);
|
||||
AutoCompleteOpen = true;
|
||||
AutoCompleteSelection = 0;
|
||||
@@ -1583,14 +1581,14 @@ public sealed class ChatLogWindow : Window
|
||||
}
|
||||
|
||||
int white;
|
||||
for (white = ptr.CursorPos - 1; white >= 0; white--)
|
||||
if (data->Buf[white] == ' ')
|
||||
for (white = data.CursorPos - 1; white >= 0; white--)
|
||||
if (data.Buf[white] == ' ')
|
||||
break;
|
||||
|
||||
var start = ptr.Buf + white + 1;
|
||||
var end = ptr.CursorPos - white - 1;
|
||||
var utf8Message = Marshal.PtrToStringUTF8(start, end);
|
||||
var correctedCursor = ptr.CursorPos - (end - utf8Message.Length);
|
||||
var start = data.Buf + white + 1;
|
||||
var end = data.CursorPos - white - 1;
|
||||
var utf8Message = Marshal.PtrToStringUTF8((nint)start, end);
|
||||
var correctedCursor = data.CursorPos - (end - utf8Message.Length);
|
||||
AutoCompleteInfo = new AutoCompleteInfo(
|
||||
utf8Message,
|
||||
white + 1,
|
||||
@@ -1601,20 +1599,20 @@ public sealed class ChatLogWindow : Window
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data->EventFlag == ImGuiInputTextFlags.CallbackCharFilter)
|
||||
if (!Plugin.Functions.Chat.IsCharValid((char) ptr.EventChar))
|
||||
if (data.EventFlag == ImGuiInputTextFlags.CallbackCharFilter)
|
||||
if (!Plugin.Functions.Chat.IsCharValid((char) data.EventChar))
|
||||
return 1;
|
||||
|
||||
if (Activate)
|
||||
{
|
||||
Activate = false;
|
||||
data->CursorPos = ActivatePos > -1 ? ActivatePos : Chat.Length;
|
||||
data->SelectionStart = data->SelectionEnd = data->CursorPos;
|
||||
data.CursorPos = ActivatePos > -1 ? ActivatePos : Chat.Length;
|
||||
data.SelectionStart = data.SelectionEnd = data.CursorPos;
|
||||
ActivatePos = -1;
|
||||
}
|
||||
|
||||
Plugin.CommandHelpWindow.IsOpen = false;
|
||||
var text = MemoryHelper.ReadString((nint) data->Buf, data->BufTextLen);
|
||||
var text = MemoryHelper.ReadString((nint) data.Buf, data.BufTextLen);
|
||||
if (text.StartsWith('/'))
|
||||
{
|
||||
var command = text.Split(' ')[0];
|
||||
@@ -1626,11 +1624,11 @@ public sealed class ChatLogWindow : Window
|
||||
Plugin.CommandHelpWindow.UpdateContent(cmd.Value);
|
||||
}
|
||||
|
||||
if (data->EventFlag != ImGuiInputTextFlags.CallbackHistory)
|
||||
if (data.EventFlag != ImGuiInputTextFlags.CallbackHistory)
|
||||
return 0;
|
||||
|
||||
var prevPos = InputBacklogIdx;
|
||||
switch (data->EventKey)
|
||||
switch (data.EventKey)
|
||||
{
|
||||
case ImGuiKey.UpArrow:
|
||||
switch (InputBacklogIdx)
|
||||
@@ -1662,8 +1660,8 @@ public sealed class ChatLogWindow : Window
|
||||
return 0;
|
||||
|
||||
var historyStr = InputBacklogIdx >= 0 ? InputBacklog[InputBacklogIdx] : string.Empty;
|
||||
ptr.DeleteChars(0, ptr.BufTextLen);
|
||||
ptr.InsertChars(0, historyStr);
|
||||
data.DeleteChars(0, data.BufTextLen);
|
||||
data.InsertChars(0, historyStr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1793,7 +1791,7 @@ public sealed class ChatLogWindow : Window
|
||||
var uv0 = new Vector2(entry.Left, entry.Top + 170) * 2 / texSize;
|
||||
var uv1 = new Vector2(entry.Left + entry.Width, entry.Top + entry.Height + 170) * 2 / texSize;
|
||||
|
||||
ImGui.Image(iconTexture.ImGuiHandle, size, uv0, uv1);
|
||||
ImGui.Image(iconTexture.Handle, size, uv0, uv1);
|
||||
ImGuiUtil.PostPayload(chunk, handler);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using ChatTwo.Util;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Lumina.Excel.Sheets;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
@@ -9,7 +9,7 @@ using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
@@ -10,7 +10,7 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin.Services;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Dalamud.Interface.Style;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Utility;
|
||||
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
@@ -146,7 +146,7 @@ public class SeStringDebugger : Window
|
||||
{ "RawItemId", item.RawItemId.ToString() },
|
||||
{ "Kind", EnumName(item.Kind) },
|
||||
{ "IsHQ", item.IsHQ.ToString() },
|
||||
{ "Item.Name", item.Kind == ItemPayload.ItemKind.EventItem ? Sheets.EventItemSheet.GetRow(item.ItemId).Name.ExtractText() : Sheets.ItemSheet.GetRow(item.ItemId).Name.ExtractText() },
|
||||
{ "Item.Name", item.Kind == ItemKind.EventItem ? Sheets.EventItemSheet.GetRow(item.ItemId).Name.ExtractText() : Sheets.ItemSheet.GetRow(item.ItemId).Name.ExtractText() },
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using ChatTwo.Util;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using ChatTwo.Code;
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Interface;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Interface.Style;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using ChatTwo.Code;
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using ChatTwo.Util;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud;
|
||||
using Dalamud.Interface.FontIdentifier;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using ChatTwo.Resources;
|
||||
using ChatTwo.Util;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.ImGuiNotification;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
|
||||
namespace ChatTwo.Ui.SettingsTabs;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user