fix: use ImRaii conditions properly

This commit is contained in:
goat 2023-06-21 20:30:34 +02:00
parent 00fd9079a9
commit 30176e61f5
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -1110,39 +1110,46 @@ internal class PluginInstallerWindow : Window, IDisposable
var useContentWidth = ImGui.GetContentRegionAvail().X; var useContentWidth = ImGui.GetContentRegionAvail().X;
using (ImRaii.Child("InstallerCategories", new Vector2(useContentWidth, useContentHeight * ImGuiHelpers.GlobalScale))) using var categoriesChild = ImRaii.Child("InstallerCategories", new Vector2(useContentWidth, useContentHeight * ImGuiHelpers.GlobalScale));
if (categoriesChild)
{ {
using var style = ImRaii.PushStyle(ImGuiStyleVar.CellPadding, ImGuiHelpers.ScaledVector2(5, 0)); using var style = ImRaii.PushStyle(ImGuiStyleVar.CellPadding, ImGuiHelpers.ScaledVector2(5, 0));
using var table = ImRaii.Table( using var table = ImRaii.Table(
"##InstallerCategoriesCont", "##InstallerCategoriesCont",
2, 2,
ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersInnerV); ImGuiTableFlags.SizingFixedFit | ImGuiTableFlags.Resizable | ImGuiTableFlags.BordersInnerV);
try if (table)
{ {
ImGui.TableSetupColumn("##InstallerCategoriesSelector", ImGuiTableColumnFlags.WidthFixed, useMenuWidth * ImGuiHelpers.GlobalScale); try
ImGui.TableSetupColumn("##InstallerCategoriesBody", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableNextRow();
ImGui.TableNextColumn();
this.DrawPluginCategorySelectors();
ImGui.TableNextColumn();
using (ImRaii.Child("ScrollingPlugins", new Vector2(-1, 0), false, ImGuiWindowFlags.NoBackground))
{ {
try ImGui.TableSetupColumn("##InstallerCategoriesSelector", ImGuiTableColumnFlags.WidthFixed, useMenuWidth * ImGuiHelpers.GlobalScale);
ImGui.TableSetupColumn("##InstallerCategoriesBody", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableNextRow();
ImGui.TableNextColumn();
this.DrawPluginCategorySelectors();
ImGui.TableNextColumn();
using var scrollingChild =
ImRaii.Child("ScrollingPlugins", new Vector2(-1, 0), false, ImGuiWindowFlags.NoBackground);
if (scrollingChild)
{ {
this.DrawPluginCategoryContent(); try
} {
catch (Exception ex) this.DrawPluginCategoryContent();
{ }
Log.Error(ex, "Could not draw category content"); catch (Exception ex)
{
Log.Error(ex, "Could not draw category content");
}
} }
} }
} catch (Exception ex)
catch (Exception ex) {
{ Log.Error(ex, "Could not draw plugin categories");
Log.Error(ex, "Could not draw plugin categories"); }
} }
} }
} }
@ -2363,7 +2370,7 @@ internal class PluginInstallerWindow : Window, IDisposable
var isLoadedAndUnloadable = plugin.State == PluginState.Loaded || var isLoadedAndUnloadable = plugin.State == PluginState.Loaded ||
plugin.State == PluginState.DependencyResolutionFailed; plugin.State == PluginState.DependencyResolutionFailed;
StyleModelV1.DalamudStandard.Push(); //StyleModelV1.DalamudStandard.Push();
var profileChooserPopupName = $"###pluginProfileChooser{plugin.Manifest.InternalName}"; var profileChooserPopupName = $"###pluginProfileChooser{plugin.Manifest.InternalName}";
if (ImGui.BeginPopup(profileChooserPopupName)) if (ImGui.BeginPopup(profileChooserPopupName))
@ -2526,7 +2533,7 @@ internal class PluginInstallerWindow : Window, IDisposable
} }
} }
StyleModelV1.DalamudStandard.Pop(); //StyleModelV1.DalamudStandard.Pop();
ImGui.SameLine(); ImGui.SameLine();
ImGuiHelpers.ScaledDummy(15, 0); ImGuiHelpers.ScaledDummy(15, 0);