Fix imgui deprecation warnings, some formatting.

This commit is contained in:
Ottermandias 2021-04-18 23:03:34 +02:00
parent c25334ea58
commit 63407f775f
3 changed files with 27 additions and 23 deletions

View file

@ -53,14 +53,14 @@ namespace Penumbra.UI
return; return;
} }
if( ImGui.ListBoxHeader( "##effective_files", AutoFillSize ) ) if( ImGui.BeginListBox( "##effective_files", AutoFillSize ) )
{ {
foreach( var file in _mods.ResolvedFiles ) foreach( var file in _mods.ResolvedFiles )
{ {
DrawFileLine( file.Value, file.Key ); DrawFileLine( file.Value, file.Key );
} }
ImGui.ListBoxFooter(); ImGui.EndListBox();
} }
ImGui.EndTabItem(); ImGui.EndTabItem();

View file

@ -45,8 +45,8 @@ namespace Penumbra.UI
private const string LabelConfigurationTab = "Configuration"; private const string LabelConfigurationTab = "Configuration";
private const string TooltipFilesTab = private const string TooltipFilesTab =
"Green files replace their standard game path counterpart (not in any option) or are in all options of a Single-Select option.\n" + "Green files replace their standard game path counterpart (not in any option) or are in all options of a Single-Select option.\n"
"Yellow files are restricted to some options."; + "Yellow files are restricted to some options.";
private const float TextSizePadding = 5f; private const float TextSizePadding = 5f;
private const float OptionSelectionWidth = 140f; private const float OptionSelectionWidth = 140f;
@ -130,8 +130,11 @@ namespace Penumbra.UI
} }
// This is only drawn when we have a mod selected, so we can forgive nulls. // This is only drawn when we have a mod selected, so we can forgive nulls.
private ModInfo Mod => _selector.Mod()!; private ModInfo Mod
private ModMeta Meta => Mod.Mod.Meta; => _selector.Mod()!;
private ModMeta Meta
=> Mod.Mod.Meta;
private void Save() private void Save()
{ {
@ -193,7 +196,7 @@ namespace Penumbra.UI
if( ImGui.BeginTabItem( LabelChangedItemsTab ) ) if( ImGui.BeginTabItem( LabelChangedItemsTab ) )
{ {
ImGui.SetNextItemWidth( -1 ); ImGui.SetNextItemWidth( -1 );
if( ImGui.ListBoxHeader( LabelChangedItemsHeader, AutoFillSize ) ) if( ImGui.BeginListBox( LabelChangedItemsHeader, AutoFillSize ) )
{ {
_changedItemsList ??= Meta.ChangedItems _changedItemsList ??= Meta.ChangedItems
.Select( ( I, index ) => ( $"{LabelChangedItemIdx}{index}", I ) ).ToArray(); .Select( ( I, index ) => ( $"{LabelChangedItemIdx}{index}", I ) ).ToArray();
@ -220,7 +223,7 @@ namespace Penumbra.UI
} }
} }
ImGui.ListBoxFooter(); ImGui.EndListBox();
} }
ImGui.EndTabItem(); ImGui.EndTabItem();
@ -239,7 +242,7 @@ namespace Penumbra.UI
} }
ImGui.SetNextItemWidth( -1 ); ImGui.SetNextItemWidth( -1 );
if( ImGui.ListBoxHeader( LabelConflictsHeader, AutoFillSize ) ) if( ImGui.BeginListBox( LabelConflictsHeader, AutoFillSize ) )
{ {
foreach( var kv in Mod.Mod.FileConflicts ) foreach( var kv in Mod.Mod.FileConflicts )
{ {
@ -258,7 +261,7 @@ namespace Penumbra.UI
ImGui.Unindent( 15 ); ImGui.Unindent( 15 );
} }
ImGui.ListBoxFooter(); ImGui.EndListBox();
} }
ImGui.EndTabItem(); ImGui.EndTabItem();
@ -274,10 +277,11 @@ namespace Penumbra.UI
if( ImGui.BeginTabItem( LabelFileSwapTab ) ) if( ImGui.BeginTabItem( LabelFileSwapTab ) )
{ {
_fileSwapOffset ??= Meta.FileSwaps _fileSwapOffset ??= Meta.FileSwaps
.Max( P => ImGui.CalcTextSize( P.Key ).X ) + TextSizePadding; .Max( P => ImGui.CalcTextSize( P.Key ).X )
+ TextSizePadding;
ImGui.SetNextItemWidth( -1 ); ImGui.SetNextItemWidth( -1 );
if( ImGui.ListBoxHeader( LabelFileSwapHeader, AutoFillSize ) ) if( ImGui.BeginListBox( LabelFileSwapHeader, AutoFillSize ) )
{ {
foreach( var file in Meta.FileSwaps ) foreach( var file in Meta.FileSwaps )
{ {
@ -288,7 +292,7 @@ namespace Penumbra.UI
ImGui.Selectable( file.Value ); ImGui.Selectable( file.Value );
} }
ImGui.ListBoxFooter(); ImGui.EndListBox();
} }
ImGui.EndTabItem(); ImGui.EndTabItem();
@ -353,7 +357,7 @@ namespace Penumbra.UI
} }
ImGui.SetNextItemWidth( -1 ); ImGui.SetNextItemWidth( -1 );
if( ImGui.ListBoxHeader( LabelFileListHeader, AutoFillSize ) ) if( ImGui.BeginListBox( LabelFileListHeader, AutoFillSize ) )
{ {
UpdateFilenameList(); UpdateFilenameList();
foreach( var file in _fullFilenameList! ) foreach( var file in _fullFilenameList! )
@ -363,7 +367,7 @@ namespace Penumbra.UI
ImGui.PopStyleColor(); ImGui.PopStyleColor();
} }
ImGui.ListBoxFooter(); ImGui.EndListBox();
} }
else else
{ {

View file

@ -86,7 +86,7 @@ namespace Penumbra.UI
} }
ImGui.SetNextItemWidth( -1 ); ImGui.SetNextItemWidth( -1 );
if( ImGui.ListBoxHeader( LabelFileListHeader, AutoFillSize - new Vector2( 0, 1.5f * ImGui.GetTextLineHeight() ) ) ) if( ImGui.BeginListBox( LabelFileListHeader, AutoFillSize - new Vector2( 0, 1.5f * ImGui.GetTextLineHeight() ) ) )
{ {
for( var i = 0; i < Mod!.Mod.ModFiles.Count; ++i ) for( var i = 0; i < Mod!.Mod.ModFiles.Count; ++i )
{ {
@ -94,7 +94,7 @@ namespace Penumbra.UI
} }
} }
ImGui.ListBoxFooter(); ImGui.EndListBox();
DrawGroupRow(); DrawGroupRow();
ImGui.EndTabItem(); ImGui.EndTabItem();