Replace all PushTextWrapPos with using version

This commit is contained in:
Infi
2024-05-14 01:13:28 +02:00
parent 0de883ec39
commit 041b0f27d4
7 changed files with 71 additions and 78 deletions
+1 -3
View File
@@ -33,7 +33,7 @@ internal sealed class About : ISettingsTab
public void Draw(bool changed)
{
ImGui.PushTextWrapPos();
using var wrap = ImGuiUtil.TextWrapPos();
ImGui.TextUnformatted(string.Format(Language.Options_About_Opening, Plugin.PluginName));
@@ -93,8 +93,6 @@ internal sealed class About : ISettingsTab
}
}
}
ImGui.Spacing();
ImGui.PopTextWrapPos();
}
}
+53 -53
View File
@@ -21,63 +21,63 @@ internal sealed class ChatLog : ISettingsTab
public void Draw(bool changed)
{
ImGui.PushTextWrapPos();
ImGuiUtil.OptionCheckbox(ref Mutable.KeepInputFocus, Language.Options_KeepInputFocus_Name, Language.Options_KeepInputFocus_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.PlaySounds, Language.Options_PlaySounds_Name, Language.Options_PlaySounds_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.SidebarTabView, Language.Options_SidebarTabView_Name, string.Format(Language.Options_SidebarTabView_Description, Plugin.PluginName));
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowNoviceNetwork, Language.Options_ShowNoviceNetwork_Name, Language.Options_ShowNoviceNetwork_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name, string.Format(Language.Options_NativeItemTooltips_Description, Plugin.PluginName));
ImGui.Spacing();
if (Mutable.NativeItemTooltips)
using (ImGuiUtil.TextWrapPos())
{
ImGuiUtil.DragFloatVertical(Language.Options_TooltipOffset_Name, Language.Options_TooltipOffset_Desc, ref Mutable.TooltipOffset, 1, 0f, 400f, $"{Mutable.TooltipOffset:N0}px", ImGuiSliderFlags.AlwaysClamp);
ImGuiUtil.OptionCheckbox(ref Mutable.KeepInputFocus, Language.Options_KeepInputFocus_Name, Language.Options_KeepInputFocus_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.PlaySounds, Language.Options_PlaySounds_Name, Language.Options_PlaySounds_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.SidebarTabView, Language.Options_SidebarTabView_Name, string.Format(Language.Options_SidebarTabView_Description, Plugin.PluginName));
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowNoviceNetwork, Language.Options_ShowNoviceNetwork_Name, Language.Options_ShowNoviceNetwork_Description);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.NativeItemTooltips, Language.Options_NativeItemTooltips_Name, string.Format(Language.Options_NativeItemTooltips_Description, Plugin.PluginName));
ImGui.Spacing();
if (Mutable.NativeItemTooltips)
{
ImGuiUtil.DragFloatVertical(Language.Options_TooltipOffset_Name, Language.Options_TooltipOffset_Desc, ref Mutable.TooltipOffset, 1, 0f, 400f, $"{Mutable.TooltipOffset:N0}px", ImGuiSliderFlags.AlwaysClamp);
ImGui.Spacing();
}
ImGuiUtil.DragFloatVertical(Language.Options_WindowOpacity_Name, ref Mutable.WindowAlpha, .25f, 0f, 100f, $"{Mutable.WindowAlpha:N2}%%", ImGuiSliderFlags.AlwaysClamp);
ImGui.Spacing();
if (ImGuiUtil.InputIntVertical(Language.Options_MaxLinesToShow_Name, Language.Options_MaxLinesToShow_Description, ref Mutable.MaxLinesToRender)) Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.CanMove, Language.Options_CanMove_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.CanResize, Language.Options_CanResize_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowTitleBar, Language.Options_ShowTitleBar_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.OverrideStyle, Language.Options_OverrideStyle_Name, Language.Options_OverrideStyle_Name_Desc);
ImGui.Spacing();
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
ImGui.TextUnformatted(Language.Options_AdjustPosition_Name);
var pos = Plugin.ChatLogWindow.LastWindowPos;
ImGui.SetNextItemWidth(-1);
if (ImGui.DragFloat2($"##{Language.Options_AdjustPosition_Name}", ref pos, 1, 0, float.MaxValue, "%.0fpx"))
Plugin.ChatLogWindow.Position = pos;
ImGuiUtil.WarningText(Language.Options_AdjustPosition_Warning);
ImGui.Spacing();
}
ImGuiUtil.DragFloatVertical(Language.Options_WindowOpacity_Name, ref Mutable.WindowAlpha, .25f, 0f, 100f, $"{Mutable.WindowAlpha:N2}%%", ImGuiSliderFlags.AlwaysClamp);
ImGui.Spacing();
if (ImGuiUtil.InputIntVertical(Language.Options_MaxLinesToShow_Name, Language.Options_MaxLinesToShow_Description, ref Mutable.MaxLinesToRender)) Mutable.MaxLinesToRender = Math.Clamp(Mutable.MaxLinesToRender, 1, 10_000);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.CanMove, Language.Options_CanMove_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.CanResize, Language.Options_CanResize_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowTitleBar, Language.Options_ShowTitleBar_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
ImGui.Spacing();
ImGuiUtil.OptionCheckbox(ref Mutable.OverrideStyle, Language.Options_OverrideStyle_Name, Language.Options_OverrideStyle_Name_Desc);
ImGui.Spacing();
ImGui.Spacing();
ImGui.Separator();
ImGui.Spacing();
ImGui.TextUnformatted(Language.Options_AdjustPosition_Name);
var pos = Plugin.ChatLogWindow.LastWindowPos;
ImGui.SetNextItemWidth(-1);
if (ImGui.DragFloat2($"##{Language.Options_AdjustPosition_Name}", ref pos, 1, 0, float.MaxValue, "%.0fpx"))
Plugin.ChatLogWindow.Position = pos;
ImGuiUtil.WarningText(Language.Options_AdjustPosition_Warning);
ImGui.Spacing();
ImGui.PopTextWrapPos();
if (!Mutable.OverrideStyle)
return;
+2 -4
View File
@@ -147,9 +147,9 @@ internal sealed class Database : ISettingsTab
return;
using var treeNode = ImRaii.TreeNode(Language.Options_Database_Advanced);
ImGui.PushTextWrapPos();
ImGuiUtil.WarningText(Language.Options_Database_Advanced_Warning);
using var wrap = ImGuiUtil.TextWrapPos();
ImGuiUtil.WarningText(Language.Options_Database_Advanced_Warning);
if (ImGuiUtil.CtrlShiftButton("Perform maintenance", "Ctrl+Shift: MessageManager.Store.PerformMaintenance()"))
Plugin.MessageManager.Store.PerformMaintenance();
@@ -161,8 +161,6 @@ internal sealed class Database : ISettingsTab
if (ImGuiUtil.CtrlShiftButton("Inject 10,000 messages", "Ctrl+Shift: creates 10,000 unique messages (async)"))
new Thread(() => InsertMessages(10_000)).Start();
ImGui.PopTextWrapPos();
ImGui.Spacing();
}
+1 -3
View File
@@ -19,7 +19,7 @@ internal sealed class Display : ISettingsTab
public void Draw(bool changed)
{
ImGui.PushTextWrapPos();
using var wrap = ImGuiUtil.TextWrapPos();
ImGuiUtil.OptionCheckbox(ref Mutable.HideChat, Language.Options_HideChat_Name, Language.Options_HideChat_Description);
ImGui.Spacing();
@@ -52,7 +52,5 @@ internal sealed class Display : ISettingsTab
ImGuiUtil.OptionCheckbox(ref Mutable.CollapseDuplicateMessages, Language.Options_CollapseDuplicateMessages_Name, Language.Options_CollapseDuplicateMessages_Description);
ImGui.Spacing();
ImGui.PopTextWrapPos();
}
}
+1 -3
View File
@@ -38,7 +38,7 @@ internal sealed class Emote : ISettingsTab
public void Draw(bool changed)
{
ImGui.PushTextWrapPos();
using var wrap = ImGuiUtil.TextWrapPos();
ImGuiUtil.OptionCheckbox(ref Mutable.ShowEmotes, Language.Options_ShowEmotes_Name, Language.Options_ShowEmotes_Desc);
ImGui.Spacing();
@@ -109,7 +109,5 @@ internal sealed class Emote : ISettingsTab
}
}
}
ImGui.PopTextWrapPos();
}
}
+1 -2
View File
@@ -29,7 +29,7 @@ public class Fonts : ISettingsTab
if (changed)
UpdateFonts();
ImGui.PushTextWrapPos();
using var wrap = ImGuiUtil.TextWrapPos();
ImGui.Checkbox(Language.Options_FontsEnabled, ref Mutable.FontsEnabled);
ImGui.Spacing();
@@ -118,6 +118,5 @@ public class Fonts : ISettingsTab
ImGuiUtil.HelpText(Language.Options_SymbolsFontSize_Description);
ImGui.Spacing();
ImGui.PopTextWrapPos();
}
}