@@ -25,6 +25,7 @@ public partial class CropForm : Form
2525 private RectangleF cropPercent ;
2626 private int currentFrame ;
2727 private IDictionary < int , CropPoint > cropsList = new Dictionary < int , CropPoint > ( ) ;
28+ private bool open = true ;
2829 private enum Corner
2930 {
3031 TopLeft ,
@@ -53,6 +54,18 @@ public CropForm()
5354 SetEvents ( ) ;
5455 }
5556
57+ private void LoadDynamicCrop ( )
58+ {
59+ if ( Filters . DynamicCrop != null )
60+ {
61+ open = false ;
62+ dynamicCropActive . Checked = true ;
63+ cropsList = Filters . DynamicCrop . crops ;
64+ cropPercent = Filters . DynamicCrop . cropArea ;
65+ open = true ;
66+ }
67+ }
68+
5669 private void SetEvents ( )
5770 {
5871 trackVideoTimeline . Maximum = Program . VideoSource . NumberOfFrames - 1 ;
@@ -99,6 +112,7 @@ void CropForm_Load(object sender, EventArgs e)
99112 trackVideoTimeline . Maximum = Filters . MultipleTrim . Trims [ Filters . MultipleTrim . Trims . Count - 1 ] . TrimEnd ;
100113 trimTimingToolStripMenuItem . Enabled = true ;
101114 }
115+ LoadDynamicCrop ( ) ;
102116 }
103117
104118 private void previewPicture_MouseDown ( object sender , MouseEventArgs e )
@@ -378,7 +392,7 @@ private void AddCropPan(int width, int height)
378392
379393 private void GenerateFilter ( IDictionary < int , CropPoint > cropsList )
380394 {
381- GeneratedCropPanFilter = new DynamicCropFilter ( cropsList , trackVideoTimeline . Maximum ) ;
395+ GeneratedCropPanFilter = new DynamicCropFilter ( cropsList , trackVideoTimeline . Maximum , cropPercent ) ;
382396 }
383397 private void GenerateFilter ( int width , int height )
384398 {
@@ -709,7 +723,9 @@ private void dynamicCropActive_CheckedChanged(object sender, EventArgs e)
709723 {
710724 dynamicCropActive . ForeColor = dynamicCropActive . Checked ? Color . Green : Color . Black ;
711725
712- if ( newHeight == 0 && dynamicCropActive . Checked )
726+ cropBars . Enabled = dynamicCropActive . Checked ? false : true ;
727+
728+ if ( newHeight == 0 && dynamicCropActive . Checked && open )
713729 ShowNewDimension ( ) ;
714730 }
715731
@@ -719,10 +735,12 @@ private void cropBars_CheckedChanged(object sender, EventArgs e)
719735 if ( cropBars . Checked )
720736 {
721737 Filters . CropBarsFilter = new CropBarsFilter ( ) ;
738+ dynamicCropActive . Enabled = false ;
722739 }
723740 else
724741 {
725742 Filters . CropBarsFilter = null ;
743+ dynamicCropActive . Enabled = true ;
726744 }
727745
728746 }
@@ -767,9 +785,13 @@ public CropFilter(int left, int top, int right, int bottom, RectangleF cropPerce
767785 public class DynamicCropFilter
768786 {
769787 private readonly string cropFilter ;
788+ public IDictionary < int , CropPoint > crops { get ; }
789+ public RectangleF cropArea { get ; }
770790
771- public DynamicCropFilter ( IDictionary < int , CropPoint > cropsList , int maximum )
791+ public DynamicCropFilter ( IDictionary < int , CropPoint > cropsList , int maximum , RectangleF cropPercent )
772792 {
793+ cropArea = cropPercent ;
794+ crops = cropsList ;
773795 List < KeyValuePair < int , CropPoint > > listCrops = cropsList . ToList ( ) ;
774796 string crop = listCrops [ 0 ] . Value . Crop ;
775797 string easeType = "easeInOutSine" ;
0 commit comments