Add enable all for option groups

This commit is contained in:
Ottermandias 2022-07-30 18:38:58 +02:00
parent f37ad11ab8
commit ff5e72e979
3 changed files with 23 additions and 3 deletions

View file

@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Threading; using System.Threading;
using Dalamud.Logging; using Dalamud.Logging;
using OtterGui.Classes; using OtterGui.Classes;

View file

@ -69,7 +69,7 @@ public partial class ConfigWindow
DrawMultiGroup( _mod.Groups[ idx ], idx ); DrawMultiGroup( _mod.Groups[ idx ], idx );
} }
_window._penumbra.Api.InvokePostSettingsPanel(_mod.ModPath.Name); _window._penumbra.Api.InvokePostSettingsPanel( _mod.ModPath.Name );
} }
@ -210,6 +210,28 @@ public partial class ConfigWindow
} }
Widget.EndFramedGroup(); Widget.EndFramedGroup();
var label = $"##multi{groupIdx}";
if( ImGui.IsItemClicked( ImGuiMouseButton.Right ) )
{
ImGui.OpenPopup( $"##multi{groupIdx}" );
}
using var style = ImRaii.PushStyle( ImGuiStyleVar.PopupBorderSize, 1 );
using var popup = ImRaii.Popup( label );
if( popup )
{
ImGui.TextUnformatted( group.Name );
ImGui.Separator();
if( ImGui.Selectable( "Enable All" ) )
{
Penumbra.CollectionManager.Current.SetModSetting( _mod.Index, groupIdx, ( 1u << group.Count ) - 1u );
}
if( ImGui.Selectable( "Disable All" ) )
{
Penumbra.CollectionManager.Current.SetModSetting( _mod.Index, groupIdx, 0 );
}
}
} }
} }
} }

View file

@ -78,7 +78,6 @@ public partial class ConfigWindow
{ {
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.PressEnterWarningBg ); using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.PressEnterWarningBg );
var w = new Vector2( width, 0 ); var w = new Vector2( width, 0 );
var symbol = '\0';
var (text, valid) = CheckPath( newName, old ); var (text, valid) = CheckPath( newName, old );
return ( ImGui.Button( text, w ) || saved ) && valid; return ( ImGui.Button( text, w ) || saved ) && valid;