mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-17 13:27:43 +01:00
Merge branch 'api14' into AddonLifecycleRefactor
This commit is contained in:
commit
4d9751ea5f
79 changed files with 2359 additions and 1509 deletions
|
|
@ -1,9 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Textures.Internal;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Internal;
|
||||
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.Data.Widgets;
|
||||
|
||||
|
|
@ -87,12 +93,30 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
|
|||
ImGuiHelpers.ScaledDummy(10f);
|
||||
for (var i = 0; i < this.icons?.Count; i++)
|
||||
{
|
||||
if (this.icons[i] == FontAwesomeIcon.None)
|
||||
continue;
|
||||
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text($"0x{(int)this.icons[i].ToIconChar():X}");
|
||||
ImGuiHelpers.ScaledRelativeSameLine(50f);
|
||||
ImGui.Text($"{this.iconNames?[i]}");
|
||||
ImGuiHelpers.ScaledRelativeSameLine(280f);
|
||||
ImGui.PushFont(this.useFixedWidth ? InterfaceManager.IconFontFixedWidth : InterfaceManager.IconFont);
|
||||
ImGui.Text(this.icons[i].ToIconString());
|
||||
ImGuiHelpers.ScaledRelativeSameLine(320f);
|
||||
if (this.useFixedWidth
|
||||
? ImGui.Button($"{(char)this.icons[i]}##FontAwesomeIconButton{i}")
|
||||
: ImGuiComponents.IconButton($"##FontAwesomeIconButton{i}", this.icons[i]))
|
||||
{
|
||||
_ = Service<DevTextureSaveMenu>.Get().ShowTextureSaveMenuAsync(
|
||||
this.DisplayName,
|
||||
this.icons[i].ToString(),
|
||||
Task.FromResult(
|
||||
Service<TextureManager>.Get().CreateTextureFromSeString(
|
||||
ReadOnlySeString.FromText(this.icons[i].ToIconString()),
|
||||
new() { Font = ImGui.GetFont(), FontSize = ImGui.GetFontSize() })));
|
||||
}
|
||||
|
||||
ImGui.PopFont();
|
||||
ImGuiHelpers.ScaledDummy(2f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Data;
|
||||
|
|
@ -9,11 +10,13 @@ using Dalamud.Interface.ImGuiSeStringRenderer;
|
|||
using Dalamud.Interface.ImGuiSeStringRenderer.Internal;
|
||||
using Dalamud.Interface.Textures.Internal;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Internal;
|
||||
using Dalamud.Storage.Assets;
|
||||
using Dalamud.Utility;
|
||||
using FFXIVClientStructs.FFXIV.Component.GUI;
|
||||
using Lumina.Excel.Sheets;
|
||||
using Lumina.Text;
|
||||
using Lumina.Text.Parse;
|
||||
using Lumina.Text.Payloads;
|
||||
using Lumina.Text.ReadOnly;
|
||||
|
||||
|
|
@ -56,11 +59,11 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
/// <inheritdoc/>
|
||||
public void Draw()
|
||||
{
|
||||
var t2 = ImGui.ColorConvertU32ToFloat4(this.style.Color ?? ImGui.GetColorU32(ImGuiCol.Text));
|
||||
var t2 = ImGui.ColorConvertU32ToFloat4(this.style.Color ??= ImGui.GetColorU32(ImGuiCol.Text));
|
||||
if (ImGui.ColorEdit4("Color", ref t2))
|
||||
this.style.Color = ImGui.ColorConvertFloat4ToU32(t2);
|
||||
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.EdgeColor ?? 0xFF000000u);
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.EdgeColor ??= 0xFF000000u);
|
||||
if (ImGui.ColorEdit4("Edge Color", ref t2))
|
||||
this.style.EdgeColor = ImGui.ColorConvertFloat4ToU32(t2);
|
||||
|
||||
|
|
@ -69,27 +72,27 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
if (ImGui.Checkbox("Forced"u8, ref t))
|
||||
this.style.ForceEdgeColor = t;
|
||||
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.ShadowColor ?? 0xFF000000u);
|
||||
if (ImGui.ColorEdit4("Shadow Color", ref t2))
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.ShadowColor ??= 0xFF000000u);
|
||||
if (ImGui.ColorEdit4("Shadow Color"u8, ref t2))
|
||||
this.style.ShadowColor = ImGui.ColorConvertFloat4ToU32(t2);
|
||||
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.LinkHoverBackColor ?? ImGui.GetColorU32(ImGuiCol.ButtonHovered));
|
||||
if (ImGui.ColorEdit4("Link Hover Color", ref t2))
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.LinkHoverBackColor ??= ImGui.GetColorU32(ImGuiCol.ButtonHovered));
|
||||
if (ImGui.ColorEdit4("Link Hover Color"u8, ref t2))
|
||||
this.style.LinkHoverBackColor = ImGui.ColorConvertFloat4ToU32(t2);
|
||||
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.LinkActiveBackColor ?? ImGui.GetColorU32(ImGuiCol.ButtonActive));
|
||||
if (ImGui.ColorEdit4("Link Active Color", ref t2))
|
||||
t2 = ImGui.ColorConvertU32ToFloat4(this.style.LinkActiveBackColor ??= ImGui.GetColorU32(ImGuiCol.ButtonActive));
|
||||
if (ImGui.ColorEdit4("Link Active Color"u8, ref t2))
|
||||
this.style.LinkActiveBackColor = ImGui.ColorConvertFloat4ToU32(t2);
|
||||
|
||||
var t3 = this.style.LineHeight ?? 1f;
|
||||
var t3 = this.style.LineHeight ??= 1f;
|
||||
if (ImGui.DragFloat("Line Height"u8, ref t3, 0.01f, 0.4f, 3f, "%.02f"))
|
||||
this.style.LineHeight = t3;
|
||||
|
||||
t3 = this.style.Opacity ?? ImGui.GetStyle().Alpha;
|
||||
t3 = this.style.Opacity ??= 1f;
|
||||
if (ImGui.DragFloat("Opacity"u8, ref t3, 0.005f, 0f, 1f, "%.02f"))
|
||||
this.style.Opacity = t3;
|
||||
|
||||
t3 = this.style.EdgeStrength ?? 0.25f;
|
||||
t3 = this.style.EdgeStrength ??= 0.25f;
|
||||
if (ImGui.DragFloat("Edge Strength"u8, ref t3, 0.005f, 0f, 1f, "%.02f"))
|
||||
this.style.EdgeStrength = t3;
|
||||
|
||||
|
|
@ -174,6 +177,24 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
ImGuiHelpers.SeStringWrapped(this.logkind.Value.Data.Span, this.style);
|
||||
}
|
||||
|
||||
if (ImGui.CollapsingHeader("Draw into drawlist"))
|
||||
{
|
||||
ImGuiHelpers.ScaledDummy(100);
|
||||
ImGui.SetCursorScreenPos(ImGui.GetItemRectMin() + ImGui.GetStyle().FramePadding);
|
||||
var clipMin = ImGui.GetItemRectMin() + ImGui.GetStyle().FramePadding;
|
||||
var clipMax = ImGui.GetItemRectMax() - ImGui.GetStyle().FramePadding;
|
||||
clipMin.Y = MathF.Max(clipMin.Y, ImGui.GetWindowPos().Y);
|
||||
clipMax.Y = MathF.Min(clipMax.Y, ImGui.GetWindowPos().Y + ImGui.GetWindowHeight());
|
||||
|
||||
var dl = ImGui.GetWindowDrawList();
|
||||
dl.PushClipRect(clipMin, clipMax);
|
||||
ImGuiHelpers.CompileSeStringWrapped(
|
||||
"<icon(1)>Test test<icon(1)>",
|
||||
new SeStringDrawParams
|
||||
{ Color = 0xFFFFFFFF, WrapWidth = float.MaxValue, TargetDrawList = dl });
|
||||
dl.PopClipRect();
|
||||
}
|
||||
|
||||
if (ImGui.CollapsingHeader("Addon Table"u8))
|
||||
{
|
||||
if (ImGui.BeginTable("Addon Sheet"u8, 3))
|
||||
|
|
@ -240,6 +261,27 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
Service<SeStringRenderer>.Get().CompileAndCache(this.testString).Data.Span));
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("Copy as Image"))
|
||||
{
|
||||
_ = Service<DevTextureSaveMenu>.Get().ShowTextureSaveMenuAsync(
|
||||
this.DisplayName,
|
||||
$"From {nameof(SeStringRendererTestWidget)}",
|
||||
Task.FromResult(
|
||||
Service<TextureManager>.Get().CreateTextureFromSeString(
|
||||
ReadOnlySeString.FromMacroString(
|
||||
this.testString,
|
||||
new(ExceptionMode: MacroStringParseExceptionMode.EmbedError)),
|
||||
this.style with
|
||||
{
|
||||
Font = ImGui.GetFont(),
|
||||
FontSize = ImGui.GetFontSize(),
|
||||
WrapWidth = ImGui.GetContentRegionAvail().X,
|
||||
ThemeIndex = AtkStage.Instance()->AtkUIColorHolder->ActiveColorThemeType,
|
||||
})));
|
||||
}
|
||||
|
||||
ImGuiHelpers.ScaledDummy(3);
|
||||
ImGuiHelpers.CompileSeStringWrapped(
|
||||
"Optional features implemented for the following test input:<br>" +
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
|
@ -306,12 +306,12 @@ internal class TexWidget : IDataWindowWidget
|
|||
pres->Release();
|
||||
|
||||
ImGui.Text($"RC: Resource({rcres})/View({rcsrv})");
|
||||
ImGui.Text(source.ToString());
|
||||
ImGui.Text($"{source.Width} x {source.Height} | {source}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text("RC: -"u8);
|
||||
ImGui.Text(" "u8);
|
||||
ImGui.Text("RC: -");
|
||||
ImGui.Text(string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -342,6 +342,10 @@ internal class TexWidget : IDataWindowWidget
|
|||
runLater?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>Adds a texture wrap for debug display purposes.</summary>
|
||||
/// <param name="textureTask">Task returning a texture.</param>
|
||||
public void AddTexture(Task<IDalamudTextureWrap> textureTask) => this.addedTextures.Add(new(Api10: textureTask));
|
||||
|
||||
private unsafe void DrawBlame(List<TextureManager.IBlameableDalamudTextureWrap> allBlames)
|
||||
{
|
||||
var im = Service<InterfaceManager>.Get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue