mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(GUI): improved selection by mask performance on large directories.
This commit is contained in:
@@ -44,6 +44,11 @@ namespace GARbro.GUI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new public bool SetSelectedItems (IEnumerable selected_items)
|
||||||
|
{
|
||||||
|
return base.SetSelectedItems (selected_items);
|
||||||
|
}
|
||||||
|
|
||||||
protected override DependencyObject GetContainerForItemOverride()
|
protected override DependencyObject GetContainerForItemOverride()
|
||||||
{
|
{
|
||||||
return new ListViewItemEx();
|
return new ListViewItemEx();
|
||||||
|
|||||||
@@ -1169,6 +1169,7 @@ namespace GARbro.GUI
|
|||||||
CurrentDirectory.SelectAll();
|
CurrentDirectory.SelectAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SetBusyState();
|
||||||
var glob = new FileNameGlob (selection.Mask.Text);
|
var glob = new FileNameGlob (selection.Mask.Text);
|
||||||
var matching = ViewModel.Where (entry => glob.IsMatch (entry.Name));
|
var matching = ViewModel.Where (entry => glob.IsMatch (entry.Name));
|
||||||
if (!matching.Any())
|
if (!matching.Any())
|
||||||
@@ -1176,15 +1177,10 @@ namespace GARbro.GUI
|
|||||||
SetStatusText (string.Format (guiStrings.MsgNoMatching, selection.Mask.Text));
|
SetStatusText (string.Format (guiStrings.MsgNoMatching, selection.Mask.Text));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int count = 0;
|
var selected = CurrentDirectory.SelectedItems.Cast<EntryViewModel>();
|
||||||
foreach (var item in matching)
|
matching = matching.Except (selected).ToList();
|
||||||
{
|
int count = matching.Count();
|
||||||
if (!CurrentDirectory.SelectedItems.Contains (item))
|
CurrentDirectory.SetSelectedItems (selected.Concat (matching));
|
||||||
{
|
|
||||||
CurrentDirectory.SelectedItems.Add (item);
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
SetStatusText (Localization.Format ("MsgSelectedFiles", count));
|
SetStatusText (Localization.Format ("MsgSelectedFiles", count));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user