mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Simplify ImGuiListClipper initialization
This commit is contained in:
parent
d25b16aa93
commit
a1b8dbcf27
7 changed files with 12 additions and 31 deletions
|
|
@ -381,11 +381,7 @@ public partial class FileDialog
|
|||
|
||||
if (this.filteredFiles.Count > 0)
|
||||
{
|
||||
ImGuiListClipperPtr clipper;
|
||||
unsafe
|
||||
{
|
||||
clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
}
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
|
||||
lock (this.filesLock)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ public sealed class SingleFontChooserDialog : IDisposable
|
|||
|
||||
if (ImGui.BeginChild("##familyList", ImGui.GetContentRegionAvail()))
|
||||
{
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
var lineHeight = ImGui.GetTextLineHeightWithSpacing();
|
||||
|
||||
if ((changed || this.firstDrawAfterRefresh) && this.selectedFamilyIndex != -1)
|
||||
|
|
@ -856,7 +856,7 @@ public sealed class SingleFontChooserDialog : IDisposable
|
|||
|
||||
if (ImGui.BeginChild("##fontList"))
|
||||
{
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
var lineHeight = ImGui.GetTextLineHeightWithSpacing();
|
||||
|
||||
if ((changed || this.firstDrawAfterRefresh) && this.selectedFontIndex != -1)
|
||||
|
|
@ -960,7 +960,7 @@ public sealed class SingleFontChooserDialog : IDisposable
|
|||
|
||||
if (ImGui.BeginChild("##fontSizeList"))
|
||||
{
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
var lineHeight = ImGui.GetTextLineHeightWithSpacing();
|
||||
|
||||
if (changed && this.selectedFontIndex != -1)
|
||||
|
|
|
|||
|
|
@ -112,10 +112,7 @@ internal class ConsoleWindow : Window, IDisposable
|
|||
|
||||
this.configuration.DalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
|
||||
|
||||
unsafe
|
||||
{
|
||||
this.clipperPtr = new(ImGui.ImGuiListClipper());
|
||||
}
|
||||
this.clipperPtr = ImGui.ImGuiListClipper();
|
||||
}
|
||||
|
||||
/// <summary>Gets the queue where log entries that are not processed yet are stored.</summary>
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
|
|||
var addon = Service<DataManager>.GetNullable()?.GetExcelSheet<Addon>() ??
|
||||
throw new InvalidOperationException("Addon sheet not loaded.");
|
||||
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
clipper.Begin(addon.Count);
|
||||
while (clipper.Step())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -449,7 +449,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
sortSpecs.SpecsDirty = false;
|
||||
}
|
||||
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
clipper.Begin(allBlames.Count);
|
||||
|
||||
while (clipper.Step())
|
||||
|
|
@ -538,7 +538,7 @@ internal class TexWidget : IDataWindowWidget
|
|||
(ImGui.GetStyle().ItemSpacing.X * 1 * numIcons));
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
clipper.Begin(textures.Count);
|
||||
|
||||
using (var enu = textures.GetEnumerator())
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ internal class UiColorWidget : IDataWindowWidget
|
|||
ImGui.TableSetupColumn("Clear Blue", ImGuiTableColumnFlags.WidthFixed, colorw);
|
||||
ImGui.TableHeadersRow();
|
||||
|
||||
var clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
clipper.Begin(colors.Count, ImGui.GetFrameHeightWithSpacing());
|
||||
while (clipper.Step())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,11 +34,7 @@ public static class ImGuiClip
|
|||
// Uses ImGuiListClipper and thus handles start- and end-dummies itself.
|
||||
public static void ClippedDraw<T>(IReadOnlyList<T> data, Action<T> draw, float lineHeight)
|
||||
{
|
||||
ImGuiListClipperPtr clipper;
|
||||
unsafe
|
||||
{
|
||||
clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
}
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
|
||||
clipper.Begin(data.Count, lineHeight);
|
||||
while (clipper.Step())
|
||||
|
|
@ -69,11 +65,7 @@ public static class ImGuiClip
|
|||
/// <typeparam name="T">The type of data to draw.</typeparam>
|
||||
public static void ClippedDraw<T>(IReadOnlyList<T> data, Action<T> draw, int itemsPerLine, float lineHeight)
|
||||
{
|
||||
ImGuiListClipperPtr clipper;
|
||||
unsafe
|
||||
{
|
||||
clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
}
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
|
||||
var maxRows = (int)MathF.Ceiling((float)data.Count / itemsPerLine);
|
||||
|
||||
|
|
@ -113,11 +105,7 @@ public static class ImGuiClip
|
|||
// Uses ImGuiListClipper and thus handles start- and end-dummies itself, but acts on type and index.
|
||||
public static void ClippedDraw<T>(IReadOnlyList<T> data, Action<T, int> draw, float lineHeight)
|
||||
{
|
||||
ImGuiListClipperPtr clipper;
|
||||
unsafe
|
||||
{
|
||||
clipper = new ImGuiListClipperPtr(ImGui.ImGuiListClipper());
|
||||
}
|
||||
var clipper = ImGui.ImGuiListClipper();
|
||||
|
||||
clipper.Begin(data.Count, lineHeight);
|
||||
while (clipper.Step())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue