From df1a9cfdcdba47c847d855183ea7d175e808e14f Mon Sep 17 00:00:00 2001 From: Infi Date: Tue, 17 Dec 2024 14:29:02 +0100 Subject: [PATCH 1/2] - Remove formatted imgui function usage - Change existing safe function - Add new safe function --- .../Components/ImGuiComponents.HelpMarker.cs | 3 +- .../Components/ImGuiComponents.Test.cs | 2 +- .../ImGuiComponents.TextWithLabel.cs | 6 +- .../Interface/Internal/DalamudInterface.cs | 36 +-- Dalamud/Interface/Internal/UiDebug.cs | 78 +++---- .../UiDebug2/Browsing/AddonTree.AtkValues.cs | 15 +- .../Internal/UiDebug2/Browsing/AddonTree.cs | 3 +- .../UiDebug2/Browsing/NodeTree.Editor.cs | 34 +-- .../UiDebug2/Browsing/NodeTree.Image.cs | 13 +- .../UiDebug2/Browsing/NodeTree.NineGrid.cs | 5 +- .../UiDebug2/Browsing/NodeTree.Res.cs | 7 +- .../UiDebug2/Browsing/NodeTree.Text.cs | 3 +- .../Browsing/TimelineTree.KeyGroupColumn.cs | 4 +- .../UiDebug2/Browsing/TimelineTree.cs | 2 +- .../Internal/UiDebug2/ElementSelector.cs | 11 +- .../Internal/UiDebug2/Utility/Gui.cs | 2 +- .../Internal/Windows/BranchSwitcherWindow.cs | 8 +- .../Internal/Windows/ChangelogWindow.cs | 178 +++++++------- .../Internal/Windows/ColorDemoWindow.cs | 5 +- .../Internal/Windows/ComponentDemoWindow.cs | 12 +- .../Internal/Windows/ConsoleWindow.cs | 40 ++-- .../Data/DataWindowWidgetExtensions.cs | 3 +- .../Data/Widgets/AddonLifecycleWidget.cs | 40 ++-- .../Windows/Data/Widgets/AddonWidget.cs | 4 +- .../Windows/Data/Widgets/AddressesWidget.cs | 9 +- .../Windows/Data/Widgets/BuddyListWidget.cs | 22 +- .../Windows/Data/Widgets/CommandWidget.cs | 23 +- .../Windows/Data/Widgets/ConditionWidget.cs | 12 +- .../Windows/Data/Widgets/DataShareWidget.cs | 4 +- .../Windows/Data/Widgets/DtrBarWidget.cs | 10 +- .../Data/Widgets/FontAwesomeTestWidget.cs | 16 +- .../Windows/Data/Widgets/GamepadWidget.cs | 46 ++-- .../Windows/Data/Widgets/GaugeWidget.cs | 8 +- .../Windows/Data/Widgets/HookWidget.cs | 12 +- .../Windows/Data/Widgets/IconBrowserWidget.cs | 8 +- .../Windows/Data/Widgets/ImGuiWidget.cs | 9 +- .../Windows/Data/Widgets/KeyStateWidget.cs | 6 +- .../Windows/Data/Widgets/ObjectTableWidget.cs | 12 +- .../Windows/Data/Widgets/PartyListWidget.cs | 18 +- .../Windows/Data/Widgets/PluginIpcWidget.cs | 18 +- .../Windows/Data/Widgets/ServicesWidget.cs | 26 +-- .../Windows/Data/Widgets/StartInfoWidget.cs | 6 +- .../Windows/Data/Widgets/TargetWidget.cs | 18 +- .../Data/Widgets/TaskSchedulerWidget.cs | 28 +-- .../PluginInstaller/PluginInstallerWindow.cs | 217 +++++++++--------- .../PluginInstaller/ProfileManagerWidget.cs | 48 ++-- .../Internal/Windows/PluginStatWindow.cs | 31 +-- .../Internal/Windows/ProfilerWindow.cs | 14 +- .../AgingSteps/ActorTableAgingStep.cs | 2 +- .../AgingSteps/AddonLifecycleAgingStep.cs | 34 +-- .../AgingSteps/AetheryteListAgingStep.cs | 2 +- .../SelfTest/AgingSteps/ChatAgingStep.cs | 2 +- .../SelfTest/AgingSteps/ConditionAgingStep.cs | 2 +- .../AgingSteps/ContextMenuAgingStep.cs | 12 +- .../SelfTest/AgingSteps/DutyStateAgingStep.cs | 2 +- .../SelfTest/AgingSteps/FateTableAgingStep.cs | 4 +- .../AgingSteps/GameConfigAgingStep.cs | 8 +- .../AgingSteps/GamepadStateAgingStep.cs | 2 +- .../SelfTest/AgingSteps/HoverAgingStep.cs | 4 +- .../AgingSteps/ItemPayloadAgingStep.cs | 12 +- .../SelfTest/AgingSteps/KeyStateAgingStep.cs | 2 +- .../AgingSteps/LoginEventAgingStep.cs | 2 +- .../AgingSteps/LogoutEventAgingStep.cs | 2 +- .../AgingSteps/MarketBoardAgingStep.cs | 64 +++--- .../SelfTest/AgingSteps/NamePlateAgingStep.cs | 2 +- .../AgingSteps/PartyFinderAgingStep.cs | 2 +- .../SelfTest/AgingSteps/TargetAgingStep.cs | 6 +- .../Windows/SelfTest/SelfTestWindow.cs | 18 +- .../Windows/Settings/SettingsWindow.cs | 8 +- .../Windows/Settings/Tabs/SettingsTabAbout.cs | 2 +- .../Windows/Settings/Tabs/SettingsTabDtr.cs | 4 +- .../Windows/Settings/Tabs/SettingsTabLook.cs | 14 +- .../Settings/Widgets/EnumSettingsEntry{T}.cs | 4 +- .../Widgets/LanguageChooserSettingsEntry.cs | 2 +- .../Settings/Widgets/SettingsEntry{T}.cs | 4 +- .../Windows/StyleEditor/StyleEditorWindow.cs | 18 +- .../Internal/Windows/TitleScreenMenuWindow.cs | 22 +- Dalamud/Interface/UiBuilder.cs | 2 +- Dalamud/Interface/Utility/ImGuiHelpers.cs | 46 +++- Dalamud/Interface/Windowing/Window.cs | 96 ++++---- Dalamud/Utility/Util.cs | 47 ++-- 81 files changed, 814 insertions(+), 774 deletions(-) diff --git a/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs b/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs index 3392136d19..43e6e53194 100644 --- a/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs +++ b/Dalamud/Interface/Components/ImGuiComponents.HelpMarker.cs @@ -1,3 +1,4 @@ +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using FFXIVClientStructs.FFXIV.Common.Math; @@ -36,7 +37,7 @@ public static void HelpMarker(string helpText, FontAwesomeIcon icon, Vector4? co using (ImRaii.PushFont(UiBuilder.IconFont)) { - ImGui.TextDisabled(icon.ToIconString()); + ImGuiHelpers.SafeTextDisabled(icon.ToIconString()); } if (ImGui.IsItemHovered()) diff --git a/Dalamud/Interface/Components/ImGuiComponents.Test.cs b/Dalamud/Interface/Components/ImGuiComponents.Test.cs index ddc083cd86..1b912c08d7 100644 --- a/Dalamud/Interface/Components/ImGuiComponents.Test.cs +++ b/Dalamud/Interface/Components/ImGuiComponents.Test.cs @@ -12,6 +12,6 @@ public static partial class ImGuiComponents /// public static void Test() { - ImGui.Text("You are viewing the test component. The test was a success."); + ImGui.TextUnformatted("You are viewing the test component. The test was a success."); } } diff --git a/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs b/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs index 43b54fc936..6a4a8aec8c 100644 --- a/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs +++ b/Dalamud/Interface/Components/ImGuiComponents.TextWithLabel.cs @@ -17,15 +17,15 @@ public static partial class ImGuiComponents /// The hint to show on hover. public static void TextWithLabel(string label, string value, string hint = "") { - ImGui.Text(label + ": "); + ImGui.TextUnformatted(label + ": "); ImGui.SameLine(); if (string.IsNullOrEmpty(hint)) { - ImGui.Text(value); + ImGui.TextUnformatted(value); } else { - ImGui.Text(value + "*"); + ImGui.TextUnformatted(value + "*"); if (ImGui.IsItemHovered()) { using (ImRaii.Tooltip()) diff --git a/Dalamud/Interface/Internal/DalamudInterface.cs b/Dalamud/Interface/Internal/DalamudInterface.cs index a21cf20701..be93ed31c9 100644 --- a/Dalamud/Interface/Internal/DalamudInterface.cs +++ b/Dalamud/Interface/Internal/DalamudInterface.cs @@ -93,7 +93,7 @@ internal class DalamudInterface : IInternalDisposableService private bool isImPlotDrawDemoWindow = false; private bool isImGuiTestWindowsInMonospace = false; private bool isImGuiDrawMetricsWindow = false; - + [ServiceManager.ServiceConstructor] private DalamudInterface( Dalamud dalamud, @@ -116,7 +116,7 @@ private DalamudInterface( this.dataManager = dataManager; this.WindowSystem = new WindowSystem("DalamudCore"); - + this.colorDemoWindow = new ColorDemoWindow() { IsOpen = false }; this.componentDemoWindow = new ComponentDemoWindow() { IsOpen = false }; this.dataWindow = new DataWindow() { IsOpen = false }; @@ -197,7 +197,7 @@ private DalamudInterface( this.creditsDarkeningAnimation.Point1 = Vector2.Zero; this.creditsDarkeningAnimation.Point2 = new Vector2(CreditsDarkeningMaxAlpha); - + // This is temporary, until we know the repercussions of vtable hooking mode consoleManager.AddCommand( "dalamud.interface.swapchain_mode", @@ -216,14 +216,14 @@ private DalamudInterface( Log.Error("Unknown swapchain mode: {Mode}", mode); return false; } - + this.configuration.QueueSave(); return true; }); } - + private delegate nint CrashDebugDelegate(nint self); - + /// /// Gets the number of frames since Dalamud has loaded. /// @@ -323,7 +323,7 @@ public void OpenPluginStats() this.pluginStatWindow.IsOpen = true; this.pluginStatWindow.BringToFront(); } - + /// /// Opens the on the plugin installed. /// @@ -388,7 +388,7 @@ public void OpenProfiler() this.profilerWindow.IsOpen = true; this.profilerWindow.BringToFront(); } - + /// /// Opens the . /// @@ -653,7 +653,7 @@ private void DrawHiddenDevMenuOpener() ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoMouseInputs | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoSavedSettings)) { - ImGui.TextColored(ImGuiColors.DalamudRed, "Is force MinHook!"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, "Is force MinHook!"); } ImGui.End(); @@ -700,7 +700,7 @@ private void DrawDevMenu() ImGui.EndMenu(); } - + var logSynchronously = this.configuration.LogSynchronously; if (ImGui.MenuItem("Log Synchronously", null, ref logSynchronously)) { @@ -792,14 +792,14 @@ private void DrawDevMenu() } ImGui.Separator(); - + if (ImGui.BeginMenu("Crash game")) { if (ImGui.MenuItem("Access Violation")) { Marshal.ReadByte(IntPtr.Zero); - } - + } + if (ImGui.MenuItem("Set UiModule to NULL")) { unsafe @@ -808,7 +808,7 @@ private void DrawDevMenu() framework->UIModule = (UIModule*)0; } } - + if (ImGui.MenuItem("Set UiModule to invalid ptr")) { unsafe @@ -817,7 +817,7 @@ private void DrawDevMenu() framework->UIModule = (UIModule*)0x12345678; } } - + if (ImGui.MenuItem("Deref nullptr in Hook")) { unsafe @@ -832,7 +832,7 @@ private void DrawDevMenu() hook.Enable(); } } - + ImGui.EndMenu(); } @@ -848,7 +848,7 @@ private void DrawDevMenu() { this.OpenBranchSwitcher(); } - + ImGui.MenuItem(this.dalamud.StartInfo.GameVersion?.ToString() ?? "Unknown version", false); ImGui.MenuItem($"D: {Util.GetScmVersion()} CS: {Util.GetGitHashClientStructs()}[{FFXIVClientStructs.ThisAssembly.Git.Commits}]", false); ImGui.MenuItem($"CLR: {Environment.Version}", false); @@ -924,7 +924,7 @@ private void DrawDevMenu() { this.configuration.ShowDevBarInfo = !this.configuration.ShowDevBarInfo; } - + ImGui.Separator(); if (ImGui.MenuItem("Show loading window")) diff --git a/Dalamud/Interface/Internal/UiDebug.cs b/Dalamud/Interface/Internal/UiDebug.cs index 2e8f4416b0..d23022d2ee 100644 --- a/Dalamud/Interface/Internal/UiDebug.cs +++ b/Dalamud/Interface/Internal/UiDebug.cs @@ -89,10 +89,10 @@ private void DrawUnitBase(AtkUnitBase* atkUnitBase) var addonName = atkUnitBase->NameString; var agent = Service.Get().FindAgentInterface(atkUnitBase); - ImGui.Text($"{addonName}"); + ImGui.TextUnformatted($"{addonName}"); ImGui.SameLine(); ImGui.PushStyleColor(ImGuiCol.Text, isVisible ? 0xFF00FF00 : 0xFF0000FF); - ImGui.Text(isVisible ? "Visible" : "Not Visible"); + ImGui.TextUnformatted(isVisible ? "Visible" : "Not Visible"); ImGui.PopStyleColor(); ImGui.SameLine(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X - 25); @@ -106,9 +106,9 @@ private void DrawUnitBase(AtkUnitBase* atkUnitBase) ImGuiHelpers.ClickToCopyText($"Agent: {(ulong)agent:X}", $"{(ulong)agent:X}"); ImGui.Separator(); - ImGui.Text($"Position: [ {atkUnitBase->X} , {atkUnitBase->Y} ]"); - ImGui.Text($"Scale: {atkUnitBase->Scale * 100}%%"); - ImGui.Text($"Widget Count {atkUnitBase->UldManager.ObjectCount}"); + ImGui.TextUnformatted($"Position: [ {atkUnitBase->X} , {atkUnitBase->Y} ]"); + ImGui.TextUnformatted($"Scale: {atkUnitBase->Scale * 100}%%"); + ImGui.TextUnformatted($"Widget Count {atkUnitBase->UldManager.ObjectCount}"); ImGui.Separator(); @@ -185,7 +185,7 @@ private void PrintSimpleNode(AtkResNode* node, string treePrefix) popped = true; } - ImGui.Text("Node: "); + ImGui.TextUnformatted("Node: "); ImGui.SameLine(); ImGuiHelpers.ClickToCopyText($"{(ulong)node:X}"); ImGui.SameLine(); @@ -209,7 +209,7 @@ private void PrintSimpleNode(AtkResNode* node, string treePrefix) { case NodeType.Text: var textNode = (AtkTextNode*)node; - ImGui.Text("text: "); + ImGui.TextUnformatted("text: "); ImGui.SameLine(); Service.Get().Draw(textNode->NodeText); @@ -227,7 +227,7 @@ private void PrintSimpleNode(AtkResNode* node, string treePrefix) if (ImGui.Button($"Decode##{(ulong)textNode:X}")) textNode->NodeText.SetString(new ReadOnlySeStringSpan(textNode->NodeText.StringPtr).ToString()); - ImGui.Text($"AlignmentType: {(AlignmentType)textNode->AlignmentFontType} FontSize: {textNode->FontSize}"); + ImGui.TextUnformatted($"AlignmentType: {(AlignmentType)textNode->AlignmentFontType} FontSize: {textNode->FontSize}"); int b = textNode->AlignmentFontType; if (ImGui.InputInt($"###setAlignment{(ulong)textNode:X}", ref b, 1)) { @@ -237,20 +237,20 @@ private void PrintSimpleNode(AtkResNode* node, string treePrefix) textNode->AtkResNode.DrawFlags |= 0x1; } - ImGui.Text($"Color: #{textNode->TextColor.R:X2}{textNode->TextColor.G:X2}{textNode->TextColor.B:X2}{textNode->TextColor.A:X2}"); + ImGui.TextUnformatted($"Color: #{textNode->TextColor.R:X2}{textNode->TextColor.G:X2}{textNode->TextColor.B:X2}{textNode->TextColor.A:X2}"); ImGui.SameLine(); - ImGui.Text($"EdgeColor: #{textNode->EdgeColor.R:X2}{textNode->EdgeColor.G:X2}{textNode->EdgeColor.B:X2}{textNode->EdgeColor.A:X2}"); + ImGui.TextUnformatted($"EdgeColor: #{textNode->EdgeColor.R:X2}{textNode->EdgeColor.G:X2}{textNode->EdgeColor.B:X2}{textNode->EdgeColor.A:X2}"); ImGui.SameLine(); - ImGui.Text($"BGColor: #{textNode->BackgroundColor.R:X2}{textNode->BackgroundColor.G:X2}{textNode->BackgroundColor.B:X2}{textNode->BackgroundColor.A:X2}"); + ImGui.TextUnformatted($"BGColor: #{textNode->BackgroundColor.R:X2}{textNode->BackgroundColor.G:X2}{textNode->BackgroundColor.B:X2}{textNode->BackgroundColor.A:X2}"); - ImGui.Text($"TextFlags: {textNode->TextFlags}"); + ImGui.TextUnformatted($"TextFlags: {textNode->TextFlags}"); ImGui.SameLine(); - ImGui.Text($"TextFlags2: {textNode->TextFlags2}"); + ImGui.TextUnformatted($"TextFlags2: {textNode->TextFlags2}"); break; case NodeType.Counter: var counterNode = (AtkCounterNode*)node; - ImGui.Text("text: "); + ImGui.TextUnformatted("text: "); ImGui.SameLine(); Service.Get().Draw(counterNode->NodeText); break; @@ -284,18 +284,16 @@ static void PrintTextureInfo(AtkUldPartsList* partsList, uint partId) { if (partId > partsList->PartCount) { - ImGui.Text("part id > part count?"); + ImGui.TextUnformatted("part id > part count?"); } else { var textureInfo = partsList->Parts[partId].UldAsset; var texType = textureInfo->AtkTexture.TextureType; - ImGui.Text( - $"texture type: {texType} part_id={partId} part_id_count={partsList->PartCount}"); + ImGui.TextUnformatted($"texture type: {texType} part_id={partId} part_id_count={partsList->PartCount}"); if (texType == TextureType.Resource) { - ImGui.Text( - $"texture path: {textureInfo->AtkTexture.Resource->TexFileResourceHandle->ResourceHandle.FileName}"); + ImGui.TextUnformatted($"texture path: {textureInfo->AtkTexture.Resource->TexFileResourceHandle->ResourceHandle.FileName}"); var kernelTexture = textureInfo->AtkTexture.Resource->KernelTextureObject; if (ImGui.TreeNode($"Texture##{(ulong)kernelTexture->D3D11ShaderResourceView:X}")) @@ -349,7 +347,7 @@ static void PrintTextureInfo(AtkUldPartsList* partsList, uint partId) } else { - ImGui.Text("no texture loaded"); + ImGui.TextUnformatted("no texture loaded"); } } } @@ -385,12 +383,12 @@ private void PrintComponentNode(AtkResNode* node, string treePrefix) popped = true; } - ImGui.Text("Node: "); + ImGui.TextUnformatted("Node: "); ImGui.SameLine(); ImGuiHelpers.ClickToCopyText($"{(ulong)node:X}"); ImGui.SameLine(); Util.ShowStruct(*compNode, (ulong)compNode); - ImGui.Text("Component: "); + ImGui.TextUnformatted("Component: "); ImGui.SameLine(); ImGuiHelpers.ClickToCopyText($"{(ulong)compNode->Component:X}"); ImGui.SameLine(); @@ -415,31 +413,31 @@ private void PrintComponentNode(AtkResNode* node, string treePrefix) { case ComponentType.TextInput: var textInputComponent = (AtkComponentTextInput*)compNode->Component; - ImGui.Text("InputBase Text1: "); + ImGui.TextUnformatted("InputBase Text1: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText1); - - ImGui.Text("InputBase Text2: "); + + ImGui.TextUnformatted("InputBase Text2: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->AtkComponentInputBase.UnkText2); - - ImGui.Text("Text1: "); + + ImGui.TextUnformatted("Text1: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText01); - - ImGui.Text("Text2: "); + + ImGui.TextUnformatted("Text2: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText02); - - ImGui.Text("Text3: "); + + ImGui.TextUnformatted("Text3: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText03); - - ImGui.Text("Text4: "); + + ImGui.TextUnformatted("Text4: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText04); - - ImGui.Text("Text5: "); + + ImGui.TextUnformatted("Text5: "); ImGui.SameLine(); Service.Get().Draw(textInputComponent->UnkText05); break; @@ -475,7 +473,7 @@ private void PrintComponentNode(AtkResNode* node, string treePrefix) private void PrintResNode(AtkResNode* node) { - ImGui.Text($"NodeID: {node->NodeId}"); + ImGui.TextUnformatted($"NodeID: {node->NodeId}"); ImGui.SameLine(); if (ImGui.SmallButton($"T:Visible##{(ulong)node:X}")) { @@ -488,13 +486,13 @@ private void PrintResNode(AtkResNode* node) ImGui.SetClipboardText($"{(ulong)node:X}"); } - ImGui.Text( + ImGui.TextUnformatted( $"X: {node->X} Y: {node->Y} " + $"ScaleX: {node->ScaleX} ScaleY: {node->ScaleY} " + $"Rotation: {node->Rotation} " + $"Width: {node->Width} Height: {node->Height} " + $"OriginX: {node->OriginX} OriginY: {node->OriginY}"); - ImGui.Text( + ImGui.TextUnformatted( $"RGBA: 0x{node->Color.R:X2}{node->Color.G:X2}{node->Color.B:X2}{node->Color.A:X2} " + $"AddRGB: {node->AddRed} {node->AddGreen} {node->AddBlue} " + $"MultiplyRGB: {node->MultiplyRed} {node->MultiplyGreen} {node->MultiplyBlue}"); @@ -516,7 +514,7 @@ private bool DrawUnitListHeader(int index, ushort count, ulong ptr, bool highlig ImGui.PopStyleColor(); ImGui.SameLine(); - ImGui.TextDisabled($"C:{count} {ptr:X}"); + ImGuiHelpers.SafeTextDisabled($"C:{count} {ptr:X}"); return treeNode; } @@ -605,7 +603,7 @@ private void DrawUnitBaseList() if (noResults) { - ImGui.TextDisabled("No Results"); + ImGuiHelpers.SafeTextDisabled("No Results"); } if (!foundSelected) diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs index c3930821b9..802bebf386 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.AtkValues.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.Internal.UiDebug2.Utility; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using Dalamud.Memory; using Dalamud.Utility; @@ -42,21 +43,21 @@ internal static void PrintAtkValues(AtkUnitBase* addon) ImGui.TableNextColumn(); if (atkValue->Type == 0) { - ImGui.TextDisabled($"#{i}"); + ImGuiHelpers.SafeTextDisabled($"#{i}"); } else { - ImGui.Text($"#{i}"); + ImGui.TextUnformatted($"#{i}"); } ImGui.TableNextColumn(); if (atkValue->Type == 0) { - ImGui.TextDisabled("Not Set"); + ImGuiHelpers.SafeTextDisabled("Not Set"); } else { - ImGui.Text($"{atkValue->Type}"); + ImGui.TextUnformatted($"{atkValue->Type}"); } ImGui.TableNextColumn(); @@ -78,7 +79,7 @@ internal static void PrintAtkValues(AtkUnitBase* addon) { if (atkValue->String == null) { - ImGui.TextDisabled("null"); + ImGuiHelpers.SafeTextDisabled("null"); } else { @@ -101,7 +102,7 @@ internal static void PrintAtkValues(AtkUnitBase* addon) default: { - ImGui.TextDisabled("Unhandled Type"); + ImGuiHelpers.SafeTextDisabled("Unhandled Type"); ImGui.SameLine(); Util.ShowStruct(atkValue); break; @@ -113,7 +114,7 @@ internal static void PrintAtkValues(AtkUnitBase* addon) } catch (Exception ex) { - ImGui.TextColored(new(1, 0, 0, 1), $"{ex}"); + ImGuiHelpers.SafeTextColored(new(1, 0, 0, 1), $"{ex}"); } } } diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs index 9d6575a55f..651efbcf97 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs @@ -3,6 +3,7 @@ using System.Numerics; using Dalamud.Interface.Components; +using Dalamud.Interface.Utility; using FFXIVClientStructs.FFXIV.Component.GUI; using ImGuiNET; @@ -122,7 +123,7 @@ internal void Draw() 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"); + ImGuiHelpers.SafeTextColored(isVisible ? new(0.1f, 1f, 0.1f, 1f) : new(0.6f, 0.6f, 0.6f, 1), isVisible ? "Visible" : "Not Visible"); ImGui.SameLine(ImGui.GetWindowWidth() - 100); diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs index 1f5abd0bf1..93bbf68ce0 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs @@ -56,7 +56,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Position:"); + ImGui.TextUnformatted("Position:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); @@ -71,7 +71,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Size:"); + ImGui.TextUnformatted("Size:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.DragFloat2($"##{(nint)this.Node:X}size", ref size, 1, 0, default, "%.0f")) @@ -85,7 +85,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Scale:"); + ImGui.TextUnformatted("Scale:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.DragFloat2($"##{(nint)this.Node:X}scale", ref scale, 0.05f)) @@ -99,7 +99,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Origin:"); + ImGui.TextUnformatted("Origin:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.DragFloat2($"##{(nint)this.Node:X}origin", ref origin, 1, default, default, "%.0f")) @@ -113,7 +113,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Rotation:"); + ImGui.TextUnformatted("Rotation:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); while (angle > 180) @@ -144,7 +144,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("RGBA:"); + ImGui.TextUnformatted("RGBA:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.ColorEdit4($"##{(nint)this.Node:X}RGBA", ref rgba, DisplayHex)) @@ -154,7 +154,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Multiply:"); + ImGui.TextUnformatted("Multiply:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.ColorEdit3($"##{(nint)this.Node:X}multiplyRGB", ref mult, DisplayHex)) @@ -166,7 +166,7 @@ private protected virtual void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Add:"); + ImGui.TextUnformatted("Add:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(124); @@ -204,7 +204,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Counter:"); + ImGui.TextUnformatted("Counter:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); @@ -230,7 +230,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Part Id:"); + ImGui.TextUnformatted("Part Id:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.InputInt($"##partId{(nint)this.Node:X}", ref partId, 1, 1)) @@ -263,7 +263,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Ninegrid Offsets:"); + ImGui.TextUnformatted("Ninegrid Offsets:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.DragFloat2($"##{(nint)this.Node:X}ngOffsetLR", ref lr, 1, 0)) @@ -309,7 +309,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Text:"); + ImGui.TextUnformatted("Text:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(Math.Max(ImGui.GetWindowContentRegionMax().X - ImGui.GetCursorPosX() - 50f, 150)); if (ImGui.InputText($"##{(nint)this.Node:X}textEdit", ref text, 512, EnterReturnsTrue)) @@ -319,7 +319,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Font:"); + ImGui.TextUnformatted("Font:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.Combo($"##{(nint)this.Node:X}fontType", ref fontIndex, FontNames, FontList.Count)) @@ -329,7 +329,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Font Size:"); + ImGui.TextUnformatted("Font Size:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.InputInt($"##{(nint)this.Node:X}fontSize", ref fontSize, 1, 10)) @@ -339,7 +339,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Alignment:"); + ImGui.TextUnformatted("Alignment:"); ImGui.TableNextColumn(); if (InputAlignment($"##{(nint)this.Node:X}alignment", ref alignment)) { @@ -348,7 +348,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Text Color:"); + ImGui.TextUnformatted("Text Color:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.ColorEdit4($"##{(nint)this.Node:X}TextRGB", ref textColor, DisplayHex)) @@ -358,7 +358,7 @@ private protected override void DrawEditorRows() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text("Edge Color:"); + ImGui.TextUnformatted("Edge Color:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(150); if (ImGui.ColorEdit4($"##{(nint)this.Node:X}EdgeRGB", ref edgeColor, DisplayHex)) diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs index 8d93b3e766..4a8f83a6bd 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs @@ -1,6 +1,7 @@ using System.Numerics; using System.Runtime.InteropServices; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; @@ -131,7 +132,7 @@ private protected virtual void DrawPartOutline(uint partId, Vector2 cursorScreen ImGui.GetWindowDrawList().AddRect(partBegin, partEnd, RgbaVector4ToUint(col)); ImGui.SetCursorPos(cursorLocalPos + uv + new Vector2(0, -20)); - ImGui.TextColored(col, $"[#{partId}]\t{part.U}, {part.V}\t{part.Width}x{part.Height}"); + ImGuiHelpers.SafeTextColored(col, $"[#{partId}]\t{part.U}, {part.V}\t{part.Width}x{part.Height}"); ImGui.SetCursorPos(savePos); } @@ -149,7 +150,7 @@ private protected override void PrintFieldsForNodeType(bool isEditorOpen = false private static void PrintPartCoords(float u, float v, float w, float h, bool asFloat = false, bool lineBreak = false) { - ImGui.TextDisabled($"{u}, {v},{(lineBreak ? "\n" : " ")}{w}, {h}"); + ImGuiHelpers.SafeTextDisabled($"{u}, {v},{(lineBreak ? "\n" : " ")}{w}, {h}"); if (ImGui.IsItemHovered()) { @@ -207,7 +208,7 @@ private void PrintPartsTable() ImGui.TableNextColumn(); var col = i == this.TexData.PartId ? new Vector4(0, 0.85F, 1, 1) : new(1); - ImGui.TextColored(col, $"#{i.ToString().PadLeft(this.TexData.PartCount.ToString().Length, '0')}"); + ImGuiHelpers.SafeTextColored(col, $"#{i.ToString().PadLeft(this.TexData.PartCount.ToString().Length, '0')}"); ImGui.TableNextColumn(); @@ -227,19 +228,19 @@ private void PrintPartsTable() ImGui.TableNextColumn(); - ImGui.TextColored(!hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Standard:\t"); + ImGuiHelpers.SafeTextColored(!hiRes ? new(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"); + ImGuiHelpers.SafeTextColored(hiRes ? new(1) : new(0.6f, 0.6f, 0.6f, 1), "Hi-Res:\t"); ImGui.SameLine(); ImGui.SetCursorPosX(cursX); PrintPartCoords(u, v, width, height); - ImGui.Text("UV:\t"); + ImGui.TextUnformatted("UV:\t"); ImGui.SameLine(); ImGui.SetCursorPosX(cursX); diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs index 48825becb6..13297462bd 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.NineGrid.cs @@ -1,4 +1,5 @@ using Dalamud.Interface.Internal.UiDebug2.Utility; +using Dalamud.Interface.Utility; using FFXIVClientStructs.FFXIV.Component.GUI; using ImGuiNET; @@ -66,7 +67,7 @@ private protected override void DrawPartOutline(uint partId, Vector2 cursorScree ImGui.GetWindowDrawList().AddRect(ngBegin2, ngEnd2, ngCol); ImGui.SetCursorPos(cursorLocalPos + uv + new Vector2(0, -20)); - ImGui.TextColored(col, $"[#{partId}]\t{part.U}, {part.V}\t{part.Width}x{part.Height}"); + ImGuiHelpers.SafeTextColored(col, $"[#{partId}]\t{part.U}, {part.V}\t{part.Width}x{part.Height}"); } ImGui.SetCursorPos(savePos); @@ -80,7 +81,7 @@ private protected override void PrintFieldsForNodeType(bool isEditorOpen = false { if (!isEditorOpen) { - ImGui.Text("NineGrid Offsets:\t"); + ImGui.TextUnformatted("NineGrid Offsets:\t"); ImGui.SameLine(); this.Offsets.Print(); } diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs index 6c12d3b4c6..af196d0656 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs @@ -4,6 +4,7 @@ using Dalamud.Interface.Components; using Dalamud.Interface.Internal.UiDebug2.Utility; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using FFXIVClientStructs.FFXIV.Component.GUI; @@ -184,13 +185,13 @@ private protected void PrintFieldLabel(nint ptr, Vector4 color, int? fieldOffset if (fieldOffset != null) { ImGui.SameLine(0, -1); - ImGui.TextColored(color * 0.85f, $"[0x{fieldOffset:X}]"); + ImGuiHelpers.SafeTextColored(color * 0.85f, $"[0x{fieldOffset:X}]"); } if (this.AddonTree.FieldNames.TryGetValue(ptr, out var result)) { ImGui.SameLine(0, -1); - ImGui.TextColored(color, string.Join(".", result)); + ImGuiHelpers.SafeTextColored(color, string.Join(".", result)); } } @@ -352,7 +353,7 @@ private void PrintTree(uint? index, bool forceOpen = false) } catch (Exception ex) { - ImGui.TextDisabled($"Couldn't display node!\n\n{ex}"); + ImGuiHelpers.SafeTextDisabled($"Couldn't display node!\n\n{ex}"); } var lineEnd = lineStart with { Y = ImGui.GetCursorScreenPos().Y - 7 }; diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs index 7c924f5031..71aa220ca4 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Text.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System.Runtime.InteropServices; using Dalamud.Game.Text.SeStringHandling; @@ -47,7 +48,7 @@ private protected override void PrintFieldsForNodeType(bool isEditorOpen = false return; } - ImGui.TextColored(new(1), "Text:"); + ImGuiHelpers.SafeTextColored(Vector4.One, "Text:"); ImGui.SameLine(); try diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs index 2ba416b4f6..ec55dba632 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.KeyGroupColumn.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; +using Dalamud.Interface.Utility; + using ImGuiNET; namespace Dalamud.Interface.Internal.UiDebug2.Browsing; @@ -83,7 +85,7 @@ public readonly void PrintValueAt(int i) } else { - ImGui.TextDisabled("..."); + ImGuiHelpers.SafeTextDisabled("..."); } } } diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs index 57e5eff990..7fe6105f31 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/TimelineTree.cs @@ -72,7 +72,7 @@ internal void Print() ("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"); + ImGuiHelpers.SafeTextColored(new(0.6f, 0.6f, 0.6f, 1), "Animation List"); for (var a = 0; a < count; a++) { diff --git a/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs b/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs index 65537e2102..ede1705bcf 100644 --- a/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs +++ b/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs @@ -6,6 +6,7 @@ using Dalamud.Interface.Components; using Dalamud.Interface.Internal.UiDebug2.Browsing; using Dalamud.Interface.Internal.UiDebug2.Utility; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using FFXIVClientStructs.FFXIV.Component.GUI; @@ -144,10 +145,10 @@ internal void DrawSelectorOutput() return; } - ImGui.Text("ELEMENT SELECTOR"); - ImGui.TextDisabled("Use the mouse to hover and identify UI elements, then click to jump to them in the inspector"); - ImGui.TextDisabled("Use the scrollwheel to choose between overlapping elements"); - ImGui.TextDisabled("Press ESCAPE to cancel"); + ImGui.TextUnformatted("ELEMENT SELECTOR"); + SafeTextDisabled("Use the mouse to hover and identify UI elements, then click to jump to them in the inspector"); + SafeTextDisabled("Use the scrollwheel to choose between overlapping elements"); + SafeTextDisabled("Press ESCAPE to cancel"); ImGui.Spacing(); var mousePos = ImGui.GetMousePos() - MainViewport.Pos; @@ -163,7 +164,7 @@ internal void DrawSelectorOutput() { Gui.PrintFieldValuePair("Mouse Position", $"{mousePos.X}, {mousePos.Y}"); ImGui.Spacing(); - ImGui.Text("RESULTS:\n"); + ImGui.TextUnformatted("RESULTS:\n"); var i = 0; foreach (var a in addonResults) diff --git a/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs b/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs index cc4f1b6983..06130abd63 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Utility/Gui.cs @@ -33,7 +33,7 @@ internal static void PrintFieldValuePair(string fieldName, string value, bool co } else { - ImGui.TextColored(grey60, value); + ImGuiHelpers.SafeTextColored(grey60, value); } } diff --git a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs index 055cb9f492..2769b53a79 100644 --- a/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs +++ b/Dalamud/Interface/Internal/Windows/BranchSwitcherWindow.cs @@ -62,7 +62,7 @@ public override void Draw() { if (this.branches == null) { - ImGui.TextColored(ImGuiColors.DalamudGrey, "Loading branches..."); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, "Loading branches..."); return; } @@ -75,12 +75,12 @@ public override void Draw() if (pickedBranch.Value.SupportedGameVer != si.GameVersion) { - ImGui.TextColored(ImGuiColors.DalamudRed, "Can't pick this branch. GameVer != SupportedGameVer."); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, "Can't pick this branch. GameVer != SupportedGameVer."); } else { - ImGui.Text($"Version: {pickedBranch.Value.AssemblyVersion} ({pickedBranch.Value.GitSha ?? "unk"})"); - ImGui.Text($"Runtime: {pickedBranch.Value.RuntimeVersion}"); + ImGui.TextUnformatted($"Version: {pickedBranch.Value.AssemblyVersion} ({pickedBranch.Value.GitSha ?? "unk"})"); + ImGui.TextUnformatted($"Runtime: {pickedBranch.Value.RuntimeVersion}"); ImGuiHelpers.ScaledDummy(5); diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs index d42dc3669f..708c95545f 100644 --- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs @@ -35,7 +35,7 @@ namespace Dalamud.Interface.Internal.Windows; internal sealed class ChangelogWindow : Window, IDisposable { private const string WarrantsChangelogForMajorMinor = "10.0."; - + private const string ChangeLog = @"• Updated Dalamud for compatibility with Patch 7.0 • Made a lot of behind-the-scenes changes to make Dalamud and plugins more stable and reliable @@ -43,7 +43,7 @@ internal sealed class ChangelogWindow : Window, IDisposable • Refreshed the Dalamud/plugin installer UI "; - private static readonly TimeSpan TitleScreenWaitTime = TimeSpan.FromSeconds(0.5f); + private static readonly TimeSpan TitleScreenWaitTime = TimeSpan.FromSeconds(0.5f); private readonly TitleScreenMenuWindow tsmWindow; @@ -54,40 +54,40 @@ internal sealed class ChangelogWindow : Window, IDisposable private readonly Lazy bannerFont; private readonly Lazy apiBumpExplainerTexture; private readonly Lazy logoTexture; - + private readonly InOutCubic windowFade = new(TimeSpan.FromSeconds(2.5f)) { Point1 = Vector2.Zero, Point2 = new Vector2(2f), }; - + private readonly InOutCubic bodyFade = new(TimeSpan.FromSeconds(0.8f)) { Point1 = Vector2.Zero, Point2 = Vector2.One, }; - + private readonly InOutCubic titleFade = new(TimeSpan.FromSeconds(0.5f)) { Point1 = Vector2.Zero, Point2 = Vector2.One, }; - + private readonly InOutCubic fadeOut = new(TimeSpan.FromSeconds(0.5f)) { Point1 = Vector2.One, Point2 = Vector2.Zero, }; - + private State state = State.WindowFadeIn; - + private bool needFadeRestart = false; - + private bool isFadingOutForStateChange = false; private State? stateAfterFadeOut; - + private AutoUpdateBehavior? chosenAutoUpdateBehavior; - + private Dictionary currentFtueLevels = new(); private DateTime? isEligibleSince; @@ -110,7 +110,7 @@ public ChangelogWindow( : base("What's new in Dalamud?##ChangelogWindow", ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse, true) { this.gameGui = gameGui; - + this.tsmWindow = tsmWindow; this.Namespace = "DalamudChangelogWindow"; this.privateAtlas = this.scopedFinalizer.Add( @@ -125,7 +125,7 @@ public ChangelogWindow( // If we are going to show a changelog, make sure we have the font ready, otherwise it will hitch if (WarrantsChangelog()) _ = this.bannerFont.Value; - + framework.Update += this.FrameworkOnUpdate; this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate); } @@ -138,7 +138,7 @@ private enum State AskAutoUpdate, Links, } - + /// /// Check if a changelog should be shown. /// @@ -163,7 +163,7 @@ public override void OnOpen() this.isFadingOutForStateChange = false; this.stateAfterFadeOut = null; - + this.state = State.WindowFadeIn; this.windowFade.Reset(); this.bodyFade.Reset(); @@ -172,9 +172,9 @@ public override void OnOpen() this.needFadeRestart = true; this.chosenAutoUpdateBehavior = null; - + this.currentFtueLevels = Service.Get().SeenFtueLevels; - + base.OnOpen(); } @@ -182,17 +182,17 @@ public override void OnOpen() public override void OnClose() { base.OnClose(); - + this.tsmWindow.AllowDrawing = true; Service.Get().SetCreditsDarkeningAnimation(false); var configuration = Service.Get(); - + if (this.chosenAutoUpdateBehavior.HasValue) { configuration.AutoUpdateBehavior = this.chosenAutoUpdateBehavior.Value; } - + configuration.SeenFtueLevels = this.currentFtueLevels; configuration.QueueSave(); } @@ -203,7 +203,7 @@ public override void PreDraw() ImGui.PushStyleVar(ImGuiStyleVar.WindowBorderSize, 0); ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, Vector2.Zero); ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 10f); - + base.PreDraw(); if (this.needFadeRestart) @@ -212,15 +212,15 @@ public override void PreDraw() this.titleFade.Restart(); this.needFadeRestart = false; } - + this.windowFade.Update(); this.titleFade.Update(); this.fadeOut.Update(); ImGui.SetNextWindowBgAlpha(Math.Clamp(this.windowFade.EasedPoint.X, 0, 0.9f)); - + this.Size = new Vector2(900, 400); this.SizeCondition = ImGuiCond.Always; - + // Center the window on the main viewport var viewportPos = ImGuiHelpers.MainViewport.Pos; var viewportSize = ImGuiHelpers.MainViewport.Size; @@ -233,9 +233,9 @@ public override void PreDraw() public override void PostDraw() { ImGui.PopStyleVar(3); - + this.ResetMovieTimer(); - + base.PostDraw(); } @@ -248,13 +248,13 @@ void Dismiss() configuration.LastChangelogMajorMinor = WarrantsChangelogForMajorMinor; configuration.QueueSave(); } - + var windowSize = ImGui.GetWindowSize(); - + var dummySize = 10 * ImGuiHelpers.GlobalScale; ImGui.Dummy(new Vector2(dummySize)); ImGui.SameLine(); - + var logoContainerSize = new Vector2(windowSize.X * 0.2f - dummySize, windowSize.Y); using (var child = ImRaii.Child("###logoContainer", logoContainerSize, false)) { @@ -262,23 +262,23 @@ void Dismiss() return; var logoSize = new Vector2(logoContainerSize.X); - + // Center the logo in the container ImGui.SetCursorPos(new Vector2(logoContainerSize.X / 2 - logoSize.X / 2, logoContainerSize.Y / 2 - logoSize.Y / 2)); - + using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f))) ImGui.Image(this.logoTexture.Value.ImGuiHandle, logoSize); } - + ImGui.SameLine(); ImGui.Dummy(new Vector2(dummySize)); ImGui.SameLine(); - + using (var child = ImRaii.Child("###textContainer", new Vector2((windowSize.X * 0.8f) - dummySize * 4, windowSize.Y), false)) { if (!child) return; - + ImGuiHelpers.ScaledDummy(20); var titleFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.titleFade.EasedPoint.X; @@ -292,21 +292,21 @@ void Dismiss() case State.ExplainerIntro: ImGuiHelpers.CenteredText("New And Improved"); break; - + case State.ExplainerApiBump: ImGuiHelpers.CenteredText("Plugin Updates"); break; - + case State.AskAutoUpdate: ImGuiHelpers.CenteredText("Auto-Updates"); break; - + case State.Links: ImGuiHelpers.CenteredText("Enjoy!"); break; } } - + ImGuiHelpers.ScaledDummy(8); if (this.state == State.WindowFadeIn && this.windowFade.EasedPoint.X > 1.5f) @@ -321,11 +321,11 @@ void Dismiss() this.bodyFade.Restart(); this.titleFade.Restart(); - + this.isFadingOutForStateChange = false; this.stateAfterFadeOut = null; } - + this.bodyFade.Update(); var bodyFadeVal = this.isFadingOutForStateChange ? this.fadeOut.EasedPoint.X : this.bodyFade.EasedPoint.X; using (ImRaii.PushStyle(ImGuiStyleVar.Alpha, Math.Clamp(bodyFadeVal, 0, 1f))) @@ -334,10 +334,10 @@ void GoToNextState(State nextState) { this.isFadingOutForStateChange = true; this.stateAfterFadeOut = nextState; - + this.fadeOut.Restart(); } - + bool DrawNextButton(State nextState) { // Draw big, centered next button at the bottom of the window @@ -346,7 +346,7 @@ bool DrawNextButton(State nextState) var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale; ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale)); ImGuiHelpers.CenterCursorFor((int)buttonWidth); - + if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight)) && !this.isFadingOutForStateChange) { GoToNextState(nextState); @@ -355,37 +355,37 @@ bool DrawNextButton(State nextState) return false; } - + switch (this.state) { case State.WindowFadeIn: case State.ExplainerIntro: - ImGui.TextWrapped($"Welcome to Dalamud v{Util.GetScmVersion()}!"); + ImGuiHelpers.SafeTextWrapped($"Welcome to Dalamud v{Util.GetScmVersion()}!"); ImGuiHelpers.ScaledDummy(5); - ImGui.TextWrapped(ChangeLog); + ImGuiHelpers.SafeTextWrapped(ChangeLog); ImGuiHelpers.ScaledDummy(5); - ImGui.TextWrapped("This changelog is a quick overview of the most important changes in this version."); - ImGui.TextWrapped("Please click next to see a quick guide to updating your plugins."); - + ImGuiHelpers.SafeTextWrapped("This changelog is a quick overview of the most important changes in this version."); + ImGuiHelpers.SafeTextWrapped("Please click next to see a quick guide to updating your plugins."); + DrawNextButton(State.ExplainerApiBump); break; - + case State.ExplainerApiBump: - ImGui.TextWrapped("Take care! Due to changes in this patch, all of your plugins need to be updated and were disabled automatically."); - ImGui.TextWrapped("This is normal and required for major game updates."); + ImGuiHelpers.SafeTextWrapped("Take care! Due to changes in this patch, all of your plugins need to be updated and were disabled automatically."); + ImGuiHelpers.SafeTextWrapped("This is normal and required for major game updates."); ImGuiHelpers.ScaledDummy(5); - ImGui.TextWrapped("To update your plugins, open the plugin installer and click 'update plugins'. Updated plugins should update and then re-enable themselves."); + ImGuiHelpers.SafeTextWrapped("To update your plugins, open the plugin installer and click 'update plugins'. Updated plugins should update and then re-enable themselves."); ImGuiHelpers.ScaledDummy(5); - ImGui.TextWrapped("Please keep in mind that not all of your plugins may already be updated for the new version."); - ImGui.TextWrapped("If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available."); - + ImGuiHelpers.SafeTextWrapped("Please keep in mind that not all of your plugins may already be updated for the new version."); + ImGuiHelpers.SafeTextWrapped("If some plugins are displayed with a red cross in the 'Installed Plugins' tab, they may not yet be available."); + ImGuiHelpers.ScaledDummy(15); ImGuiHelpers.CenterCursorFor(this.apiBumpExplainerTexture.Value.Width); ImGui.Image( this.apiBumpExplainerTexture.Value.ImGuiHandle, this.apiBumpExplainerTexture.Value.Size); - + if (!this.currentFtueLevels.TryGetValue(FtueLevels.AutoUpdate.Name, out var autoUpdateLevel) || autoUpdateLevel < FtueLevels.AutoUpdate.AutoUpdateInitial) { if (DrawNextButton(State.AskAutoUpdate)) @@ -397,23 +397,23 @@ bool DrawNextButton(State nextState) { DrawNextButton(State.Links); } - + break; - + case State.AskAutoUpdate: ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateHint", "Dalamud can update your plugins automatically, making sure that you always " + "have the newest features and bug fixes. You can choose when and how auto-updates are run here.")); ImGuiHelpers.ScaledDummy(2); - + ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer1", "You can always update your plugins manually by clicking the update button in the plugin list. " + "You can also opt into updates for specific plugins by right-clicking them and selecting \"Always auto-update\".")); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer2", "Dalamud will only notify you about updates while you are idle.")); - + ImGuiHelpers.ScaledDummy(15); - + bool DrawCenteredButton(string text, float height) { var buttonHeight = height * ImGuiHelpers.GlobalScale; @@ -427,97 +427,97 @@ bool DrawCenteredButton(string text, float height) using (ImRaii.PushColor(ImGuiCol.Button, ImGuiColors.DPSRed)) { if (DrawCenteredButton("Enable auto-updates", 30)) - { + { this.chosenAutoUpdateBehavior = AutoUpdateBehavior.UpdateMainRepo; GoToNextState(State.Links); } } - + ImGuiHelpers.ScaledDummy(2); - + using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, 1)) using (var buttonColor = ImRaii.PushColor(ImGuiCol.Button, Vector4.Zero)) { buttonColor.Push(ImGuiCol.Border, ImGuiColors.DalamudGrey3); if (DrawCenteredButton("Disable auto-updates", 25)) - { + { this.chosenAutoUpdateBehavior = AutoUpdateBehavior.OnlyNotify; GoToNextState(State.Links); } } - + break; - + case State.Links: - ImGui.TextWrapped("If you note any issues or need help, please check the FAQ, and reach out on our Discord if you need help."); - ImGui.TextWrapped("Enjoy your time with the game and Dalamud!"); - + ImGuiHelpers.SafeTextWrapped("If you note any issues or need help, please check the FAQ, and reach out on our Discord if you need help."); + ImGuiHelpers.SafeTextWrapped("Enjoy your time with the game and Dalamud!"); + ImGuiHelpers.ScaledDummy(45); - + bool CenteredIconButton(FontAwesomeIcon icon, string text) { var buttonWidth = ImGuiComponents.GetIconButtonWithTextWidth(icon, text); ImGuiHelpers.CenterCursorFor((int)buttonWidth); return ImGuiComponents.IconButtonWithText(icon, text); } - + if (CenteredIconButton(FontAwesomeIcon.Download, "Open Plugin Installer")) { Service.Get().OpenPluginInstaller(); this.IsOpen = false; Dismiss(); } - + ImGuiHelpers.ScaledDummy(5); - + ImGuiHelpers.CenterCursorFor( (int)(ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.Globe, "See the FAQ") + ImGuiComponents.GetIconButtonWithTextWidth(FontAwesomeIcon.LaughBeam, "Join our Discord server") + - (5 * ImGuiHelpers.GlobalScale) + + (5 * ImGuiHelpers.GlobalScale) + (ImGui.GetStyle().ItemSpacing.X * 4))); if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Globe, "See the FAQ")) { Util.OpenLink("https://goatcorp.github.io/faq/"); } - + ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); ImGui.SameLine(); - + if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.LaughBeam, "Join our Discord server")) { Util.OpenLink("https://discord.gg/3NMcUV5"); } - + ImGuiHelpers.ScaledDummy(5); - + if (CenteredIconButton(FontAwesomeIcon.Heart, "Support what we care about")) { Util.OpenLink("https://goatcorp.github.io/faq/support"); } - + var buttonHeight = 30 * ImGuiHelpers.GlobalScale; var buttonText = "Close"; var buttonWidth = ImGui.CalcTextSize(buttonText).X + 40 * ImGuiHelpers.GlobalScale; ImGui.SetCursorPosY(windowSize.Y - buttonHeight - (20 * ImGuiHelpers.GlobalScale)); ImGuiHelpers.CenterCursorFor((int)buttonWidth); - + if (ImGui.Button(buttonText, new Vector2(buttonWidth, buttonHeight))) { this.IsOpen = false; Dismiss(); } - + break; } } - + // Draw close button in the top right corner ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 100f); var btnAlpha = Math.Clamp(this.windowFade.EasedPoint.X - 0.5f, 0f, 1f); ImGui.PushStyleColor(ImGuiCol.Button, ImGuiColors.DPSRed.WithAlpha(btnAlpha).Desaturate(0.3f)); ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudWhite.WithAlpha(btnAlpha)); - + var childSize = ImGui.GetWindowSize(); var closeButtonSize = 15 * ImGuiHelpers.GlobalScale; ImGui.SetCursorPos(new Vector2(childSize.X - closeButtonSize - (10 * ImGuiHelpers.GlobalScale), 10 * ImGuiHelpers.GlobalScale)); @@ -544,7 +544,7 @@ public void Dispose() { this.scopedFinalizer.Dispose(); } - + private void FrameworkOnUpdate(IFramework unused) { if (!WarrantsChangelog()) @@ -555,7 +555,7 @@ private void FrameworkOnUpdate(IFramework unused) if (this.openedThroughEligibility) return; - + var isEligible = this.gameGui.GetAddonByName("_TitleMenu", 1) != IntPtr.Zero; var charaSelect = this.gameGui.GetAddonByName("CharaSelect", 1); @@ -572,14 +572,14 @@ private void FrameworkOnUpdate(IFramework unused) { this.isEligibleSince = null; } - + if (this.isEligibleSince != null && DateTime.Now - this.isEligibleSince > TitleScreenWaitTime) { this.IsOpen = true; this.openedThroughEligibility = true; } } - + private unsafe void ResetMovieTimer() { var uiModule = UIModule.Instance(); diff --git a/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs b/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs index 3d2b585aca..4753f4e7ff 100644 --- a/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ColorDemoWindow.cs @@ -4,6 +4,7 @@ using System.Reflection; using Dalamud.Interface.Colors; +using Dalamud.Interface.Utility; using Dalamud.Interface.Windowing; using ImGuiNET; @@ -52,14 +53,14 @@ public ColorDemoWindow() /// public override void Draw() { - ImGui.Text("This is a collection of UI colors you can use in your plugin."); + ImGui.TextUnformatted("This is a collection of UI colors you can use in your plugin."); ImGui.Separator(); foreach (var property in typeof(ImGuiColors).GetProperties(BindingFlags.Public | BindingFlags.Static)) { var color = (Vector4)property.GetValue(null); - ImGui.TextColored(color, property.Name); + ImGuiHelpers.SafeTextColored(color, property.Name); } } } diff --git a/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs b/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs index 0b704990b7..89d1237308 100644 --- a/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ComponentDemoWindow.cs @@ -73,7 +73,7 @@ public override void OnClose() /// public override void Draw() { - ImGui.Text("This is a collection of UI components you can use in your plugin."); + ImGui.TextUnformatted("This is a collection of UI components you can use in your plugin."); for (var i = 0; i < this.componentDemos.Count; i++) { @@ -93,13 +93,13 @@ public override void Draw() private static void HelpMarkerDemo() { - ImGui.Text("Hover over the icon to learn more."); + ImGui.TextUnformatted("Hover over the icon to learn more."); ImGuiComponents.HelpMarker("help me!"); } private static void IconButtonDemo() { - ImGui.Text("Click on the icon to use as a button."); + ImGui.TextUnformatted("Click on the icon to use as a button."); ImGui.SameLine(); if (ImGuiComponents.IconButton(1, FontAwesomeIcon.Carrot)) { @@ -108,7 +108,7 @@ private static void IconButtonDemo() if (ImGui.BeginPopup("IconButtonDemoPopup")) { - ImGui.Text("You clicked!"); + ImGui.TextUnformatted("You clicked!"); ImGui.EndPopup(); } } @@ -147,14 +147,14 @@ private void EasingsDemo() ImGui.Bullet(); ImGui.SetCursorPos(cursor + new Vector2(0, 10)); - ImGui.Text($"{easing.GetType().Name} ({easing.Value})"); + ImGui.TextUnformatted($"{easing.GetType().Name} ({easing.Value})"); ImGuiHelpers.ScaledDummy(5); } } private void ColorPickerWithPaletteDemo() { - ImGui.Text("Click on the color button to use the picker."); + ImGui.TextUnformatted("Click on the color button to use the picker."); ImGui.SameLine(); this.defaultColor = ImGuiComponents.ColorPickerWithPalette(1, "ColorPickerWithPalette Demo", this.defaultColor); } diff --git a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs index f7ce5d1454..be0f26a475 100644 --- a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs @@ -41,9 +41,9 @@ internal class ConsoleWindow : Window, IDisposable // Fields below should be touched only from the main thread. private readonly RollingList logText; private readonly RollingList filteredLogEntries; - + private readonly List pluginFilters = new(); - + private readonly DalamudConfiguration configuration; private int newRolledLines; @@ -87,14 +87,14 @@ public ConsoleWindow(DalamudConfiguration configuration) : base("Dalamud Console", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) { this.configuration = configuration; - + this.autoScroll = configuration.LogAutoScroll; this.autoOpen = configuration.LogOpenAtStartup; Service.GetAsync().ContinueWith(r => r.Result.Update += this.FrameworkOnUpdate); - + var cm = Service.Get(); - cm.AddCommand("clear", "Clear the console log", () => + cm.AddCommand("clear", "Clear the console log", () => { this.QueueClear(); return true; @@ -150,17 +150,13 @@ public override void Draw() if (this.exceptionLogFilter is not null) { - ImGui.TextColored( - ImGuiColors.DalamudRed, - $"Regex Filter Error: {this.exceptionLogFilter.GetType().Name}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, $"Regex Filter Error: {this.exceptionLogFilter.GetType().Name}"); ImGui.TextUnformatted(this.exceptionLogFilter.Message); } if (this.exceptionLogHighlight is not null) { - ImGui.TextColored( - ImGuiColors.DalamudRed, - $"Regex Highlight Error: {this.exceptionLogHighlight.GetType().Name}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, $"Regex Highlight Error: {this.exceptionLogHighlight.GetType().Name}"); ImGui.TextUnformatted(this.exceptionLogHighlight.Message); } @@ -578,7 +574,7 @@ private void DrawOptionsToolbar() inputWidth = ImGui.GetWindowWidth() - (ImGui.GetStyle().WindowPadding.X * 2); if (!breakInputLines) - inputWidth = (inputWidth - ImGui.GetStyle().ItemSpacing.X) / 2; + inputWidth = (inputWidth - ImGui.GetStyle().ItemSpacing.X) / 2; } else { @@ -721,7 +717,7 @@ private void DrawFilterToolbar() if (!sourceNames.Any()) { - ImGui.TextColored(ImGuiColors.DalamudRed, "No Results"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, "No Results"); } foreach (var selectable in sourceNames) @@ -749,7 +745,7 @@ private void DrawFilterToolbar() } ImGui.TableNextColumn(); - ImGui.Text(entry.Source); + ImGui.TextUnformatted(entry.Source); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X); @@ -799,15 +795,15 @@ private void ProcessCommand() { if (string.IsNullOrEmpty(this.commandText)) return; - + this.historyPos = -1; - + if (this.commandText != this.configuration.LogCommandHistory.LastOrDefault()) this.configuration.LogCommandHistory.Add(this.commandText); - + if (this.configuration.LogCommandHistory.Count > HistorySize) this.configuration.LogCommandHistory.RemoveAt(0); - + this.configuration.QueueSave(); this.lastCmdSuccess = Service.Get().ProcessCommand(this.commandText); @@ -832,7 +828,7 @@ private unsafe int CommandInputCallback(ImGuiInputTextCallbackData* data) this.completionZipText = null; this.completionTabIdx = 0; break; - + case ImGuiInputTextFlags.CallbackCompletion: var textBytes = new byte[data->BufTextLen]; Marshal.Copy((IntPtr)data->Buf, textBytes, 0, data->BufTextLen); @@ -843,11 +839,11 @@ private unsafe int CommandInputCallback(ImGuiInputTextCallbackData* data) // We can't do any completion for parameters at the moment since it just calls into CommandHandler if (words.Length > 1) return 0; - + var wordToComplete = words[0]; if (wordToComplete.IsNullOrWhitespace()) return 0; - + if (this.completionZipText is not null) wordToComplete = this.completionZipText; @@ -878,7 +874,7 @@ private unsafe int CommandInputCallback(ImGuiInputTextCallbackData* data) toComplete = candidates.ElementAt(this.completionTabIdx); this.completionTabIdx = (this.completionTabIdx + 1) % candidates.Count(); } - + if (toComplete != null) { ptr.DeleteChars(0, ptr.BufTextLen); diff --git a/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs b/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs index 24adb8bc58..428d12e19f 100644 --- a/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs +++ b/Dalamud/Interface/Internal/Windows/Data/DataWindowWidgetExtensions.cs @@ -2,6 +2,7 @@ using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification.Internal; +using Dalamud.Interface.Utility; using ImGuiNET; @@ -41,7 +42,7 @@ public static void TextColumnCopiable(this IDataWindowWidget widget, string s, b ImGui.SetNextWindowSizeConstraints(Vector2.One, new(wrx, float.MaxValue)); ImGui.BeginTooltip(); ImGui.PushTextWrapPos(wrx); - ImGui.TextWrapped(s.Replace("%", "%%")); + ImGuiHelpers.SafeTextWrapped(s); ImGui.PopTextWrapPos(); ImGui.EndTooltip(); } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs index 53066765ed..9796af0652 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonLifecycleWidget.cs @@ -19,11 +19,11 @@ public class AddonLifecycleWidget : IDataWindowWidget /// public string DisplayName { get; init; } = "Addon Lifecycle"; - + /// [MemberNotNullWhen(true, "AddonLifecycle")] public bool Ready { get; set; } - + private AddonLifecycle? AddonLifecycle { get; set; } /// @@ -38,13 +38,13 @@ public void Load() this.Ready = true; }); } - + /// public void Draw() { if (!this.Ready) { - ImGui.Text("AddonLifecycle Reference is null, reload module."); + ImGui.TextUnformatted("AddonLifecycle Reference is null, reload module."); return; } @@ -62,11 +62,11 @@ public void Draw() ImGui.Unindent(); } } - + private void DrawEventListeners() { if (!this.Ready) return; - + foreach (var eventType in Enum.GetValues()) { if (ImGui.CollapsingHeader(eventType.ToString())) @@ -76,9 +76,9 @@ private void DrawEventListeners() if (listeners.Count == 0) { - ImGui.Text("No Listeners Registered for Event"); + ImGui.TextUnformatted("No Listeners Registered for Event"); } - + if (ImGui.BeginTable("AddonLifecycleListenersTable", 2)) { ImGui.TableSetupColumn("##AddonName", ImGuiTableColumnFlags.WidthFixed, 100.0f * ImGuiHelpers.GlobalScale); @@ -87,15 +87,15 @@ private void DrawEventListeners() foreach (var listener in listeners) { ImGui.TableNextColumn(); - ImGui.Text(listener.AddonName is "" ? "GLOBAL" : listener.AddonName); + ImGui.TextUnformatted(listener.AddonName is "" ? "GLOBAL" : listener.AddonName); ImGui.TableNextColumn(); - ImGui.Text($"{listener.FunctionDelegate.Method.DeclaringType?.FullName ?? "Unknown Declaring Type"}::{listener.FunctionDelegate.Method.Name}"); + ImGui.TextUnformatted($"{listener.FunctionDelegate.Method.DeclaringType?.FullName ?? "Unknown Declaring Type"}::{listener.FunctionDelegate.Method.Name}"); } - + ImGui.EndTable(); } - + ImGui.Unindent(); } } @@ -109,33 +109,33 @@ private void DrawReceiveEventHooks() if (listeners.Count == 0) { - ImGui.Text("No ReceiveEvent Hooks are Registered"); + ImGui.TextUnformatted("No ReceiveEvent Hooks are Registered"); } - + foreach (var receiveEventListener in this.AddonLifecycle.ReceiveEventListeners) { if (ImGui.CollapsingHeader(string.Join(", ", receiveEventListener.AddonNames))) { ImGui.Columns(2); - ImGui.Text("Hook Address"); + ImGui.TextUnformatted("Hook Address"); ImGui.NextColumn(); - ImGui.Text(receiveEventListener.FunctionAddress.ToString("X")); + ImGui.TextUnformatted(receiveEventListener.FunctionAddress.ToString("X")); ImGui.NextColumn(); - ImGui.Text("Hook Status"); + ImGui.TextUnformatted("Hook Status"); ImGui.NextColumn(); if (receiveEventListener.Hook is null) { - ImGui.Text("Hook is null"); + ImGui.TextUnformatted("Hook is null"); } else { var color = receiveEventListener.Hook.IsEnabled ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed; var text = receiveEventListener.Hook.IsEnabled ? "Enabled" : "Disabled"; - ImGui.TextColored(color, text); + ImGuiHelpers.SafeTextColored(color, text); } - + ImGui.Columns(1); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs index 18bcd93344..593d3c031c 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs @@ -15,7 +15,7 @@ internal unsafe class AddonWidget : IDataWindowWidget private nint findAgentInterfacePtr; /// - public string DisplayName { get; init; } = "Addon"; + public string DisplayName { get; init; } = "Addon"; /// public string[]? CommandShortcuts { get; init; } @@ -44,7 +44,7 @@ public void Draw() if (address == nint.Zero) { - ImGui.Text("Null"); + ImGui.TextUnformatted("Null"); return; } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs index c7ed526e1b..c2a682a511 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/AddressesWidget.cs @@ -19,7 +19,7 @@ internal class AddressesWidget : IDataWindowWidget public string[]? CommandShortcuts { get; init; } = { "address" }; /// - public string DisplayName { get; init; } = "Addresses"; + public string DisplayName { get; init; } = "Addresses"; /// public bool Ready { get; set; } @@ -29,7 +29,7 @@ public void Load() { this.Ready = true; } - + /// public void Draw() { @@ -47,7 +47,7 @@ public void Draw() } } - ImGui.Text($"Result: {this.sigResult.ToInt64():X}"); + ImGui.TextUnformatted($"Result: {this.sigResult.ToInt64():X}"); ImGui.SameLine(); if (ImGui.Button($"C##{this.sigResult.ToInt64():X}")) ImGui.SetClipboardText(this.sigResult.ToInt64().ToString("X")); @@ -57,8 +57,7 @@ public void Draw() ImGui.TextUnformatted($"{debugScannedValue.Key}"); foreach (var valueTuple in debugScannedValue.Value) { - ImGui.TextUnformatted( - $" {valueTuple.ClassName} - {Util.DescribeAddress(valueTuple.Address)}"); + ImGui.TextUnformatted($" {valueTuple.ClassName} - {Util.DescribeAddress(valueTuple.Address)}"); ImGui.SameLine(); if (ImGui.Button($"C##{valueTuple.Address.ToInt64():X}")) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs index 961d3c3c09..e9366b9fe1 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/BuddyListWidget.cs @@ -16,9 +16,9 @@ internal class BuddyListWidget : IDataWindowWidget /// public string[]? CommandShortcuts { get; init; } = { "buddy", "buddylist" }; - + /// - public string DisplayName { get; init; } = "Buddy List"; + public string DisplayName { get; init; } = "Buddy List"; /// public void Load() @@ -36,17 +36,17 @@ public void Draw() var member = buddyList.CompanionBuddy; if (member == null) { - ImGui.Text("[Companion] null"); + ImGui.TextUnformatted("[Companion] null"); } else { - ImGui.Text($"[Companion] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}"); + ImGui.TextUnformatted($"[Companion] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}"); if (this.resolveGameData) { var gameObject = member.GameObject; if (gameObject == null) { - ImGui.Text("GameObject was null"); + ImGui.TextUnformatted("GameObject was null"); } else { @@ -60,17 +60,17 @@ public void Draw() var member = buddyList.PetBuddy; if (member == null) { - ImGui.Text("[Pet] null"); + ImGui.TextUnformatted("[Pet] null"); } else { - ImGui.Text($"[Pet] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}"); + ImGui.TextUnformatted($"[Pet] {member.Address.ToInt64():X} - {member.ObjectId} - {member.DataID}"); if (this.resolveGameData) { var gameObject = member.GameObject; if (gameObject == null) { - ImGui.Text("GameObject was null"); + ImGui.TextUnformatted("GameObject was null"); } else { @@ -84,20 +84,20 @@ public void Draw() var count = buddyList.Length; if (count == 0) { - ImGui.Text("[BattleBuddy] None present"); + ImGui.TextUnformatted("[BattleBuddy] None present"); } else { for (var i = 0; i < count; i++) { var member = buddyList[i]; - ImGui.Text($"[BattleBuddy] [{i}] {member?.Address.ToInt64():X} - {member?.ObjectId} - {member?.DataID}"); + ImGui.TextUnformatted($"[BattleBuddy] [{i}] {member?.Address.ToInt64():X} - {member?.ObjectId} - {member?.DataID}"); if (this.resolveGameData) { var gameObject = member?.GameObject; if (gameObject == null) { - ImGui.Text("GameObject was null"); + ImGui.TextUnformatted("GameObject was null"); } else { diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs index 07695c02ab..5b9956181a 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/CommandWidget.cs @@ -1,6 +1,7 @@ using System.Linq; using Dalamud.Game.Command; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using ImGuiNET; @@ -14,9 +15,9 @@ internal class CommandWidget : IDataWindowWidget { /// public string[]? CommandShortcuts { get; init; } = { "command" }; - + /// - public string DisplayName { get; init; } = "Command"; + public string DisplayName { get; init; } = "Command"; /// public bool Ready { get; set; } @@ -44,7 +45,7 @@ public void Draw() ImGui.TableSetupColumn("HelpMessage", ImGuiTableColumnFlags.NoSort); ImGui.TableSetupColumn("In Help?", ImGuiTableColumnFlags.NoSort); ImGui.TableHeadersRow(); - + var sortSpecs = ImGui.TableGetSortSpecs(); var commands = commandManager.Commands.ToArray(); @@ -65,18 +66,18 @@ public void Draw() foreach (var command in commands) { ImGui.TableNextRow(); - + ImGui.TableSetColumnIndex(0); - ImGui.Text(command.Key); - + ImGui.TextUnformatted(command.Key); + ImGui.TableNextColumn(); - ImGui.Text(commandManager.GetHandlerAssemblyName(command.Key, command.Value)); - + ImGui.TextUnformatted(commandManager.GetHandlerAssemblyName(command.Key, command.Value)); + ImGui.TableNextColumn(); - ImGui.TextWrapped(command.Value.HelpMessage); - + ImGuiHelpers.SafeTextWrapped(command.Value.HelpMessage); + ImGui.TableNextColumn(); - ImGui.Text(command.Value.ShowInHelp ? "Yes" : "No"); + ImGui.TextUnformatted(command.Value.ShowInHelp ? "Yes" : "No"); } } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs index 355a73a71f..ade540fb85 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ConditionWidget.cs @@ -15,9 +15,9 @@ internal class ConditionWidget : IDataWindowWidget /// public string[]? CommandShortcuts { get; init; } = { "condition" }; - + /// - public string DisplayName { get; init; } = "Condition"; + public string DisplayName { get; init; } = "Condition"; /// public void Load() @@ -31,10 +31,10 @@ public void Draw() var condition = Service.Get(); #if DEBUG - ImGui.Text($"ptr: {Util.DescribeAddress(condition.Address)}"); + ImGui.TextUnformatted($"ptr: {Util.DescribeAddress(condition.Address)}"); #endif - ImGui.Text("Current Conditions:"); + ImGui.TextUnformatted("Current Conditions:"); ImGui.Separator(); var didAny = false; @@ -48,10 +48,10 @@ public void Draw() didAny = true; - ImGui.Text($"ID: {i} Enum: {typedCondition}"); + ImGui.TextUnformatted($"ID: {i} Enum: {typedCondition}"); } if (!didAny) - ImGui.Text("None. Talk to a shop NPC or visit a market board to find out more!"); + ImGui.TextUnformatted("None. Talk to a shop NPC or visit a market board to find out more!"); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs index b1bd0f05c1..ce4cf2f60d 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/DataShareWidget.cs @@ -148,7 +148,7 @@ private static string ReprMethod(MethodInfo? mi, bool withParams) { if (mi is null) return "-"; - + var sb = new StringBuilder(); sb.Append(ReprType(mi.DeclaringType)) .Append("::") @@ -236,7 +236,7 @@ private void DrawTextCell(string s, Func? tooltip = null, bool framepad using (ImRaii.Tooltip()) { ImGui.PushTextWrapPos(wrx); - ImGui.TextWrapped((tooltip?.Invoke() ?? s).Replace("%", "%%")); + ImGuiHelpers.SafeTextWrapped(tooltip?.Invoke() ?? s); ImGui.PopTextWrapPos(); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs index 8b7a692d47..e07d2c9264 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/DtrBarWidget.cs @@ -150,17 +150,17 @@ public void Draw() this.DrawDtrTestEntry(ref this.dtrTest3, "DTR Test #3"); ImGui.Separator(); - ImGui.Text("IDtrBar.Entries:"); + ImGui.TextUnformatted("IDtrBar.Entries:"); foreach (var e in Service.Get().Entries) - ImGui.Text(e.Title); + ImGui.TextUnformatted(e.Title); var configuration = Service.Get(); if (configuration.DtrOrder != null) { ImGui.Separator(); - ImGui.Text("DtrOrder:"); + ImGui.TextUnformatted("DtrOrder:"); foreach (var order in configuration.DtrOrder) - ImGui.Text(order); + ImGui.TextUnformatted(order); } } @@ -178,7 +178,7 @@ private void DrawDtrTestEntry(ref IDtrBarEntry? entry, string title) if (entry != null) { - ImGui.Text(title); + ImGui.TextUnformatted(title); var text = entry.Text?.TextValue ?? string.Empty; if (ImGui.InputText($"Text###{entry.Title}t", ref text, 255)) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs index a6d76f44fb..8d5d8a61c4 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/FontAwesomeTestWidget.cs @@ -19,12 +19,12 @@ internal class FontAwesomeTestWidget : IDataWindowWidget private string iconSearchInput = string.Empty; private bool iconSearchChanged = true; private bool useFixedWidth = false; - + /// public string[]? CommandShortcuts { get; init; } = { "fa", "fatest", "fontawesome" }; - + /// - public string DisplayName { get; init; } = "Font Awesome Test"; + public string DisplayName { get; init; } = "Font Awesome Test"; /// public bool Ready { get; set; } @@ -81,22 +81,22 @@ public void Draw() { this.iconSearchChanged = true; } - + ImGui.Checkbox("Use fixed width font", ref this.useFixedWidth); ImGuiHelpers.ScaledDummy(10f); for (var i = 0; i < this.icons?.Count; i++) { - ImGui.Text($"0x{(int)this.icons[i].ToIconChar():X}"); + ImGui.TextUnformatted($"0x{(int)this.icons[i].ToIconChar():X}"); ImGuiHelpers.ScaledRelativeSameLine(50f); - ImGui.Text($"{this.iconNames?[i]}"); + ImGui.TextUnformatted($"{this.iconNames?[i]}"); ImGuiHelpers.ScaledRelativeSameLine(280f); ImGui.PushFont(this.useFixedWidth ? InterfaceManager.IconFontFixedWidth : InterfaceManager.IconFont); - ImGui.Text(this.icons[i].ToIconString()); + ImGui.TextUnformatted(this.icons[i].ToIconString()); ImGui.PopFont(); ImGuiHelpers.ScaledDummy(2f); } - + ImGui.PopStyleVar(); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs index 5121d82e66..f9d2bfd05c 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/GamepadWidget.cs @@ -12,9 +12,9 @@ internal class GamepadWidget : IDataWindowWidget { /// public string[]? CommandShortcuts { get; init; } = { "gamepad", "controller" }; - + /// - public string DisplayName { get; init; } = "Gamepad"; + public string DisplayName { get; init; } = "Gamepad"; /// public bool Ready { get; set; } @@ -30,7 +30,7 @@ public void Draw() { var gamepadState = Service.Get(); - ImGui.Text($"GamepadInput {Util.DescribeAddress(gamepadState.GamepadInputAddress)}"); + ImGui.TextUnformatted($"GamepadInput {Util.DescribeAddress(gamepadState.GamepadInputAddress)}"); #if DEBUG if (ImGui.IsItemHovered()) @@ -56,28 +56,28 @@ public void Draw() "Buttons Released", gamepadState.ButtonsReleased, gamepadState.Released); - ImGui.Text($"LeftStick {gamepadState.LeftStick}"); - ImGui.Text($"RightStick {gamepadState.RightStick}"); + ImGui.TextUnformatted($"LeftStick {gamepadState.LeftStick}"); + ImGui.TextUnformatted($"RightStick {gamepadState.RightStick}"); } - + private void DrawHelper(string text, uint mask, Func resolve) { - ImGui.Text($"{text} {mask:X4}"); - ImGui.Text($"DPadLeft {resolve(GamepadButtons.DpadLeft)} " + - $"DPadUp {resolve(GamepadButtons.DpadUp)} " + - $"DPadRight {resolve(GamepadButtons.DpadRight)} " + - $"DPadDown {resolve(GamepadButtons.DpadDown)} "); - ImGui.Text($"West {resolve(GamepadButtons.West)} " + - $"North {resolve(GamepadButtons.North)} " + - $"East {resolve(GamepadButtons.East)} " + - $"South {resolve(GamepadButtons.South)} "); - ImGui.Text($"L1 {resolve(GamepadButtons.L1)} " + - $"L2 {resolve(GamepadButtons.L2)} " + - $"R1 {resolve(GamepadButtons.R1)} " + - $"R2 {resolve(GamepadButtons.R2)} "); - ImGui.Text($"Select {resolve(GamepadButtons.Select)} " + - $"Start {resolve(GamepadButtons.Start)} " + - $"L3 {resolve(GamepadButtons.L3)} " + - $"R3 {resolve(GamepadButtons.R3)} "); + ImGui.TextUnformatted($"{text} {mask:X4}"); + ImGui.TextUnformatted($"DPadLeft {resolve(GamepadButtons.DpadLeft)} " + + $"DPadUp {resolve(GamepadButtons.DpadUp)} " + + $"DPadRight {resolve(GamepadButtons.DpadRight)} " + + $"DPadDown {resolve(GamepadButtons.DpadDown)} "); + ImGui.TextUnformatted($"West {resolve(GamepadButtons.West)} " + + $"North {resolve(GamepadButtons.North)} " + + $"East {resolve(GamepadButtons.East)} " + + $"South {resolve(GamepadButtons.South)} "); + ImGui.TextUnformatted($"L1 {resolve(GamepadButtons.L1)} " + + $"L2 {resolve(GamepadButtons.L2)} " + + $"R1 {resolve(GamepadButtons.R1)} " + + $"R2 {resolve(GamepadButtons.R2)} "); + ImGui.TextUnformatted($"Select {resolve(GamepadButtons.Select)} " + + $"Start {resolve(GamepadButtons.Start)} " + + $"L3 {resolve(GamepadButtons.L3)} " + + $"R3 {resolve(GamepadButtons.R3)} "); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs index f305854064..ee39f10e4d 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/GaugeWidget.cs @@ -13,9 +13,9 @@ internal class GaugeWidget : IDataWindowWidget { /// public string[]? CommandShortcuts { get; init; } = { "gauge", "jobgauge", "job" }; - + /// - public string DisplayName { get; init; } = "Job Gauge"; + public string DisplayName { get; init; } = "Job Gauge"; /// public bool Ready { get; set; } @@ -35,7 +35,7 @@ public void Draw() var player = clientState.LocalPlayer; if (player == null) { - ImGui.Text("Player is not present"); + ImGui.TextUnformatted("Player is not present"); return; } @@ -68,7 +68,7 @@ public void Draw() if (gauge == null) { - ImGui.Text("No supported gauge exists for this job."); + ImGui.TextUnformatted("No supported gauge exists for this job."); return; } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs index b24587d6c9..666ffa4082 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/HookWidget.cs @@ -14,19 +14,19 @@ internal class HookWidget : IDataWindowWidget { private Hook? messageBoxMinHook; private bool hookUseMinHook; - + private delegate int MessageBoxWDelegate( IntPtr hWnd, [MarshalAs(UnmanagedType.LPWStr)] string text, [MarshalAs(UnmanagedType.LPWStr)] string caption, NativeFunctions.MessageBoxType type); - + /// - public string DisplayName { get; init; } = "Hook"; + public string DisplayName { get; init; } = "Hook"; /// public string[]? CommandShortcuts { get; init; } = { "hook" }; - + /// public bool Ready { get; set; } @@ -65,14 +65,14 @@ public void Draw() _ = NativeFunctions.MessageBoxW(IntPtr.Zero, "Hi", "Hello", NativeFunctions.MessageBoxType.Ok); if (this.messageBoxMinHook != null) - ImGui.Text("Enabled: " + this.messageBoxMinHook?.IsEnabled); + ImGui.TextUnformatted("Enabled: " + this.messageBoxMinHook?.IsEnabled); } catch (Exception ex) { Log.Error(ex, "MinHook error caught"); } } - + private int MessageBoxWDetour(IntPtr hwnd, string text, string caption, NativeFunctions.MessageBoxType type) { Log.Information("[DATAHOOK] {Hwnd} {Text} {Caption} {Type}", hwnd, text, caption, type); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs index ff34574b58..c9f13616e5 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs @@ -18,7 +18,7 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets; public class IconBrowserWidget : IDataWindowWidget { private const int MaxIconId = 250_000; - + private Vector2 iconSize = new(64.0f, 64.0f); private Vector2 editIconSize = new(64.0f, 64.0f); @@ -167,7 +167,7 @@ private void DrawIcon(int iconId) var textSize = ImGui.CalcTextSize(iconId.ToString()); ImGui.SetCursorPosX( texture.Size.X * scale / 2.0f - textSize.X / 2.0f + ImGui.GetStyle().FramePadding.X * 2.0f); - ImGui.Text(iconId.ToString()); + ImGui.TextUnformatted(iconId.ToString()); ImGui.Image(texture.ImGuiHandle, texture.Size * scale); ImGui.EndTooltip(); @@ -204,7 +204,7 @@ private void DrawIcon(int iconId) ImGui.GetColorU32(ImGuiColors.DalamudRed), iconText); } - + if (ImGui.IsItemHovered()) ImGui.SetTooltip($"{iconId}\n{exc}".Replace("%", "%%")); @@ -224,7 +224,7 @@ private void DrawIcon(int iconId) cursor + ((this.iconSize - textSize) / 2), color, text); - + if (ImGui.IsItemHovered()) ImGui.SetTooltip(iconId.ToString()); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs index 1476ce2e69..8c64e12cc5 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ImGuiWidget.cs @@ -47,16 +47,15 @@ public void Draw() var interfaceManager = Service.Get(); var nm = Service.Get(); - ImGui.Text("Monitor count: " + ImGui.GetPlatformIO().Monitors.Size); - ImGui.Text("OverrideGameCursor: " + interfaceManager.OverrideGameCursor); + ImGui.TextUnformatted("Monitor count: " + ImGui.GetPlatformIO().Monitors.Size); + ImGui.TextUnformatted("OverrideGameCursor: " + interfaceManager.OverrideGameCursor); ImGui.Button("THIS IS A BUTTON###hoverTestButton"); interfaceManager.OverrideGameCursor = !ImGui.IsItemHovered(); ImGui.Separator(); - ImGui.TextUnformatted( - $"WindowSystem.TimeSinceLastAnyFocus: {WindowSystem.TimeSinceLastAnyFocus.TotalMilliseconds:0}ms"); + ImGui.TextUnformatted($"WindowSystem.TimeSinceLastAnyFocus: {WindowSystem.TimeSinceLastAnyFocus.TotalMilliseconds:0}ms"); ImGui.Separator(); @@ -303,7 +302,7 @@ public void Draw() }; } } - + ImGui.SameLine(); if (ImGui.Button("Replace images using setter")) { diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs index ce56052b1b..47c8291043 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/KeyStateWidget.cs @@ -12,9 +12,9 @@ internal class KeyStateWidget : IDataWindowWidget { /// public string[]? CommandShortcuts { get; init; } = { "keystate" }; - + /// - public string DisplayName { get; init; } = "KeyState"; + public string DisplayName { get; init; } = "KeyState"; /// public bool Ready { get; set; } @@ -40,7 +40,7 @@ public void Draw() ImGui.PushStyleColor(ImGuiCol.Text, value ? ImGuiColors.HealerGreen : ImGuiColors.DPSRed); - ImGui.Text($"{vkCode} ({code})"); + ImGui.TextUnformatted($"{vkCode} ({code})"); ImGui.PopStyleColor(); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs index 761dc49a87..b6a8fcad30 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ObjectTableWidget.cs @@ -19,24 +19,24 @@ internal class ObjectTableWidget : IDataWindowWidget /// public string[]? CommandShortcuts { get; init; } = { "ot", "objecttable" }; - + /// - public string DisplayName { get; init; } = "Object Table"; + public string DisplayName { get; init; } = "Object Table"; /// public bool Ready { get; set; } - + /// public void Load() { this.Ready = true; } - + /// public void Draw() { ImGui.Checkbox("Resolve GameData", ref this.resolveGameData); - + var chatGui = Service.Get(); var clientState = Service.Get(); var gameGui = Service.Get(); @@ -112,7 +112,7 @@ public void Draw() ImGuiWindowFlags.NoDocking | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNav)) - ImGui.Text(objectText); + ImGui.TextUnformatted(objectText); ImGui.End(); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs index 6e4cbcb163..7315c03d30 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/PartyListWidget.cs @@ -13,9 +13,9 @@ internal class PartyListWidget : IDataWindowWidget /// public string[]? CommandShortcuts { get; init; } = { "partylist", "party" }; - + /// - public string DisplayName { get; init; } = "Party List"; + public string DisplayName { get; init; } = "Party List"; /// public bool Ready { get; set; } @@ -33,28 +33,28 @@ public void Draw() ImGui.Checkbox("Resolve GameData", ref this.resolveGameData); - ImGui.Text($"GroupManager: {partyList.GroupManagerAddress.ToInt64():X}"); - ImGui.Text($"GroupList: {partyList.GroupListAddress.ToInt64():X}"); - ImGui.Text($"AllianceList: {partyList.AllianceListAddress.ToInt64():X}"); + ImGui.TextUnformatted($"GroupManager: {partyList.GroupManagerAddress.ToInt64():X}"); + ImGui.TextUnformatted($"GroupList: {partyList.GroupListAddress.ToInt64():X}"); + ImGui.TextUnformatted($"AllianceList: {partyList.AllianceListAddress.ToInt64():X}"); - ImGui.Text($"{partyList.Length} Members"); + ImGui.TextUnformatted($"{partyList.Length} Members"); for (var i = 0; i < partyList.Length; i++) { var member = partyList[i]; if (member == null) { - ImGui.Text($"[{i}] was null"); + ImGui.TextUnformatted($"[{i}] was null"); continue; } - ImGui.Text($"[{i}] {member.Address.ToInt64():X} - {member.Name} - {member.GameObject?.GameObjectId}"); + ImGui.TextUnformatted($"[{i}] {member.Address.ToInt64():X} - {member.Name} - {member.GameObject?.GameObjectId}"); if (this.resolveGameData) { var actor = member.GameObject; if (actor == null) { - ImGui.Text("Actor was null"); + ImGui.TextUnformatted("Actor was null"); } else { diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs index d67dfc1037..207586ce4d 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/PluginIpcWidget.cs @@ -17,18 +17,18 @@ internal class PluginIpcWidget : IDataWindowWidget // IPC private ICallGateProvider? ipcPub; private ICallGateSubscriber? ipcSub; - + // IPC private ICallGateProvider? ipcPubGo; private ICallGateSubscriber? ipcSubGo; - + private string callGateResponse = string.Empty; - + /// public string[]? CommandShortcuts { get; init; } = { "ipc" }; - + /// - public string DisplayName { get; init; } = "Plugin IPC"; + public string DisplayName { get; init; } = "Plugin IPC"; /// public bool Ready { get; set; } @@ -108,18 +108,18 @@ public void Draw() { this.callGateResponse = this.ipcSub.InvokeFunc("button2"); } - + if (ImGui.Button("Action GO")) { this.ipcSubGo.InvokeAction(Service.Get().LocalPlayer); } - + if (ImGui.Button("Func GO")) { this.callGateResponse = this.ipcSubGo.InvokeFunc(Service.Get().LocalPlayer); } - + if (!this.callGateResponse.IsNullOrEmpty()) - ImGui.Text($"Response: {this.callGateResponse}"); + ImGui.TextUnformatted($"Response: {this.callGateResponse}"); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs index d1e6bc58a3..05981f0ba5 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs @@ -26,9 +26,9 @@ internal class ServicesWidget : IDataWindowWidget /// public string[]? CommandShortcuts { get; init; } = { "services" }; - + /// - public string DisplayName { get; init; } = "Service Container"; + public string DisplayName { get; init; } = "Service Container"; /// public bool Ready { get; set; } @@ -48,7 +48,7 @@ public void Draw() { if (ImGui.Button("Clear selection")) this.selectedNodes.Clear(); - + ImGui.SameLine(); switch (this.includeUnloadDependencies) { @@ -90,12 +90,12 @@ public void Draw() var dl = ImGui.GetWindowDrawList(); var mouse = ImGui.GetMousePos(); var maxRowWidth = 0f; - + // 1. Layout for (var level = 0; level < this.dependencyNodes.Count; level++) { var levelNodes = this.dependencyNodes[level]; - + var rowWidth = 0f; foreach (var node in levelNodes) rowWidth += node.DisplayedNameSize.X + cellPad.X + margin.X; @@ -139,7 +139,7 @@ public void Draw() { var rect = this.nodeRects[node]; var point1 = new Vector2((rect.X + rect.Z) / 2, rect.Y); - + foreach (var parent in node.InvalidParents) { rect = this.nodeRects[parent]; @@ -149,7 +149,7 @@ public void Draw() dl.AddLine(point1, point2, lineInvalidColor, 2f * ImGuiHelpers.GlobalScale); } - + foreach (var parent in node.Parents) { rect = this.nodeRects[parent]; @@ -170,7 +170,7 @@ public void Draw() } } } - + // 3. Draw boxes foreach (var levelNodes in this.dependencyNodes) { @@ -231,7 +231,7 @@ public void Draw() } } } - + ImGui.SetCursorPos(default); ImGui.Dummy(new(maxRowWidth, this.dependencyNodes.Count * rowHeight)); ImGui.EndChild(); @@ -249,7 +249,7 @@ public void Draw() using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed, !hasInterface)) { - ImGui.Text( + ImGui.TextUnformatted( hasInterface ? $"\t => Provided via interface: {container.InterfaceToTypeMap.First(x => x.Value == instance.Key).Key.FullName}" : "\t => NO INTERFACE!!!"); @@ -258,7 +258,7 @@ public void Draw() if (isPublic) { using var color = ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.Text("\t => PUBLIC!!!"); + ImGui.TextUnformatted("\t => PUBLIC!!!"); } ImGuiHelpers.ScaledDummy(2); @@ -301,7 +301,7 @@ private ServiceDependencyNode(Type t) public string DisplayedName { get; } public string TypeSuffix { get; } - + public uint TypeSuffixColor { get; } public Vector2 DisplayedNameSize => @@ -319,7 +319,7 @@ private ServiceDependencyNode(Type t) public IEnumerable Relatives => this.parents.Concat(this.children).Concat(this.invalidParents); - + public int Level { get; private set; } public static List CreateTree(bool includeUnloadDependencies) diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs index 4dee316c52..214c3f4122 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/StartInfoWidget.cs @@ -10,9 +10,9 @@ internal class StartInfoWidget : IDataWindowWidget { /// public string[]? CommandShortcuts { get; init; } = { "startinfo" }; - + /// - public string DisplayName { get; init; } = "Start Info"; + public string DisplayName { get; init; } = "Start Info"; /// public bool Ready { get; set; } @@ -28,6 +28,6 @@ public void Draw() { var startInfo = Service.Get().StartInfo; - ImGui.Text(JsonConvert.SerializeObject(startInfo, Formatting.Indented)); + ImGui.TextUnformatted(JsonConvert.SerializeObject(startInfo, Formatting.Indented)); } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs index 68e00799d5..bf3b48aa25 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TargetWidget.cs @@ -12,12 +12,12 @@ namespace Dalamud.Interface.Internal.Windows.Data.Widgets; internal class TargetWidget : IDataWindowWidget { private bool resolveGameData; - + /// public string[]? CommandShortcuts { get; init; } = { "target" }; - + /// - public string DisplayName { get; init; } = "Target"; + public string DisplayName { get; init; } = "Target"; /// public bool Ready { get; set; } @@ -32,7 +32,7 @@ public void Load() public void Draw() { ImGui.Checkbox("Resolve GameData", ref this.resolveGameData); - + var clientState = Service.Get(); var targetMgr = Service.Get(); @@ -40,7 +40,7 @@ public void Draw() { Util.PrintGameObject(targetMgr.Target, "CurrentTarget", this.resolveGameData); - ImGui.Text("Target"); + ImGui.TextUnformatted("Target"); Util.ShowGameObjectStruct(targetMgr.Target); var tot = targetMgr.Target.TargetObject; @@ -49,7 +49,7 @@ public void Draw() ImGuiHelpers.ScaledDummy(10); ImGui.Separator(); - ImGui.Text("ToT"); + ImGui.TextUnformatted("ToT"); Util.ShowGameObjectStruct(tot); } @@ -67,10 +67,10 @@ public void Draw() if (targetMgr.SoftTarget != null) Util.PrintGameObject(targetMgr.SoftTarget, "SoftTarget", this.resolveGameData); - + if (targetMgr.GPoseTarget != null) Util.PrintGameObject(targetMgr.GPoseTarget, "GPoseTarget", this.resolveGameData); - + if (targetMgr.MouseOverNameplateTarget != null) Util.PrintGameObject(targetMgr.MouseOverNameplateTarget, "MouseOverNameplateTarget", this.resolveGameData); @@ -92,7 +92,7 @@ public void Draw() } else { - ImGui.Text("LocalPlayer is null."); + ImGui.TextUnformatted("LocalPlayer is null."); } } } diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs index f4086fe5a8..9fe34733ae 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TaskSchedulerWidget.cs @@ -34,12 +34,12 @@ internal class TaskSchedulerWidget : IDataWindowWidget private Task? downloadTask = null; private (long Downloaded, long Total, float Percentage) downloadState; private CancellationTokenSource taskSchedulerCancelSource = new(); - + /// public string[]? CommandShortcuts { get; init; } = { "tasksched", "taskscheduler" }; - + /// - public string DisplayName { get; init; } = "Task Scheduler"; + public string DisplayName { get; init; } = "Task Scheduler"; /// public bool Ready { get; set; } @@ -73,7 +73,7 @@ public void Draw() this.taskSchedulerCancelSource = new(); } - ImGui.Text("Run in any thread: "); + ImGui.TextUnformatted("Run in any thread: "); ImGui.SameLine(); if (ImGui.Button("Short Task.Run")) @@ -108,7 +108,7 @@ public void Draw() }); } - ImGui.Text("Run in Framework.Update: "); + ImGui.TextUnformatted("Run in Framework.Update: "); ImGui.SameLine(); if (ImGui.Button("ASAP")) @@ -250,7 +250,7 @@ public void Draw() ImGui.InputText("URL", this.urlBytes, (uint)this.urlBytes.Length); ImGui.InputText("Local Path", this.localPathBytes, (uint)this.localPathBytes.Length); ImGui.SameLine(); - + if (ImGuiComponents.IconButton("##localpathpicker", FontAwesomeIcon.File)) { var defaultFileName = Encoding.UTF8.GetString(this.urlBytes).Split('\0', 2)[0].Split('/').Last(); @@ -339,31 +339,31 @@ public void Draw() { var token = this.taskSchedulerCancelSource.Token; Task.Run( - () => + () => { for (var i = 0; i < 100; i++) { token.ThrowIfCancellationRequested(); Task.Run( - () => + () => { for (var j = 0; j < 100; j++) { token.ThrowIfCancellationRequested(); Task.Run( - () => + () => { for (var k = 0; k < 100; k++) { token.ThrowIfCancellationRequested(); Task.Run( - () => + () => { for (var l = 0; l < 100; l++) { token.ThrowIfCancellationRequested(); Task.Run( - async () => + async () => { for (var m = 0; m < 100; m++) { @@ -380,7 +380,7 @@ public void Draw() } }); } - + ImGui.SameLine(); ImGuiHelpers.ScaledDummy(20); @@ -442,7 +442,7 @@ public void Draw() if (task.Exception != null) { ImGuiHelpers.ScaledDummy(15); - ImGui.TextColored(ImGuiColors.DalamudRed, "EXCEPTION:"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, "EXCEPTION:"); ImGui.TextUnformatted(task.Exception.ToString()); } } @@ -456,7 +456,7 @@ public void Draw() this.fileDialogManager.Draw(); } - + private async Task TestTaskInTaskDelay(CancellationToken token) { await Task.Delay(5000, token); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index 61f4bd1fce..c63954c306 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -120,7 +120,7 @@ internal class PluginInstallerWindow : Window, IDisposable private List pluginListUpdatable = new(); private bool hasDevPlugins = false; private bool hasHiddenPlugins = false; - + private string searchText = string.Empty; private bool isSearchTextPrefilled = false; @@ -137,7 +137,7 @@ internal class PluginInstallerWindow : Window, IDisposable private LoadingIndicatorKind loadingIndicatorKind = LoadingIndicatorKind.Unknown; private string verifiedCheckmarkHoveredPlugin = string.Empty; - + private string? staleDalamudNewVersion = null; /// @@ -215,8 +215,8 @@ private enum PluginSortKind ProfileOrNot, SearchScore, } - - [Flags] + + [Flags] private enum PluginHeaderFlags { None = 0, @@ -236,7 +236,7 @@ private enum InstalledPluginListFilter Updateable, Dev, } - + private bool AnyOperationInProgress => this.installStatus == OperationStatus.InProgress || this.updateStatus == OperationStatus.InProgress || this.enableDisableStatus == OperationStatus.InProgress; @@ -304,7 +304,7 @@ public override void OnOpen() { if (!t.IsCompletedSuccessfully) return; - + var versionInfo = t.Result; if (versionInfo.AssemblyVersion != Util.GetScmVersion() && versionInfo.Track != "release" && @@ -413,7 +413,7 @@ public bool DisplayErrorContinuation(Task task, object state) { if (!task.IsFaulted && !task.IsCanceled) return true; - + var newErrorMessage = state as string; if (task.Exception != null) @@ -438,7 +438,7 @@ public bool DisplayErrorContinuation(Task task, object state) } } } - + if (task.IsCanceled) Log.Error("A task was cancelled"); @@ -446,14 +446,14 @@ public bool DisplayErrorContinuation(Task task, object state) return false; } - + private static void EnsureHaveTestingOptIn(IPluginManifest manifest) { var configuration = Service.Get(); - + if (configuration.PluginTestingOptIns.Any(x => x.InternalName == manifest.InternalName)) return; - + configuration.PluginTestingOptIns.Add(new PluginTestingOptIn(manifest.InternalName)); configuration.QueueSave(); } @@ -490,7 +490,7 @@ private void SetOpenPage(PluginInstallerOpenKind kind) throw new ArgumentOutOfRangeException(nameof(kind), kind, null); } } - + private void DrawProgressOverlay() { var pluginManager = Service.Get(); @@ -637,7 +637,7 @@ private void DrawHeader() var headerText = Locs.Header_Hint; var headerTextSize = ImGui.CalcTextSize(headerText); - ImGui.Text(headerText); + ImGui.TextUnformatted(headerText); ImGui.SameLine(); @@ -733,7 +733,7 @@ private void DrawHeader() } } } - + private void DrawFooter() { var configuration = Service.Get(); @@ -802,7 +802,7 @@ private void DrawUpdatePluginsButton() { this.updateStatus = OperationStatus.InProgress; this.loadingIndicatorKind = LoadingIndicatorKind.UpdatingAll; - + var toUpdate = this.pluginListUpdatable .Where(x => x.InstalledPlugin.IsWantedByAnyProfile) .ToList(); @@ -869,7 +869,7 @@ private void DrawErrorModal() if (ImGui.BeginPopupModal(modalTitle, ref this.errorModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar)) { - ImGui.Text(this.errorModalMessage); + ImGui.TextUnformatted(this.errorModalMessage); ImGui.Spacing(); var buttonWidth = 120f; @@ -905,7 +905,7 @@ private void DrawUpdateModal() if (ImGui.BeginPopupModal(modalTitle, ref this.updateModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar)) { - ImGui.Text(Locs.UpdateModal_UpdateAvailable(this.updateModalPlugin.Name)); + ImGui.TextUnformatted(Locs.UpdateModal_UpdateAvailable(this.updateModalPlugin.Name)); ImGui.Spacing(); var buttonWidth = 120f; @@ -946,7 +946,7 @@ private void DrawTestingWarningModal() if (ImGui.BeginPopupModal(modalTitle, ref this.testingWarningModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar)) { - ImGui.Text(Locs.TestingWarningModal_DowngradeBody); + ImGui.TextUnformatted(Locs.TestingWarningModal_DowngradeBody); ImGuiHelpers.ScaledDummy(10); @@ -991,11 +991,11 @@ private void DrawDeletePluginConfigWarningModal() if (this.deletePluginConfigWarningModalExplainTesting) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudOrange); - ImGui.Text(Locs.DeletePluginConfigWarningModal_ExplainTesting()); + ImGui.TextUnformatted(Locs.DeletePluginConfigWarningModal_ExplainTesting()); ImGui.PopStyleColor(); } - - ImGui.Text(Locs.DeletePluginConfigWarningModal_Body(this.deletePluginConfigWarningModalPluginName)); + + ImGui.TextUnformatted(Locs.DeletePluginConfigWarningModal_Body(this.deletePluginConfigWarningModalPluginName)); ImGui.Spacing(); var buttonWidth = 120f; @@ -1043,10 +1043,9 @@ private void DrawFeedbackModal() ImGuiHelpers.SafeTextWrapped(this.feedbackPlugin.FeedbackMessage); } - if (this.pluginListUpdatable.Any( - up => up.InstalledPlugin.Manifest.InternalName == this.feedbackPlugin?.InternalName)) + if (this.pluginListUpdatable.Any(up => up.InstalledPlugin.Manifest.InternalName == this.feedbackPlugin?.InternalName)) { - ImGui.TextColored(ImGuiColors.DalamudRed, Locs.FeedbackModal_HasUpdate); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, Locs.FeedbackModal_HasUpdate); } ImGui.Spacing(); @@ -1067,18 +1066,18 @@ private void DrawFeedbackModal() }); } - ImGui.Text(Locs.FeedbackModal_ContactInformationHelp); + ImGui.TextUnformatted(Locs.FeedbackModal_ContactInformationHelp); - ImGui.TextColored(ImGuiColors.DalamudRed, Locs.FeedbackModal_ContactInformationWarning); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, Locs.FeedbackModal_ContactInformationWarning); ImGui.Spacing(); ImGui.Checkbox(Locs.FeedbackModal_IncludeLastError, ref this.feedbackModalIncludeException); - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.FeedbackModal_IncludeLastErrorHint); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.FeedbackModal_IncludeLastErrorHint); ImGui.Spacing(); - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.FeedbackModal_Hint); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.FeedbackModal_Hint); var buttonWidth = 120f; ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2); @@ -1163,20 +1162,20 @@ private void DrawChangelogList(bool displayDalamud, bool displayPlugins) { if (this.pluginListInstalled.Count == 0) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoInstalled); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoInstalled); return; } if (this.dalamudChangelogRefreshTask?.IsFaulted == true || this.dalamudChangelogRefreshTask?.IsCanceled == true) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_ChangelogError); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.TabBody_ChangelogError); return; } if (this.dalamudChangelogManager?.Changelogs == null) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_LoadingPlugins); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.TabBody_LoadingPlugins); if (this.dalamudChangelogManager != null && this.dalamudChangelogRefreshTask == null) @@ -1215,7 +1214,7 @@ private void DrawChangelogList(bool displayDalamud, bool displayPlugins) if (sortedChangelogs == null || !sortedChangelogs.Any()) { - ImGui.TextColored( + ImGuiHelpers.SafeTextColored( ImGuiColors.DalamudGrey2, this.pluginListInstalled.Any(plugin => !plugin.Manifest.Changelog.IsNullOrEmpty()) ? Locs.TabBody_SearchNoMatching @@ -1242,7 +1241,7 @@ private IEnumerable GatherProxies() if (availableManifests.Count == 0) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoCompatible); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoCompatible); return proxies; } @@ -1252,7 +1251,7 @@ private IEnumerable GatherProxies() if (filteredAvailableManifests.Count == 0) { - ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching); return proxies; } @@ -1264,7 +1263,7 @@ private IEnumerable GatherProxies() plugin.Manifest.RepoUrl == availableManifest.RepoUrl && !plugin.IsDev); - // We "consumed" this plugin from the pile and remove it. + // We "consumed" this plugin from the pile and remove it. if (plugin != null) { installedPlugins.Remove(plugin); @@ -1296,7 +1295,7 @@ bool IsProxyHidden(PluginInstallerAvailablePluginProxy proxy) return isHidden; return !isHidden; } - + // Filter out plugins that are not hidden proxies = proxies.Where(IsProxyHidden).ToList(); @@ -1328,14 +1327,14 @@ private void DrawAvailablePluginList() ImGui.PopID(); } - + // Reset the category to "All" if we're on the "Hidden" category and there are no hidden plugins (we removed the last one) if (i == 0 && this.categoryManager.CurrentCategoryKind == PluginCategoryManager.CategoryKind.Hidden) { this.categoryManager.CurrentCategoryKind = PluginCategoryManager.CategoryKind.All; } } - + private void DrawInstalledPluginList(InstalledPluginListFilter filter) { var pluginList = this.pluginListInstalled; @@ -1343,7 +1342,7 @@ private void DrawInstalledPluginList(InstalledPluginListFilter filter) if (pluginList.Count == 0) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoInstalled); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.TabBody_SearchNoInstalled); return; } @@ -1353,7 +1352,7 @@ private void DrawInstalledPluginList(InstalledPluginListFilter filter) if (filteredList.Count == 0) { - ImGui.TextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey2, Locs.TabBody_SearchNoMatching); return; } @@ -1363,7 +1362,7 @@ private void DrawInstalledPluginList(InstalledPluginListFilter filter) { if (filter == InstalledPluginListFilter.Testing && !manager.HasTestingOptIn(plugin.Manifest)) continue; - + // Find applicable update and manifest, if we have them AvailablePluginUpdate? update = null; RemotePluginManifest? remoteManifest = null; @@ -1383,11 +1382,11 @@ private void DrawInstalledPluginList(InstalledPluginListFilter filter) { continue; } - + this.DrawInstalledPlugin(plugin, i++, remoteManifest, update); drewAny = true; } - + if (!drewAny) { var text = filter switch @@ -1398,7 +1397,7 @@ private void DrawInstalledPluginList(InstalledPluginListFilter filter) InstalledPluginListFilter.Dev => Locs.TabBody_NoPluginsDev, _ => throw new ArgumentException(null, nameof(filter)), }; - + ImGuiHelpers.ScaledDummy(60); using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey)) @@ -1490,7 +1489,7 @@ private void DrawPluginCategorySelectors() foreach (var categoryKind in groupInfo.Categories) { var categoryInfo = this.categoryManager.CategoryList.First(x => x.CategoryKind == categoryKind); - + switch (categoryInfo.Condition) { case PluginCategoryManager.CategoryInfo.AppearCondition.None: @@ -1549,7 +1548,7 @@ void DrawWarningIcon() ImGui.PopFont(); ImGui.PopStyleColor(); } - + void DrawLinesCentered(string text) { var lines = text.Split('\n'); @@ -1558,7 +1557,7 @@ void DrawLinesCentered(string text) ImGuiHelpers.CenteredText(line); } } - + var pm = Service.Get(); if (pm.SafeMode) { @@ -1623,7 +1622,7 @@ void DrawLinesCentered(string text) case PluginCategoryManager.CategoryKind.IsTesting: this.DrawInstalledPluginList(InstalledPluginListFilter.Testing); break; - + case PluginCategoryManager.CategoryKind.UpdateablePlugins: this.DrawInstalledPluginList(InstalledPluginListFilter.Updateable); break; @@ -1631,7 +1630,7 @@ void DrawLinesCentered(string text) case PluginCategoryManager.CategoryKind.PluginProfiles: this.profileManagerWidget.Draw(); break; - + default: ImGui.TextUnformatted("You found a secret category. Please feel a sense of pride and accomplishment."); break; @@ -1652,7 +1651,7 @@ void DrawLinesCentered(string text) case PluginCategoryManager.CategoryKind.PluginChangelogs: this.DrawChangelogList(false, true); break; - + default: ImGui.TextUnformatted("You found a quiet category. Please don't wake it up."); break; @@ -1715,19 +1714,19 @@ private void DrawImageTester() var cursor = ImGui.GetCursorPos(); // Name - ImGui.Text("My Cool Plugin"); + ImGui.TextUnformatted("My Cool Plugin"); // Download count var downloadCountText = Locs.PluginBody_AuthorWithDownloadCount("Plugin Enjoyer", 69420); ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudGrey3, downloadCountText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, downloadCountText); cursor.Y += ImGui.GetTextLineHeightWithSpacing(); ImGui.SetCursorPos(cursor); // Description - ImGui.TextWrapped("This plugin does very many great things."); + ImGuiHelpers.SafeTextWrapped("This plugin does very many great things."); startCursor.Y += sectionSize; ImGui.SetCursorPos(startCursor); @@ -1737,7 +1736,7 @@ private void DrawImageTester() ImGui.Indent(); // Description - ImGui.TextWrapped("This is a description.\nIt has multiple lines.\nTruly descriptive."); + ImGuiHelpers.SafeTextWrapped("This is a description.\nIt has multiple lines.\nTruly descriptive."); ImGuiHelpers.ScaledDummy(5); @@ -1863,7 +1862,7 @@ static void CheckImageSize(Task? imageTask, int maxWidth, i if (!imageTask.IsCompleted) { - ImGui.Text("Loading..."); + ImGui.TextUnformatted("Loading..."); return; } @@ -1953,7 +1952,7 @@ private bool DrawPluginListLoading() if (!ready) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.TabBody_LoadingPlugins); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.TabBody_LoadingPlugins); } var failedRepos = pluginManager.Repos @@ -1967,7 +1966,7 @@ private bool DrawPluginListLoading() .Select(repo => $"{failText} ({repo.PluginMasterUrl})") .Aggregate((s1, s2) => $"{s1}\n{s2}"); - ImGui.TextColored(ImGuiColors.DalamudRed, aggFailText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, aggFailText); } return ready; @@ -1979,9 +1978,9 @@ private bool DrawPluginCollapsingHeader(string label, LocalPlugin? plugin, IPlug var sectionSize = ImGuiHelpers.GlobalScale * 66; var tapeCursor = ImGui.GetCursorPos(); - + ImGui.Separator(); - + var startCursor = ImGui.GetCursorPos(); if (flags.HasFlag(PluginHeaderFlags.IsTesting)) @@ -1992,9 +1991,9 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk var windowPos = ImGui.GetWindowPos(); var scroll = new Vector2(ImGui.GetScrollX(), ImGui.GetScrollY()); - + var adjustedPosition = windowPos + position - scroll; - + var yellow = ImGui.ColorConvertFloat4ToU32(new Vector4(1.0f, 0.9f, 0.0f, 0.10f)); var numStripes = (int)(size.X / stripeWidth) + (int)(size.Y / skewAmount) + 1; // +1 to cover partial stripe @@ -2004,19 +2003,19 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk var x1 = x0 + stripeWidth; var y0 = adjustedPosition.Y; var y1 = y0 + size.Y; - + var p0 = new Vector2(x0, y0); var p1 = new Vector2(x1, y0); var p2 = new Vector2(x1 - skewAmount, y1); var p3 = new Vector2(x0 - skewAmount, y1); - + if (i % 2 != 0) continue; - + wdl.AddQuadFilled(p0, p1, p2, p3, yellow); } } - + DrawCautionTape(tapeCursor + new Vector2(0, 1), new Vector2(ImGui.GetWindowWidth(), sectionSize + ImGui.GetStyle().ItemSpacing.Y), ImGuiHelpers.GlobalScale * 40, 20); } @@ -2025,7 +2024,7 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk ImGui.PushStyleColor(ImGuiCol.ButtonHovered, new Vector4(0.5f, 0.5f, 0.5f, 0.2f)); ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0.5f, 0.5f, 0.5f, 0.35f)); ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 0); - + ImGui.SetCursorPos(tapeCursor); if (ImGui.Button($"###plugin{index}CollapsibleBtn", new Vector2(ImGui.GetContentRegionAvail().X, sectionSize + ImGui.GetStyle().ItemSpacing.Y))) @@ -2125,7 +2124,7 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk // Verified Checkmark or dev plugin wrench { ImGui.SameLine(); - ImGui.Text(" "); + ImGui.TextUnformatted(" "); ImGui.SameLine(); var verifiedOutlineColor = KnownColor.White.Vector() with { W = 0.75f }; @@ -2158,12 +2157,12 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk : Locs.PluginBody_AuthorWithDownloadCountUnavailable(manifest.Author); ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudGrey3, downloadCountText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, downloadCountText); if (flags.HasFlag(PluginHeaderFlags.IsNew)) { ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.TankBlue, Locs.PluginTitleMod_New); + ImGuiHelpers.SafeTextColored(ImGuiColors.TankBlue, Locs.PluginTitleMod_New); } cursor.Y += ImGui.GetTextLineHeightWithSpacing(); @@ -2180,7 +2179,7 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk else bodyText += Locs.PluginBody_Outdated_WaitForUpdate; - ImGui.TextWrapped(bodyText); + ImGuiHelpers.SafeTextWrapped(bodyText); ImGui.PopStyleColor(); } else if (plugin is { IsBanned: true }) @@ -2205,32 +2204,32 @@ void DrawCautionTape(Vector2 position, Vector2 size, float stripeWidth, float sk else if (plugin is { IsOrphaned: true }) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.TextWrapped(Locs.PluginBody_Orphaned); + ImGuiHelpers.SafeTextWrapped(Locs.PluginBody_Orphaned); ImGui.PopStyleColor(); } else if (plugin is { IsDecommissioned: true, IsThirdParty: false }) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.TextWrapped(Locs.PluginBody_NoServiceOfficial); + ImGuiHelpers.SafeTextWrapped(Locs.PluginBody_NoServiceOfficial); ImGui.PopStyleColor(); } else if (plugin is { IsDecommissioned: true, IsThirdParty: true }) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.TextWrapped(Locs.PluginBody_NoServiceThird); + ImGuiHelpers.SafeTextWrapped(Locs.PluginBody_NoServiceThird); ImGui.PopStyleColor(); } else if (plugin != null && !plugin.CheckPolicy()) { ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.TextWrapped(Locs.PluginBody_Policy); + ImGuiHelpers.SafeTextWrapped(Locs.PluginBody_Policy); ImGui.PopStyleColor(); } else if (plugin is { State: PluginState.LoadError or PluginState.DependencyResolutionFailed }) { // Load failed warning ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed); - ImGui.TextWrapped(Locs.PluginBody_LoadFailed); + ImGuiHelpers.SafeTextWrapped(Locs.PluginBody_LoadFailed); ImGui.PopStyleColor(); } @@ -2302,11 +2301,11 @@ private void DrawChangelog(IChangelogEntry log) ImGui.TextUnformatted(log.Title); ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{log.Version}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, $" v{log.Version}"); if (log.Author != null) { ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudGrey3, Locs.PluginBody_AuthorWithoutDownloadCount(log.Author)); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, Locs.PluginBody_AuthorWithoutDownloadCount(log.Author)); } if (log.Date != DateTime.MinValue) @@ -2314,7 +2313,7 @@ private void DrawChangelog(IChangelogEntry log) var whenText = log.Date.LocRelativePastLong(); var whenSize = ImGui.CalcTextSize(whenText); ImGui.SameLine(ImGui.GetWindowWidth() - whenSize.X - (25 * ImGuiHelpers.GlobalScale)); - ImGui.TextColored(ImGuiColors.DalamudGrey3, whenText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, whenText); if (ImGui.IsItemHovered()) ImGui.SetTooltip("Published on " + log.Date.LocAbsolute()); } @@ -2368,11 +2367,11 @@ private void DrawAvailablePlugin(RemotePluginManifest manifest, int index) { label += Locs.PluginTitleMod_TestingAvailable; } - + var isThirdParty = manifest.SourceRepo.IsThirdParty; ImGui.PushID($"available{index}{manifest.InternalName}"); - + var flags = PluginHeaderFlags.None; if (isThirdParty) flags |= PluginHeaderFlags.IsThirdParty; @@ -2382,7 +2381,7 @@ private void DrawAvailablePlugin(RemotePluginManifest manifest, int index) flags |= PluginHeaderFlags.IsInstallableOutdated; if (useTesting || manifest.IsTestingExclusive) flags |= PluginHeaderFlags.IsTesting; - + if (this.DrawPluginCollapsingHeader(label, null, manifest, flags, () => this.DrawAvailablePluginContextMenu(manifest), index)) { if (!wasSeen) @@ -2396,7 +2395,7 @@ private void DrawAvailablePlugin(RemotePluginManifest manifest, int index) if (manifest.SourceRepo.IsThirdParty) { var repoText = Locs.PluginBody_Plugin3rdPartyRepo(manifest.SourceRepo.PluginMasterUrl); - ImGui.TextColored(ImGuiColors.DalamudGrey3, repoText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, repoText); ImGuiHelpers.ScaledDummy(2); } @@ -2478,7 +2477,7 @@ private void DrawAvailablePluginContextMenu(RemotePluginManifest manifest) EnsureHaveTestingOptIn(manifest); this.StartInstall(manifest, true); } - + ImGui.Separator(); } @@ -2676,9 +2675,9 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani availablePluginUpdate.UseTesting ? availablePluginUpdate.UpdateManifest.TestingAssemblyVersion : availablePluginUpdate.UpdateManifest.AssemblyVersion; - + availableChangelog = - availablePluginUpdate.UseTesting ? + availablePluginUpdate.UseTesting ? availablePluginUpdate.UpdateManifest.TestingChangelog : availablePluginUpdate.UpdateManifest.Changelog; } @@ -2715,7 +2714,7 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani : Locs.PluginBody_AuthorWithDownloadCountUnavailable(manifest.Author); ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudGrey3, downloadText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, downloadText); var acceptsFeedback = this.pluginListAvailable.Any(x => x.InternalName == plugin.InternalName && x.AcceptsFeedback); @@ -2733,12 +2732,12 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani if (plugin.IsDev) { var fileText = Locs.PluginBody_DevPluginPath(plugin.DllFile.FullName); - ImGui.TextColored(ImGuiColors.DalamudGrey3, fileText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, fileText); } else if (isThirdParty) { var repoText = Locs.PluginBody_Plugin3rdPartyRepo(manifest.InstalledFromUrl); - ImGui.TextColored(ImGuiColors.DalamudGrey3, repoText); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, repoText); } // Description @@ -2751,8 +2750,8 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani if (this.hasDevPlugins) { ImGuiHelpers.ScaledDummy(3); - ImGui.TextColored(ImGuiColors.DalamudGrey, $"WorkingPluginId: {plugin.EffectiveWorkingPluginId}"); - ImGui.TextColored(ImGuiColors.DalamudGrey, $"Command prefix: {ConsoleManagerPluginUtil.GetSanitizedNamespaceName(plugin.InternalName)}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, $"WorkingPluginId: {plugin.EffectiveWorkingPluginId}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, $"Command prefix: {ConsoleManagerPluginUtil.GetSanitizedNamespaceName(plugin.InternalName)}"); ImGuiHelpers.ScaledDummy(3); } @@ -2802,7 +2801,7 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani } ImGui.SameLine(); - ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{plugin.EffectiveVersion}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, $" v{plugin.EffectiveVersion}"); ImGuiHelpers.ScaledDummy(5); @@ -2835,7 +2834,7 @@ private void DrawInstalledPlugin(LocalPlugin plugin, int index, RemotePluginMani { this.DrawInstalledPluginChangelog(applicableChangelog); } - + if (this.categoryManager.CurrentCategoryKind == PluginCategoryManager.CategoryKind.UpdateablePlugins && !availableChangelog.IsNullOrWhitespace() && !didDrawAvailableChangelogInsideCollapsible) @@ -2857,7 +2856,7 @@ private void DrawInstalledPluginChangelog(string changelog) if (ImGui.BeginChild("##changelog", new Vector2(-1, 100), true, ImGuiWindowFlags.NoNavFocus | ImGuiWindowFlags.NoNavInputs | ImGuiWindowFlags.AlwaysAutoResize)) { - ImGui.Text("Changelog:"); + ImGui.TextUnformatted("Changelog:"); ImGuiHelpers.ScaledDummy(2); ImGuiHelpers.SafeTextWrapped(changelog!); } @@ -3002,7 +3001,7 @@ private void DrawPluginControlButton(LocalPlugin plugin, AvailablePluginUpdate? } if (!didAny) - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.Profiles_None); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.Profiles_None); ImGui.Separator(); @@ -3022,7 +3021,7 @@ private void DrawPluginControlButton(LocalPlugin plugin, AvailablePluginUpdate? } ImGui.SameLine(); - ImGui.Text(Locs.Profiles_RemoveFromAll); + ImGui.TextUnformatted(Locs.Profiles_RemoveFromAll); ImGui.EndPopup(); } @@ -3305,7 +3304,7 @@ private void DrawDevPluginValidationIssues(LocalDevPlugin devPlugin) if (problems.Count == 0) { ImGui.PushFont(InterfaceManager.IconFont); - ImGui.Text(FontAwesomeIcon.Check.ToIconString()); + ImGui.TextUnformatted(FontAwesomeIcon.Check.ToIconString()); ImGui.PopFont(); ImGui.SameLine(); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.HealerGreen, "No validation issues found in this plugin!"); @@ -3362,13 +3361,13 @@ private void DrawDevPluginValidationIssues(LocalDevPlugin devPlugin) switch (problem.Severity) { case PluginValidator.ValidationSeverity.Fatal: - ImGui.Text(FontAwesomeIcon.TimesCircle.ToIconString()); + ImGui.TextUnformatted(FontAwesomeIcon.TimesCircle.ToIconString()); break; case PluginValidator.ValidationSeverity.Warning: - ImGui.Text(FontAwesomeIcon.ExclamationTriangle.ToIconString()); + ImGui.TextUnformatted(FontAwesomeIcon.ExclamationTriangle.ToIconString()); break; case PluginValidator.ValidationSeverity.Information: - ImGui.Text(FontAwesomeIcon.InfoCircle.ToIconString()); + ImGui.TextUnformatted(FontAwesomeIcon.InfoCircle.ToIconString()); break; default: throw new ArgumentOutOfRangeException(); @@ -3689,7 +3688,7 @@ private void OnAvailablePluginsChanged() this.pluginListUpdatable = pluginManager.UpdatablePlugins.ToList(); this.ResortPlugins(); } - + this.hasHiddenPlugins = this.pluginListAvailable.Any(x => configuration.HiddenPluginInternalName.Contains(x.InternalName)); this.UpdateCategoriesOnPluginsChange(); @@ -3841,7 +3840,7 @@ private void DrawFontawesomeIconOutlined(FontAwesomeIcon icon, Vector4 outline, if (x is 0 && y is 0) continue; ImGui.SetCursorPos(cursorStart + new Vector2(x, y)); - ImGui.Text(icon.ToIconString()); + ImGui.TextUnformatted(icon.ToIconString()); } } @@ -3849,7 +3848,7 @@ private void DrawFontawesomeIconOutlined(FontAwesomeIcon icon, Vector4 outline, ImGui.PushStyleColor(ImGuiCol.Text, iconColor); ImGui.SetCursorPos(cursorStart); - ImGui.Text(icon.ToIconString()); + ImGui.TextUnformatted(icon.ToIconString()); ImGui.PopStyleColor(); ImGui.PopFont(); @@ -3943,16 +3942,16 @@ internal static class Locs public static string TabBody_DownloadFailed => Loc.Localize("InstallerDownloadFailed", "Download failed."); public static string TabBody_SafeMode => Loc.Localize("InstallerSafeMode", "Dalamud is running in Plugin Safe Mode, restart to activate plugins."); - + public static string TabBody_NoPluginsTesting => Loc.Localize("InstallerNoPluginsTesting", "You aren't testing any plugins at the moment!\nYou can opt in to testing versions in the plugin context menu."); - + public static string TabBody_NoPluginsInstalled => string.Format(Loc.Localize("InstallerNoPluginsInstalled", "You don't have any plugins installed yet!\nYou can install them from the \"{0}\" tab."), PluginCategoryManager.Locs.Category_All); - + public static string TabBody_NoPluginsUpdateable => Loc.Localize("InstallerNoPluginsUpdate", "No plugins have updates available at the moment."); - + public static string TabBody_NoPluginsDev => Loc.Localize("InstallerNoPluginsDev", "You don't have any dev plugins. Add them from the settings."); - + #endregion #region Search text @@ -4014,11 +4013,11 @@ internal static class Locs public static string PluginContext_TestingOptIn => Loc.Localize("InstallerTestingOptIn", "Receive plugin testing versions"); public static string PluginContext_InstallTestingVersion => Loc.Localize("InstallerInstallTestingVersion", "Install testing version"); - + public static string PluginContext_MarkAllSeen => Loc.Localize("InstallerMarkAllSeen", "Mark all as seen"); public static string PluginContext_HidePlugin => Loc.Localize("InstallerHidePlugin", "Hide from installer"); - + public static string PluginContext_UnhidePlugin => Loc.Localize("InstallerUnhidePlugin", "Unhide from installer"); public static string PluginContext_DeletePluginConfig => Loc.Localize("InstallerDeletePluginConfig", "Reset plugin data"); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs index 95315dbd3f..6250f2f781 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs @@ -56,11 +56,11 @@ public void Draw() this.DrawChoice(); return; } - + var tutorialTitle = Locs.TutorialTitle + "###collectionsTutorWindow"; var tutorialId = ImGui.GetID(tutorialTitle); this.DrawTutorial(tutorialTitle); - + switch (this.mode) { case Mode.Overview: @@ -120,22 +120,22 @@ private void DrawTutorial(string modalTitle) ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphFour); ImGuiHelpers.ScaledDummy(5); ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommands); - + ImGui.Bullet(); ImGui.SameLine(); ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnable); - + ImGui.Bullet(); ImGui.SameLine(); ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsDisable); - + ImGui.Bullet(); ImGui.SameLine(); ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsToggle); ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnd); ImGuiHelpers.ScaledDummy(5); - + var buttonWidth = 120f; ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2); if (ImGui.Button("OK", new Vector2(buttonWidth, 40))) @@ -186,14 +186,14 @@ private void DrawOverview(uint tutorialId) if (ImGui.IsItemHovered()) ImGui.SetTooltip(Locs.ImportProfileHint); - + ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); ImGui.SameLine(); - + if (ImGuiComponents.IconButton(FontAwesomeIcon.Question)) ImGui.OpenPopup(tutorialId); - + if (ImGui.IsItemHovered()) ImGui.SetTooltip(Locs.TutorialHint); @@ -224,7 +224,7 @@ private void DrawOverview(uint tutorialId) ImGuiHelpers.ScaledDummy(3); ImGui.SameLine(); - ImGui.Text(profile.Name); + ImGui.TextUnformatted(profile.Name); ImGui.SameLine(); ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30)); @@ -425,7 +425,7 @@ private void DrawEdit() ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight)); ImGui.PopStyleVar(); } - + ImGui.SameLine(); var text = $"{pmPlugin.Name}{(pmPlugin.IsDev ? " (dev plugin" : string.Empty)}"; @@ -448,15 +448,15 @@ private void DrawEdit() ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2)); ImGui.TextUnformatted(text); - + var firstAvailableInstalled = pm.InstalledPlugins.FirstOrDefault(x => x.InternalName == profileEntry.InternalName); var installable = pm.AvailablePlugins.FirstOrDefault( x => x.InternalName == profileEntry.InternalName && !x.SourceRepo.IsThirdParty); - + if (firstAvailableInstalled != null) { - ImGui.Text($"Match to plugin '{firstAvailableInstalled.Name}'?"); + ImGui.TextUnformatted($"Match to plugin '{firstAvailableInstalled.Name}'?"); ImGui.SameLine(); if (ImGuiComponents.IconButtonWithText( FontAwesomeIcon.Check, @@ -488,7 +488,7 @@ private void DrawEdit() if (ImGui.IsItemHovered()) ImGui.SetTooltip(Locs.InstallPlugin); } - + ImGui.SetCursorPos(before); } @@ -525,7 +525,7 @@ private void DrawEdit() if (!didAny) { - ImGui.TextColored(ImGuiColors.DalamudGrey, Locs.NoPluginsInProfile); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, Locs.NoPluginsInProfile); } ImGuiHelpers.ScaledDummy(10); @@ -608,13 +608,13 @@ private static class Locs public static string TutorialTitle => Loc.Localize("ProfileManagerTutorial", "About Collections"); - + public static string TutorialParagraphOne => Loc.Localize("ProfileManagerTutorialParagraphOne", "Collections are shareable lists of plugins that can be enabled or disabled in the plugin installer or via chat commands.\nWhen a plugin is part of a collection, it will be enabled if the collection is enabled. If a plugin is part of multiple collections, it will be enabled if one or more collections it is a part of are enabled."); - + public static string TutorialParagraphTwo => Loc.Localize("ProfileManagerTutorialParagraphTwo", "You can add plugins to collections by clicking the plus button when editing a collection on this screen, or by using the button with the toolbox icon on the \"Installed Plugins\" screen."); - + public static string TutorialParagraphThree => Loc.Localize("ProfileManagerTutorialParagraphThree", "If a collection's \"Start on boot\" checkbox is ticked, the collection and the plugins within will be enabled every time the game starts up, even if it has been manually disabled in a prior session."); @@ -623,25 +623,25 @@ private static class Locs public static string TutorialCommands => Loc.Localize("ProfileManagerTutorialCommands", "You can use the following commands in chat or in macros to manage active collections:"); - + public static string TutorialCommandsEnable => Loc.Localize("ProfileManagerTutorialCommandsEnable", "{0} \"Collection Name\" - Enable a collection").Format(ProfileCommandHandler.CommandEnable); public static string TutorialCommandsDisable => Loc.Localize("ProfileManagerTutorialCommandsDisable", "{0} \"Collection Name\" - Disable a collection").Format(ProfileCommandHandler.CommandDisable); - + public static string TutorialCommandsToggle => Loc.Localize("ProfileManagerTutorialCommandsToggle", "{0} \"Collection Name\" - Toggle a collection's state").Format(ProfileCommandHandler.CommandToggle); - + public static string TutorialCommandsEnd => Loc.Localize("ProfileManagerTutorialCommandsEnd", "If you run multiple of these commands, they will be executed in order."); public static string Choice1 => Loc.Localize("ProfileManagerChoice1", "Plugin collections are a new feature that allow you to group plugins into collections which can be toggled and shared."); - + public static string Choice2 => Loc.Localize("ProfileManagerChoice2", "They are experimental and may still contain bugs. Do you want to enable them now?"); - + public static string ChoiceConfirmation => Loc.Localize("ProfileManagerChoiceConfirmation", "Yes, enable Plugin Collections"); diff --git a/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs b/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs index 314f023da4..60fa76c15e 100644 --- a/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginStatWindow.cs @@ -8,6 +8,7 @@ using Dalamud.Interface.Components; using Dalamud.Interface.ImGuiNotification; using Dalamud.Interface.ImGuiNotification.Internal; +using Dalamud.Interface.Utility; using Dalamud.Interface.Windowing; using Dalamud.Plugin.Internal; using Dalamud.Plugin.Internal.Types; @@ -132,20 +133,20 @@ public override void Draw() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text(plugin.Manifest.Name); + ImGui.TextUnformatted(plugin.Manifest.Name); if (plugin.DalamudInterface != null) { ImGui.TableNextColumn(); - ImGui.Text($"{plugin.DalamudInterface.LocalUiBuilder.LastDrawTime / 10000f:F4}ms"); + ImGui.TextUnformatted($"{plugin.DalamudInterface.LocalUiBuilder.LastDrawTime / 10000f:F4}ms"); ImGui.TableNextColumn(); - ImGui.Text($"{plugin.DalamudInterface.LocalUiBuilder.MaxDrawTime / 10000f:F4}ms"); + ImGui.TextUnformatted($"{plugin.DalamudInterface.LocalUiBuilder.MaxDrawTime / 10000f:F4}ms"); ImGui.TableNextColumn(); - ImGui.Text(plugin.DalamudInterface.LocalUiBuilder.DrawTimeHistory.Count > 0 - ? $"{plugin.DalamudInterface.LocalUiBuilder.DrawTimeHistory.Average() / 10000f:F4}ms" - : "-"); + ImGui.TextUnformatted(plugin.DalamudInterface.LocalUiBuilder.DrawTimeHistory.Count > 0 + ? $"{plugin.DalamudInterface.LocalUiBuilder.DrawTimeHistory.Average() / 10000f:F4}ms" + : "-"); } } @@ -239,16 +240,16 @@ public override void Draw() ImGui.TableNextRow(); ImGui.TableNextColumn(); - ImGui.Text($"{handlerHistory.Key}"); + ImGui.TextUnformatted($"{handlerHistory.Key}"); ImGui.TableNextColumn(); - ImGui.Text($"{handlerHistory.Value.Last():F4}ms"); + ImGui.TextUnformatted($"{handlerHistory.Value.Last():F4}ms"); ImGui.TableNextColumn(); - ImGui.Text($"{handlerHistory.Value.Max():F4}ms"); + ImGui.TextUnformatted($"{handlerHistory.Value.Max():F4}ms"); ImGui.TableNextColumn(); - ImGui.Text($"{handlerHistory.Value.Average():F4}ms"); + ImGui.TextUnformatted($"{handlerHistory.Value.Average():F4}ms"); } ImGui.EndTable(); @@ -308,8 +309,8 @@ public override void Draw() ImGui.TableNextColumn(); - ImGui.Text($"{trackedHook.Delegate.Target} :: {trackedHook.Delegate.Method.Name}"); - ImGui.TextDisabled(trackedHook.Assembly.FullName); + ImGui.TextUnformatted($"{trackedHook.Delegate.Target} :: {trackedHook.Delegate.Method.Name}"); + ImGuiHelpers.SafeTextDisabled(trackedHook.Assembly.FullName); ImGui.TableNextColumn(); if (!trackedHook.Hook.IsDisposed) { @@ -334,16 +335,16 @@ public override void Draw() if (trackedHook.Hook.IsDisposed) { - ImGui.Text("Disposed"); + ImGui.TextUnformatted("Disposed"); } else { - ImGui.Text(trackedHook.Hook.IsEnabled ? "Enabled" : "Disabled"); + ImGui.TextUnformatted(trackedHook.Hook.IsEnabled ? "Enabled" : "Disabled"); } ImGui.TableNextColumn(); - ImGui.Text(trackedHook.Hook.BackendName); + ImGui.TextUnformatted(trackedHook.Hook.BackendName); } catch (Exception ex) { diff --git a/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs b/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs index 28dcdb117e..3ee7361294 100644 --- a/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ProfilerWindow.cs @@ -43,7 +43,7 @@ public override void Draw() var actualMin = Timings.AllTimings.Keys.Min(x => x.StartTime); var actualMax = Timings.AllTimings.Keys.Max(x => x.EndTime); - ImGui.Text("Timings"); + ImGui.TextUnformatted("Timings"); var childHeight = Math.Max(300, 20 * (2.5f + this.occupied.Count)); @@ -192,7 +192,7 @@ public override void Draw() var eventsXPos = new List(); const float eventsXPosFudge = 5f; - + foreach (var timingEvent in Timings.Events) { var startX = (timingEvent.StartTime - this.min) / (this.max - this.min) * width; @@ -217,7 +217,7 @@ public override void Draw() { textPos.X = pos.X + (uint)startX - textSize.X - padding; } - + var numClashes = eventsXPos.Count(x => Math.Abs(x - textPos.X) < textSize.X + eventsXPosFudge); if (numClashes > 0) { @@ -228,7 +228,7 @@ public override void Draw() textPos, ImGui.GetColorU32(ImGuiColors.DalamudWhite), timingEvent.Name); - + eventsXPos.Add(textPos.X); } } @@ -254,9 +254,9 @@ public override void Draw() this.max = this.min + (sizeShown * 1000f); } - ImGui.Text("Min: " + actualMin.ToString("0.000")); - ImGui.Text("Max: " + actualMax.ToString("0.000")); - ImGui.Text("Timings: " + Timings.AllTimings.Count); + ImGui.TextUnformatted("Min: " + actualMin.ToString("0.000")); + ImGui.TextUnformatted("Max: " + actualMax.ToString("0.000")); + ImGui.TextUnformatted("Timings: " + Timings.AllTimings.Count); } [SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Internals")] diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ActorTableAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ActorTableAgingStep.cs index 242e93a496..43b6f017be 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ActorTableAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ActorTableAgingStep.cs @@ -19,7 +19,7 @@ public SelfTestStepResult RunStep() { var objectTable = Service.Get(); - ImGui.Text("Checking actor table..."); + ImGui.TextUnformatted("Checking actor table..."); if (this.index == objectTable.Length - 1) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AddonLifecycleAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AddonLifecycleAgingStep.cs index 28edab88a5..e6ade3c9b5 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AddonLifecycleAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AddonLifecycleAgingStep.cs @@ -13,7 +13,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps; internal class AddonLifecycleAgingStep : IAgingStep { private readonly List listeners; - + private AddonLifecycle? service; private TestStep currentStep = TestStep.CharacterRefresh; private bool listenersRegistered; @@ -33,7 +33,7 @@ public AddonLifecycleAgingStep() new(AddonEvent.PreFinalize, "Character", this.PreFinalize), }; } - + private enum TestStep { CharacterRefresh, @@ -44,10 +44,10 @@ private enum TestStep CharacterFinalize, Complete, } - + /// public string Name => "Test AddonLifecycle"; - + /// public SelfTestStepResult RunStep() { @@ -60,26 +60,26 @@ public SelfTestStepResult RunStep() { this.service.RegisterListener(listener); } - + this.listenersRegistered = true; } switch (this.currentStep) { case TestStep.CharacterRefresh: - ImGui.Text("Open Character Window."); + ImGui.TextUnformatted("Open Character Window."); break; case TestStep.CharacterSetup: - ImGui.Text("Open Character Window."); + ImGui.TextUnformatted("Open Character Window."); break; case TestStep.CharacterRequestedUpdate: - ImGui.Text("Change tabs, or un-equip/equip gear."); + ImGui.TextUnformatted("Change tabs, or un-equip/equip gear."); break; case TestStep.CharacterFinalize: - ImGui.Text("Close Character Window."); + ImGui.TextUnformatted("Close Character Window."); break; case TestStep.CharacterUpdate: @@ -89,7 +89,7 @@ public SelfTestStepResult RunStep() // Nothing to report to tester. break; } - + return this.currentStep is TestStep.Complete ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting; } @@ -101,32 +101,32 @@ public void CleanUp() this.service?.UnregisterListener(listener); } } - + private void PostSetup(AddonEvent eventType, AddonArgs addonInfo) - { + { if (this.currentStep is TestStep.CharacterSetup) this.currentStep++; } - + private void PostUpdate(AddonEvent eventType, AddonArgs addonInfo) { if (this.currentStep is TestStep.CharacterUpdate) this.currentStep++; } - + private void PostDraw(AddonEvent eventType, AddonArgs addonInfo) { if (this.currentStep is TestStep.CharacterDraw) this.currentStep++; } - + private void PostRefresh(AddonEvent eventType, AddonArgs addonInfo) { if (this.currentStep is TestStep.CharacterRefresh) this.currentStep++; } - + private void PostRequestedUpdate(AddonEvent eventType, AddonArgs addonInfo) { if (this.currentStep is TestStep.CharacterRequestedUpdate) this.currentStep++; } - + private void PreFinalize(AddonEvent eventType, AddonArgs addonInfo) { if (this.currentStep is TestStep.CharacterFinalize) this.currentStep++; diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AetheryteListAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AetheryteListAgingStep.cs index 6a4519eab8..b6712ce990 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AetheryteListAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/AetheryteListAgingStep.cs @@ -19,7 +19,7 @@ public SelfTestStepResult RunStep() { var list = Service.Get(); - ImGui.Text("Checking aetheryte list..."); + ImGui.TextUnformatted("Checking aetheryte list..."); if (this.index == list.Length - 1) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ChatAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ChatAgingStep.cs index 2fdd8c060c..87a2739c5d 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ChatAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ChatAgingStep.cs @@ -32,7 +32,7 @@ public SelfTestStepResult RunStep() break; case 1: - ImGui.Text("Type \"/e DALAMUD\" in chat..."); + ImGui.TextUnformatted("Type \"/e DALAMUD\" in chat..."); if (!this.subscribed) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ConditionAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ConditionAgingStep.cs index 8ce2111c93..99083db9eb 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ConditionAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ConditionAgingStep.cs @@ -24,7 +24,7 @@ public SelfTestStepResult RunStep() return SelfTestStepResult.Fail; } - ImGui.Text("Please jump..."); + ImGui.TextUnformatted("Please jump..."); return condition[ConditionFlag.Jumping] ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting; } diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs index f08eccd96a..04ebd2441f 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ContextMenuAgingStep.cs @@ -48,7 +48,7 @@ public SelfTestStepResult RunStep() this.materiaSheet = dataMgr.GetExcelSheet(); this.stainSheet = dataMgr.GetExcelSheet(); - ImGui.Text(this.currentSubStep.ToString()); + ImGui.TextUnformatted(this.currentSubStep.ToString()); switch (this.currentSubStep) { @@ -59,7 +59,7 @@ public SelfTestStepResult RunStep() case SubStep.TestInventoryAndSubmenu: if (this.targetInventorySubmenuOpened == true) { - ImGui.Text($"Is the data in the submenu correct?"); + ImGui.TextUnformatted($"Is the data in the submenu correct?"); if (ImGui.Button("Yes")) this.currentSubStep++; @@ -71,7 +71,7 @@ public SelfTestStepResult RunStep() } else { - ImGui.Text("Right-click an item and select \"Self Test\"."); + ImGui.TextUnformatted("Right-click an item and select \"Self Test\"."); if (ImGui.Button("Skip")) this.currentSubStep++; @@ -82,7 +82,7 @@ public SelfTestStepResult RunStep() case SubStep.TestDefault: if (this.targetCharacter is { } character) { - ImGui.Text($"Did you click \"{character.Name}\" ({character.ClassJob.Value.Abbreviation.ExtractText()})?"); + ImGui.TextUnformatted($"Did you click \"{character.Name}\" ({character.ClassJob.Value.Abbreviation.ExtractText()})?"); if (ImGui.Button("Yes")) this.currentSubStep++; @@ -94,7 +94,7 @@ public SelfTestStepResult RunStep() } else { - ImGui.Text("Right-click a character."); + ImGui.TextUnformatted("Right-click a character."); if (ImGui.Button("Skip")) this.currentSubStep++; @@ -110,7 +110,7 @@ public SelfTestStepResult RunStep() return SelfTestStepResult.Waiting; } - + /// public void CleanUp() { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/DutyStateAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/DutyStateAgingStep.cs index 19e218ecb8..642e2aec5a 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/DutyStateAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/DutyStateAgingStep.cs @@ -20,7 +20,7 @@ public SelfTestStepResult RunStep() { var dutyState = Service.Get(); - ImGui.Text("Enter a duty now..."); + ImGui.TextUnformatted("Enter a duty now..."); if (!this.subscribed) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/FateTableAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/FateTableAgingStep.cs index eef9863028..b29e92e740 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/FateTableAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/FateTableAgingStep.cs @@ -19,11 +19,11 @@ public SelfTestStepResult RunStep() { var fateTable = Service.Get(); - ImGui.Text("Checking fate table..."); + ImGui.TextUnformatted("Checking fate table..."); if (fateTable.Length == 0) { - ImGui.Text("Go to a zone that has FATEs currently up."); + ImGui.TextUnformatted("Go to a zone that has FATEs currently up."); return SelfTestStepResult.Waiting; } diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GameConfigAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GameConfigAgingStep.cs index 97c163590b..696bde3bf6 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GameConfigAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GameConfigAgingStep.cs @@ -44,7 +44,7 @@ public SelfTestStepResult RunStep() } else { - ImGui.Text("Switch Movement Type to Standard"); + ImGui.TextUnformatted("Switch Movement Type to Standard"); } return SelfTestStepResult.Waiting; @@ -58,7 +58,7 @@ public SelfTestStepResult RunStep() } else { - ImGui.Text("Switch Movement Type to Legacy"); + ImGui.TextUnformatted("Switch Movement Type to Legacy"); } return SelfTestStepResult.Waiting; @@ -74,7 +74,7 @@ public SelfTestStepResult RunStep() } else { - ImGui.Text("Switch Movement Type to Legacy"); + ImGui.TextUnformatted("Switch Movement Type to Legacy"); } return SelfTestStepResult.Waiting; @@ -88,7 +88,7 @@ public SelfTestStepResult RunStep() } else { - ImGui.Text("Switch Movement Type to Standard"); + ImGui.TextUnformatted("Switch Movement Type to Standard"); } return SelfTestStepResult.Waiting; diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GamepadStateAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GamepadStateAgingStep.cs index ccee570c75..a6425d0d34 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GamepadStateAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/GamepadStateAgingStep.cs @@ -17,7 +17,7 @@ public SelfTestStepResult RunStep() { var gamepadState = Service.Get(); - ImGui.Text("Hold down North, East, L1"); + ImGui.TextUnformatted("Hold down North, East, L1"); if (gamepadState.Raw(GamepadButtons.North) == 1 && gamepadState.Raw(GamepadButtons.East) == 1 diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/HoverAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/HoverAgingStep.cs index 8f509b8e7d..320c6018c9 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/HoverAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/HoverAgingStep.cs @@ -22,7 +22,7 @@ public SelfTestStepResult RunStep() if (!this.clearedItem) { - ImGui.Text("Hover WHM soul crystal..."); + ImGui.TextUnformatted("Hover WHM soul crystal..."); if (gameGui.HoveredItem == 4547) { @@ -32,7 +32,7 @@ public SelfTestStepResult RunStep() if (!this.clearedAction) { - ImGui.Text("Hover \"Open Linkshells\" action..."); + ImGui.TextUnformatted("Hover \"Open Linkshells\" action..."); if (gameGui.HoveredAction != null && gameGui.HoveredAction.ActionKind == HoverActionKind.MainCommand && diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ItemPayloadAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ItemPayloadAgingStep.cs index 1ccb5934f2..fb5567bd52 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ItemPayloadAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/ItemPayloadAgingStep.cs @@ -44,7 +44,7 @@ public SelfTestStepResult RunStep() SeString? toPrint = null; - ImGui.Text(this.currentSubStep.ToString()); + ImGui.TextUnformatted(this.currentSubStep.ToString()); switch (this.currentSubStep) { @@ -53,7 +53,7 @@ public SelfTestStepResult RunStep() this.currentSubStep++; break; case SubStep.HoverNormalItem: - ImGui.Text("Hover the item."); + ImGui.TextUnformatted("Hover the item."); if (gameGui.HoveredItem != normalItemId) return SelfTestStepResult.Waiting; this.currentSubStep++; @@ -63,7 +63,7 @@ public SelfTestStepResult RunStep() this.currentSubStep++; break; case SubStep.HoverHqItem: - ImGui.Text("Hover the item."); + ImGui.TextUnformatted("Hover the item."); if (gameGui.HoveredItem != 1_000_000 + hqItemId) return SelfTestStepResult.Waiting; this.currentSubStep++; @@ -73,7 +73,7 @@ public SelfTestStepResult RunStep() this.currentSubStep++; break; case SubStep.HoverCollectable: - ImGui.Text("Hover the item."); + ImGui.TextUnformatted("Hover the item."); if (gameGui.HoveredItem != 500_000 + collectableItemId) return SelfTestStepResult.Waiting; this.currentSubStep++; @@ -83,7 +83,7 @@ public SelfTestStepResult RunStep() this.currentSubStep++; break; case SubStep.HoverEventItem: - ImGui.Text("Hover the item."); + ImGui.TextUnformatted("Hover the item."); if (gameGui.HoveredItem != eventItemId) return SelfTestStepResult.Waiting; this.currentSubStep++; @@ -93,7 +93,7 @@ public SelfTestStepResult RunStep() this.currentSubStep++; break; case SubStep.HoverNormalWithText: - ImGui.Text("Hover the item."); + ImGui.TextUnformatted("Hover the item."); if (gameGui.HoveredItem != normalItemId) return SelfTestStepResult.Waiting; this.currentSubStep++; diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/KeyStateAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/KeyStateAgingStep.cs index 522943e877..85a9f1165a 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/KeyStateAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/KeyStateAgingStep.cs @@ -17,7 +17,7 @@ public SelfTestStepResult RunStep() { var keyState = Service.Get(); - ImGui.Text("Hold down D,A,L,M,U"); + ImGui.TextUnformatted("Hold down D,A,L,M,U"); if (keyState[VirtualKey.D] && keyState[VirtualKey.A] diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs index d755e95efe..fbd91436f7 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LoginEventAgingStep.cs @@ -20,7 +20,7 @@ public SelfTestStepResult RunStep() { var clientState = Service.Get(); - ImGui.Text("Log in now..."); + ImGui.TextUnformatted("Log in now..."); if (!this.subscribed) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs index 7231821118..9b55b4e494 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/LogoutEventAgingStep.cs @@ -20,7 +20,7 @@ public SelfTestStepResult RunStep() { var clientState = Service.Get(); - ImGui.Text("Log out now..."); + ImGui.TextUnformatted("Log out now..."); if (!this.subscribed) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/MarketBoardAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/MarketBoardAgingStep.cs index 513141fa94..b966181268 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/MarketBoardAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/MarketBoardAgingStep.cs @@ -42,7 +42,7 @@ public SelfTestStepResult RunStep() this.SubscribeToEvents(); } - ImGui.Text($"Testing: {this.currentSubStep.ToString()}"); + ImGui.TextUnformatted($"Testing: {this.currentSubStep.ToString()}"); switch (this.currentSubStep) { @@ -50,16 +50,16 @@ public SelfTestStepResult RunStep() if (this.historyListing == null) { - ImGui.Text("Goto a Market Board. Open any item that has historical sale listings."); + ImGui.TextUnformatted("Goto a Market Board. Open any item that has historical sale listings."); } else { - ImGui.Text("Does one of the historical sales match this information?"); + ImGui.TextUnformatted("Does one of the historical sales match this information?"); ImGui.Separator(); - ImGui.Text($"Quantity: {this.historyListing.Quantity.ToString()}"); - ImGui.Text($"Buyer: {this.historyListing.BuyerName}"); - ImGui.Text($"Sale Price: {this.historyListing.SalePrice.ToString()}"); - ImGui.Text($"Purchase Time: {this.historyListing.PurchaseTime.ToString(CultureInfo.InvariantCulture)}"); + ImGui.TextUnformatted($"Quantity: {this.historyListing.Quantity.ToString()}"); + ImGui.TextUnformatted($"Buyer: {this.historyListing.BuyerName}"); + ImGui.TextUnformatted($"Sale Price: {this.historyListing.SalePrice.ToString()}"); + ImGui.TextUnformatted($"Purchase Time: {this.historyListing.PurchaseTime.ToString(CultureInfo.InvariantCulture)}"); ImGui.Separator(); if (ImGui.Button("Looks Correct / Skip")) { @@ -78,16 +78,16 @@ public SelfTestStepResult RunStep() if (this.itemListing == null) { - ImGui.Text("Goto a Market Board. Open any item that has sale listings."); + ImGui.TextUnformatted("Goto a Market Board. Open any item that has sale listings."); } else { - ImGui.Text("Does one of the sales match this information?"); + ImGui.TextUnformatted("Does one of the sales match this information?"); ImGui.Separator(); - ImGui.Text($"Quantity: {this.itemListing.ItemQuantity.ToString()}"); - ImGui.Text($"Price Per Unit: {this.itemListing.PricePerUnit}"); - ImGui.Text($"Retainer Name: {this.itemListing.RetainerName}"); - ImGui.Text($"Is HQ?: {(this.itemListing.IsHq ? "Yes" : "No")}"); + ImGui.TextUnformatted($"Quantity: {this.itemListing.ItemQuantity.ToString()}"); + ImGui.TextUnformatted($"Price Per Unit: {this.itemListing.PricePerUnit}"); + ImGui.TextUnformatted($"Retainer Name: {this.itemListing.RetainerName}"); + ImGui.TextUnformatted($"Is HQ?: {(this.itemListing.IsHq ? "Yes" : "No")}"); ImGui.Separator(); if (ImGui.Button("Looks Correct / Skip")) { @@ -105,15 +105,15 @@ public SelfTestStepResult RunStep() case SubStep.PurchaseRequests: if (this.marketBoardPurchaseRequest == null) { - ImGui.Text("Goto a Market Board. Purchase any item, the cheapest you can find."); + ImGui.TextUnformatted("Goto a Market Board. Purchase any item, the cheapest you can find."); } else { - ImGui.Text("Does this information match the purchase you made? This is testing the request to the server."); + ImGui.TextUnformatted("Does this information match the purchase you made? This is testing the request to the server."); ImGui.Separator(); - ImGui.Text($"Quantity: {this.marketBoardPurchaseRequest.ItemQuantity.ToString()}"); - ImGui.Text($"Item ID: {this.marketBoardPurchaseRequest.CatalogId}"); - ImGui.Text($"Price Per Unit: {this.marketBoardPurchaseRequest.PricePerUnit}"); + ImGui.TextUnformatted($"Quantity: {this.marketBoardPurchaseRequest.ItemQuantity.ToString()}"); + ImGui.TextUnformatted($"Item ID: {this.marketBoardPurchaseRequest.CatalogId}"); + ImGui.TextUnformatted($"Price Per Unit: {this.marketBoardPurchaseRequest.PricePerUnit}"); ImGui.Separator(); if (ImGui.Button("Looks Correct / Skip")) { @@ -131,14 +131,14 @@ public SelfTestStepResult RunStep() case SubStep.Purchases: if (this.marketBoardPurchase == null) { - ImGui.Text("Goto a Market Board. Purchase any item, the cheapest you can find."); + ImGui.TextUnformatted("Goto a Market Board. Purchase any item, the cheapest you can find."); } else { - ImGui.Text("Does this information match the purchase you made? This is testing the response from the server."); + ImGui.TextUnformatted("Does this information match the purchase you made? This is testing the response from the server."); ImGui.Separator(); - ImGui.Text($"Quantity: {this.marketBoardPurchase.ItemQuantity.ToString()}"); - ImGui.Text($"Item ID: {this.marketBoardPurchase.CatalogId}"); + ImGui.TextUnformatted($"Quantity: {this.marketBoardPurchase.ItemQuantity.ToString()}"); + ImGui.TextUnformatted($"Item ID: {this.marketBoardPurchase.CatalogId}"); ImGui.Separator(); if (ImGui.Button("Looks Correct / Skip")) { @@ -156,20 +156,20 @@ public SelfTestStepResult RunStep() case SubStep.Taxes: if (this.marketTaxRate == null) { - ImGui.Text("Goto a Retainer Vocate and talk to then. Click the 'View market tax rates' menu item."); + ImGui.TextUnformatted("Goto a Retainer Vocate and talk to then. Click the 'View market tax rates' menu item."); } else { - ImGui.Text("Does this market tax rate information look correct?"); + ImGui.TextUnformatted("Does this market tax rate information look correct?"); ImGui.Separator(); - ImGui.Text($"Uldah: {this.marketTaxRate.UldahTax.ToString()}"); - ImGui.Text($"Gridania: {this.marketTaxRate.GridaniaTax.ToString()}"); - ImGui.Text($"Limsa Lominsa: {this.marketTaxRate.LimsaLominsaTax.ToString()}"); - ImGui.Text($"Ishgard: {this.marketTaxRate.IshgardTax.ToString()}"); - ImGui.Text($"Kugane: {this.marketTaxRate.KuganeTax.ToString()}"); - ImGui.Text($"Crystarium: {this.marketTaxRate.CrystariumTax.ToString()}"); - ImGui.Text($"Sharlayan: {this.marketTaxRate.SharlayanTax.ToString()}"); - ImGui.Text($"Tuliyollal: {this.marketTaxRate.TuliyollalTax.ToString()}"); + ImGui.TextUnformatted($"Uldah: {this.marketTaxRate.UldahTax.ToString()}"); + ImGui.TextUnformatted($"Gridania: {this.marketTaxRate.GridaniaTax.ToString()}"); + ImGui.TextUnformatted($"Limsa Lominsa: {this.marketTaxRate.LimsaLominsaTax.ToString()}"); + ImGui.TextUnformatted($"Ishgard: {this.marketTaxRate.IshgardTax.ToString()}"); + ImGui.TextUnformatted($"Kugane: {this.marketTaxRate.KuganeTax.ToString()}"); + ImGui.TextUnformatted($"Crystarium: {this.marketTaxRate.CrystariumTax.ToString()}"); + ImGui.TextUnformatted($"Sharlayan: {this.marketTaxRate.SharlayanTax.ToString()}"); + ImGui.TextUnformatted($"Tuliyollal: {this.marketTaxRate.TuliyollalTax.ToString()}"); ImGui.Separator(); if (ImGui.Button("Looks Correct / Skip")) { diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/NamePlateAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/NamePlateAgingStep.cs index 5a03a6dc20..d18de2c96c 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/NamePlateAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/NamePlateAgingStep.cs @@ -41,7 +41,7 @@ public SelfTestStepResult RunStep() break; case SubStep.Confirm: - ImGui.Text("Click to redraw all visible nameplates"); + ImGui.TextUnformatted("Click to redraw all visible nameplates"); if (ImGui.Button("Request redraw")) namePlateGui.RequestRedraw(); diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/PartyFinderAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/PartyFinderAgingStep.cs index d6f38092b9..4ff8e5c6da 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/PartyFinderAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/PartyFinderAgingStep.cs @@ -34,7 +34,7 @@ public SelfTestStepResult RunStep() return SelfTestStepResult.Pass; } - ImGui.Text("Open Party Finder"); + ImGui.TextUnformatted("Open Party Finder"); return SelfTestStepResult.Waiting; } diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/TargetAgingStep.cs b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/TargetAgingStep.cs index f8767ad535..57f53d3801 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/TargetAgingStep.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/TargetAgingStep.cs @@ -32,7 +32,7 @@ public SelfTestStepResult RunStep() break; case 1: - ImGui.Text("Target a player..."); + ImGui.TextUnformatted("Target a player..."); var cTarget = targetManager.Target; if (cTarget is PlayerCharacter) @@ -43,7 +43,7 @@ public SelfTestStepResult RunStep() break; case 2: - ImGui.Text("Focus-Target a Battle NPC..."); + ImGui.TextUnformatted("Focus-Target a Battle NPC..."); var fTarget = targetManager.FocusTarget; if (fTarget is BattleNpc) @@ -54,7 +54,7 @@ public SelfTestStepResult RunStep() break; case 3: - ImGui.Text("Soft-Target an EventObj..."); + ImGui.TextUnformatted("Soft-Target an EventObj..."); var sTarget = targetManager.SoftTarget; if (sTarget is EventObj) diff --git a/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs b/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs index 3b36702283..29ca9801c0 100644 --- a/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs +++ b/Dalamud/Interface/Internal/Windows/SelfTest/SelfTestWindow.cs @@ -127,11 +127,11 @@ public override void Draw() if (this.stepResults.Any(x => x.Result == SelfTestStepResult.Fail)) { - ImGui.TextColored(ImGuiColors.DalamudRed, "One or more checks failed!"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, "One or more checks failed!"); } else { - ImGui.TextColored(ImGuiColors.HealerGreen, "All checks passed!"); + ImGuiHelpers.SafeTextColored(ImGuiColors.HealerGreen, "All checks passed!"); } return; @@ -189,10 +189,10 @@ private void DrawResultTable() ImGui.TableNextRow(); ImGui.TableSetColumnIndex(0); - ImGui.Text(i.ToString()); + ImGui.TextUnformatted(i.ToString()); ImGui.TableSetColumnIndex(1); - ImGui.Text(step.Name); + ImGui.TextUnformatted(step.Name); ImGui.TableSetColumnIndex(2); ImGui.PushFont(Interface.Internal.InterfaceManager.MonoFont); @@ -203,13 +203,13 @@ private void DrawResultTable() switch (result.Result) { case SelfTestStepResult.Pass: - ImGui.TextColored(ImGuiColors.HealerGreen, "PASS"); + ImGuiHelpers.SafeTextColored(ImGuiColors.HealerGreen, "PASS"); break; case SelfTestStepResult.Fail: - ImGui.TextColored(ImGuiColors.DalamudRed, "FAIL"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, "FAIL"); break; default: - ImGui.TextColored(ImGuiColors.DalamudGrey, "NR"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, "NR"); break; } } @@ -217,11 +217,11 @@ private void DrawResultTable() { if (this.selfTestRunning && this.currentStep == i) { - ImGui.TextColored(ImGuiColors.DalamudGrey, "WAIT"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, "WAIT"); } else { - ImGui.TextColored(ImGuiColors.DalamudGrey, "NR"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, "NR"); } } diff --git a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs index c678dff10a..2117058174 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs @@ -42,7 +42,7 @@ public SettingsWindow() }; this.SizeCondition = ImGuiCond.FirstUseEver; - + this.tabs = [ new SettingsTabGeneral(), @@ -143,7 +143,7 @@ public override void Draw() flags |= ImGuiTabItemFlags.SetSelected; this.setActiveTab = null; } - + using var tab = ImRaii.TabItem(settingsTab.Title, flags); if (tab) { @@ -194,7 +194,7 @@ public override void Draw() any = true; - ImGui.TextColored(ImGuiColors.DalamudGrey, settingsTab.Title); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, settingsTab.Title); ImGui.Dummy(new Vector2(5)); foreach (var settingsTabEntry in eligible) @@ -209,7 +209,7 @@ public override void Draw() } if (!any) - ImGui.TextColored(ImGuiColors.DalamudGrey, "No results found..."); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, "No results found..."); ImGui.EndTabItem(); } diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs index 428be05c25..1238772f08 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAbout.cs @@ -276,7 +276,7 @@ public override void Draw() using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)) { ImGuiHelpers.ScaledDummy(0, windowSize.Y + 20f); - ImGui.Text(string.Empty); + ImGui.TextUnformatted(string.Empty); const float imageSize = 190f; ImGui.SameLine((ImGui.GetWindowWidth() / 2) - (imageSize / 2)); diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs index d1040b5b24..bc3ad0c4a8 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabDtr.cs @@ -134,11 +134,11 @@ public override void Draw() ImGuiHelpers.ScaledDummy(10); - ImGui.Text(Loc.Localize("DalamudSettingServerInfoBarSpacing", "Server Info Bar spacing")); + ImGui.TextUnformatted(Loc.Localize("DalamudSettingServerInfoBarSpacing", "Server Info Bar spacing")); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarSpacingHint", "Configure the amount of space between entries in the server info bar here.")); ImGui.SliderInt("Spacing", ref this.dtrSpacing, 0, 40); - ImGui.Text(Loc.Localize("DalamudSettingServerInfoBarDirection", "Server Info Bar direction")); + ImGui.TextUnformatted(Loc.Localize("DalamudSettingServerInfoBarDirection", "Server Info Bar direction")); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingServerInfoBarDirectionHint", "If checked, the Server Info Bar elements will expand to the right instead of the left.")); ImGui.Checkbox("Swap Direction", ref this.dtrSwapDirection); diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs index 61ab00936e..d801138755 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabLook.cs @@ -24,7 +24,7 @@ namespace Dalamud.Interface.Internal.Windows.Settings.Tabs; [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "Internals")] public class SettingsTabLook : SettingsTab { - private static readonly (string, float)[] GlobalUiScalePresets = + private static readonly (string, float)[] GlobalUiScalePresets = { ("80%##DalamudSettingsGlobalUiScaleReset96", 0.8f), ("100%##DalamudSettingsGlobalUiScaleReset12", 1f), @@ -107,7 +107,7 @@ private static readonly (string, float)[] GlobalUiScalePresets = Loc.Localize("DalamudSettingToggleDockingHint", "This will allow you to fuse and tab plugin windows."), c => c.IsDocking, (v, c) => c.IsDocking = v), - + new SettingsEntry( Loc.Localize("DalamudSettingEnablePluginUISoundEffects", "Enable sound effects for plugin windows"), Loc.Localize("DalamudSettingEnablePluginUISoundEffectsHint", "This will allow you to enable or disable sound effects generated by plugin user interfaces.\nThis is affected by your in-game `System Sounds` volume settings."), @@ -125,19 +125,19 @@ private static readonly (string, float)[] GlobalUiScalePresets = Loc.Localize("DalamudSettingToggleTsmHint", "This will allow you to access certain Dalamud and Plugin functionality from the title screen.\nDisabling this will also hide the Dalamud version text on the title screen."), c => c.ShowTsm, (v, c) => c.ShowTsm = v), - + new SettingsEntry( Loc.Localize("DalamudSettingInstallerOpenDefault", "Open the Plugin Installer to the \"Installed Plugins\" tab by default"), Loc.Localize("DalamudSettingInstallerOpenDefaultHint", "This will allow you to open the Plugin Installer to the \"Installed Plugins\" tab by default, instead of the \"Available Plugins\" tab."), c => c.PluginInstallerOpen == PluginInstallerOpenKind.InstalledPlugins, (v, c) => c.PluginInstallerOpen = v ? PluginInstallerOpenKind.InstalledPlugins : PluginInstallerOpenKind.AllPlugins), - + new SettingsEntry( Loc.Localize("DalamudSettingReducedMotion", "Reduce motions"), Loc.Localize("DalamudSettingReducedMotionHint", "This will suppress certain animations from Dalamud, such as the notification popup."), c => c.ReduceMotions ?? false, (v, c) => c.ReduceMotions = v), - + new SettingsEntry( Loc.Localize("DalamudSettingImeStateIndicatorOpacity", "IME State Indicator Opacity (CJK only)"), Loc.Localize("DalamudSettingImeStateIndicatorOpacityHint", "When any of CJK IMEs is in use, the state of IME will be shown with the opacity specified here."), @@ -168,7 +168,7 @@ public override void Draw() var fontBuildTask = interfaceManager.FontBuildTask; ImGui.AlignTextToFramePadding(); - ImGui.Text(Loc.Localize("DalamudSettingsGlobalUiScale", "Global Font Scale")); + ImGui.TextUnformatted(Loc.Localize("DalamudSettingsGlobalUiScale", "Global Font Scale")); var buttonSize = GlobalUiScalePresets @@ -210,7 +210,7 @@ public override void Draw() if (fontBuildTask.IsFaulted || fontBuildTask.IsCanceled) { - ImGui.TextColored( + ImGuiHelpers.SafeTextColored( ImGuiColors.DalamudRed, Loc.Localize("DalamudSettingsFontBuildFaulted", "Failed to load fonts as requested.")); if (fontBuildTask.Exception is not null diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs index f406545423..22a98a34f3 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/EnumSettingsEntry{T}.cs @@ -137,7 +137,7 @@ public override void Draw() { using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed)) { - ImGui.Text(validityMsg); + ImGui.TextUnformatted(validityMsg); } } } @@ -152,7 +152,7 @@ public override void Draw() { using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed)) { - ImGui.Text(warningMessage); + ImGui.TextUnformatted(warningMessage); } } } diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs index cb79000d20..b50aa7a4e4 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/LanguageChooserSettingsEntry.cs @@ -70,7 +70,7 @@ public override void Save() public override void Draw() { - ImGui.Text(this.Name); + ImGui.TextUnformatted(this.Name); ImGui.Combo("##XlLangCombo", ref this.langIndex, this.locLanguages, this.locLanguages.Length); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsLanguageHint", "Select the language Dalamud will be displayed in.")); } diff --git a/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs b/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs index cffe0a5da6..ee7fe6c42e 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Widgets/SettingsEntry{T}.cs @@ -127,7 +127,7 @@ public override void Draw() { using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed)) { - ImGui.Text(validityMsg); + ImGui.TextUnformatted(validityMsg); } } } @@ -142,7 +142,7 @@ public override void Draw() { using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudRed)) { - ImGui.Text(warningMessage); + ImGui.TextUnformatted(warningMessage); } } } diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs index ceb0091396..6f119a7cb0 100644 --- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs +++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs @@ -84,7 +84,7 @@ public override void Draw() var appliedThisFrame = false; var styleAry = config.SavedStyles.Select(x => x.Name).ToArray(); - ImGui.Text(Loc.Localize("StyleEditorChooseStyle", "Choose Style:")); + ImGui.TextUnformatted(Loc.Localize("StyleEditorChooseStyle", "Choose Style:")); if (ImGui.Combo("###styleChooserCombo", ref this.currentSel, styleAry, styleAry.Length)) { var newStyle = config.SavedStyles[this.currentSel]; @@ -112,7 +112,7 @@ public override void Draw() if (isBuiltinStyle) ImGui.BeginDisabled(); - + if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash) && this.currentSel != 0) { this.currentSel--; @@ -157,7 +157,7 @@ public override void Draw() if (ImGui.IsItemHovered()) ImGui.SetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing")); - + if (isBuiltinStyle) ImGui.EndDisabled(); @@ -203,11 +203,11 @@ public override void Draw() if (isBuiltinStyle) { - ImGui.TextColored(ImGuiColors.DalamudRed, Loc.Localize("StyleEditorNotAllowed", "You cannot edit built-in styles. Please add a new style first.")); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudRed, Loc.Localize("StyleEditorNotAllowed", "You cannot edit built-in styles. Please add a new style first.")); } else if (appliedThisFrame) { - ImGui.Text(Loc.Localize("StyleEditorApplying", "Applying style...")); + ImGui.TextUnformatted(Loc.Localize("StyleEditorApplying", "Applying style...")); } else if (ImGui.BeginTabBar("StyleEditorTabs")) { @@ -228,13 +228,13 @@ public override void Draw() ImGui.SliderFloat("IndentSpacing", ref style.IndentSpacing, 0.0f, 30.0f, "%.0f"); ImGui.SliderFloat("ScrollbarSize", ref style.ScrollbarSize, 1.0f, 20.0f, "%.0f"); ImGui.SliderFloat("GrabMinSize", ref style.GrabMinSize, 1.0f, 20.0f, "%.0f"); - ImGui.Text("Borders"); + ImGui.TextUnformatted("Borders"); ImGui.SliderFloat("WindowBorderSize", ref style.WindowBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("ChildBorderSize", ref style.ChildBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("PopupBorderSize", ref style.PopupBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("FrameBorderSize", ref style.FrameBorderSize, 0.0f, 1.0f, "%.0f"); ImGui.SliderFloat("TabBorderSize", ref style.TabBorderSize, 0.0f, 1.0f, "%.0f"); - ImGui.Text("Rounding"); + ImGui.TextUnformatted("Rounding"); ImGui.SliderFloat("WindowRounding", ref style.WindowRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("ChildRounding", ref style.ChildRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("FrameRounding", ref style.FrameRounding, 0.0f, 12.0f, "%.0f"); @@ -243,7 +243,7 @@ public override void Draw() ImGui.SliderFloat("GrabRounding", ref style.GrabRounding, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("LogSliderDeadzone", ref style.LogSliderDeadzone, 0.0f, 12.0f, "%.0f"); ImGui.SliderFloat("TabRounding", ref style.TabRounding, 0.0f, 12.0f, "%.0f"); - ImGui.Text("Alignment"); + ImGui.TextUnformatted("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")) @@ -362,7 +362,7 @@ public override void Draw() if (ImGui.BeginPopupModal(renameModalTitle, ref this.renameModalDrawing, ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoScrollbar)) { - ImGui.Text(Loc.Localize("StyleEditorEnterName", "Please enter the new name for this style.")); + ImGui.TextUnformatted(Loc.Localize("StyleEditorEnterName", "Please enter the new name for this style.")); ImGui.Spacing(); ImGui.InputText("###renameModalInput", ref this.renameText, 255); diff --git a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs index 88f2919544..afd8e422e7 100644 --- a/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs +++ b/Dalamud/Interface/Internal/Windows/TitleScreenMenuWindow.cs @@ -50,11 +50,11 @@ internal class TitleScreenMenuWindow : Window, IDisposable private readonly Lazy myFontHandle; private readonly Lazy shadeTexture; private readonly AddonLifecycleEventListener versionStringListener; - + private readonly Dictionary shadeEasings = new(); private readonly Dictionary moveEasings = new(); private readonly Dictionary logoEasings = new(); - + private readonly IConsoleVariable showTsm; private InOutCubic? fadeOutEasing; @@ -62,7 +62,7 @@ internal class TitleScreenMenuWindow : Window, IDisposable private State state = State.Hide; private int lastLoadedPluginCount = -1; - + /// /// Initializes a new instance of the class. /// @@ -91,7 +91,7 @@ public TitleScreenMenuWindow( ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoNavFocus) { this.showTsm = consoleManager.AddVariable("dalamud.show_tsm", "Show the Title Screen Menu", true); - + this.clientState = clientState; this.configuration = configuration; this.gameGui = gameGui; @@ -124,7 +124,7 @@ public TitleScreenMenuWindow( framework.Update += this.FrameworkOnUpdate; this.scopedFinalizer.Add(() => framework.Update -= this.FrameworkOnUpdate); - + this.versionStringListener = new AddonLifecycleEventListener(AddonEvent.PreDraw, "_TitleRevision", this.OnVersionStringDraw); addonLifecycle.RegisterListener(this.versionStringListener); this.scopedFinalizer.Add(() => addonLifecycle.UnregisterListener(this.versionStringListener)); @@ -136,7 +136,7 @@ private enum State Show, FadeOut, } - + /// /// Gets or sets a value indicating whether drawing is allowed. /// @@ -165,7 +165,7 @@ public override void Draw() { if (!this.AllowDrawing || !this.showTsm.Value) return; - + var scale = ImGui.GetIO().FontGlobalScale; var entries = this.titleScreenMenu.PluginEntries; @@ -174,7 +174,7 @@ public override void Draw() ImGuiHoveredFlags.AllowWhenBlockedByActiveItem); Service.Get().OverrideGameCursor = !hovered; - + switch (this.state) { case State.Show: @@ -401,12 +401,12 @@ private bool DrawEntry( for (int i = 0, to = (int)Math.Ceiling(1 * scale); i < to; i++) { ImGui.SetCursorPos(new Vector2(cursor.X, cursor.Y + i)); - ImGui.Text(entry.Name); + ImGui.TextUnformatted(entry.Name); } } ImGui.SetCursorPos(cursor); - ImGui.Text(entry.Name); + ImGui.TextUnformatted(entry.Name); if (overrideAlpha) { @@ -439,7 +439,7 @@ private unsafe void OnVersionStringDraw(AddonEvent ev, AddonArgs args) var addon = (AtkUnitBase*)drawArgs.Addon; var textNode = addon->GetTextNodeById(3); - + // look and feel init. should be harmless to set. textNode->TextFlags |= (byte)TextFlags.MultiLine; textNode->AlignmentType = AlignmentType.TopLeft; diff --git a/Dalamud/Interface/UiBuilder.cs b/Dalamud/Interface/UiBuilder.cs index 1413f33471..01f82053db 100644 --- a/Dalamud/Interface/UiBuilder.cs +++ b/Dalamud/Interface/UiBuilder.cs @@ -702,7 +702,7 @@ private void OnDraw() if (this.hasErrorWindow && ImGui.Begin($"{this.namespaceName} Error", ref this.hasErrorWindow, ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoResize)) { - ImGui.Text($"The plugin {this.namespaceName} ran into an error.\nContact the plugin developer for support.\n\nPlease try restarting your game."); + ImGui.TextUnformatted($"The plugin {this.namespaceName} ran into an error.\nContact the plugin developer for support.\n\nPlease try restarting your game."); ImGui.Spacing(); if (ImGui.Button("OK")) diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs index 8dedae5cd5..6f70ca3a79 100644 --- a/Dalamud/Interface/Utility/ImGuiHelpers.cs +++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs @@ -111,7 +111,7 @@ public static class ImGuiHelpers /// /// The size of the indent. public static void ScaledIndent(float size) => ImGui.Indent(size * GlobalScale); - + /// /// Use a relative ImGui.SameLine() from your current cursor position, scaled by the Dalamud global scale. /// @@ -237,11 +237,45 @@ public static SeStringDrawResult CompileSeStringWrapped( ImGuiButtonFlags buttonFlags = ImGuiButtonFlags.MouseButtonDefault) => Service.Get().CompileAndDrawWrapped(text, style, imGuiId, buttonFlags); + /// + /// Write unformatted disabled text. + /// + /// The text to write. + public static void SafeTextDisabled(string text) + { + // TextDisabled(const char* fmt, ...) = shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor(); + using (ImRaii.PushColor(ImGuiCol.Text, ImGui.GetColorU32(ImGuiCol.TextDisabled))) + { + ImGui.TextUnformatted(text); + } + } + + /// + /// Write unformatted text with a color. + /// + /// The color of the text. + /// The text to write. + public static void SafeTextColored(Vector4 color, string text) + { + // TextColored(const ImVec4& col, const char* fmt, ...) = shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor() + using (ImRaii.PushColor(ImGuiCol.Text, color)) + { + ImGui.TextUnformatted(text); + } + } + /// /// Write unformatted text wrapped. /// /// The text to write. - public static void SafeTextWrapped(string text) => ImGui.TextWrapped(text.Replace("%", "%%")); + public static void SafeTextWrapped(string text) + { + // TextWrapped(const char* fmt, ...) = shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos(); + using (ImRaii.TextWrapPos(0.0f)) + { + ImGui.TextUnformatted(text); + } + } /// /// Write unformatted text wrapped. @@ -252,7 +286,7 @@ public static void SafeTextColoredWrapped(Vector4 color, string text) { using (ImRaii.PushColor(ImGuiCol.Text, color)) { - ImGui.TextWrapped(text.Replace("%", "%%")); + SafeTextWrapped(text); } } @@ -292,7 +326,7 @@ public static unsafe void AdjustGlyphMetrics(this ImFontPtr fontPtr, float scale foreach (ref var kp in new Span((void*)font->KerningPairs.Data, font->KerningPairs.Size)) kp.AdvanceXAdjustment = rounder(kp.AdvanceXAdjustment * scale); - + foreach (ref var fkp in new Span((void*)font->FrequentKerningPairs.Data, font->FrequentKerningPairs.Size)) fkp = rounder(fkp * scale); } @@ -541,7 +575,7 @@ public static unsafe ushort[] BuildRangesToArray( builder.BuildRanges(out var vec); return new ReadOnlySpan((void*)vec.Data, vec.Size).ToArray(); } - + /// public static ushort[] CreateImGuiRangesFrom(params UnicodeRange[] ranges) => CreateImGuiRangesFrom((IEnumerable)ranges); @@ -624,7 +658,7 @@ internal static unsafe void SetTextFromCallback(ImGuiInputTextCallbackData* data ImGuiNative.ImGuiInputTextCallbackData_InsertChars(data, 0, pBuf, pBuf + len); ImGuiNative.ImGuiInputTextCallbackData_SelectAll(data); } - + /// /// Finds the corresponding ImGui viewport ID for the given window handle. /// diff --git a/Dalamud/Interface/Windowing/Window.cs b/Dalamud/Interface/Windowing/Window.cs index 589217a73e..a0fabf4054 100644 --- a/Dalamud/Interface/Windowing/Window.cs +++ b/Dalamud/Interface/Windowing/Window.cs @@ -26,7 +26,7 @@ public abstract class Window private static readonly ModuleLog Log = new("WindowSystem"); private static bool wasEscPressedLastFrame = false; - + private bool internalLastIsOpen = false; private bool internalIsOpen = false; private bool internalIsPinned = false; @@ -87,7 +87,7 @@ protected Window(string name, ImGuiWindowFlags flags = ImGuiWindowFlags.None, bo /// Gets or sets a value representing the sound effect id to be played when the window is closed. /// public uint OnCloseSfxId { get; set; } = 24u; - + /// /// Gets or sets the position of this window. /// @@ -155,7 +155,7 @@ protected Window(string name, ImGuiWindowFlags flags = ImGuiWindowFlags.None, bo /// /// Gets or sets a list of available title bar buttons. - /// + /// /// If or are set to true, and this features is not /// disabled globally by the user, an internal title bar button to manage these is added when drawing, but it will /// not appear in this collection. If you wish to remove this button, set both of these values to false. @@ -170,7 +170,7 @@ public bool IsOpen get => this.internalIsOpen; set => this.internalIsOpen = value; } - + private bool CanShowCloseButton => this.ShowCloseButton && !this.internalIsClickthrough; /// @@ -267,7 +267,7 @@ public virtual void OnClose() public virtual void Update() { } - + /// /// Draw the window via ImGui. /// @@ -286,7 +286,7 @@ internal void DrawInternal(DalamudConfiguration? configuration) this.OnClose(); this.IsFocused = false; - + if (doSoundEffects && !this.DisableWindowSounds) UIGlobals.PlaySoundEffect(this.OnCloseSfxId); } @@ -301,7 +301,7 @@ internal void DrawInternal(DalamudConfiguration? configuration) if (hasNamespace) ImGui.PushID(this.Namespace); - + if (this.internalLastIsOpen != this.internalIsOpen && this.internalIsOpen) { this.internalLastIsOpen = this.internalIsOpen; @@ -364,10 +364,10 @@ internal void DrawInternal(DalamudConfiguration? configuration) if (ImGui.BeginPopup(additionsPopupName, ImGuiWindowFlags.NoMove)) { var isAvailable = ImGuiHelpers.CheckIsWindowOnMainViewport(); - + if (!isAvailable) ImGui.BeginDisabled(); - + if (this.internalIsClickthrough) ImGui.BeginDisabled(); @@ -399,23 +399,23 @@ internal void DrawInternal(DalamudConfiguration? configuration) if (isAvailable) { - ImGui.TextColored(ImGuiColors.DalamudGrey, - Loc.Localize("WindowSystemContextActionClickthroughDisclaimer", - "Open this menu again to disable clickthrough.")); - ImGui.TextColored(ImGuiColors.DalamudGrey, - Loc.Localize("WindowSystemContextActionDisclaimer", - "These options may not work for all plugins at the moment.")); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, + Loc.Localize("WindowSystemContextActionClickthroughDisclaimer", + "Open this menu again to disable clickthrough.")); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, + Loc.Localize("WindowSystemContextActionDisclaimer", + "These options may not work for all plugins at the moment.")); } else { - ImGui.TextColored(ImGuiColors.DalamudGrey, - Loc.Localize("WindowSystemContextActionViewportDisclaimer", - "These features are only available if this window is inside the game window.")); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey, + Loc.Localize("WindowSystemContextActionViewportDisclaimer", + "These features are only available if this window is inside the game window.")); } if (!isAvailable) ImGui.EndDisabled(); - + ImGui.EndPopup(); } @@ -511,7 +511,7 @@ private void ApplyConditionals() { ImGui.SetNextWindowBgAlpha(this.BgAlpha.Value); } - + // Manually set alpha takes precedence, if devs don't want that, they should turn it off if (this.internalAlpha.HasValue) { @@ -522,18 +522,18 @@ private void ApplyConditionals() private unsafe void DrawTitleBarButtons(void* window, ImGuiWindowFlags flags, Vector4 titleBarRect, IEnumerable buttons) { ImGui.PushClipRect(ImGui.GetWindowPos(), ImGui.GetWindowPos() + ImGui.GetWindowSize(), false); - + var style = ImGui.GetStyle(); var fontSize = ImGui.GetFontSize(); var drawList = ImGui.GetWindowDrawList(); - + var padR = 0f; var buttonSize = ImGui.GetFontSize(); var numNativeButtons = 0; if (this.CanShowCloseButton) numNativeButtons++; - + if (!flags.HasFlag(ImGuiWindowFlags.NoCollapse) && style.WindowMenuButtonPosition == ImGuiDir.Right) numNativeButtons++; @@ -543,15 +543,15 @@ private unsafe void DrawTitleBarButtons(void* window, ImGuiWindowFlags flags, Ve // Pad to the left, to get out of the way of the native buttons padR += numNativeButtons * (buttonSize + style.ItemInnerSpacing.X); - - Vector2 GetCenter(Vector4 rect) => new((rect.X + rect.Z) * 0.5f, (rect.Y + rect.W) * 0.5f); + + Vector2 GetCenter(Vector4 rect) => new((rect.X + rect.Z) * 0.5f, (rect.Y + rect.W) * 0.5f); var numButtons = 0; bool DrawButton(TitleBarButton button, Vector2 pos) { var id = ImGui.GetID($"###CustomTbButton{numButtons}"); numButtons++; - + var min = pos; var max = pos + new Vector2(fontSize, fontSize); Vector4 bb = new(min.X, min.Y, max.X, max.Y); @@ -563,12 +563,12 @@ bool DrawButton(TitleBarButton button, Vector2 pos) { hovered = false; held = false; - + // ButtonBehavior does not function if the window is clickthrough, so we have to do it ourselves if (ImGui.IsMouseHoveringRect(min, max)) { hovered = true; - + // We can't use ImGui native functions here, because they don't work with clickthrough if ((User32.GetKeyState((int)VirtualKey.LBUTTON) & 0x8000) != 0) { @@ -581,7 +581,7 @@ bool DrawButton(TitleBarButton button, Vector2 pos) { pressed = ImGuiNativeAdditions.igButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags.None); } - + if (isClipped) return pressed; @@ -590,10 +590,10 @@ bool DrawButton(TitleBarButton button, Vector2 pos) var textCol = ImGui.GetColorU32(ImGuiCol.Text); if (hovered || held) drawList.AddCircleFilled(GetCenter(bb) + new Vector2(0.0f, -0.5f), (fontSize * 0.5f) + 1.0f, bgCol); - + var offset = button.IconOffset * ImGuiHelpers.GlobalScale; drawList.AddText(InterfaceManager.IconFont, (float)(fontSize * 0.8), new Vector2(bb.X + offset.X, bb.Y + offset.Y), textCol, button.Icon.ToIconString()); - + if (hovered) button.ShowTooltip?.Invoke(); @@ -608,14 +608,14 @@ bool DrawButton(TitleBarButton button, Vector2 pos) { if (this.internalIsClickthrough && !button.AvailableClickthrough) return; - + Vector2 position = new(titleBarRect.Z - padR - buttonSize, titleBarRect.Y + style.FramePadding.Y); padR += buttonSize + style.ItemInnerSpacing.X; - + if (DrawButton(button, position)) button.Click?.Invoke(ImGuiMouseButton.Left); } - + ImGui.PopClipRect(); } @@ -625,7 +625,7 @@ bool DrawButton(TitleBarButton button, Vector2 pos) public struct WindowSizeConstraints { private Vector2 internalMaxSize = new(float.MaxValue); - + /// /// Initializes a new instance of the struct. /// @@ -637,7 +637,7 @@ public WindowSizeConstraints() /// Gets or sets the minimum size of the window. /// public Vector2 MinimumSize { get; set; } = new(0); - + /// /// Gets or sets the maximum size of the window. /// @@ -646,12 +646,12 @@ public Vector2 MaximumSize get => this.GetSafeMaxSize(); set => this.internalMaxSize = value; } - + private Vector2 GetSafeMaxSize() { var currentMin = this.MinimumSize; - if (this.internalMaxSize.X < currentMin.X || this.internalMaxSize.Y < currentMin.Y) + if (this.internalMaxSize.X < currentMin.X || this.internalMaxSize.Y < currentMin.Y) return new Vector2(float.MaxValue); return this.internalMaxSize; @@ -667,52 +667,52 @@ public class TitleBarButton /// Gets or sets the icon of the button. /// public FontAwesomeIcon Icon { get; set; } - + /// /// Gets or sets a vector by which the position of the icon within the button shall be offset. /// Automatically scaled by the global font scale for you. /// public Vector2 IconOffset { get; set; } - + /// /// Gets or sets an action that is called when a tooltip shall be drawn. /// May be null if no tooltip shall be drawn. /// public Action? ShowTooltip { get; set; } - + /// /// Gets or sets an action that is called when the button is clicked. /// public Action Click { get; set; } - + /// /// Gets or sets the priority the button shall be shown in. /// Lower = closer to ImGui default buttons. /// public int Priority { get; set; } - + /// /// Gets or sets a value indicating whether or not the button shall be clickable /// when the respective window is set to clickthrough. /// public bool AvailableClickthrough { get; set; } } - + [SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "imports")] private static unsafe class ImGuiNativeAdditions { [DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)] public static extern bool igItemAdd(Vector4 bb, uint id, Vector4* navBb, uint flags); - + [DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)] public static extern bool igButtonBehavior(Vector4 bb, uint id, bool* outHovered, bool* outHeld, ImGuiButtonFlags flags); - + [DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)] public static extern void* igGetCurrentWindow(); - + [DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)] public static extern void igStartMouseMovingWindow(void* window); - + [DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)] public static extern void ImGuiWindow_TitleBarRect(Vector4* pOut, void* window); } diff --git a/Dalamud/Utility/Util.cs b/Dalamud/Utility/Util.cs index d5e14e212a..a7fb2a0275 100644 --- a/Dalamud/Utility/Util.cs +++ b/Dalamud/Utility/Util.cs @@ -139,11 +139,11 @@ public static unsafe bool FastByteArrayCompare(byte[]? a1, byte[]? a2) public static string GetScmVersion() { if (scmVersionInternal != null) return scmVersionInternal; - + var asm = typeof(Util).Assembly; var attrs = asm.GetCustomAttributes(); - return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value + return scmVersionInternal = attrs.First(a => a.Key == "SCMVersion").Value ?? asm.GetName().Version!.ToString(); } @@ -408,11 +408,11 @@ public static void ShowObject(object obj) { var type = obj.GetType(); - ImGui.Text($"Object Dump({type.Name}) for {obj}({obj.GetHashCode()})"); + ImGui.TextUnformatted($"Object Dump({type.Name}) for {obj}({obj.GetHashCode()})"); ImGuiHelpers.ScaledDummy(5); - ImGui.TextColored(ImGuiColors.DalamudOrange, "-> Properties:"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudOrange, "-> Properties:"); ImGui.Indent(); @@ -420,16 +420,16 @@ public static void ShowObject(object obj) { if (p.PropertyType.IsGenericType && (p.PropertyType.IsByRef || p.PropertyType.IsByRefLike)) { - ImGui.TextColored(ImGuiColors.DalamudOrange, $" {p.Name}: (ref typed property)"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudOrange, $" {p.Name}: (ref typed property)"); } else { var value = p.GetValue(obj); var valueType = value?.GetType(); if (valueType == typeof(IntPtr)) - ImGui.TextColored(ImGuiColors.DalamudOrange, $" {p.Name}: 0x{value:X}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudOrange, $" {p.Name}: 0x{value:X}"); else - ImGui.TextColored(ImGuiColors.DalamudOrange, $" {p.Name}: {value}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudOrange, $" {p.Name}: {value}"); } } @@ -437,13 +437,13 @@ public static void ShowObject(object obj) ImGuiHelpers.ScaledDummy(5); - ImGui.TextColored(ImGuiColors.HealerGreen, "-> Fields:"); + ImGuiHelpers.SafeTextColored(ImGuiColors.HealerGreen, "-> Fields:"); ImGui.Indent(); foreach (var fieldInfo in type.GetFields()) { - ImGui.TextColored(ImGuiColors.HealerGreen, $" {fieldInfo.Name}: {fieldInfo.GetValue(obj)}"); + ImGuiHelpers.SafeTextColored(ImGuiColors.HealerGreen, $" {fieldInfo.Name}: {fieldInfo.GetValue(obj)}"); } ImGui.Unindent(); @@ -853,7 +853,7 @@ internal static void SetExceptionIfIncomplete(this TaskCompletionSource t, // ignore } } - + /// /// Print formatted IGameObject Information to ImGui. /// @@ -991,7 +991,7 @@ private static void ShowSpanProperty(ulong addr, IList path, PropertyInf var propType = p.PropertyType; if (p.GetGetMethod() is not { } getMethod) { - ImGui.Text("(No getter available)"); + ImGui.TextUnformatted("(No getter available)"); return; } @@ -1125,7 +1125,7 @@ private static unsafe void ShowValue(ulong addr, IList path, Type type, var ptrObj = SafeMemory.PtrToStructure(new IntPtr(unboxed), eType); if (ptrObj == null) { - ImGui.Text("null or invalid"); + ImGui.TextUnformatted("null or invalid"); } else { @@ -1139,7 +1139,7 @@ private static unsafe void ShowValue(ulong addr, IList path, Type type, } else { - ImGui.Text("null"); + ImGui.TextUnformatted("null"); } } else @@ -1150,7 +1150,7 @@ private static unsafe void ShowValue(ulong addr, IList path, Type type, } else { - ImGui.Text($"{value}"); + ImGui.TextUnformatted($"{value}"); } } } @@ -1210,22 +1210,23 @@ private static void ShowStructInternal(object obj, ulong addr, bool autoExpand = if (fixedBuffer != null) { - ImGui.Text("fixed"); + ImGui.TextUnformatted("fixed"); ImGui.SameLine(); - ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{fixedBuffer.ElementType.Name}[0x{fixedBuffer.Length:X}]"); + ImGuiHelpers.SafeTextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{fixedBuffer.ElementType.Name}[0x{fixedBuffer.Length:X}]"); } else { if (offset != null) { - ImGui.TextDisabled($"[0x{offset.Value:X}]"); + ImGuiHelpers.SafeTextDisabled($"[0x{offset.Value:X}]"); ImGui.SameLine(); } - ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{f.FieldType.Name}"); + + ImGuiHelpers.SafeTextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{f.FieldType.Name}"); } ImGui.SameLine(); - ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.4f, 1), $"{f.Name}: "); + ImGuiHelpers.SafeTextColored(new Vector4(0.2f, 0.9f, 0.4f, 1), $"{f.Name}: "); ImGui.SameLine(); pathList.Add(f.Name); @@ -1233,7 +1234,7 @@ private static void ShowStructInternal(object obj, ulong addr, bool autoExpand = { if (f.FieldType.IsGenericType && (f.FieldType.IsByRef || f.FieldType.IsByRefLike)) { - ImGui.Text("Cannot preview ref typed fields."); // object never contains ref struct + ImGui.TextUnformatted("Cannot preview ref typed fields."); // object never contains ref struct } else if (f.FieldType == typeof(bool) && offset != null) { @@ -1259,9 +1260,9 @@ private static void ShowStructInternal(object obj, ulong addr, bool autoExpand = foreach (var p in obj.GetType().GetProperties().Where(static p => p.GetGetMethod()?.GetParameters().Length == 0)) { - ImGui.TextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{p.PropertyType.Name}"); + ImGuiHelpers.SafeTextColored(new Vector4(0.2f, 0.9f, 0.9f, 1), $"{p.PropertyType.Name}"); ImGui.SameLine(); - ImGui.TextColored(new Vector4(0.2f, 0.6f, 0.4f, 1), $"{p.Name}: "); + ImGuiHelpers.SafeTextColored(new Vector4(0.2f, 0.6f, 0.4f, 1), $"{p.Name}: "); ImGui.SameLine(); pathList.Add(p.Name); @@ -1273,7 +1274,7 @@ private static void ShowStructInternal(object obj, ulong addr, bool autoExpand = } else if (p.PropertyType.IsGenericType && (p.PropertyType.IsByRef || p.PropertyType.IsByRefLike)) { - ImGui.Text("Cannot preview ref typed properties."); + ImGui.TextUnformatted("Cannot preview ref typed properties."); } else { From d293e5deb0e375c74bbbc1323a91e3462a941e2a Mon Sep 17 00:00:00 2001 From: Infi Date: Mon, 23 Dec 2024 22:11:24 +0100 Subject: [PATCH 2/2] Add SafeSetTooltip --- .../ImGuiFileDialog/FileDialog.UI.cs | 4 +- .../Internal/UiDebug2/Browsing/AddonTree.cs | 4 +- .../UiDebug2/Browsing/NodeTree.Editor.cs | 3 +- .../UiDebug2/Browsing/NodeTree.Image.cs | 2 +- .../UiDebug2/Browsing/NodeTree.Res.cs | 4 +- .../Internal/UiDebug2/ElementSelector.cs | 2 +- .../Internal/UiDebug2/UiDebug2.Sidebar.cs | 3 +- .../Internal/Windows/ChangelogWindow.cs | 2 +- .../Internal/Windows/ConsoleWindow.cs | 6 +-- .../Internal/Windows/Data/DataWindow.cs | 4 +- .../Windows/Data/Widgets/IconBrowserWidget.cs | 6 +-- .../Windows/Data/Widgets/ServicesWidget.cs | 2 +- .../Windows/Data/Widgets/TexWidget.cs | 4 +- .../PluginInstaller/PluginInstallerWindow.cs | 38 +++++++------- .../PluginInstaller/ProfileManagerWidget.cs | 24 ++++----- .../Windows/Settings/SettingsWindow.cs | 6 +-- .../Settings/Tabs/SettingsTabAutoUpdate.cs | 50 +++++++++---------- .../Windows/StyleEditor/StyleEditorWindow.cs | 8 +-- Dalamud/Interface/Utility/ImGuiHelpers.cs | 14 ++++++ .../Interface/Utility/Table/ColumnFlags.cs | 2 +- 20 files changed, 102 insertions(+), 86 deletions(-) diff --git a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs index e4747b1e67..7feccf66a1 100644 --- a/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs +++ b/Dalamud/Interface/ImGuiFileDialog/FileDialog.UI.cs @@ -215,7 +215,7 @@ private void DrawSearchBar() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Reset to current directory"); + ImGuiHelpers.SafeSetTooltip("Reset to current directory"); } ImGui.SameLine(); @@ -250,7 +250,7 @@ private void DrawDirectoryCreation() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Create Directory"); + ImGuiHelpers.SafeSetTooltip("Create Directory"); } if (this.createDirectoryMode) diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs index 651efbcf97..de68d96a5b 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/AddonTree.cs @@ -134,7 +134,7 @@ internal void Draw() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Toggle Visibility"); + ImGuiHelpers.SafeSetTooltip("Toggle Visibility"); } ImGui.SameLine(); @@ -145,7 +145,7 @@ internal void Draw() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Toggle Popout Window"); + ImGuiHelpers.SafeSetTooltip("Toggle Popout Window"); } PaddedSeparator(1); diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs index 93bbf68ce0..3c510b23b8 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Editor.cs @@ -3,6 +3,7 @@ using Dalamud.Interface.Components; using Dalamud.Interface.Internal.UiDebug2.Utility; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using FFXIVClientStructs.FFXIV.Component.GUI; @@ -129,7 +130,7 @@ private protected virtual void DrawEditorRows() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Rotation (deg)"); + ImGuiHelpers.SafeSetTooltip("Rotation (deg)"); hov = true; } diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs index 4a8f83a6bd..85cf1f2769 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Image.cs @@ -154,7 +154,7 @@ private static void PrintPartCoords(float u, float v, float w, float h, bool asF if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Click to copy as Vector2\nShift-click to copy as Vector4"); + ImGuiHelpers.SafeSetTooltip("Click to copy as Vector2\nShift-click to copy as Vector4"); } var suffix = asFloat ? "f" : string.Empty; diff --git a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs index af196d0656..7a7cbb7169 100644 --- a/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs +++ b/Dalamud/Interface/Internal/UiDebug2/Browsing/NodeTree.Res.cs @@ -386,7 +386,7 @@ private void DrawBasicControls() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Toggle Visibility"); + ImGuiHelpers.SafeSetTooltip("Toggle Visibility"); } ImGui.SameLine(); @@ -402,7 +402,7 @@ private void DrawBasicControls() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Toggle Popout Window"); + ImGuiHelpers.SafeSetTooltip("Toggle Popout Window"); } } diff --git a/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs b/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs index ede1705bcf..28562cdfce 100644 --- a/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs +++ b/Dalamud/Interface/Internal/UiDebug2/ElementSelector.cs @@ -106,7 +106,7 @@ internal void DrawInterface() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Element Selector"); + ImGuiHelpers.SafeSetTooltip("Element Selector"); } ImGui.SameLine(); diff --git a/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs b/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs index 50967453df..1cec0cd31c 100644 --- a/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs +++ b/Dalamud/Interface/Internal/UiDebug2/UiDebug2.Sidebar.cs @@ -2,6 +2,7 @@ using System.Numerics; using Dalamud.Interface.Components; +using Dalamud.Interface.Utility; using Dalamud.Interface.Utility.Raii; using FFXIVClientStructs.FFXIV.Client.UI; @@ -78,7 +79,7 @@ private void DrawNameSearch() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Filter by visibility"); + ImGuiHelpers.SafeSetTooltip("Filter by visibility"); } ImGui.SameLine(); diff --git a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs index 708c95545f..a1d13c9a13 100644 --- a/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ChangelogWindow.cs @@ -532,7 +532,7 @@ bool CenteredIconButton(FontAwesomeIcon icon, string text) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("I don't care about this"); + ImGuiHelpers.SafeSetTooltip("I don't care about this"); } } } diff --git a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs index be0f26a475..e34c59e176 100644 --- a/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs +++ b/Dalamud/Interface/Internal/Windows/ConsoleWindow.cs @@ -525,7 +525,7 @@ private void DrawOptionsToolbar() this.QueueClear(); } - if (ImGui.IsItemHovered()) ImGui.SetTooltip("Clear Log"); + if (ImGui.IsItemHovered()) ImGuiHelpers.SafeSetTooltip("Clear Log"); ImGui.SameLine(); @@ -561,7 +561,7 @@ private void DrawOptionsToolbar() this.killGameArmed = true; } - if (ImGui.IsItemHovered()) ImGui.SetTooltip("Kill game"); + if (ImGui.IsItemHovered()) ImGuiHelpers.SafeSetTooltip("Kill game"); ImGui.SameLine(); @@ -1066,7 +1066,7 @@ private bool DrawToggleButtonWithTooltip( result = true; } - if (ImGui.IsItemHovered()) ImGui.SetTooltip(tooltip); + if (ImGui.IsItemHovered()) ImGuiHelpers.SafeSetTooltip(tooltip); if (buttonEnabled) ImGui.PopStyleColor(); diff --git a/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs b/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs index 7678b395e3..80faf3fea3 100644 --- a/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs +++ b/Dalamud/Interface/Internal/Windows/Data/DataWindow.cs @@ -175,7 +175,7 @@ private void DrawContents() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip($"{(this.selectionCollapsed ? "Expand" : "Collapse")} selection pane"); + ImGuiHelpers.SafeSetTooltip($"{(this.selectionCollapsed ? "Expand" : "Collapse")} selection pane"); } ImGui.SameLine(); @@ -187,7 +187,7 @@ private void DrawContents() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Force Reload"); + ImGuiHelpers.SafeSetTooltip("Force Reload"); } ImGui.SameLine(); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs index c9f13616e5..5a2a409b99 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/IconBrowserWidget.cs @@ -176,7 +176,7 @@ private void DrawIcon(int iconId) // else, just draw the iconId. else if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(iconId.ToString()); + ImGuiHelpers.SafeSetTooltip(iconId.ToString()); } if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) @@ -206,7 +206,7 @@ private void DrawIcon(int iconId) } if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"{iconId}\n{exc}".Replace("%", "%%")); + ImGuiHelpers.SafeSetTooltip($"{iconId}\n{exc}".Replace("%", "%%")); ImGui.GetWindowDrawList().AddRect( cursor, @@ -226,7 +226,7 @@ private void DrawIcon(int iconId) text); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(iconId.ToString()); + ImGuiHelpers.SafeSetTooltip(iconId.ToString()); ImGui.GetWindowDrawList().AddRect( cursor, diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs index 05981f0ba5..be27f04c3c 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/ServicesWidget.cs @@ -193,7 +193,7 @@ public void Draw() ImGui.SetCursorScreenPos(new(rc.X, rc.Y)); ImGui.InvisibleButton(node.DisplayedName, new(rc.Z - rc.X, rc.W - rc.Y)); if (ImGui.IsItemHovered() && node.BlockingReason is not null) - ImGui.SetTooltip(node.BlockingReason); + ImGuiHelpers.SafeSetTooltip(node.BlockingReason); ImGui.SetCursorPos((new Vector2(rc.X, rc.Y) - pos) + ((cellSize - textSize) / 2)); ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero); diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs index 07b2d01ff6..b46976d870 100644 --- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs +++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs @@ -600,7 +600,7 @@ private unsafe void DrawLoadedTextures(ICollection textu if (ImGuiComponents.IconButton(FontAwesomeIcon.Sync)) this.textureManager.InvalidatePaths(new[] { texture.SourcePathForDebug }); if (ImGui.IsItemHovered()) - ImGui.SetTooltip($"Call {nameof(ITextureSubstitutionProvider.InvalidatePaths)}."); + ImGuiHelpers.SafeSetTooltip($"Call {nameof(ITextureSubstitutionProvider.InvalidatePaths)}."); ImGui.SameLine(); if (remain <= 0) @@ -608,7 +608,7 @@ private unsafe void DrawLoadedTextures(ICollection textu if (ImGuiComponents.IconButton(FontAwesomeIcon.Trash)) texture.ReleaseSelfReference(true); if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled)) - ImGui.SetTooltip("Release self-reference immediately."); + ImGuiHelpers.SafeSetTooltip("Release self-reference immediately."); if (remain <= 0) ImGui.EndDisabled(); diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index c63954c306..644dd709e3 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -2315,7 +2315,7 @@ private void DrawChangelog(IChangelogEntry log) ImGui.SameLine(ImGui.GetWindowWidth() - whenSize.X - (25 * ImGuiHelpers.GlobalScale)); ImGuiHelpers.SafeTextColored(ImGuiColors.DalamudGrey3, whenText); if (ImGui.IsItemHovered()) - ImGui.SetTooltip("Published on " + log.Date.LocAbsolute()); + ImGuiHelpers.SafeSetTooltip("Published on " + log.Date.LocAbsolute()); } cursor.Y += ImGui.GetTextLineHeightWithSpacing(); @@ -3035,7 +3035,7 @@ private void DrawPluginControlButton(LocalPlugin plugin, AvailablePluginUpdate? ImGuiComponents.DisabledToggleButton(toggleId, false); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.PluginButtonToolTip_LoadUnloadFailed); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_LoadUnloadFailed); } else if (this.enableDisableStatus == OperationStatus.InProgress && this.enableDisableWorkingPluginId == plugin.EffectiveWorkingPluginId) { @@ -3046,9 +3046,9 @@ private void DrawPluginControlButton(LocalPlugin plugin, AvailablePluginUpdate? ImGuiComponents.DisabledToggleButton(toggleId, isLoadedAndUnloadable); if (inMultipleProfiles && ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.PluginButtonToolTip_NeedsToBeInSingleProfile); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_NeedsToBeInSingleProfile); else if (inSingleNonDefaultProfileWhichIsDisabled && ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.PluginButtonToolTip_SingleProfileDisabled(profilesThatWantThisPlugin.First().Name)); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_SingleProfileDisabled(profilesThatWantThisPlugin.First().Name)); } else { @@ -3164,7 +3164,7 @@ async Task Enabler() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.PluginButtonToolTip_PickProfiles); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_PickProfiles); } else if (!applicableForProfiles && config.ProfilesEnabled) { @@ -3175,7 +3175,7 @@ async Task Enabler() ImGui.EndDisabled(); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.PluginButtonToolTip_ProfilesNotSupported); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_ProfilesNotSupported); } } @@ -3216,7 +3216,7 @@ private void DrawUpdateSinglePluginButton(AvailablePluginUpdate update) var updateVersion = update.UseTesting ? update.UpdateManifest.TestingAssemblyVersion : update.UpdateManifest.AssemblyVersion; - ImGui.SetTooltip(Locs.PluginButtonToolTip_UpdateSingle(updateVersion.ToString())); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_UpdateSingle(updateVersion.ToString())); } } @@ -3241,7 +3241,7 @@ private void DrawOpenPluginSettingsButton(LocalPlugin plugin) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(Locs.PluginButtonToolTip_OpenUi); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_OpenUi); } } @@ -3268,7 +3268,7 @@ private void DrawOpenPluginSettingsButton(LocalPlugin plugin) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(Locs.PluginButtonToolTip_OpenConfiguration); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_OpenConfiguration); } } } @@ -3288,7 +3288,7 @@ private void DrawSendFeedbackButton(IPluginManifest manifest, bool isTesting, bo if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(Locs.FeedbackModal_Title); + ImGuiHelpers.SafeSetTooltip(Locs.FeedbackModal_Title); } } @@ -3340,7 +3340,7 @@ private void DrawDevPluginValidationIssues(LocalDevPlugin devPlugin) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip("Dismiss this issue"); + ImGuiHelpers.SafeSetTooltip("Dismiss this issue"); } } @@ -3418,7 +3418,7 @@ private void DrawDevPluginButtons(LocalPlugin localPlugin) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(isInDefaultProfile ? Locs.PluginButtonToolTip_StartOnBoot : Locs.PluginButtonToolTip_NeedsToBeInDefault); + ImGuiHelpers.SafeSetTooltip(isInDefaultProfile ? Locs.PluginButtonToolTip_StartOnBoot : Locs.PluginButtonToolTip_NeedsToBeInDefault); } } @@ -3437,7 +3437,7 @@ private void DrawDevPluginButtons(LocalPlugin localPlugin) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(Locs.PluginButtonToolTip_AutomaticReloading); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_AutomaticReloading); } } } @@ -3465,9 +3465,9 @@ private void DrawDeletePluginButton(LocalPlugin plugin) if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(plugin.State == PluginState.Loaded - ? Locs.PluginButtonToolTip_DeletePluginLoaded - : Locs.PluginButtonToolTip_DeletePluginRestricted); + ImGuiHelpers.SafeSetTooltip(plugin.State == PluginState.Loaded + ? Locs.PluginButtonToolTip_DeletePluginLoaded + : Locs.PluginButtonToolTip_DeletePluginRestricted); } } else @@ -3514,7 +3514,7 @@ private void DrawDeletePluginButton(LocalPlugin plugin) tooltipMessage = Locs.PluginButtonToolTip_DeletePluginScheduled; } - ImGui.SetTooltip(tooltipMessage); + ImGuiHelpers.SafeSetTooltip(tooltipMessage); } } } @@ -3545,7 +3545,7 @@ private bool DrawVisitRepoUrlButton(string? repoUrl, bool big) } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.PluginButtonToolTip_VisitPluginUrl); + ImGuiHelpers.SafeSetTooltip(Locs.PluginButtonToolTip_VisitPluginUrl); return true; } @@ -3888,7 +3888,7 @@ private void VerifiedCheckmarkFadeTooltip(string source, string tooltip) var fadePercent = this.tooltipFadeEasing.EasedPoint.X; ImGui.PushStyleColor(ImGuiCol.Text, ImGui.GetStyle().Colors[(int)ImGuiCol.Text] with { W = fadePercent }); ImGui.PushStyleColor(ImGuiCol.FrameBg, ImGui.GetStyle().Colors[(int)ImGuiCol.FrameBg] with { W = fadePercent }); - ImGui.SetTooltip(tooltip); + ImGuiHelpers.SafeSetTooltip(tooltip); ImGui.PopStyleColor(2); } } diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs index 6250f2f781..1ae61d0fa8 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/ProfileManagerWidget.cs @@ -164,7 +164,7 @@ private void DrawOverview(uint tutorialId) profman.AddNewProfile(); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.AddProfile); + ImGuiHelpers.SafeSetTooltip(Locs.AddProfile); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); @@ -185,7 +185,7 @@ private void DrawOverview(uint tutorialId) } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.ImportProfileHint); + ImGuiHelpers.SafeSetTooltip(Locs.ImportProfileHint); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); @@ -195,7 +195,7 @@ private void DrawOverview(uint tutorialId) ImGui.OpenPopup(tutorialId); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.TutorialHint); + ImGuiHelpers.SafeSetTooltip(Locs.TutorialHint); ImGui.Separator(); ImGuiHelpers.ScaledDummy(5); @@ -237,7 +237,7 @@ private void DrawOverview(uint tutorialId) } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.EditProfileHint); + ImGuiHelpers.SafeSetTooltip(Locs.EditProfileHint); ImGui.SameLine(); ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30 * 2) - 5); @@ -246,7 +246,7 @@ private void DrawOverview(uint tutorialId) toCloneGuid = profile.Guid; if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.CloneProfileHint); + ImGuiHelpers.SafeSetTooltip(Locs.CloneProfileHint); ImGui.SameLine(); ImGui.SetCursorPosX(windowSize.X - (ImGuiHelpers.GlobalScale * 30 * 3) - 5); @@ -258,7 +258,7 @@ private void DrawOverview(uint tutorialId) } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.CopyToClipboardHint); + ImGuiHelpers.SafeSetTooltip(Locs.CopyToClipboardHint); didAny = true; @@ -320,7 +320,7 @@ private void DrawEdit() this.Reset(); if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.BackToOverview); + ImGuiHelpers.SafeSetTooltip(Locs.BackToOverview); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); @@ -333,7 +333,7 @@ private void DrawEdit() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.CopyToClipboardHint); + ImGuiHelpers.SafeSetTooltip(Locs.CopyToClipboardHint); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); @@ -357,7 +357,7 @@ private void DrawEdit() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.DeleteProfileHint); + ImGuiHelpers.SafeSetTooltip(Locs.DeleteProfileHint); ImGui.SameLine(); ImGuiHelpers.ScaledDummy(5); @@ -380,7 +380,7 @@ private void DrawEdit() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.TooltipEnableDisable); + ImGuiHelpers.SafeSetTooltip(Locs.TooltipEnableDisable); ImGui.Separator(); @@ -486,7 +486,7 @@ private void DrawEdit() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.InstallPlugin); + ImGuiHelpers.SafeSetTooltip(Locs.InstallPlugin); } ImGui.SetCursorPos(before); @@ -513,7 +513,7 @@ private void DrawEdit() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Locs.RemovePlugin); + ImGuiHelpers.SafeSetTooltip(Locs.RemovePlugin); } if (wantRemovePluginGuid != null) diff --git a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs index 2117058174..5f749a2fad 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/SettingsWindow.cs @@ -241,9 +241,9 @@ public override void Draw() if (ImGui.IsItemHovered()) { - ImGui.SetTooltip(!ImGui.IsKeyDown(ImGuiKey.ModShift) - ? Loc.Localize("DalamudSettingsSaveAndExit", "Save changes and close") - : Loc.Localize("DalamudSettingsSave", "Save changes")); + ImGuiHelpers.SafeSetTooltip(!ImGui.IsKeyDown(ImGuiKey.ModShift) + ? Loc.Localize("DalamudSettingsSaveAndExit", "Save changes and close") + : Loc.Localize("DalamudSettingsSave", "Save changes")); } } } diff --git a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs index 77c79c96d4..b34142f04d 100644 --- a/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs +++ b/Dalamud/Interface/Internal/Windows/Settings/Tabs/SettingsTabAutoUpdate.cs @@ -25,7 +25,7 @@ public class SettingsTabAutoUpdates : SettingsTab private bool checkPeriodically; private string pickerSearch = string.Empty; private List autoUpdatePreferences = []; - + public override SettingsEntry[] Entries { get; } = Array.Empty(); public override string Title => Loc.Localize("DalamudSettingsAutoUpdates", "Auto-Updates"); @@ -36,15 +36,15 @@ public override void Draw() "Dalamud can update your plugins automatically, making sure that you always " + "have the newest features and bug fixes. You can choose when and how auto-updates are run here.")); ImGuiHelpers.ScaledDummy(2); - + ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer1", "You can always update your plugins manually by clicking the update button in the plugin list. " + "You can also opt into updates for specific plugins by right-clicking them and selecting \"Always auto-update\".")); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdateDisclaimer2", "Dalamud will only notify you about updates while you are idle.")); - + ImGuiHelpers.ScaledDummy(8); - + ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateBehavior", "When the game starts...")); var behaviorInt = (int)this.behavior; @@ -62,20 +62,20 @@ public override void Draw() "These updates are not reviewed by the Dalamud team and may contain malicious code."); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudOrange, warning); } - + ImGuiHelpers.ScaledDummy(8); - + ImGui.Checkbox(Loc.Localize("DalamudSettingsAutoUpdatePeriodically", "Periodically check for new updates while playing"), ref this.checkPeriodically); ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudGrey, Loc.Localize("DalamudSettingsAutoUpdatePeriodicallyHint", "Plugins won't update automatically after startup, you will only receive a notification while you are not actively playing.")); - + ImGuiHelpers.ScaledDummy(5); ImGui.Separator(); ImGuiHelpers.ScaledDummy(5); - + ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateOptedIn", "Per-plugin overrides")); - + ImGuiHelpers.SafeTextColoredWrapped(ImGuiColors.DalamudWhite, Loc.Localize("DalamudSettingsAutoUpdateOverrideHint", "Here, you can choose to receive or not to receive updates for specific plugins. " + "This will override the settings above for the selected plugins.")); @@ -83,25 +83,25 @@ public override void Draw() if (this.autoUpdatePreferences.Count == 0) { ImGuiHelpers.ScaledDummy(20); - + using (ImRaii.PushColor(ImGuiCol.Text, ImGuiColors.DalamudGrey)) { ImGuiHelpers.CenteredText(Loc.Localize("DalamudSettingsAutoUpdateOptedInHint2", "You don't have auto-update rules for any plugins.")); } - + ImGuiHelpers.ScaledDummy(2); } else { ImGuiHelpers.ScaledDummy(5); - + var pic = Service.Get(); var windowSize = ImGui.GetWindowSize(); var pluginLineHeight = 32 * ImGuiHelpers.GlobalScale; Guid? wantRemovePluginGuid = null; - + foreach (var preference in this.autoUpdatePreferences) { var pmPlugin = Service.Get().InstalledPlugins @@ -124,7 +124,7 @@ public override void Draw() ImGui.Image(pic.DevPluginIcon.ImGuiHandle, new Vector2(pluginLineHeight)); ImGui.PopStyleVar(); } - + ImGui.SameLine(); var text = $"{pmPlugin.Name}{(pmPlugin.IsDev ? " (dev plugin" : string.Empty)}"; @@ -147,7 +147,7 @@ public override void Draw() ImGui.SetCursorPosY(ImGui.GetCursorPosY() + (pluginLineHeight / 2) - (textHeight.Y / 2)); ImGui.TextUnformatted(text); - + ImGui.SetCursorPos(before); } @@ -191,9 +191,9 @@ string OptKindToString(AutoUpdatePreference.OptKind kind) } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Loc.Localize("DalamudSettingsAutoUpdateOptInRemove", "Remove this override")); + ImGuiHelpers.SafeSetTooltip(Loc.Localize("DalamudSettingsAutoUpdateOptInRemove", "Remove this override")); } - + if (wantRemovePluginGuid != null) { this.autoUpdatePreferences.RemoveAll(x => x.WorkingPluginId == wantRemovePluginGuid); @@ -205,19 +205,19 @@ void OnPluginPicked(LocalPlugin plugin) var id = plugin.EffectiveWorkingPluginId; if (id == Guid.Empty) throw new InvalidOperationException("Plugin ID is empty."); - + this.autoUpdatePreferences.Add(new AutoUpdatePreference(id)); } - + bool IsPluginDisabled(LocalPlugin plugin) => this.autoUpdatePreferences.Any(x => x.WorkingPluginId == plugin.EffectiveWorkingPluginId); - + bool IsPluginFiltered(LocalPlugin plugin) => !plugin.IsDev; - + var pickerId = DalamudComponents.DrawPluginPicker( "###autoUpdatePicker", ref this.pickerSearch, OnPluginPicked, IsPluginDisabled, IsPluginFiltered); - + const FontAwesomeIcon addButtonIcon = FontAwesomeIcon.Plus; var addButtonText = Loc.Localize("DalamudSettingsAutoUpdateOptInAdd", "Add new override"); ImGuiHelpers.CenterCursorFor(ImGuiComponents.GetIconButtonWithTextWidth(addButtonIcon, addButtonText)); @@ -237,18 +237,18 @@ public override void Load() this.behavior = configuration.AutoUpdateBehavior ?? AutoUpdateBehavior.None; this.checkPeriodically = configuration.CheckPeriodicallyForUpdates; this.autoUpdatePreferences = configuration.PluginAutoUpdatePreferences; - + base.Load(); } public override void Save() { var configuration = Service.Get(); - + configuration.AutoUpdateBehavior = this.behavior; configuration.CheckPeriodicallyForUpdates = this.checkPeriodically; configuration.PluginAutoUpdatePreferences = this.autoUpdatePreferences; - + base.Save(); } } diff --git a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs index 6f119a7cb0..e7bbe5e122 100644 --- a/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs +++ b/Dalamud/Interface/Internal/Windows/StyleEditor/StyleEditorWindow.cs @@ -126,7 +126,7 @@ public override void Draw() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Loc.Localize("StyleEditorDeleteStyle", "Delete current style")); + ImGuiHelpers.SafeSetTooltip(Loc.Localize("StyleEditorDeleteStyle", "Delete current style")); ImGui.SameLine(); @@ -140,7 +140,7 @@ public override void Draw() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Loc.Localize("StyleEditorRenameStyle", "Rename style")); + ImGuiHelpers.SafeSetTooltip(Loc.Localize("StyleEditorRenameStyle", "Rename style")); ImGui.SameLine(); @@ -156,7 +156,7 @@ public override void Draw() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing")); + ImGuiHelpers.SafeSetTooltip(Loc.Localize("StyleEditorCopy", "Copy style to clipboard for sharing")); if (isBuiltinStyle) ImGui.EndDisabled(); @@ -195,7 +195,7 @@ public override void Draw() } if (ImGui.IsItemHovered()) - ImGui.SetTooltip(Loc.Localize("StyleEditorImport", "Import style from clipboard")); + ImGuiHelpers.SafeSetTooltip(Loc.Localize("StyleEditorImport", "Import style from clipboard")); ImGui.Separator(); diff --git a/Dalamud/Interface/Utility/ImGuiHelpers.cs b/Dalamud/Interface/Utility/ImGuiHelpers.cs index 6f70ca3a79..0465381f4a 100644 --- a/Dalamud/Interface/Utility/ImGuiHelpers.cs +++ b/Dalamud/Interface/Utility/ImGuiHelpers.cs @@ -237,6 +237,20 @@ public static SeStringDrawResult CompileSeStringWrapped( ImGuiButtonFlags buttonFlags = ImGuiButtonFlags.MouseButtonDefault) => Service.Get().CompileAndDrawWrapped(text, style, imGuiId, buttonFlags); + /// + /// Display an unformatted tooltip. + /// + /// The text to write. + public static void SafeSetTooltip(string text) + { + // SetTooltip(const char* fmt, ...) = is more or less a shortcut for the 'if (BeginTooltip()) { Text(...); EndTooltip(); }' idiom (~~with a subtlety that it discard any previously submitted tooltip~~) + // Important Note: ImRaii does not discard previous tooltips! + using (ImRaii.Tooltip()) + { + ImGui.TextUnformatted(text); + } + } + /// /// Write unformatted disabled text. /// diff --git a/Dalamud/Interface/Utility/Table/ColumnFlags.cs b/Dalamud/Interface/Utility/Table/ColumnFlags.cs index 24670adfc0..e6c9039227 100644 --- a/Dalamud/Interface/Utility/Table/ColumnFlags.cs +++ b/Dalamud/Interface/Utility/Table/ColumnFlags.cs @@ -38,7 +38,7 @@ public override bool DrawFilter() } if (!all && ImGui.IsItemHovered()) - ImGui.SetTooltip("Right-click to clear filters."); + ImGuiHelpers.SafeSetTooltip("Right-click to clear filters."); if (!combo) return false;