Merge branch 'main' into dean/extrachat-input-channels
This commit is contained in:
+33
-18
@@ -13,6 +13,7 @@ using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal;
|
||||
using Dalamud.Interface.Style;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Memory;
|
||||
@@ -75,12 +76,8 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
||||
Plugin = plugin;
|
||||
Salt = new Random().Next().ToString();
|
||||
|
||||
Size = new Vector2(500, 250);
|
||||
SizeCondition = ImGuiCond.FirstUseEver;
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(500, 250),
|
||||
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
||||
};
|
||||
|
||||
PayloadHandler = new PayloadHandler(this);
|
||||
HandlerLender = new Lender<PayloadHandler>(() => new PayloadHandler(this));
|
||||
@@ -100,6 +97,24 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
||||
Plugin.AddonLifecycle.RegisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip);
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
if (Plugin.Config.OverrideStyle)
|
||||
{
|
||||
var styles = StyleModel.GetConfiguredStyles();
|
||||
styles?.First(style => style.Name.Equals(Plugin.Config.ChosenStyle)).Push();
|
||||
}
|
||||
}
|
||||
|
||||
public override void PostDraw()
|
||||
{
|
||||
if (Plugin.Config.OverrideStyle)
|
||||
{
|
||||
var styles = StyleModel.GetConfiguredStyles();
|
||||
styles?.First(style => style.Name.Equals(Plugin.Config.ChosenStyle)).Pop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Plugin.AddonLifecycle.UnregisterListener(AddonEvent.PostRequestedUpdate, "ItemDetail", PayloadHandler.MoveTooltip);
|
||||
Plugin.ClientState.Logout -= Logout;
|
||||
@@ -1292,10 +1307,8 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
||||
|| cmd.Alias.RawString == command
|
||||
|| cmd.ShortCommand.RawString == command
|
||||
|| cmd.ShortAlias.RawString == command);
|
||||
if (cmd != null) {
|
||||
if (cmd != null)
|
||||
Plugin.CommandHelpWindow.UpdateContent(cmd);
|
||||
Plugin.CommandHelpWindow.IsOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (data->EventFlag != ImGuiInputTextFlags.CallbackHistory) {
|
||||
@@ -1367,18 +1380,20 @@ public sealed class ChatLogWindow : Window, IUiComponent {
|
||||
|
||||
private void DrawChunk(Chunk chunk, bool wrap = true, PayloadHandler? handler = null, float lineWidth = 0f) {
|
||||
if (chunk is IconChunk icon && _fontIcon != null) {
|
||||
var bounds = IconUtil.GetBounds((byte) icon.Icon);
|
||||
if (bounds != null) {
|
||||
var texSize = new Vector2(_fontIcon.Width, _fontIcon.Height);
|
||||
var bounds = IconUtil.GfdFileView.TryGetEntry((uint) icon.Icon, out var entry);
|
||||
if (!bounds)
|
||||
return;
|
||||
|
||||
var sizeRatio = Plugin.Config.FontSize / bounds.Value.W;
|
||||
var size = new Vector2(bounds.Value.Z, bounds.Value.W) * sizeRatio * ImGuiHelpers.GlobalScale;
|
||||
var texSize = new Vector2(_fontIcon.Width, _fontIcon.Height);
|
||||
|
||||
var uv0 = new Vector2(bounds.Value.X, bounds.Value.Y - 2) / texSize;
|
||||
var uv1 = new Vector2(bounds.Value.X + bounds.Value.Z, bounds.Value.Y - 2 + bounds.Value.W) / texSize;
|
||||
ImGui.Image(_fontIcon.ImGuiHandle, size, uv0, uv1);
|
||||
ImGuiUtil.PostPayload(chunk, handler);
|
||||
}
|
||||
var sizeRatio = Plugin.Config.FontSize / entry.Height;
|
||||
var size = new Vector2(entry.Width, entry.Height) * sizeRatio * ImGuiHelpers.GlobalScale;
|
||||
|
||||
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(_fontIcon.ImGuiHandle, size, uv0, uv1);
|
||||
ImGuiUtil.PostPayload(chunk, handler);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user