- Handle NBSP payloads
- Use ingame version of axis font
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.29.8</Version>
|
<Version>1.29.9</Version>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ public class FontManager
|
|||||||
|
|
||||||
private ushort[] Ranges;
|
private ushort[] Ranges;
|
||||||
private ushort[] JpRange;
|
private ushort[] JpRange;
|
||||||
private readonly ushort[] SymRange = [0xE020, 0xE0DB, 0];
|
|
||||||
|
|
||||||
|
|
||||||
public static readonly HashSet<float> AxisFontSizeList =
|
public static readonly HashSet<float> AxisFontSizeList =
|
||||||
@@ -123,8 +122,7 @@ public class FontManager
|
|||||||
Plugin.Config.JapaneseFontV2.FontId.AddToBuildToolkit(tk, config);
|
Plugin.Config.JapaneseFontV2.FontId.AddToBuildToolkit(tk, config);
|
||||||
|
|
||||||
config.SizePt = Plugin.Config.SymbolsFontSizeV2;
|
config.SizePt = Plugin.Config.SymbolsFontSizeV2;
|
||||||
config.GlyphRanges = SymRange;
|
tk.AddGameSymbol(config);
|
||||||
tk.AddFontFromMemory(GameSymFont, config, "ChatTwo2 Sym Font");
|
|
||||||
|
|
||||||
tk.Font = config.MergeFont;
|
tk.Font = config.MergeFont;
|
||||||
}
|
}
|
||||||
@@ -144,8 +142,7 @@ public class FontManager
|
|||||||
Plugin.Config.JapaneseFontV2.FontId.AddToBuildToolkit(tk, config);
|
Plugin.Config.JapaneseFontV2.FontId.AddToBuildToolkit(tk, config);
|
||||||
|
|
||||||
config.SizePt = Plugin.Config.SymbolsFontSizeV2;
|
config.SizePt = Plugin.Config.SymbolsFontSizeV2;
|
||||||
config.GlyphRanges = SymRange;
|
tk.AddGameSymbol(config);
|
||||||
tk.AddFontFromMemory(GameSymFont, config, "ChatTwo2 Sym Font");
|
|
||||||
|
|
||||||
tk.Font = config.MergeFont;
|
tk.Font = config.MergeFont;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,20 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Dalamud.Utility.Signatures;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.System.String;
|
using FFXIVClientStructs.FFXIV.Client.System.String;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI;
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
|
|
||||||
namespace ChatTwo.GameFunctions;
|
namespace ChatTwo.GameFunctions;
|
||||||
|
|
||||||
// From: https://git.anna.lgbt/anna/XivCommon/src/branch/main/XivCommon/Functions/Chat.cs
|
// From: https://git.anna.lgbt/anna/XivCommon/src/branch/main/XivCommon/Functions/Chat.cs
|
||||||
public unsafe class ChatCommon
|
public unsafe class ChatBox
|
||||||
{
|
{
|
||||||
[Signature("48 89 5C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 48 8B F2 48 8B F9 45 84 C9")]
|
public static void SendMessageUnsafe(byte[] message)
|
||||||
private readonly delegate* unmanaged<UIModule*, Utf8String*, nint, byte, void> ProcessChatBox = null!;
|
|
||||||
|
|
||||||
internal ChatCommon()
|
|
||||||
{
|
{
|
||||||
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SendMessageUnsafe(byte[] message)
|
|
||||||
{
|
|
||||||
if (ProcessChatBox == null)
|
|
||||||
throw new InvalidOperationException("Could not find signature for chat sending");
|
|
||||||
|
|
||||||
var mes = Utf8String.FromSequence(message);
|
var mes = Utf8String.FromSequence(message);
|
||||||
ProcessChatBox(UIModule.Instance(), mes, IntPtr.Zero, 0);
|
UIModule.Instance()->ProcessChatBoxEntry(mes);
|
||||||
mes->Dtor(true);
|
mes->Dtor(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(string message)
|
public static void SendMessage(string message)
|
||||||
{
|
{
|
||||||
var bytes = Encoding.UTF8.GetBytes(message);
|
var bytes = Encoding.UTF8.GetBytes(message);
|
||||||
if (bytes.Length == 0)
|
if (bytes.Length == 0)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using FFXIVClientStructs.FFXIV.Client.UI.Info;
|
|||||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||||
using Lumina.Excel;
|
using Lumina.Excel;
|
||||||
using Lumina.Excel.Sheets;
|
using Lumina.Excel.Sheets;
|
||||||
|
|
||||||
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
using ValueType = FFXIVClientStructs.FFXIV.Component.GUI.ValueType;
|
||||||
|
|
||||||
namespace ChatTwo.GameFunctions;
|
namespace ChatTwo.GameFunctions;
|
||||||
@@ -66,10 +67,10 @@ internal unsafe class GameFunctions : IDisposable
|
|||||||
|
|
||||||
var worldName = row.Name.ExtractText();
|
var worldName = row.Name.ExtractText();
|
||||||
ReplacementName = $"{name}@{worldName}";
|
ReplacementName = $"{name}@{worldName}";
|
||||||
Plugin.Common.SendMessage($"/{commandName} add {Placeholder}");
|
ChatBox.SendMessage($"/{commandName} add {Placeholder}");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static T* GetAddon<T>(string name) where T : unmanaged
|
private static T* GetAddon<T>(string name) where T : unmanaged
|
||||||
{
|
{
|
||||||
var addon = RaptureAtkModule.Instance()->RaptureAtkUnitManager.GetAddonByName(name);
|
var addon = RaptureAtkModule.Instance()->RaptureAtkUnitManager.GetAddonByName(name);
|
||||||
return addon != null && addon->IsReady ? (T*)addon : null;
|
return addon != null && addon->IsReady ? (T*)addon : null;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using ChatTwo.GameFunctions;
|
|
||||||
using ChatTwo.Http;
|
using ChatTwo.Http;
|
||||||
using ChatTwo.Ipc;
|
using ChatTwo.Ipc;
|
||||||
using ChatTwo.Resources;
|
using ChatTwo.Resources;
|
||||||
@@ -53,7 +52,6 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
public DebuggerWindow DebuggerWindow { get; }
|
public DebuggerWindow DebuggerWindow { get; }
|
||||||
|
|
||||||
internal Commands Commands { get; }
|
internal Commands Commands { get; }
|
||||||
internal ChatCommon Common { get; }
|
|
||||||
internal GameFunctions.GameFunctions Functions { get; }
|
internal GameFunctions.GameFunctions Functions { get; }
|
||||||
internal MessageManager MessageManager { get; }
|
internal MessageManager MessageManager { get; }
|
||||||
internal IpcManager Ipc { get; }
|
internal IpcManager Ipc { get; }
|
||||||
@@ -97,7 +95,6 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
ServerCore = new ServerCore(this);
|
ServerCore = new ServerCore(this);
|
||||||
|
|
||||||
Commands = new Commands(this);
|
Commands = new Commands(this);
|
||||||
Common = new ChatCommon();
|
|
||||||
Functions = new GameFunctions.GameFunctions(this);
|
Functions = new GameFunctions.GameFunctions(this);
|
||||||
Ipc = new IpcManager();
|
Ipc = new IpcManager();
|
||||||
ExtraChat = new ExtraChat(this);
|
ExtraChat = new ExtraChat(this);
|
||||||
|
|||||||
@@ -877,7 +877,7 @@ public sealed class ChatLogWindow : Window
|
|||||||
// registers stub handlers and actually processes its commands in a
|
// registers stub handlers and actually processes its commands in a
|
||||||
// SendMessage detour.
|
// SendMessage detour.
|
||||||
var bytes = Encoding.UTF8.GetBytes(channel.Value.Prefix());
|
var bytes = Encoding.UTF8.GetBytes(channel.Value.Prefix());
|
||||||
Plugin.Common.SendMessageUnsafe(bytes);
|
ChatBox.SendMessageUnsafe(bytes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,7 +921,7 @@ public sealed class ChatLogWindow : Window
|
|||||||
var tellBytes = Encoding.UTF8.GetBytes(trimmed);
|
var tellBytes = Encoding.UTF8.GetBytes(trimmed);
|
||||||
AutoTranslate.ReplaceWithPayload(ref tellBytes);
|
AutoTranslate.ReplaceWithPayload(ref tellBytes);
|
||||||
|
|
||||||
Plugin.Common.SendMessageUnsafe(tellBytes);
|
ChatBox.SendMessageUnsafe(tellBytes);
|
||||||
|
|
||||||
Chat = string.Empty;
|
Chat = string.Empty;
|
||||||
return;
|
return;
|
||||||
@@ -949,14 +949,14 @@ public sealed class ChatLogWindow : Window
|
|||||||
|
|
||||||
if (activeTab.CurrentChannel.UseTempChannel)
|
if (activeTab.CurrentChannel.UseTempChannel)
|
||||||
trimmed = $"{activeTab.CurrentChannel.TempChannel.Prefix()} {trimmed}";
|
trimmed = $"{activeTab.CurrentChannel.TempChannel.Prefix()} {trimmed}";
|
||||||
else // (activeTab is { Channel: { } channel }) TODO Check this channel selection
|
else
|
||||||
trimmed = $"{activeTab.CurrentChannel.Channel.Prefix()} {trimmed}";
|
trimmed = $"{activeTab.CurrentChannel.Channel.Prefix()} {trimmed}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(trimmed);
|
var bytes = Encoding.UTF8.GetBytes(trimmed);
|
||||||
AutoTranslate.ReplaceWithPayload(ref bytes);
|
AutoTranslate.ReplaceWithPayload(ref bytes);
|
||||||
|
|
||||||
Plugin.Common.SendMessageUnsafe(bytes);
|
ChatBox.SendMessageUnsafe(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
Chat = string.Empty;
|
Chat = string.Empty;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using System.Numerics;
|
using System.Globalization;
|
||||||
|
using System.Numerics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ChatTwo.Util;
|
using ChatTwo.Util;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using Lumina.Excel;
|
|
||||||
using Lumina.Excel.Sheets;
|
|
||||||
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
|
using DalamudPartyFinderPayload = Dalamud.Game.Text.SeStringHandling.Payloads.PartyFinderPayload;
|
||||||
|
|
||||||
namespace ChatTwo.Ui;
|
namespace ChatTwo.Ui;
|
||||||
@@ -15,7 +16,7 @@ public class SeStringDebugger : Window
|
|||||||
{
|
{
|
||||||
private readonly Plugin Plugin;
|
private readonly Plugin Plugin;
|
||||||
|
|
||||||
public SeStringDebugger(Plugin plugin) : base($"SeString Debugger###chat2-sestringdebugger")
|
public SeStringDebugger(Plugin plugin) : base("SeString Debugger###chat2-sestringdebugger")
|
||||||
{
|
{
|
||||||
Plugin = plugin;
|
Plugin = plugin;
|
||||||
|
|
||||||
@@ -92,8 +93,8 @@ public class SeStringDebugger : Window
|
|||||||
{ "TerritoryType.RowId", map.TerritoryType.RowId.ToString() },
|
{ "TerritoryType.RowId", map.TerritoryType.RowId.ToString() },
|
||||||
{ "RawX", map.RawX.ToString() },
|
{ "RawX", map.RawX.ToString() },
|
||||||
{ "RawY", map.RawY.ToString() },
|
{ "RawY", map.RawY.ToString() },
|
||||||
{ "XCoord", map.XCoord.ToString() },
|
{ "XCoord", map.XCoord.ToString(CultureInfo.InvariantCulture) },
|
||||||
{ "YCoord", map.YCoord.ToString() },
|
{ "YCoord", map.YCoord.ToString(CultureInfo.InvariantCulture) },
|
||||||
{ "CoordinateString", map.CoordinateString },
|
{ "CoordinateString", map.CoordinateString },
|
||||||
{ "DataString", map.DataString },
|
{ "DataString", map.DataString },
|
||||||
});
|
});
|
||||||
@@ -160,7 +161,7 @@ public class SeStringDebugger : Window
|
|||||||
}
|
}
|
||||||
case IconPayload icon:
|
case IconPayload icon:
|
||||||
{
|
{
|
||||||
var found = IconUtil.GfdFileView.TryGetEntry((uint) icon.Icon, out var entry);
|
var found = IconUtil.GfdFileView.TryGetEntry((uint) icon.Icon, out _);
|
||||||
RenderMetadataDictionary("Link IconPayload", new Dictionary<string, string?>
|
RenderMetadataDictionary("Link IconPayload", new Dictionary<string, string?>
|
||||||
{
|
{
|
||||||
{ "Found", found.ToString() },
|
{ "Found", found.ToString() },
|
||||||
@@ -173,15 +174,12 @@ public class SeStringDebugger : Window
|
|||||||
var colorPayload = ColorPayload.From(raw.Data);
|
var colorPayload = ColorPayload.From(raw.Data);
|
||||||
if (colorPayload != null)
|
if (colorPayload != null)
|
||||||
{
|
{
|
||||||
var push = colorPayload.Enabled && colorPayload.Color != 0;
|
|
||||||
// if (push) ImGui.PushStyleColor(ImGuiCol.Text, ColourUtil.RgbaToAbgr(colorPayload.U));
|
|
||||||
RenderMetadataDictionary("Link ColorPayload", new Dictionary<string, string?>
|
RenderMetadataDictionary("Link ColorPayload", new Dictionary<string, string?>
|
||||||
{
|
{
|
||||||
{ "Unshifted", colorPayload.UnshiftedColor.ToString("X8") },
|
{ "Unshifted", colorPayload.UnshiftedColor.ToString("X8") },
|
||||||
{ "Color", colorPayload.Color.ToString("X8") },
|
{ "Color", colorPayload.Color.ToString("X8") },
|
||||||
{ "Enabled?", colorPayload.Enabled.ToString() },
|
{ "Enabled?", colorPayload.Enabled.ToString() },
|
||||||
});
|
});
|
||||||
// if (push) ImGui.PopStyleColor();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -289,10 +287,8 @@ public class SeStringDebugger : Window
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(original))
|
if (string.IsNullOrEmpty(original))
|
||||||
{
|
{
|
||||||
var str = original == null ? "(null)" : "(empty)";
|
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, new Vector4(1, 1, 1, 0.5f));
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1, 1, 1, 0.5f));
|
ImGui.TextUnformatted(original == null ? "(null)" : "(empty)");
|
||||||
ImGui.TextUnformatted(str);
|
|
||||||
ImGui.PopStyleColor();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,46 +296,35 @@ public class SeStringDebugger : Window
|
|||||||
var start = 0;
|
var start = 0;
|
||||||
var end = text.Length;
|
var end = text.Length;
|
||||||
|
|
||||||
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
|
using var pushedStyle = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
|
||||||
|
|
||||||
void WriteText(string text)
|
void WriteText(string wText)
|
||||||
{
|
{
|
||||||
if (wrap)
|
if (wrap)
|
||||||
{
|
ImGui.TextWrapped(wText);
|
||||||
ImGui.TextWrapped(text);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
ImGui.TextUnformatted(wText);
|
||||||
ImGui.TextUnformatted(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (start < end && char.IsWhiteSpace(text[start]))
|
while (start < end && char.IsWhiteSpace(text[start]))
|
||||||
{
|
|
||||||
start++;
|
start++;
|
||||||
}
|
|
||||||
if (start > 0)
|
if (start > 0)
|
||||||
{
|
{
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1, 1, 1, 0.5f));
|
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, new Vector4(1, 1, 1, 0.5f));
|
||||||
WriteText(new string('_', start));
|
WriteText(new string('_', start));
|
||||||
ImGui.PopStyleColor();
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (end > start && char.IsWhiteSpace(text[end - 1]))
|
while (end > start && char.IsWhiteSpace(text[end - 1]))
|
||||||
{
|
|
||||||
end--;
|
end--;
|
||||||
}
|
|
||||||
|
|
||||||
WriteText(text[start..end]);
|
WriteText(text[start..end]);
|
||||||
if (end < text.Length)
|
if (end < text.Length)
|
||||||
{
|
{
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(1, 1, 1, 0.5f));
|
using var pushedColor = ImRaii.PushColor(ImGuiCol.Text, new Vector4(1, 1, 1, 0.5f));
|
||||||
WriteText(new string('_', text.Length - end));
|
WriteText(new string('_', text.Length - end));
|
||||||
ImGui.PopStyleColor();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ImGui.PopStyleVar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,21 +31,21 @@ public sealed class SettingsWindow : Window
|
|||||||
Plugin = plugin;
|
Plugin = plugin;
|
||||||
Mutable = new Configuration();
|
Mutable = new Configuration();
|
||||||
|
|
||||||
Tabs = new List<ISettingsTab>
|
Tabs =
|
||||||
{
|
[
|
||||||
new Display(Mutable),
|
new Display(Mutable),
|
||||||
new ChatLog(Plugin, Mutable),
|
new ChatLog(Plugin, Mutable),
|
||||||
new Emote(Plugin, Mutable),
|
new Emote(Plugin, Mutable),
|
||||||
new Preview(Plugin, Mutable),
|
new Preview(Mutable),
|
||||||
new Fonts(Mutable),
|
new Fonts(Mutable),
|
||||||
new ChatColours(Plugin, Mutable),
|
new ChatColours(Plugin, Mutable),
|
||||||
new Tabs(Plugin, Mutable),
|
new Tabs(Mutable),
|
||||||
new Database(Plugin, Mutable),
|
new Database(Plugin, Mutable),
|
||||||
new Webinterface(Plugin, Mutable),
|
new Webinterface(Plugin, Mutable),
|
||||||
new Miscellaneous(Mutable),
|
new Miscellaneous(Mutable),
|
||||||
new Changelog(Mutable),
|
new Changelog(Mutable),
|
||||||
new About(),
|
new About()
|
||||||
};
|
];
|
||||||
|
|
||||||
RespectCloseHotkey = false;
|
RespectCloseHotkey = false;
|
||||||
DisableWindowSounds = true;
|
DisableWindowSounds = true;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ internal sealed class About : ISettingsTab
|
|||||||
{
|
{
|
||||||
public string Name => string.Format(Language.Options_About_Tab, Plugin.PluginName) + "###tabs-about";
|
public string Name => string.Format(Language.Options_About_Tab, Plugin.PluginName) + "###tabs-about";
|
||||||
|
|
||||||
private readonly List<string> _translators =
|
private readonly List<string> Translators =
|
||||||
[
|
[
|
||||||
"q673135110", "Akizem", "d0tiKs",
|
"q673135110", "Akizem", "d0tiKs",
|
||||||
"Moonlight_Everlit", "Dark32", "andreycout",
|
"Moonlight_Everlit", "Dark32", "andreycout",
|
||||||
@@ -28,7 +28,7 @@ internal sealed class About : ISettingsTab
|
|||||||
|
|
||||||
internal About()
|
internal About()
|
||||||
{
|
{
|
||||||
_translators.Sort((a, b) => string.Compare(a.ToLowerInvariant(), b.ToLowerInvariant(), StringComparison.Ordinal));
|
Translators.Sort((a, b) => string.Compare(a.ToLowerInvariant(), b.ToLowerInvariant(), StringComparison.Ordinal));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(bool changed)
|
public void Draw(bool changed)
|
||||||
@@ -85,14 +85,12 @@ internal sealed class About : ISettingsTab
|
|||||||
using var translatorChild = ImRaii.Child("translators");
|
using var translatorChild = ImRaii.Child("translators");
|
||||||
if (translatorChild)
|
if (translatorChild)
|
||||||
{
|
{
|
||||||
foreach (var translator in _translators)
|
foreach (var translator in Translators)
|
||||||
{
|
|
||||||
ImGui.TextUnformatted(translator);
|
ImGui.TextUnformatted(translator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ namespace ChatTwo.Ui.SettingsTabs;
|
|||||||
|
|
||||||
internal sealed class Preview : ISettingsTab
|
internal sealed class Preview : ISettingsTab
|
||||||
{
|
{
|
||||||
private readonly Plugin Plugin;
|
|
||||||
private Configuration Mutable { get; }
|
private Configuration Mutable { get; }
|
||||||
|
|
||||||
public string Name => Language.Options_Preview_Tab + "###tabs-preview";
|
public string Name => $"{Language.Options_Preview_Tab}###tabs-preview";
|
||||||
|
|
||||||
internal Preview(Plugin plugin, Configuration mutable)
|
internal Preview(Configuration mutable)
|
||||||
{
|
{
|
||||||
Plugin = plugin;
|
|
||||||
Mutable = mutable;
|
Mutable = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,16 +9,14 @@ namespace ChatTwo.Ui.SettingsTabs;
|
|||||||
|
|
||||||
internal sealed class Tabs : ISettingsTab
|
internal sealed class Tabs : ISettingsTab
|
||||||
{
|
{
|
||||||
private Plugin Plugin { get; }
|
|
||||||
private Configuration Mutable { get; }
|
private Configuration Mutable { get; }
|
||||||
|
|
||||||
public string Name => Language.Options_Tabs_Tab + "###tabs-tabs";
|
public string Name => Language.Options_Tabs_Tab + "###tabs-tabs";
|
||||||
|
|
||||||
private int _toOpen = -2;
|
private int ToOpen = -2;
|
||||||
|
|
||||||
internal Tabs(Plugin plugin, Configuration mutable)
|
internal Tabs(Configuration mutable)
|
||||||
{
|
{
|
||||||
Plugin = plugin;
|
|
||||||
Mutable = mutable;
|
Mutable = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,13 +45,13 @@ internal sealed class Tabs : ISettingsTab
|
|||||||
}
|
}
|
||||||
|
|
||||||
var toRemove = -1;
|
var toRemove = -1;
|
||||||
var doOpens = _toOpen > -2;
|
var doOpens = ToOpen > -2;
|
||||||
for (var i = 0; i < Mutable.Tabs.Count; i++)
|
for (var i = 0; i < Mutable.Tabs.Count; i++)
|
||||||
{
|
{
|
||||||
var tab = Mutable.Tabs[i];
|
var tab = Mutable.Tabs[i];
|
||||||
|
|
||||||
if (doOpens)
|
if (doOpens)
|
||||||
ImGui.SetNextItemOpen(i == _toOpen);
|
ImGui.SetNextItemOpen(i == ToOpen);
|
||||||
|
|
||||||
using var treeNode = ImRaii.TreeNode($"{tab.Name}###tab-{i}");
|
using var treeNode = ImRaii.TreeNode($"{tab.Name}###tab-{i}");
|
||||||
if (!treeNode.Success)
|
if (!treeNode.Success)
|
||||||
@@ -64,7 +62,7 @@ internal sealed class Tabs : ISettingsTab
|
|||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.Options_Tabs_Delete))
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.Options_Tabs_Delete))
|
||||||
{
|
{
|
||||||
toRemove = i;
|
toRemove = i;
|
||||||
_toOpen = -1;
|
ToOpen = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
@@ -72,7 +70,7 @@ internal sealed class Tabs : ISettingsTab
|
|||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: Language.Options_Tabs_MoveUp) && i > 0)
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: Language.Options_Tabs_MoveUp) && i > 0)
|
||||||
{
|
{
|
||||||
(Mutable.Tabs[i - 1], Mutable.Tabs[i]) = (Mutable.Tabs[i], Mutable.Tabs[i - 1]);
|
(Mutable.Tabs[i - 1], Mutable.Tabs[i]) = (Mutable.Tabs[i], Mutable.Tabs[i - 1]);
|
||||||
_toOpen = i - 1;
|
ToOpen = i - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
@@ -80,7 +78,7 @@ internal sealed class Tabs : ISettingsTab
|
|||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: Language.Options_Tabs_MoveDown) && i < Mutable.Tabs.Count - 1)
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: Language.Options_Tabs_MoveDown) && i < Mutable.Tabs.Count - 1)
|
||||||
{
|
{
|
||||||
(Mutable.Tabs[i + 1], Mutable.Tabs[i]) = (Mutable.Tabs[i], Mutable.Tabs[i + 1]);
|
(Mutable.Tabs[i + 1], Mutable.Tabs[i]) = (Mutable.Tabs[i], Mutable.Tabs[i + 1]);
|
||||||
_toOpen = i + 1;
|
ToOpen = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.InputText(Language.Options_Tabs_Name, ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
|
ImGui.InputText(Language.Options_Tabs_Name, ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
|
||||||
@@ -135,6 +133,6 @@ internal sealed class Tabs : ISettingsTab
|
|||||||
Mutable.Tabs.RemoveAt(toRemove);
|
Mutable.Tabs.RemoveAt(toRemove);
|
||||||
|
|
||||||
if (doOpens)
|
if (doOpens)
|
||||||
_toOpen = -2;
|
ToOpen = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ using ChatTwo.Code;
|
|||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Lumina.Text.Payloads;
|
||||||
|
|
||||||
|
using PayloadType = Dalamud.Game.Text.SeStringHandling.PayloadType;
|
||||||
|
|
||||||
namespace ChatTwo.Util;
|
namespace ChatTwo.Util;
|
||||||
|
|
||||||
@@ -112,6 +115,11 @@ internal static class ChunkUtil
|
|||||||
var id = GetInteger(reader);
|
var id = GetInteger(reader);
|
||||||
link = new AchievementPayload(id);
|
link = new AchievementPayload(id);
|
||||||
}
|
}
|
||||||
|
else if (rawPayload.Data is [_, (byte)MacroCode.NonBreakingSpace, _, _])
|
||||||
|
{
|
||||||
|
// NonBreakingSpace payload
|
||||||
|
Append(" ");
|
||||||
|
}
|
||||||
// NOTE: no URIPayload because it originates solely from
|
// NOTE: no URIPayload because it originates solely from
|
||||||
// new Message(). The game doesn't have a URI payload type.
|
// new Message(). The game doesn't have a URI payload type.
|
||||||
else if (Equals(rawPayload, RawPayload.LinkTerminator))
|
else if (Equals(rawPayload, RawPayload.LinkTerminator))
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using Dalamud.Utility;
|
namespace ChatTwo.Util;
|
||||||
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
|
|
||||||
using FFXIVClientStructs.FFXIV.Component.Text;
|
|
||||||
|
|
||||||
namespace ChatTwo.Util;
|
|
||||||
|
|
||||||
public class ColorPayload
|
public class ColorPayload
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user