Manual overloads for ImGui functions accepting text (#2319)

* wip2

* Implement AutoUtf8Buffer

* reformat

* Work on manual bindings

* restructure

* Name scripts properly

* Update utility functions to use ImU8String

* add overloads

* Add more overloads

* Use ImGuiWindow from gen, support AddCallback

* Use LibraryImport for custom ImGuiNative functinos

* Make manual overloads for string-returning functinos

* Make all overloads with self as its first parameter extension methods

* Fix overload resolution by removing unnecessary

* in => scoped in

* Fix compilation errors
This commit is contained in:
srkizer 2025-08-05 03:14:00 +09:00 committed by GitHub
parent 0c63541864
commit c69329f592
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
293 changed files with 61312 additions and 754 deletions

View file

@ -87,7 +87,7 @@ internal unsafe class UiDebug
var addonName = atkUnitBase->NameString;
var agent = Service<GameGui>.Get().FindAgentInterface(atkUnitBase);
ImGui.Text($"{addonName}");
ImGui.Text(addonName);
ImGui.SameLine();
ImGui.PushStyleColor(ImGuiCol.Text, isVisible ? 0xFF00FF00 : 0xFF0000FF);
ImGui.Text(isVisible ? "Visible" : "Not Visible");
@ -211,7 +211,7 @@ internal unsafe class UiDebug
ImGui.SameLine();
Service<SeStringRenderer>.Get().Draw(textNode->NodeText);
ImGui.InputText($"Replace Text##{(ulong)textNode:X}", textNode->NodeText.StringPtr, (uint)textNode->NodeText.BufSize);
ImGui.InputText($"Replace Text##{(ulong)textNode:X}", new(textNode->NodeText.StringPtr, (int)textNode->NodeText.BufSize));
ImGui.SameLine();
if (ImGui.Button($"Encode##{(ulong)textNode:X}"))

View file

@ -1,3 +1,5 @@
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Internal.UiDebug2.Utility;
using Dalamud.Interface.Utility.Raii;
@ -110,7 +112,7 @@ public unsafe partial class AddonTree
}
catch (Exception ex)
{
ImGui.TextColored(new(1, 0, 0, 1), $"{ex}");
ImGui.TextColored(new Vector4(1, 0, 0, 1), $"{ex}");
}
}
}

View file

@ -121,7 +121,7 @@ public unsafe partial class AddonTree : IDisposable
ImGui.SameLine();
ImGui.SameLine();
ImGui.TextColored(isVisible ? new(0.1f, 1f, 0.1f, 1f) : new(0.6f, 0.6f, 0.6f, 1), isVisible ? "Visible" : "Not Visible");
ImGui.TextColored(isVisible ? new Vector4(0.1f, 1f, 0.1f, 1f) : new(0.6f, 0.6f, 0.6f, 1), isVisible ? "Visible" : "Not Visible");
ImGui.SameLine(ImGui.GetWindowWidth() - 100);

View file

@ -57,11 +57,11 @@ public static class Events
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{evt->State.StateFlags}");
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{evt->State.UnkFlags1}");
ImGui.TextUnformatted($"{evt->State.ReturnFlags}");
ImGui.TableNextColumn();
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Target:X}", null, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Target:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGui.TableNextColumn();
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Listener:X}", null, new Vector4(0.6f, 0.6f, 0.6f, 1));
ImGuiHelpers.ClickToCopyText($"{(nint)evt->Listener:X}", default, new Vector4(0.6f, 0.6f, 0.6f, 1));
evt = evt->NextEvent;
}
}

View file

@ -321,7 +321,7 @@ internal unsafe partial class TextNodeTree
ImGui.Text("Font:");
ImGui.TableNextColumn();
ImGui.SetNextItemWidth(150);
if (ImGui.Combo($"##{(nint)this.Node:X}fontType", ref fontIndex, FontNames, FontList.Count))
if (ImGui.Combo($"##{(nint)this.Node:X}fontType", ref fontIndex, FontNames))
{
this.TxtNode->FontType = FontList[fontIndex];
}

View file

@ -226,13 +226,13 @@ internal unsafe partial class ImageNodeTree : ResNodeTree
ImGui.TableNextColumn();
ImGui.TextColored(!hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t");
ImGui.TextColored(!hiRes ? new Vector4(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t");
ImGui.SameLine();
var cursX = ImGui.GetCursorPosX();
PrintPartCoords(u / 2f, v / 2f, width / 2f, height / 2f);
ImGui.TextColored(hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t");
ImGui.TextColored(hiRes ? new Vector4(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t");
ImGui.SameLine();
ImGui.SetCursorPosX(cursX);

View file

@ -1,3 +1,4 @@
using System.Numerics;
using System.Runtime.InteropServices;
using Dalamud.Bindings.ImGui;
@ -46,7 +47,7 @@ internal unsafe partial class TextNodeTree : ResNodeTree
return;
}
ImGui.TextColored(new(1), "Text:");
ImGui.TextColored(new Vector4(1), "Text:");
ImGui.SameLine();
try

View file

@ -74,7 +74,7 @@ public readonly unsafe partial struct TimelineTree
("Frame Time", $"{this.NodeTimeline->FrameTime:F2} ({this.NodeTimeline->FrameTime * 30:F0})"));
PrintFieldValuePairs(("Active Label Id", $"{this.NodeTimeline->ActiveLabelId}"), ("Duration", $"{this.NodeTimeline->LabelFrameIdxDuration}"), ("End Frame", $"{this.NodeTimeline->LabelEndFrameIdx}"));
ImGui.TextColored(new(0.6f, 0.6f, 0.6f, 1), "Animation List");
ImGui.TextColored(new Vector4(0.6f, 0.6f, 0.6f, 1), "Animation List");
for (var a = 0; a < animationCount; a++)
{

View file

@ -28,7 +28,7 @@ internal static class Gui
var grey60 = new Vector4(0.6f, 0.6f, 0.6f, 1);
if (copy)
{
ImGuiHelpers.ClickToCopyText(value, null, grey60);
ImGuiHelpers.ClickToCopyText(value, default, grey60);
}
else
{

View file

@ -68,7 +68,7 @@ public class BranchSwitcherWindow : Window
var si = Service<Dalamud>.Get().StartInfo;
var itemsArray = this.branches.Select(x => x.Key).ToArray();
ImGui.ListBox("Branch", ref this.selectedBranchIndex, itemsArray, itemsArray.Length);
ImGui.ListBox("Branch", ref this.selectedBranchIndex, itemsArray);
var pickedBranch = this.branches.ElementAt(this.selectedBranchIndex);

View file

@ -835,11 +835,9 @@ internal class ConsoleWindow : Window, IDisposable
}
}
private unsafe int CommandInputCallback(ImGuiInputTextCallbackData* data)
private int CommandInputCallback(ref ImGuiInputTextCallbackData data)
{
var ptr = new ImGuiInputTextCallbackDataPtr(data);
switch (data->EventFlag)
switch (data.EventFlag)
{
case ImGuiInputTextFlags.CallbackEdit:
this.completionZipText = null;
@ -847,9 +845,7 @@ internal class ConsoleWindow : Window, IDisposable
break;
case ImGuiInputTextFlags.CallbackCompletion:
var textBytes = new byte[data->BufTextLen];
Marshal.Copy((IntPtr)data->Buf, textBytes, 0, data->BufTextLen);
var text = Encoding.UTF8.GetString(textBytes);
var text = Encoding.UTF8.GetString(data.BufTextSpan);
var words = text.Split();
@ -894,8 +890,8 @@ internal class ConsoleWindow : Window, IDisposable
if (toComplete != null)
{
ptr.DeleteChars(0, ptr.BufTextLen);
ptr.InsertChars(0, toComplete);
data.DeleteChars(0, data.BufTextLen);
data.InsertChars(0, toComplete);
}
}
@ -904,14 +900,14 @@ internal class ConsoleWindow : Window, IDisposable
case ImGuiInputTextFlags.CallbackHistory:
var prevPos = this.historyPos;
if (ptr.EventKey == ImGuiKey.UpArrow)
if (data.EventKey == ImGuiKey.UpArrow)
{
if (this.historyPos == -1)
this.historyPos = this.configuration.LogCommandHistory.Count - 1;
else if (this.historyPos > 0)
this.historyPos--;
}
else if (data->EventKey == ImGuiKey.DownArrow)
else if (data.EventKey == ImGuiKey.DownArrow)
{
if (this.historyPos != -1)
{
@ -926,8 +922,8 @@ internal class ConsoleWindow : Window, IDisposable
{
var historyStr = this.historyPos >= 0 ? this.configuration.LogCommandHistory[this.historyPos] : string.Empty;
ptr.DeleteChars(0, ptr.BufTextLen);
ptr.InsertChars(0, historyStr);
data.DeleteChars(0, data.BufTextLen);
data.InsertChars(0, historyStr);
}
break;

View file

@ -49,7 +49,7 @@ internal static class DataWindowWidgetExtensions
{
ImGui.SetClipboardText(s);
Service<NotificationManager>.Get().AddNotification(
$"Copied {ImGui.TableGetColumnNameS()} to clipboard.",
$"Copied {ImGui.TableGetColumnName()} to clipboard.",
widget.DisplayName,
NotificationType.Success);
}

View file

@ -120,23 +120,13 @@ internal class DataShareWidget : IDataWindowWidget
ImGui.SameLine();
if (ImGui.Button("Copy"))
{
fixed (byte* pData = data)
ImGui.SetClipboardText(pData);
}
ImGui.SetClipboardText(data);
fixed (byte* pLabel = "text"u8)
fixed (byte* pData = data)
{
ImGui.InputTextMultiline(
pLabel,
pData,
(uint)data.Length,
ImGui.GetContentRegionAvail(),
ImGuiInputTextFlags.ReadOnly,
null,
null);
}
ImGui.InputTextMultiline(
"text"u8,
data,
ImGui.GetContentRegionAvail(),
ImGuiInputTextFlags.ReadOnly);
}
this.nextTab = -1;
@ -243,7 +233,7 @@ internal class DataShareWidget : IDataWindowWidget
{
ImGui.SetClipboardText(tooltip?.Invoke() ?? s);
Service<NotificationManager>.Get().AddNotification(
$"Copied {ImGui.TableGetColumnNameS()} to clipboard.",
$"Copied {ImGui.TableGetColumnName()} to clipboard.",
this.DisplayName,
NotificationType.Success);
}

View file

@ -69,7 +69,7 @@ internal class FontAwesomeTestWidget : IDataWindowWidget
ImGui.SetNextItemWidth(160f);
var categoryIndex = this.selectedIconCategory;
if (ImGui.Combo("####FontAwesomeCategorySearch", ref categoryIndex, this.iconCategories, this.iconCategories.Length))
if (ImGui.Combo("####FontAwesomeCategorySearch", ref categoryIndex, this.iconCategories))
{
this.selectedIconCategory = categoryIndex;
this.iconSearchChanged = true;

View file

@ -61,58 +61,25 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
public unsafe void Draw()
{
ImGui.AlignTextToFramePadding();
if (ImGui.Combo("Global Scale per Font", ref this.fontScaleMode, FontScaleModes, FontScaleModes.Length))
if (ImGui.Combo("Global Scale per Font"u8, ref this.fontScaleMode, FontScaleModes))
this.ClearAtlas();
if (ImGui.Checkbox("Global Scale for Atlas"u8, ref this.atlasScaleMode))
this.ClearAtlas();
fixed (byte* labelPtr = "Global Scale for Atlas"u8)
{
var v = this.atlasScaleMode;
if (ImGui.Checkbox(labelPtr, ref v))
{
this.atlasScaleMode = v;
this.ClearAtlas();
}
}
ImGui.SameLine();
fixed (byte* labelPtr = "Word Wrap"u8)
{
var v = this.useWordWrap;
if (ImGui.Checkbox(labelPtr, &v))
this.useWordWrap = v;
}
ImGui.Checkbox("Word Wrap"u8, ref this.useWordWrap);
ImGui.SameLine();
fixed (byte* labelPtr = "Italic"u8)
{
var v = this.useItalic;
if (ImGui.Checkbox(labelPtr, &v))
{
this.useItalic = v;
this.ClearAtlas();
}
}
if (ImGui.Checkbox("Italic"u8, ref this.useItalic))
this.ClearAtlas();
ImGui.SameLine();
fixed (byte* labelPtr = "Bold"u8)
{
var v = this.useBold;
if (ImGui.Checkbox(labelPtr, &v))
{
this.useBold = v;
this.ClearAtlas();
}
}
if (ImGui.Checkbox("Bold"u8, ref this.useBold))
this.ClearAtlas();
ImGui.SameLine();
fixed (byte* labelPtr = "Minimum Range"u8)
{
var v = this.useMinimumBuild;
if (ImGui.Checkbox(labelPtr, &v))
{
this.useMinimumBuild = v;
this.ClearAtlas();
}
}
if (ImGui.Checkbox("Minimum Range"u8, ref this.useMinimumBuild))
this.ClearAtlas();
ImGui.SameLine();
if (ImGui.Button("Reset Text") || this.testStringBuffer.IsDisposed)
@ -215,12 +182,8 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
{
if (ImGui.InputTextMultiline(
labelPtr,
this.testStringBuffer.Data,
(uint)this.testStringBuffer.Capacity,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3),
0,
null,
null))
this.testStringBuffer.StorageSpan,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3)))
{
var len = this.testStringBuffer.StorageSpan.IndexOf((byte)0);
if (len + 4 >= this.testStringBuffer.Capacity)
@ -293,8 +256,7 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
}
else if (!handle.Value.Available)
{
fixed (byte* labelPtr = "Loading..."u8)
ImGui.TextUnformatted(labelPtr, labelPtr + 8 + ((Environment.TickCount / 200) % 3));
ImGui.TextUnformatted("Loading..."u8[..(8 + ((Environment.TickCount / 200) % 3))]);
}
else
{
@ -303,16 +265,12 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
if (counter++ % 2 == 0)
{
using var pushPop = handle.Value.Push();
ImGui.TextUnformatted(
this.testStringBuffer.Data,
this.testStringBuffer.Data + this.testStringBuffer.Length);
ImGui.TextUnformatted(this.testStringBuffer.DataSpan);
}
else
{
handle.Value.Push();
ImGui.TextUnformatted(
this.testStringBuffer.Data,
this.testStringBuffer.Data + this.testStringBuffer.Length);
ImGui.TextUnformatted(this.testStringBuffer.DataSpan);
handle.Value.Pop();
}
}
@ -379,12 +337,9 @@ internal class GamePrebakedFontsTestWidget : IDataWindowWidget, IDisposable
return;
unsafe void TestSingle(ImFontPtr fontPtr, IFontHandle handle)
void TestSingle(ImFontPtr fontPtr, IFontHandle handle)
{
var dim = default(Vector2);
var test = "Test string"u8;
fixed (byte* pTest = test)
ImGui.CalcTextSizeA(ref dim, fontPtr, fontPtr.FontSize, float.MaxValue, 0f, pTest, (string)null, null);
var dim = ImGui.CalcTextSizeA(fontPtr, fontPtr.FontSize, float.MaxValue, 0f, "Test string"u8, out _);
Log.Information($"{nameof(GamePrebakedFontsTestWidget)}: {handle} => {dim}");
}
}

View file

@ -73,17 +73,9 @@ internal class ImGuiWidget : IDataWindowWidget
ImGui.Checkbox("##manualType", ref this.notificationTemplate.ManualType);
ImGui.SameLine();
ImGui.Combo(
"Type##type",
ref this.notificationTemplate.TypeInt,
NotificationTemplate.TypeTitles,
NotificationTemplate.TypeTitles.Length);
ImGui.Combo("Type##type", ref this.notificationTemplate.TypeInt, NotificationTemplate.TypeTitles);
ImGui.Combo(
"Icon##iconCombo",
ref this.notificationTemplate.IconInt,
NotificationTemplate.IconTitles,
NotificationTemplate.IconTitles.Length);
ImGui.Combo("Icon##iconCombo", ref this.notificationTemplate.IconInt, NotificationTemplate.IconTitles);
switch (this.notificationTemplate.IconInt)
{
case 1 or 2:
@ -96,8 +88,7 @@ internal class ImGuiWidget : IDataWindowWidget
ImGui.Combo(
"Asset##iconAssetCombo",
ref this.notificationTemplate.IconAssetInt,
NotificationTemplate.AssetSources,
NotificationTemplate.AssetSources.Length);
NotificationTemplate.AssetSources);
break;
case 3 or 7:
ImGui.InputText(
@ -116,20 +107,17 @@ internal class ImGuiWidget : IDataWindowWidget
ImGui.Combo(
"Initial Duration",
ref this.notificationTemplate.InitialDurationInt,
NotificationTemplate.InitialDurationTitles,
NotificationTemplate.InitialDurationTitles.Length);
NotificationTemplate.InitialDurationTitles);
ImGui.Combo(
"Extension Duration",
ref this.notificationTemplate.HoverExtendDurationInt,
NotificationTemplate.HoverExtendDurationTitles,
NotificationTemplate.HoverExtendDurationTitles.Length);
NotificationTemplate.HoverExtendDurationTitles);
ImGui.Combo(
"Progress",
ref this.notificationTemplate.ProgressMode,
NotificationTemplate.ProgressModeTitles,
NotificationTemplate.ProgressModeTitles.Length);
NotificationTemplate.ProgressModeTitles);
ImGui.Checkbox("Respect UI Hidden", ref this.notificationTemplate.RespectUiHidden);

View file

@ -89,7 +89,7 @@ internal class NounProcessorWidget : IDataWindowWidget
var language = this.languages[this.selectedLanguageIndex];
ImGui.SetNextItemWidth(300);
if (ImGui.Combo("###SelectedSheetName", ref this.selectedSheetNameIndex, NounSheets.Select(t => t.Name).ToArray(), NounSheets.Length))
if (ImGui.Combo("###SelectedSheetName", ref this.selectedSheetNameIndex, NounSheets.Select(t => t.Name).ToArray()))
{
this.rowId = 1;
}
@ -97,7 +97,7 @@ internal class NounProcessorWidget : IDataWindowWidget
ImGui.SameLine();
ImGui.SetNextItemWidth(120);
if (ImGui.Combo("###SelectedLanguage", ref this.selectedLanguageIndex, this.languageNames, this.languageNames.Length))
if (ImGui.Combo("###SelectedLanguage", ref this.selectedLanguageIndex, this.languageNames))
{
language = this.languages[this.selectedLanguageIndex];
this.rowId = 1;
@ -107,7 +107,7 @@ internal class NounProcessorWidget : IDataWindowWidget
var sheet = dataManager.Excel.GetSheet<RawRow>(Language.English, sheetType.Name);
var minRowId = (int)sheet.FirstOrDefault().RowId;
var maxRowId = (int)sheet.LastOrDefault().RowId;
if (ImGui.InputInt("RowId###RowId", ref this.rowId, 1, 10, ImGuiInputTextFlags.AutoSelectAll))
if (ImGui.InputInt("RowId###RowId", ref this.rowId, 1, 10, flags: ImGuiInputTextFlags.AutoSelectAll))
{
if (this.rowId < minRowId)
this.rowId = minRowId;
@ -120,7 +120,7 @@ internal class NounProcessorWidget : IDataWindowWidget
ImGui.TextUnformatted($"(Range: {minRowId} - {maxRowId})");
ImGui.SetNextItemWidth(120);
if (ImGui.InputInt("Amount###Amount", ref this.amount, 1, 10, ImGuiInputTextFlags.AutoSelectAll))
if (ImGui.InputInt("Amount###Amount", ref this.amount, 1, 10, flags: ImGuiInputTextFlags.AutoSelectAll))
{
if (this.amount <= 0)
this.amount = 1;

View file

@ -568,7 +568,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
}
}).OrderBy(sheetName => sheetName, StringComparer.InvariantCulture).ToArray();
var sheetChanged = ImGui.Combo("Sheet Name", ref this.importSelectedSheetName, this.validImportSheetNames, this.validImportSheetNames.Length);
var sheetChanged = ImGui.Combo("Sheet Name", ref this.importSelectedSheetName, this.validImportSheetNames);
try
{
@ -683,7 +683,7 @@ internal class SeStringCreatorWidget : IDataWindowWidget
ImGui.TableNextColumn(); // Type
var type = (int)entry.Type;
ImGui.SetNextItemWidth(-1);
if (ImGui.Combo($"##Type{i}", ref type, ["String", "Macro", "Fixed"], 3))
if (ImGui.Combo($"##Type{i}", ref type, ["String", "Macro", "Fixed"]))
{
entry.Type = (TextEntryType)type;
updateString |= true;

View file

@ -115,7 +115,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
ImGui.SameLine();
var t4 = this.style.ThemeIndex ?? AtkStage.Instance()->AtkUIColorHolder->ActiveColorThemeType;
ImGui.PushItemWidth(ImGui.CalcTextSize("WWWWWWWWWWWWWW").X);
if (ImGui.Combo("##theme", ref t4, ThemeNames, ThemeNames.Length))
if (ImGui.Combo("##theme", ref t4, ThemeNames))
this.style.ThemeIndex = t4;
ImGui.SameLine();
@ -265,12 +265,8 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
{
if (ImGui.InputTextMultiline(
labelPtr,
this.testStringBuffer.Data,
(uint)this.testStringBuffer.Capacity,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3),
0,
null,
null))
this.testStringBuffer.StorageSpan,
new(ImGui.GetContentRegionAvail().X, ImGui.GetTextLineHeight() * 3)))
{
var len = this.testStringBuffer.StorageSpan.IndexOf((byte)0);
if (len + 4 >= this.testStringBuffer.Capacity)
@ -278,7 +274,7 @@ internal unsafe class SeStringRendererTestWidget : IDataWindowWidget
if (len < this.testStringBuffer.Capacity)
{
this.testStringBuffer.LengthUnsafe = len;
this.testStringBuffer.StorageSpan[len] = default;
this.testStringBuffer.StorageSpan[len] = 0;
}
this.testString = string.Empty;

View file

@ -243,8 +243,8 @@ internal class TaskSchedulerWidget : IDataWindowWidget
if (ImGui.CollapsingHeader("Download"))
{
ImGui.InputText("URL", ref this.url, (uint)this.url.Length);
ImGui.InputText("Local Path", ref this.localPath, (uint)this.localPath.Length);
ImGui.InputText("URL", ref this.url);
ImGui.InputText("Local Path", ref this.localPath);
ImGui.SameLine();
if (ImGuiComponents.IconButton("##localpathpicker", FontAwesomeIcon.File))

View file

@ -71,7 +71,7 @@ internal class TexWidget : IDataWindowWidget
private enum DrawBlameTableColumnUserId
{
NativeAddress,
NativeAddress = 1,
Actions,
Name,
Width,
@ -231,7 +231,7 @@ internal class TexWidget : IDataWindowWidget
ImGui.PopID();
}
if (ImGui.CollapsingHeader($"CropCopy##{this.DrawExistingTextureModificationArgs}"))
if (ImGui.CollapsingHeader($"CropCopy##{nameof(this.DrawExistingTextureModificationArgs)}"))
{
ImGui.PushID(nameof(this.DrawExistingTextureModificationArgs));
this.DrawExistingTextureModificationArgs();
@ -709,8 +709,7 @@ internal class TexWidget : IDataWindowWidget
if (ImGui.Combo(
"Assembly",
ref this.inputManifestResourceAssemblyIndex,
this.inputManifestResourceAssemblyCandidateNames,
this.inputManifestResourceAssemblyCandidateNames.Length))
this.inputManifestResourceAssemblyCandidateNames))
{
this.inputManifestResourceNameIndex = 0;
this.inputManifestResourceNameCandidates = null;
@ -727,8 +726,7 @@ internal class TexWidget : IDataWindowWidget
ImGui.Combo(
"Name",
ref this.inputManifestResourceNameIndex,
this.inputManifestResourceNameCandidates,
this.inputManifestResourceNameCandidates.Length);
this.inputManifestResourceNameCandidates);
var name =
this.inputManifestResourceNameIndex >= 0
@ -844,15 +842,14 @@ internal class TexWidget : IDataWindowWidget
ImGui.Combo(
nameof(this.textureModificationArgs.DxgiFormat),
ref this.renderTargetChoiceInt,
this.supportedRenderTargetFormatNames,
this.supportedRenderTargetFormatNames.Length);
this.supportedRenderTargetFormatNames);
Span<int> wh = stackalloc int[2];
wh[0] = this.textureModificationArgs.NewWidth;
wh[1] = this.textureModificationArgs.NewHeight;
if (ImGui.InputInt2(
if (ImGui.InputInt(
$"{nameof(this.textureModificationArgs.NewWidth)}/{nameof(this.textureModificationArgs.NewHeight)}",
ref wh[0]))
wh))
{
this.textureModificationArgs.NewWidth = wh[0];
this.textureModificationArgs.NewHeight = wh[1];

View file

@ -41,9 +41,9 @@ internal class ToastWidget : IDataWindowWidget
ImGui.InputText("Toast text", ref this.inputTextToast, 200);
ImGui.Combo("Toast Position", ref this.toastPosition, new[] { "Bottom", "Top", }, 2);
ImGui.Combo("Toast Speed", ref this.toastSpeed, new[] { "Slow", "Fast", }, 2);
ImGui.Combo("Quest Toast Position", ref this.questToastPosition, new[] { "Centre", "Right", "Left" }, 3);
ImGui.Combo("Toast Position", ref this.toastPosition, ["Bottom", "Top"]);
ImGui.Combo("Toast Speed", ref this.toastSpeed, ["Slow", "Fast"]);
ImGui.Combo("Quest Toast Position", ref this.questToastPosition, ["Centre", "Right", "Left"]);
ImGui.Checkbox("Quest Checkmark", ref this.questToastCheckmark);
ImGui.Checkbox("Quest Play Sound", ref this.questToastSound);
ImGui.InputInt("Quest Icon ID", ref this.questToastIconId);

View file

@ -101,7 +101,7 @@ internal class UldWidget : IDataWindowWidget
}
var selectedUldPrev = this.selectedUld;
ImGui.Combo("##selectUld", ref this.selectedUld, uldNames, uldNames.Length);
ImGui.Combo("##selectUld", ref this.selectedUld, uldNames);
ImGui.SameLine();
if (ImGuiComponents.IconButton("selectUldLeft", FontAwesomeIcon.AngleLeft))
this.selectedUld = ((this.selectedUld + uldNames.Length) - 1) % uldNames.Length;
@ -117,7 +117,7 @@ internal class UldWidget : IDataWindowWidget
ClearTask(ref this.selectedUldFileTask);
}
ImGui.Combo("##selectTheme", ref this.selectedTheme, ThemeDisplayNames, ThemeDisplayNames.Length);
ImGui.Combo("##selectTheme", ref this.selectedTheme, ThemeDisplayNames);
ImGui.SameLine();
if (ImGuiComponents.IconButton("selectThemeLeft", FontAwesomeIcon.AngleLeft))
this.selectedTheme = ((this.selectedTheme + ThemeDisplayNames.Length) - 1) % ThemeDisplayNames.Length;

View file

@ -174,7 +174,7 @@ internal class ProfileManagerWidget
{
try
{
profman.ImportProfile(ImGui.GetClipboardTextS());
profman.ImportProfile(ImGui.GetClipboardText());
Service<NotificationManager>.Get().AddNotification(Locs.NotificationImportSuccess, type: NotificationType.Success);
}
catch (Exception ex)

View file

@ -210,7 +210,8 @@ public class SettingsTabLook : SettingsTab
var len = Encoding.UTF8.GetByteCount(buildingFonts);
var p = stackalloc byte[len];
Encoding.UTF8.GetBytes(buildingFonts, new(p, len));
ImGui.TextUnformatted(p, (p + len + ((Environment.TickCount / 200) % 3)) - 2);
ImGui.TextUnformatted(
new ReadOnlySpan<byte>(p, len)[..((len + ((Environment.TickCount / 200) % 3)) - 2)]);
}
}

View file

@ -70,7 +70,7 @@ public sealed class LanguageChooserSettingsEntry : SettingsEntry
public override void Draw()
{
ImGui.Text(this.Name);
ImGui.Combo("##XlLangCombo", ref this.langIndex, this.locLanguages, this.locLanguages.Length);
ImGui.Combo("##XlLangCombo", ref this.langIndex, this.locLanguages);
ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsLanguageHint", "Select the language Dalamud will be displayed in."));
}
}

View file

@ -84,7 +84,7 @@ public class StyleEditorWindow : Window
var styleAry = config.SavedStyles.Select(x => x.Name).ToArray();
ImGui.Text(Loc.Localize("StyleEditorChooseStyle", "Choose Style:"));
if (ImGui.Combo("###styleChooserCombo", ref this.currentSel, styleAry, styleAry.Length))
if (ImGui.Combo("###styleChooserCombo", ref this.currentSel, styleAry))
{
var newStyle = config.SavedStyles[this.currentSel];
newStyle.Apply();
@ -166,7 +166,7 @@ public class StyleEditorWindow : Window
{
this.SaveStyle();
var styleJson = ImGui.GetClipboardTextS();
var styleJson = ImGui.GetClipboardText();
try
{
@ -245,7 +245,7 @@ public class StyleEditorWindow : Window
ImGui.Text("Alignment");
ImGui.SliderFloat2("WindowTitleAlign", ref style.WindowTitleAlign, 0.0f, 1.0f, "%.2f");
var windowMenuButtonPosition = (int)style.WindowMenuButtonPosition + 1;
if (ImGui.Combo("WindowMenuButtonPosition", ref windowMenuButtonPosition, "None\0Left\0Right\0"))
if (ImGui.Combo("WindowMenuButtonPosition", ref windowMenuButtonPosition, ["None", "Left", "Right"]))
style.WindowMenuButtonPosition = (ImGuiDir)(windowMenuButtonPosition - 1);
ImGui.SliderFloat2("ButtonTextAlign", ref style.ButtonTextAlign, 0.0f, 1.0f, "%.2f");
ImGui.SameLine();