From 8a355e390561affae7657b154b58768cf3233dfa Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Wed, 1 Sep 2021 21:57:37 +0200 Subject: [PATCH] Fix begin/end child and window. --- Penumbra/UI/LaunchButton.cs | 12 ++++-------- Penumbra/UI/MenuTabs/TabCollections.cs | 15 ++++++--------- .../MenuTabs/TabInstalled/TabInstalledModPanel.cs | 6 +----- .../MenuTabs/TabInstalled/TabInstalledSelector.cs | 15 ++++++++------- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/Penumbra/UI/LaunchButton.cs b/Penumbra/UI/LaunchButton.cs index 54962d19..f146b23f 100644 --- a/Penumbra/UI/LaunchButton.cs +++ b/Penumbra/UI/LaunchButton.cs @@ -26,10 +26,10 @@ namespace Penumbra.UI | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoSavedSettings; - private readonly SettingsInterface _base; + private readonly SettingsInterface _base; public ManageModsButton( SettingsInterface ui ) - => _base = ui; + => _base = ui; public void Draw() { @@ -43,12 +43,8 @@ namespace Penumbra.UI ImGui.SetNextWindowPos( ss - WindowPosOffset, ImGuiCond.Always ); - if( !ImGui.Begin( MenuButtonsName, ButtonFlags ) ) - { - return; - } - - if( ImGui.Button( MenuButtonLabel, WindowSize ) ) + if( ImGui.Begin( MenuButtonsName, ButtonFlags ) + && ImGui.Button( MenuButtonLabel, WindowSize ) ) { _base.FlipVisibility(); } diff --git a/Penumbra/UI/MenuTabs/TabCollections.cs b/Penumbra/UI/MenuTabs/TabCollections.cs index 0af8f283..9e73be70 100644 --- a/Penumbra/UI/MenuTabs/TabCollections.cs +++ b/Penumbra/UI/MenuTabs/TabCollections.cs @@ -254,6 +254,7 @@ namespace Penumbra.UI { if( !ImGui.BeginChild( "##CollectionChild", AutoFillSize, true ) ) { + ImGui.EndChild(); return; } @@ -285,7 +286,6 @@ namespace Penumbra.UI } DrawNewCharacterCollection(); - ImGui.EndChild(); } @@ -296,21 +296,18 @@ namespace Penumbra.UI return; } - if( !ImGui.BeginChild( "##CollectionHandling", new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 6 ), true ) ) + if( ImGui.BeginChild( "##CollectionHandling", new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 6 ), true ) ) { - ImGui.EndTabItem(); - return; + DrawCurrentCollectionSelector( true ); + + ImGui.Dummy( new Vector2( 0, 10 ) ); + DrawNewCollectionInput(); } - DrawCurrentCollectionSelector( true ); - - ImGui.Dummy( new Vector2( 0, 10 ) ); - DrawNewCollectionInput(); ImGui.EndChild(); DrawCharacterCollectionSelectors(); - ImGui.EndTabItem(); } } diff --git a/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledModPanel.cs b/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledModPanel.cs index 96e8f71e..5f03fbf8 100644 --- a/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledModPanel.cs +++ b/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledModPanel.cs @@ -504,12 +504,8 @@ namespace Penumbra.UI try { var ret = ImGui.BeginChild( LabelModPanel, AutoFillSize, true ); - if( !ret ) - { - return; - } - if( Mod == null ) + if( !ret || Mod == null ) { ImGui.EndChild(); return; diff --git a/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledSelector.cs b/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledSelector.cs index 757a76cb..07290ef5 100644 --- a/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledSelector.cs +++ b/Penumbra/UI/MenuTabs/TabInstalled/TabInstalledSelector.cs @@ -764,15 +764,16 @@ namespace Penumbra.UI ImGui.PushStyleVar( ImGuiStyleVar.ItemSpacing, Vector2.Zero ); ImGui.BeginGroup(); // Inlay selector list - ImGui.BeginChild( LabelSelectorList, + if( ImGui.BeginChild( LabelSelectorList, new Vector2( SelectorPanelWidth * _selectorScalingFactor, -ImGui.GetFrameHeightWithSpacing() ), - true, ImGuiWindowFlags.HorizontalScrollbar ); + true, ImGuiWindowFlags.HorizontalScrollbar ) ) + { + ImGui.PushStyleVar( ImGuiStyleVar.IndentSpacing, 12.5f ); - ImGui.PushStyleVar( ImGuiStyleVar.IndentSpacing, 12.5f ); - - var modIndex = 0; - DrawFolderContent( _modManager.StructuredMods, ref modIndex ); - ImGui.PopStyleVar(); + var modIndex = 0; + DrawFolderContent( _modManager.StructuredMods, ref modIndex ); + ImGui.PopStyleVar(); + } ImGui.EndChild();