Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pakfile Explorer Searching #57

Open
tsa96 opened this issue Jul 24, 2024 · 1 comment
Open

Pakfile Explorer Searching #57

tsa96 opened this issue Jul 24, 2024 · 1 comment
Labels
Size: Medium Something that may take a few days or so to implement. Type: Enhancement This can improve a system/thing already in place.

Comments

@tsa96
Copy link
Member

tsa96 commented Jul 24, 2024

Add a text box to the top bar of the pakfile explorer page to filter displayed items.

This is probably quite challenging. As far as I can tell, TreeDataGrid doesn't have a specific property for whether a node should be displayed or not; it just displays item in a list of a node's children (you provide an accessor function

new HierarchicalExpanderColumn<Node>(
new TemplateColumn<Node>(
"Name",
"EntryNameCell",
null, // No edit cell, doesn't work well, we use dialog window instead
new GridLength(4, GridUnitType.Star),
new TemplateColumnOptions<Node> {
CompareAscending = Node.SortAscending(x => x.Name),
CompareDescending = Node.SortDescending(x => x.Name),
IsTextSearchEnabled = true,
TextSearchValueSelector = x => x.Name,
BeginEditGestures = BeginEditGestures.None
}),
x => x.Children,
x => x.IsDirectory,
x => x.IsExpanded),
).

So when the search changes, every node in the tree needs to determine which of it's children to display.

Probably the best way to do this is to change every directory node to hold a SourceList _source of all children, then track changes to a child node's reactive property IsVisible then do something like _source.Connect().AutoRefresh(x => x.IsVisible).Filter(x => x.IsVisible).BindTo(this, x => x.FilteredChildren); where FilteredChildren is an ObservableCollection, then determine if this node should be visible with FilteredChildren.CountChanged.Select(x => x > 0).Subscribe(x => IsVisible = x) (probably don't want ToPropertyEx here since IsVisible with be a regular reactive property not an ObservableAsProperty). Leaf nodes then listen to the search input children and change their IsVisible property accordingly, which should bubble up through the tree.

Hoooopefully that approach is okay. It sounds very expensive but not sure of alternatives due to how TreeDataGrid works.

This is mostly blocked until #39 is merged. Someone could get started if they want, but pakfile explorer code on that branch may change.

@tsa96 tsa96 added Size: Medium Something that may take a few days or so to implement. Type: Enhancement This can improve a system/thing already in place. labels Jul 24, 2024
@tsa96
Copy link
Member Author

tsa96 commented Jul 24, 2024

Whilst doing this we should also do a checkbox to allow filtering out cubemaps and .vhv files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: Medium Something that may take a few days or so to implement. Type: Enhancement This can improve a system/thing already in place.
Projects
None yet
Development

No branches or pull requests

1 participant