diff --git a/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml b/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml index 2c37def..02a0554 100644 --- a/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml +++ b/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml @@ -69,6 +69,8 @@ + diff --git a/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml.cs b/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml.cs index a2081ec..47d6c4f 100644 --- a/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml.cs +++ b/MangaPrinter.WpfGUI/Dialogs/dlgChooseCutoffRatio.xaml.cs @@ -31,6 +31,8 @@ public dlgChooseCutoffRatio() private int maxCount = 1; + public bool doSmartDelete = false; + private void Window_Loaded(object sender, RoutedEventArgs e) { if (InputBuckets != null && InputBuckets.Count > 0) @@ -99,7 +101,7 @@ private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs _x2 = new double[] { InputBuckets[BucketIndex].value, InputBuckets[BucketIndex].value }; IEnumerable _y2 = new double[] { 0, maxCount }; @@ -125,5 +127,11 @@ private void BtnCancel_Click(object sender, RoutedEventArgs e) { DialogResult = false; } + + private void btnSmartDel_Click(object sender, RoutedEventArgs e) + { + doSmartDelete = true; + DialogResult = false; + } } } diff --git a/MangaPrinter.WpfGUI/MainWindow.xaml.cs b/MangaPrinter.WpfGUI/MainWindow.xaml.cs index 7f12b06..d44132d 100644 --- a/MangaPrinter.WpfGUI/MainWindow.xaml.cs +++ b/MangaPrinter.WpfGUI/MainWindow.xaml.cs @@ -416,13 +416,12 @@ private IEnumerable plotData(IEnumerable chapters, int var b = buckets.Last((bucket) => page.AspectRatio >= bucket.value); //Console.WriteLine("{0}.{1}: {2}", page.Chapter.Name, page.Name, page.AspectRatio); b.count++; - b.bucketItemsDesc.Add( - !page.IsDouble? + b.bucketPages.Add(page); + b.bucketPagesDesc.Add(!page.IsDouble ? String.Format("{0}] {1}, p.{2} ({3})", - b.bucketItemsDesc.Count, page.Chapter.Name, page.ChildIndexStart, page.AspectRatio) : + b.bucketPagesDesc.Count, page.Chapter.Name, page.ChildIndexStart, page.AspectRatio) : String.Format("{0}] {1}, p.{2}-p.{3} ({4})", - b.bucketItemsDesc.Count, page.Chapter.Name, page.ChildIndexStart, page.ChildIndexEnd, page.AspectRatio) - ); + b.bucketPagesDesc.Count, page.Chapter.Name, page.ChildIndexStart, page.ChildIndexEnd, page.AspectRatio)); } return buckets; @@ -437,12 +436,38 @@ private void BtnNewCutoffRatio_Click(object sender, RoutedEventArgs e) }, isProgressKnwon: false); dlg.ShowDialog(); + if ((dlg.DialogResult ?? false) && (dlg.InputBuckets != null) && (dlg.InputBuckets.Count > 0)) { double newAspectCutoff = Math.Round(dlg.InputBuckets[dlg.BucketIndex].value, 2); txtPageMaxWidth.Text = newAspectCutoff.ToString(); UpdateApectCutoff(newAspectCutoff); } + + if (!(dlg.DialogResult ?? false) && dlg.doSmartDelete + && (dlg.InputBuckets != null) && (dlg.InputBuckets.Count > 0)) + { + //dlg.InputBuckets[dlg.BucketIndex].bucketPages + + dlgBluredImageListActions dlg2 = new dlgBluredImageListActions(); + dlg2.CustomTitle = "Quick Delete pages (Aspect ratio)"; + + dlg2.Pages = new ObservableCollection>( + dlg.InputBuckets[dlg.BucketIndex].bucketPages + .Select(_p => new ActionMangaPage() { Page = _p, Result = false }) + ); + + if (dlg2.ShowDialog() ?? false) + { + dlg2.Pages + .Where(p => p.Result == true) + .ForEach(p => { + p.Page.Chapter.Pages.Remove(p.Page); + p.Page.Chapter.updateChapterStats(); + }); + } + } + } private void UpdateApectCutoff(double newAspectCutoff) diff --git a/MangaPrinter.WpfGUI/Utils/BucketInfo.cs b/MangaPrinter.WpfGUI/Utils/BucketInfo.cs index 9134c45..11195ea 100644 --- a/MangaPrinter.WpfGUI/Utils/BucketInfo.cs +++ b/MangaPrinter.WpfGUI/Utils/BucketInfo.cs @@ -1,4 +1,5 @@ -using System; +using MangaPrinter.Core; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -10,6 +11,7 @@ public class BucketInfo { public int index = 0; public double value = 0; public int count = 0; - public List bucketItemsDesc = new List(); + public List bucketPagesDesc = new List(); + public List bucketPages = new List(); }; -} +} \ No newline at end of file