mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-16 05:34:25 +01:00
Add Everything option and coloring to active filters.
This commit is contained in:
parent
513a2780f1
commit
f4ba14de3c
2 changed files with 30 additions and 5 deletions
|
|
@ -27,6 +27,7 @@ public static class Colors
|
||||||
public const uint MetaInfoText = 0xAAFFFFFF;
|
public const uint MetaInfoText = 0xAAFFFFFF;
|
||||||
public const uint RedTableBgTint = 0x40000080;
|
public const uint RedTableBgTint = 0x40000080;
|
||||||
public const uint DiscordColor = 0xFFDA8972;
|
public const uint DiscordColor = 0xFFDA8972;
|
||||||
|
public const uint FilterActive = 0x807070FF;
|
||||||
|
|
||||||
public static (uint DefaultColor, string Name, string Description) Data( this ColorId color )
|
public static (uint DefaultColor, string Name, string Description) Data( this ColorId color )
|
||||||
=> color switch
|
=> color switch
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Dalamud.Interface;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
|
|
@ -21,10 +22,10 @@ public partial class ModFileSystemSelector
|
||||||
public ColorId Color;
|
public ColorId Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
private const StringComparison IgnoreCase = StringComparison.InvariantCultureIgnoreCase;
|
private const StringComparison IgnoreCase = StringComparison.InvariantCultureIgnoreCase;
|
||||||
private LowerString _modFilter = LowerString.Empty;
|
private LowerString _modFilter = LowerString.Empty;
|
||||||
private int _filterType = -1;
|
private int _filterType = -1;
|
||||||
private ModFilter _stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
private ModFilter _stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
||||||
|
|
||||||
private void SetFilterTooltip()
|
private void SetFilterTooltip()
|
||||||
{
|
{
|
||||||
|
|
@ -252,13 +253,30 @@ public partial class ModFileSystemSelector
|
||||||
var pos = ImGui.GetCursorPos();
|
var pos = ImGui.GetCursorPos();
|
||||||
var remainingWidth = width - ImGui.GetFrameHeight();
|
var remainingWidth = width - ImGui.GetFrameHeight();
|
||||||
var comboPos = new Vector2( pos.X + remainingWidth, pos.Y );
|
var comboPos = new Vector2( pos.X + remainingWidth, pos.Y );
|
||||||
|
|
||||||
|
var everything = _stateFilter == ModFilterExtensions.UnfilteredStateMods;
|
||||||
|
|
||||||
ImGui.SetCursorPos( comboPos );
|
ImGui.SetCursorPos( comboPos );
|
||||||
|
// Draw combo button
|
||||||
|
using var color = ImRaii.PushColor( ImGuiCol.Button, Colors.FilterActive, !everything );
|
||||||
using var combo = ImRaii.Combo( "##filterCombo", string.Empty,
|
using var combo = ImRaii.Combo( "##filterCombo", string.Empty,
|
||||||
ImGuiComboFlags.NoPreview | ImGuiComboFlags.PopupAlignLeft | ImGuiComboFlags.HeightLargest );
|
ImGuiComboFlags.NoPreview | ImGuiComboFlags.PopupAlignLeft | ImGuiComboFlags.HeightLargest );
|
||||||
|
color.Pop();
|
||||||
|
|
||||||
if( combo )
|
if( combo )
|
||||||
{
|
{
|
||||||
|
using var style = ImRaii.PushStyle( ImGuiStyleVar.ItemSpacing,
|
||||||
|
ImGui.GetStyle().ItemSpacing with { Y = 3 * ImGuiHelpers.GlobalScale } );
|
||||||
var flags = ( int )_stateFilter;
|
var flags = ( int )_stateFilter;
|
||||||
|
|
||||||
|
|
||||||
|
if( ImGui.Checkbox( "Everything", ref everything ) )
|
||||||
|
{
|
||||||
|
_stateFilter = everything ? ModFilterExtensions.UnfilteredStateMods : 0;
|
||||||
|
SetFilterDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.Dummy( new Vector2( 0, 5 * ImGuiHelpers.GlobalScale ) );
|
||||||
foreach( ModFilter flag in Enum.GetValues( typeof( ModFilter ) ) )
|
foreach( ModFilter flag in Enum.GetValues( typeof( ModFilter ) ) )
|
||||||
{
|
{
|
||||||
if( ImGui.CheckboxFlags( flag.ToName(), ref flags, ( int )flag ) )
|
if( ImGui.CheckboxFlags( flag.ToName(), ref flags, ( int )flag ) )
|
||||||
|
|
@ -270,7 +288,13 @@ public partial class ModFileSystemSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
combo.Dispose();
|
combo.Dispose();
|
||||||
ImGuiUtil.HoverTooltip( "Filter mods for their activation status." );
|
if( ImGui.IsItemClicked( ImGuiMouseButton.Right ) )
|
||||||
|
{
|
||||||
|
_stateFilter = ModFilterExtensions.UnfilteredStateMods;
|
||||||
|
SetFilterDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiUtil.HoverTooltip( "Filter mods for their activation status.\nRight-Click to clear all filters." );
|
||||||
ImGui.SetCursorPos( pos );
|
ImGui.SetCursorPos( pos );
|
||||||
return remainingWidth;
|
return remainingWidth;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue