GUI: Add Select all/none buttons to namespace tree selector
This commit is contained in:
@@ -231,6 +231,12 @@
|
|||||||
<DockPanel DockPanel.Dock="Right" Width="230">
|
<DockPanel DockPanel.Dock="Right" Width="230">
|
||||||
<Label DockPanel.Dock="Top" Foreground="{StaticResource WindowsBlue}" FontSize="18">Namespaces</Label>
|
<Label DockPanel.Dock="Top" Foreground="{StaticResource WindowsBlue}" FontSize="18">Namespaces</Label>
|
||||||
<TextBlock DockPanel.Dock="Top" TextWrapping="WrapWithOverflow" Margin="10,0,5,5">This only applies to C# prototypes output</TextBlock>
|
<TextBlock DockPanel.Dock="Top" TextWrapping="WrapWithOverflow" Margin="10,0,5,5">This only applies to C# prototypes output</TextBlock>
|
||||||
|
|
||||||
|
<StackPanel DockPanel.Dock="Top" Margin="10,0,5,5" Orientation="Horizontal">
|
||||||
|
<Button Margin="2,0,5,0" Width="103" Click="SelectAllNamespaces_Click">Select all</Button>
|
||||||
|
<Button Width="103" Click="SelectNoneNamespaces_Click">Select none</Button>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<TreeView DockPanel.Dock="Bottom" Name="trvNamespaces" ItemTemplate="{StaticResource NamespaceTreeItemTemplate}" Width="210" Margin="10,5,5,5"></TreeView>
|
<TreeView DockPanel.Dock="Bottom" Name="trvNamespaces" ItemTemplate="{StaticResource NamespaceTreeItemTemplate}" Width="210" Margin="10,5,5,5"></TreeView>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Il2CppInspector;
|
using Il2CppInspector;
|
||||||
using Il2CppInspector.Cpp;
|
using Il2CppInspector.Cpp;
|
||||||
using Il2CppInspector.GUI;
|
using Il2CppInspector.GUI;
|
||||||
using Il2CppInspector.Model;
|
using Il2CppInspector.Model;
|
||||||
@@ -573,6 +573,23 @@ namespace Il2CppInspectorGUI
|
|||||||
await LoadBinaryAsync(files[0]);
|
await LoadBinaryAsync(files[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SelectAllNamespaces_Click(object sender, RoutedEventArgs e) {
|
||||||
|
var tree = (IEnumerable<CheckboxNode>) trvNamespaces.ItemsSource;
|
||||||
|
|
||||||
|
// Breadth-first selection
|
||||||
|
for (var level = tree; level.Any(); level = level.Where(node => node.Children != null).SelectMany(node => node.Children))
|
||||||
|
foreach (var item in level)
|
||||||
|
item.IsChecked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectNoneNamespaces_Click(object sender, RoutedEventArgs e) {
|
||||||
|
var tree = (IEnumerable<CheckboxNode>) trvNamespaces.ItemsSource;
|
||||||
|
|
||||||
|
// Only need to clear the top level because this will clear all the children automatically
|
||||||
|
foreach (var topLevelItem in tree)
|
||||||
|
topLevelItem.IsChecked = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replacement for TreeViewItem that includes checkbox state
|
// Replacement for TreeViewItem that includes checkbox state
|
||||||
|
|||||||
Reference in New Issue
Block a user