mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-02 13:53:40 +01:00
chore: warnings pass
This commit is contained in:
parent
505e37fd28
commit
b093323acc
49 changed files with 352 additions and 254 deletions
|
|
@ -9,16 +9,6 @@ namespace Dalamud.Interface.GameFonts
|
|||
/// </summary>
|
||||
public class FdtReader
|
||||
{
|
||||
private static unsafe T StructureFromByteArray<T> (byte[] data, int offset)
|
||||
{
|
||||
var len = Marshal.SizeOf<T>();
|
||||
if (offset + len > data.Length)
|
||||
throw new Exception("Data too short");
|
||||
|
||||
fixed (byte* ptr = data)
|
||||
return Marshal.PtrToStructure<T>(new(ptr + offset));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FdtReader"/> class.
|
||||
/// </summary>
|
||||
|
|
@ -33,7 +23,7 @@ namespace Dalamud.Interface.GameFonts
|
|||
this.Glyphs.Add(StructureFromByteArray<FontTableEntry>(data, this.FileHeader.FontTableHeaderOffset + Marshal.SizeOf<FontTableHeader>() + (Marshal.SizeOf<FontTableEntry>() * i)));
|
||||
|
||||
for (int i = 0, i_ = Math.Min(this.FontHeader.KerningTableEntryCount, this.KerningHeader.Count); i < i_; i++)
|
||||
this.Distances.Add(StructureFromByteArray<KerningTableEntry>(data, this.FileHeader.KerningTableHeaderOffset+ Marshal.SizeOf<KerningTableHeader>() + (Marshal.SizeOf<KerningTableEntry>() * i)));
|
||||
this.Distances.Add(StructureFromByteArray<KerningTableEntry>(data, this.FileHeader.KerningTableHeaderOffset + Marshal.SizeOf<KerningTableHeader>() + (Marshal.SizeOf<KerningTableEntry>() * i)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -68,7 +58,7 @@ namespace Dalamud.Interface.GameFonts
|
|||
/// <returns>Corresponding FontTableEntry, or null if not found.</returns>
|
||||
public FontTableEntry? FindGlyph(int codepoint)
|
||||
{
|
||||
var i = this.Glyphs.BinarySearch(new FontTableEntry { CharUtf8 = CodePointToUtf8int32(codepoint) });
|
||||
var i = this.Glyphs.BinarySearch(new FontTableEntry { CharUtf8 = CodePointToUtf8Int32(codepoint) });
|
||||
if (i < 0 || i == this.Glyphs.Count)
|
||||
return null;
|
||||
return this.Glyphs[i];
|
||||
|
|
@ -95,13 +85,23 @@ namespace Dalamud.Interface.GameFonts
|
|||
/// <returns>Supposed distance adjustment between given characters.</returns>
|
||||
public int GetDistance(int codepoint1, int codepoint2)
|
||||
{
|
||||
var i = this.Distances.BinarySearch(new KerningTableEntry { LeftUtf8 = CodePointToUtf8int32(codepoint1), RightUtf8 = CodePointToUtf8int32(codepoint2) });
|
||||
var i = this.Distances.BinarySearch(new KerningTableEntry { LeftUtf8 = CodePointToUtf8Int32(codepoint1), RightUtf8 = CodePointToUtf8Int32(codepoint2) });
|
||||
if (i < 0 || i == this.Distances.Count)
|
||||
return 0;
|
||||
return this.Distances[i].RightOffset;
|
||||
}
|
||||
|
||||
private static int CodePointToUtf8int32(int codepoint)
|
||||
private static unsafe T StructureFromByteArray<T>(byte[] data, int offset)
|
||||
{
|
||||
var len = Marshal.SizeOf<T>();
|
||||
if (offset + len > data.Length)
|
||||
throw new Exception("Data too short");
|
||||
|
||||
fixed (byte* ptr = data)
|
||||
return Marshal.PtrToStructure<T>(new(ptr + offset));
|
||||
}
|
||||
|
||||
private static int CodePointToUtf8Int32(int codepoint)
|
||||
{
|
||||
if (codepoint <= 0x7F)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Numerics;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Interface.Internal;
|
||||
|
|
@ -12,6 +13,7 @@ using Dalamud.Utility.Timing;
|
|||
using ImGuiNET;
|
||||
using Lumina.Data.Files;
|
||||
using Serilog;
|
||||
|
||||
using static Dalamud.Interface.ImGuiHelpers;
|
||||
|
||||
namespace Dalamud.Interface.GameFonts
|
||||
|
|
@ -40,7 +42,9 @@ namespace Dalamud.Interface.GameFonts
|
|||
private readonly Dictionary<GameFontStyle, int> fontUseCounter = new();
|
||||
private readonly Dictionary<GameFontStyle, Dictionary<char, Tuple<int, FdtReader.FontTableEntry>>> glyphRectIds = new();
|
||||
|
||||
#pragma warning disable CS0414
|
||||
private bool isBetweenBuildFontsAndRightAfterImGuiIoFontsBuild = false;
|
||||
#pragma warning restore CS0414
|
||||
|
||||
[ServiceManager.ServiceConstructor]
|
||||
private GameFontManager(DataManager dataManager)
|
||||
|
|
|
|||
|
|
@ -1,31 +1,43 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface;
|
||||
|
||||
/// <summary>
|
||||
/// Class containing various extensions to ImGui, aiding with building custom widgets.
|
||||
/// </summary>
|
||||
public static class ImGuiExtensions
|
||||
{
|
||||
public static void AddTextClippedEx(
|
||||
this ImDrawListPtr drawListPtr, Vector2 posMin, Vector2 posMax, string text, Vector2? textSizeIfKnown,
|
||||
Vector2 align, Vector4? clipRect)
|
||||
/// <summary>
|
||||
/// Draw clipped text.
|
||||
/// </summary>
|
||||
/// <param name="drawListPtr">Pointer to the draw list.</param>
|
||||
/// <param name="posMin">Minimum position.</param>
|
||||
/// <param name="posMax">Maximum position.</param>
|
||||
/// <param name="text">Text to draw.</param>
|
||||
/// <param name="textSizeIfKnown">Size of the text, if known.</param>
|
||||
/// <param name="align">Alignment.</param>
|
||||
/// <param name="clipRect">Clip rect to use.</param>
|
||||
public static void AddTextClippedEx(this ImDrawListPtr drawListPtr, Vector2 posMin, Vector2 posMax, string text, Vector2? textSizeIfKnown, Vector2 align, Vector4? clipRect)
|
||||
{
|
||||
var pos = posMin;
|
||||
var textSize = textSizeIfKnown ?? ImGui.CalcTextSize(text, false, 0);
|
||||
|
||||
|
||||
var clipMin = clipRect.HasValue ? new Vector2(clipRect.Value.X, clipRect.Value.Y) : posMin;
|
||||
var clipMax = clipRect.HasValue ? new Vector2(clipRect.Value.Z, clipRect.Value.W) : posMax;
|
||||
|
||||
|
||||
var needClipping = (pos.X + textSize.X >= clipMax.X) || (pos.Y + textSize.Y >= clipMax.Y);
|
||||
if (clipRect.HasValue)
|
||||
needClipping |= (pos.X < clipMin.X) || (pos.Y < clipMin.Y);
|
||||
|
||||
|
||||
if (align.X > 0)
|
||||
{
|
||||
pos.X = Math.Max(pos.X, pos.X + ((posMax.X - pos.X - textSize.X) * align.X));
|
||||
}
|
||||
|
||||
|
||||
if (align.Y > 0)
|
||||
{
|
||||
pos.Y = Math.Max(pos.Y, pos.Y + ((posMax.Y - pos.Y - textSize.Y) * align.Y));
|
||||
|
|
@ -42,22 +54,32 @@ public static class ImGuiExtensions
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add text to a draw list.
|
||||
/// </summary>
|
||||
/// <param name="drawListPtr">Pointer to the draw list.</param>
|
||||
/// <param name="font">Font to use.</param>
|
||||
/// <param name="fontSize">Font size.</param>
|
||||
/// <param name="pos">Position to draw at.</param>
|
||||
/// <param name="col">Color to use.</param>
|
||||
/// <param name="textBegin">Text to draw.</param>
|
||||
/// <param name="cpuFineClipRect">Clip rect to use.</param>
|
||||
// TODO: This should go into ImDrawList.Manual.cs in ImGui.NET...
|
||||
public static unsafe void AddText(this ImDrawListPtr drawListPtr, ImFontPtr font, float fontSize, Vector2 pos, uint col, string textBegin, ref Vector4 cpuFineClipRect)
|
||||
{
|
||||
var nativeFont = font.NativePtr;
|
||||
var textBeginByteCount = Encoding.UTF8.GetByteCount(textBegin);
|
||||
var nativeTextBegin = stackalloc byte[textBeginByteCount + 1];
|
||||
|
||||
|
||||
fixed (char* textBeginPtr = textBegin)
|
||||
{
|
||||
var nativeTextBeginOffset = Encoding.UTF8.GetBytes(textBeginPtr, textBegin.Length, nativeTextBegin, textBeginByteCount);
|
||||
nativeTextBegin[nativeTextBeginOffset] = 0;
|
||||
}
|
||||
|
||||
|
||||
byte* nativeTextEnd = null;
|
||||
var wrapWidth = 0.0f;
|
||||
|
||||
|
||||
fixed (Vector4* nativeCpuFineClipRect = &cpuFineClipRect)
|
||||
{
|
||||
ImGuiNative.ImDrawList_AddText_FontPtr(drawListPtr.NativePtr, nativeFont, fontSize, pos, col, nativeTextBegin, nativeTextEnd, wrapWidth, nativeCpuFineClipRect);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Utility;
|
||||
|
||||
namespace Dalamud.Interface.ImGuiFileDialog
|
||||
|
|
|
|||
|
|
@ -313,7 +313,6 @@ namespace Dalamud.Interface.ImGuiFileDialog
|
|||
{
|
||||
if (ImGui.BeginChild("##FileDialog_SideBar", size))
|
||||
{
|
||||
|
||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + Scaled(5));
|
||||
|
||||
var idx = 0;
|
||||
|
|
@ -508,6 +507,7 @@ namespace Dalamud.Interface.ImGuiFileDialog
|
|||
this.pathClicked = this.SelectDirectory(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.IsDirectoryMode())
|
||||
{
|
||||
this.SelectFileName(file);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.ImGuiFileDialog
|
||||
|
|
@ -14,7 +15,9 @@ namespace Dalamud.Interface.ImGuiFileDialog
|
|||
/// <summary>
|
||||
/// The flags used to draw the file picker window.
|
||||
/// </summary>
|
||||
#pragma warning disable SA1401
|
||||
public ImGuiWindowFlags WindowFlags;
|
||||
#pragma warning restore SA1401
|
||||
|
||||
private readonly string title;
|
||||
private readonly int selectionCountMax;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.ImGuiFileDialog
|
||||
|
|
@ -9,11 +10,13 @@ namespace Dalamud.Interface.ImGuiFileDialog
|
|||
/// </summary>
|
||||
public class FileDialogManager
|
||||
{
|
||||
#pragma warning disable SA1401
|
||||
/// <summary> Additional quick access items for the side bar.</summary>
|
||||
public readonly List<(string Name, string Path, FontAwesomeIcon Icon, int Position)> CustomSideBarItems = new();
|
||||
|
||||
/// <summary> Additional flags with which to draw the window. </summary>
|
||||
public ImGuiWindowFlags AddedWindowFlags = ImGuiWindowFlags.None;
|
||||
#pragma warning restore SA1401
|
||||
|
||||
private FileDialog? dialog;
|
||||
private Action<bool, string>? callback;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Dalamud.Interface
|
|||
/// <summary>
|
||||
/// Gets a <see cref="Vector2"/> that is pre-scaled with the <see cref="GlobalScale"/> multiplier.
|
||||
/// </summary>
|
||||
/// <param name="x">Vector2 X & Y parameter.</param>
|
||||
/// <param name="x">Vector2 X/Y parameter.</param>
|
||||
/// <returns>A scaled Vector2.</returns>
|
||||
public static Vector2 ScaledVector2(float x) => new Vector2(x, x) * GlobalScale;
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ namespace Dalamud.Interface
|
|||
public ushort Height;
|
||||
public ushort X;
|
||||
public ushort Y;
|
||||
public uint TextureIndexAndGlyphID;
|
||||
public uint TextureIndexAndGlyphId;
|
||||
public float GlyphAdvanceX;
|
||||
public Vector2 GlyphOffset;
|
||||
public ImFont* Font;
|
||||
|
|
@ -394,15 +394,15 @@ namespace Dalamud.Interface
|
|||
|
||||
public int TextureIndex
|
||||
{
|
||||
get => (int)(this.TextureIndexAndGlyphID & TextureIndexMask) >> TextureIndexShift;
|
||||
set => this.TextureIndexAndGlyphID = (this.TextureIndexAndGlyphID & ~TextureIndexMask) | ((uint)value << TextureIndexShift);
|
||||
get => (int)(this.TextureIndexAndGlyphId & TextureIndexMask) >> TextureIndexShift;
|
||||
set => this.TextureIndexAndGlyphId = (this.TextureIndexAndGlyphId & ~TextureIndexMask) | ((uint)value << TextureIndexShift);
|
||||
}
|
||||
|
||||
public int GlyphID
|
||||
public int GlyphId
|
||||
{
|
||||
get => (int)(this.TextureIndexAndGlyphID & GlyphIDMask) >> GlyphIDShift;
|
||||
set => this.TextureIndexAndGlyphID = (this.TextureIndexAndGlyphID & ~GlyphIDMask) | ((uint)value << GlyphIDShift);
|
||||
get => (int)(this.TextureIndexAndGlyphId & GlyphIDMask) >> GlyphIDShift;
|
||||
set => this.TextureIndexAndGlyphId = (this.TextureIndexAndGlyphId & ~GlyphIDMask) | ((uint)value << GlyphIDShift);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Dalamud.Interface.Internal
|
|||
private readonly CreditsWindow creditsWindow;
|
||||
private readonly DataWindow dataWindow;
|
||||
private readonly GamepadModeNotifierWindow gamepadModeNotifierWindow;
|
||||
private readonly IMEWindow imeWindow;
|
||||
private readonly ImeWindow imeWindow;
|
||||
private readonly ConsoleWindow consoleWindow;
|
||||
private readonly PluginStatWindow pluginStatWindow;
|
||||
private readonly PluginInstallerWindow pluginWindow;
|
||||
|
|
@ -93,7 +93,7 @@ namespace Dalamud.Interface.Internal
|
|||
this.creditsWindow = new CreditsWindow() { IsOpen = false };
|
||||
this.dataWindow = new DataWindow() { IsOpen = false };
|
||||
this.gamepadModeNotifierWindow = new GamepadModeNotifierWindow() { IsOpen = false };
|
||||
this.imeWindow = new IMEWindow() { IsOpen = false };
|
||||
this.imeWindow = new ImeWindow() { IsOpen = false };
|
||||
this.consoleWindow = new ConsoleWindow() { IsOpen = configuration.LogOpenAtStartup };
|
||||
this.pluginStatWindow = new PluginStatWindow() { IsOpen = false };
|
||||
this.pluginWindow = new PluginInstallerWindow(pluginImageCache) { IsOpen = false };
|
||||
|
|
@ -231,7 +231,7 @@ namespace Dalamud.Interface.Internal
|
|||
public void OpenGamepadModeNotifierWindow() => this.gamepadModeNotifierWindow.IsOpen = true;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="IMEWindow"/>.
|
||||
/// Opens the <see cref="ImeWindow"/>.
|
||||
/// </summary>
|
||||
public void OpenImeWindow() => this.imeWindow.IsOpen = true;
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ namespace Dalamud.Interface.Internal
|
|||
public void OpenProfiler() => this.profilerWindow.IsOpen = true;
|
||||
|
||||
/// <summary>
|
||||
/// Opens the <see cref="BranchSwitcherWindow"/>
|
||||
/// Opens the <see cref="BranchSwitcherWindow"/>.
|
||||
/// </summary>
|
||||
public void OpenBranchSwitcher() => this.branchSwitcherWindow.IsOpen = true;
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ namespace Dalamud.Interface.Internal
|
|||
#region Close
|
||||
|
||||
/// <summary>
|
||||
/// Closes the <see cref="IMEWindow"/>.
|
||||
/// Closes the <see cref="ImeWindow"/>.
|
||||
/// </summary>
|
||||
public void CloseImeWindow() => this.imeWindow.IsOpen = false;
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ namespace Dalamud.Interface.Internal
|
|||
public void ToggleGamepadModeNotifierWindow() => this.gamepadModeNotifierWindow.Toggle();
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the <see cref="IMEWindow"/>.
|
||||
/// Toggles the <see cref="ImeWindow"/>.
|
||||
/// </summary>
|
||||
public void ToggleIMEWindow() => this.imeWindow.Toggle();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState.GamePad;
|
||||
|
|
@ -100,6 +101,7 @@ namespace Dalamud.Interface.Internal
|
|||
|
||||
[UnmanagedFunctionPointer(CallingConvention.ThisCall)]
|
||||
private delegate IntPtr ProcessMessageDelegate(IntPtr hWnd, uint msg, ulong wParam, ulong lParam, IntPtr handeled);
|
||||
|
||||
/// <summary>
|
||||
/// This event gets called each frame to facilitate ImGui drawing.
|
||||
/// </summary>
|
||||
|
|
@ -1135,7 +1137,7 @@ namespace Dalamud.Interface.Internal
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Associated InterfaceManager.
|
||||
/// Gets the associated InterfaceManager.
|
||||
/// </summary>
|
||||
public InterfaceManager Manager { get; init; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ namespace Dalamud.Interface.Internal.ManagedAsserts
|
|||
// TODO: Needs to be updated for ImGui 1.88
|
||||
return;
|
||||
|
||||
#pragma warning disable CS0162
|
||||
if (!AssertsEnabled)
|
||||
{
|
||||
return;
|
||||
|
|
@ -93,6 +94,7 @@ namespace Dalamud.Interface.Internal.ManagedAsserts
|
|||
ShowAssert(source, $"Mismatched Begin/BeginChild vs End/EndChild calls: did you call End/EndChild too much?\n\ncSnap.WindowStackSize = {cSnap.WindowStackSize}");
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS0162
|
||||
}
|
||||
|
||||
private static void ShowAssert(string source, string message)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
/// </summary>
|
||||
internal class CreditsWindow : Window, IDisposable
|
||||
{
|
||||
private const float CreditFPS = 60.0f;
|
||||
private const float CreditFps = 60.0f;
|
||||
private const string ThankYouText = "Thank you!";
|
||||
private const string CreditsTextTempl = @"
|
||||
Dalamud
|
||||
A FFXIV Plugin Framework
|
||||
|
|
@ -163,7 +164,6 @@ Contribute at: https://github.com/goatsoft/Dalamud
|
|||
private string creditsText;
|
||||
|
||||
private GameFontHandle? thankYouFont;
|
||||
private const string thankYouText = "Thank you!";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CreditsWindow"/> class.
|
||||
|
|
@ -265,11 +265,11 @@ Contribute at: https://github.com/goatsoft/Dalamud
|
|||
if (this.thankYouFont != null)
|
||||
{
|
||||
ImGui.PushFont(this.thankYouFont.ImFont);
|
||||
var thankYouLenX = ImGui.CalcTextSize(thankYouText).X;
|
||||
var thankYouLenX = ImGui.CalcTextSize(ThankYouText).X;
|
||||
|
||||
ImGui.Dummy(new Vector2((windowX / 2) - (thankYouLenX / 2), 0f));
|
||||
ImGui.SameLine();
|
||||
ImGui.TextUnformatted(thankYouText);
|
||||
ImGui.TextUnformatted(ThankYouText);
|
||||
|
||||
ImGui.PopFont();
|
||||
}
|
||||
|
|
@ -278,7 +278,7 @@ Contribute at: https://github.com/goatsoft/Dalamud
|
|||
|
||||
ImGui.PopStyleVar();
|
||||
|
||||
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFPS))
|
||||
if (this.creditsThrottler.Elapsed.TotalMilliseconds > (1000.0f / CreditFps))
|
||||
{
|
||||
var curY = ImGui.GetScrollY();
|
||||
var maxY = ImGui.GetScrollMaxY();
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
/// <summary>
|
||||
/// A window for displaying IME details.
|
||||
/// </summary>
|
||||
internal unsafe class IMEWindow : Window
|
||||
internal unsafe class ImeWindow : Window
|
||||
{
|
||||
private const int ImePageSize = 9;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IMEWindow"/> class.
|
||||
/// Initializes a new instance of the <see cref="ImeWindow"/> class.
|
||||
/// </summary>
|
||||
public IMEWindow()
|
||||
public ImeWindow()
|
||||
: base("Dalamud IME", ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground)
|
||||
{
|
||||
this.Size = new Vector2(100, 200);
|
||||
|
|
@ -38,8 +38,8 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
return;
|
||||
}
|
||||
|
||||
//ImGui.Text($"{ime.GetCursorPos()}");
|
||||
//ImGui.Text($"{ImGui.GetWindowViewport().WorkSize}");
|
||||
// ImGui.Text($"{ime.GetCursorPos()}");
|
||||
// ImGui.Text($"{ImGui.GetWindowViewport().WorkSize}");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
|
|||
|
|
@ -1518,8 +1518,9 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
ImGui.TextWrapped(Locs.PluginBody_Outdated);
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
else if (plugin is { IsBanned: true }) // Banned warning
|
||||
else if (plugin is { IsBanned: true })
|
||||
{
|
||||
// Banned warning
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
ImGuiHelpers.SafeTextWrapped(plugin.BanReason.IsNullOrEmpty()
|
||||
? Locs.PluginBody_Banned
|
||||
|
|
@ -1539,8 +1540,9 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
ImGui.TextWrapped(Locs.PluginBody_Policy);
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
else if (plugin is { State: PluginState.LoadError or PluginState.DependencyResolutionFailed }) // Load failed warning
|
||||
else if (plugin is { State: PluginState.LoadError or PluginState.DependencyResolutionFailed })
|
||||
{
|
||||
// Load failed warning
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
|
||||
ImGui.TextWrapped(Locs.PluginBody_LoadFailed);
|
||||
ImGui.PopStyleColor();
|
||||
|
|
@ -1803,7 +1805,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
var configuration = Service<DalamudConfiguration>.Get();
|
||||
var commandManager = Service<CommandManager>.Get();
|
||||
|
||||
var testingOptIn =
|
||||
var testingOptIn =
|
||||
configuration.PluginTestingOptIns?.FirstOrDefault(x => x.InternalName == plugin.Manifest.InternalName);
|
||||
var trouble = false;
|
||||
|
||||
|
|
@ -2179,9 +2181,10 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
plugin.ReloadManifest();
|
||||
}
|
||||
|
||||
var enableTask = Task.Run(() => plugin.Enable())
|
||||
.ContinueWith(this.DisplayErrorContinuation,
|
||||
Locs.ErrorModal_EnableFail(plugin.Name));
|
||||
var enableTask = Task.Run(plugin.Enable)
|
||||
.ContinueWith(
|
||||
this.DisplayErrorContinuation,
|
||||
Locs.ErrorModal_EnableFail(plugin.Name));
|
||||
|
||||
enableTask.Wait();
|
||||
if (!enableTask.Result)
|
||||
|
|
@ -2191,8 +2194,9 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
}
|
||||
|
||||
var loadTask = Task.Run(() => plugin.LoadAsync(PluginLoadReason.Installer))
|
||||
.ContinueWith(this.DisplayErrorContinuation,
|
||||
Locs.ErrorModal_LoadFail(plugin.Name));
|
||||
.ContinueWith(
|
||||
this.DisplayErrorContinuation,
|
||||
Locs.ErrorModal_LoadFail(plugin.Name));
|
||||
|
||||
loadTask.Wait();
|
||||
this.enableDisableStatus = OperationStatus.Complete;
|
||||
|
|
@ -2200,9 +2204,10 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
if (!loadTask.Result)
|
||||
return;
|
||||
|
||||
notifications.AddNotification(Locs.Notifications_PluginEnabled(plugin.Manifest.Name),
|
||||
Locs.Notifications_PluginEnabledTitle,
|
||||
NotificationType.Success);
|
||||
notifications.AddNotification(
|
||||
Locs.Notifications_PluginEnabled(plugin.Manifest.Name),
|
||||
Locs.Notifications_PluginEnabledTitle,
|
||||
NotificationType.Success);
|
||||
});
|
||||
|
||||
if (availableUpdate != default && !availableUpdate.InstalledPlugin.IsDev)
|
||||
|
|
@ -2833,6 +2838,7 @@ namespace Dalamud.Interface.Internal.Windows.PluginInstaller
|
|||
public static string PluginBody_Plugin3rdPartyRepo(string url) => Loc.Localize("InstallerPlugin3rdPartyRepo", "From custom plugin repository {0}").Format(url);
|
||||
|
||||
public static string PluginBody_AvailableDevPlugin => Loc.Localize("InstallerDevPlugin", " This plugin is available in one of your repos, please remove it from the devPlugins folder.");
|
||||
|
||||
public static string PluginBody_Outdated => Loc.Localize("InstallerOutdatedPluginBody ", "This plugin is outdated and incompatible at the moment. Please wait for it to be updated by its author.");
|
||||
|
||||
public static string PluginBody_Orphaned => Loc.Localize("InstallerOrphanedPluginBody ", "This plugin's source repository is no longer available. You may need to reinstall it from its repository, or re-add the repository.");
|
||||
|
|
|
|||
|
|
@ -188,7 +188,6 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
ImGui.TableNextColumn();
|
||||
ImGui.Text($"{handlerHistory.Key}");
|
||||
|
||||
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.Text($"{handlerHistory.Value.Last():F4}ms");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Utility.Numerics;
|
||||
|
|
@ -10,29 +12,30 @@ using ImGuiNET;
|
|||
|
||||
namespace Dalamud.Interface.Internal.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// Class used to draw the Dalamud profiler.
|
||||
/// </summary>
|
||||
public class ProfilerWindow : Window
|
||||
{
|
||||
private double min;
|
||||
private double max;
|
||||
private List<List<Tuple<double, double>>> occupied = new();
|
||||
|
||||
public ProfilerWindow() : base("Profiler", forceMainWindow: true) { }
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ProfilerWindow"/> class.
|
||||
/// </summary>
|
||||
public ProfilerWindow()
|
||||
: base("Profiler", forceMainWindow: true)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Window.OnOpen"/>
|
||||
public override void OnOpen()
|
||||
{
|
||||
this.min = Timings.AllTimings.Keys.Min(x => x.StartTime);
|
||||
this.max = Timings.AllTimings.Keys.Max(x => x.EndTime);
|
||||
}
|
||||
|
||||
private class RectInfo
|
||||
{
|
||||
internal TimingHandle Timing;
|
||||
internal Vector2 MinPos;
|
||||
internal Vector2 MaxPos;
|
||||
internal Vector4 RectColor;
|
||||
internal bool Hover;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Draw()
|
||||
{
|
||||
|
|
@ -249,4 +252,14 @@ public class ProfilerWindow : Window
|
|||
ImGui.Text("Max: " + actualMax.ToString("0.000"));
|
||||
ImGui.Text("Timings: " + Timings.AllTimings.Count);
|
||||
}
|
||||
|
||||
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Internals")]
|
||||
private class RectInfo
|
||||
{
|
||||
internal TimingHandle Timing;
|
||||
internal Vector2 MinPos;
|
||||
internal Vector2 MaxPos;
|
||||
internal Vector4 RectColor;
|
||||
internal bool Hover;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
|||
/// </summary>
|
||||
internal class ContextMenuAgingStep : IAgingStep
|
||||
{
|
||||
/*
|
||||
private SubStep currentSubStep;
|
||||
|
||||
private uint clickedItemId;
|
||||
|
|
@ -36,6 +37,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
|||
TestMultiple,
|
||||
Finish,
|
||||
}
|
||||
*/
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name => "Test Context Menu";
|
||||
|
|
@ -141,13 +143,15 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
|||
/// <inheritdoc/>
|
||||
public void CleanUp()
|
||||
{
|
||||
// var contextMenu = Service<ContextMenu>.Get();
|
||||
// contextMenu.ContextMenuOpened -= this.ContextMenuOnContextMenuOpened;
|
||||
/*
|
||||
var contextMenu = Service<ContextMenu>.Get();
|
||||
contextMenu.ContextMenuOpened -= this.ContextMenuOnContextMenuOpened;
|
||||
|
||||
this.currentSubStep = SubStep.Start;
|
||||
this.clickedItemId = 0;
|
||||
this.clickedPlayerName = null;
|
||||
this.multipleTriggerOne = this.multipleTriggerTwo = false;
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Utility;
|
||||
|
|
@ -16,9 +17,9 @@ namespace Dalamud.Interface.Style
|
|||
/// </summary>
|
||||
public abstract class StyleModel
|
||||
{
|
||||
private static int NumPushedStyles = 0;
|
||||
private static int NumPushedColors = 0;
|
||||
private static bool HasPushedOnce = false;
|
||||
private static int numPushedStyles = 0;
|
||||
private static int numPushedColors = 0;
|
||||
private static bool hasPushedOnce = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the style model.
|
||||
|
|
@ -130,11 +131,11 @@ namespace Dalamud.Interface.Style
|
|||
/// </summary>
|
||||
public void Pop()
|
||||
{
|
||||
if (!HasPushedOnce)
|
||||
if (!hasPushedOnce)
|
||||
throw new InvalidOperationException("Wasn't pushed at least once.");
|
||||
|
||||
ImGui.PopStyleVar(NumPushedStyles);
|
||||
ImGui.PopStyleColor(NumPushedColors);
|
||||
ImGui.PopStyleVar(numPushedStyles);
|
||||
ImGui.PopStyleColor(numPushedColors);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -146,8 +147,8 @@ namespace Dalamud.Interface.Style
|
|||
{
|
||||
ImGui.PushStyleVar(style, arg);
|
||||
|
||||
if (!HasPushedOnce)
|
||||
NumPushedStyles++;
|
||||
if (!hasPushedOnce)
|
||||
numPushedStyles++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -159,8 +160,8 @@ namespace Dalamud.Interface.Style
|
|||
{
|
||||
ImGui.PushStyleVar(style, arg);
|
||||
|
||||
if (!HasPushedOnce)
|
||||
NumPushedStyles++;
|
||||
if (!hasPushedOnce)
|
||||
numPushedStyles++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -172,8 +173,8 @@ namespace Dalamud.Interface.Style
|
|||
{
|
||||
ImGui.PushStyleColor(color, value);
|
||||
|
||||
if (!HasPushedOnce)
|
||||
NumPushedColors++;
|
||||
if (!hasPushedOnce)
|
||||
numPushedColors++;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -181,7 +182,7 @@ namespace Dalamud.Interface.Style
|
|||
/// </summary>
|
||||
protected void DonePushing()
|
||||
{
|
||||
HasPushedOnce = true;
|
||||
hasPushedOnce = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.IoC.Internal;
|
||||
using ImGuiScene;
|
||||
|
|
@ -202,14 +203,6 @@ namespace Dalamud.Interface
|
|||
/// </summary>
|
||||
internal Guid Id { get; init; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>
|
||||
/// Trigger the action associated with this entry.
|
||||
/// </summary>
|
||||
internal void Trigger()
|
||||
{
|
||||
this.onTriggered();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int CompareTo(TitleScreenMenuEntry? other)
|
||||
{
|
||||
|
|
@ -235,6 +228,14 @@ namespace Dalamud.Interface
|
|||
return string.Compare(this.Name, other.Name, StringComparison.InvariantCultureIgnoreCase);
|
||||
return string.Compare(this.Name, other.Name, StringComparison.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger the action associated with this entry.
|
||||
/// </summary>
|
||||
internal void Trigger()
|
||||
{
|
||||
this.onTriggered();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dalamud.Configuration.Internal;
|
||||
using Dalamud.Game;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue