From 4dc9ed83979c2d0f26eb10d184a0e3ede67b7f1e Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 4 Oct 2015 20:59:47 +0300 Subject: [PATCH] Added Scrolling capture tab for AutoClose setting --- .../ScrollingCaptureOptions.cs | 38 +++++++++--- ShareX/Forms/TaskSettingsForm.Designer.cs | 22 +++++++ ShareX/Forms/TaskSettingsForm.cs | 4 ++ ShareX/Forms/TaskSettingsForm.resx | 61 +++++++++++++++++-- ShareX/TaskHelpers.cs | 1 - ShareX/TaskSettings.cs | 3 - 6 files changed, 113 insertions(+), 16 deletions(-) diff --git a/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs b/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs index cb3fba2d3..1f5fcc7c0 100644 --- a/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs +++ b/ShareX.ScreenCaptureLib/ScrollingCaptureOptions.cs @@ -24,30 +24,54 @@ You should have received a copy of the GNU General Public License #endregion License Information (GPL v3) using ShareX.ScreenCaptureLib; +using System.ComponentModel; namespace ShareX { public class ScrollingCaptureOptions { + [DefaultValue(ScrollingCaptureScrollMethod.Automatic)] public ScrollingCaptureScrollMethod ScrollMethod { get; set; } = ScrollingCaptureScrollMethod.Automatic; + + [DefaultValue(500)] public int StartDelay { get; set; } = 500; + + [DefaultValue(500)] public int ScrollDelay { get; set; } = 500; + + [DefaultValue(20)] public int MaximumScrollCount { get; set; } = 20; + + [DefaultValue(true)] public bool StartSelectionAutomatically { get; set; } = true; + + [DefaultValue(false)] public bool StartCaptureAutomatically { get; set; } = false; + + [DefaultValue(true)] public bool ScrollTopBeforeCapture { get; set; } = true; + + [DefaultValue(true)] public bool AutoDetectScrollEnd { get; set; } = true; + + [DefaultValue(true)] public bool RemoveDuplicates { get; set; } = true; + + [DefaultValue(true)] public bool AfterCaptureAutomaticallyCombine { get; set; } = true; + + [DefaultValue(false)] public bool AutoUpload { get; set; } = false; + + [DefaultValue(false), Description("Automatically close scrolling capture window after completing the task.")] public bool AutoClose { get; set; } = false; - public int TrimLeftEdge { get; set; } = 0; - public int TrimTopEdge { get; set; } = 0; - public int TrimRightEdge { get; set; } = 0; - public int TrimBottomEdge { get; set; } = 0; - public int CombineAdjustmentVertical { get; set; } = 0; - public int CombineAdjustmentLastVertical { get; set; } = 0; - public int IgnoreLast { get; set; } = 0; + public int TrimLeftEdge = 0; + public int TrimTopEdge = 0; + public int TrimRightEdge = 0; + public int TrimBottomEdge = 0; + public int CombineAdjustmentVertical = 0; + public int CombineAdjustmentLastVertical = 0; + public int IgnoreLast = 0; } } \ No newline at end of file diff --git a/ShareX/Forms/TaskSettingsForm.Designer.cs b/ShareX/Forms/TaskSettingsForm.Designer.cs index c2369072c..0fa2f159b 100644 --- a/ShareX/Forms/TaskSettingsForm.Designer.cs +++ b/ShareX/Forms/TaskSettingsForm.Designer.cs @@ -200,6 +200,8 @@ private void InitializeComponent() this.pgTaskSettings = new System.Windows.Forms.PropertyGrid(); this.chkUseDefaultAdvancedSettings = new System.Windows.Forms.CheckBox(); this.tttvMain = new ShareX.HelpersLib.TabToTreeView(); + this.tpScrollingCapture = new System.Windows.Forms.TabPage(); + this.pgScrollingCapture = new System.Windows.Forms.PropertyGrid(); this.tcTaskSettings.SuspendLayout(); this.tpTask.SuspendLayout(); this.cmsDestinations.SuspendLayout(); @@ -247,6 +249,7 @@ private void InitializeComponent() this.tpVideoThumbnailer.SuspendLayout(); this.tpIRCClient.SuspendLayout(); this.tpAdvanced.SuspendLayout(); + this.tpScrollingCapture.SuspendLayout(); this.SuspendLayout(); // // cmsAfterCapture @@ -786,6 +789,7 @@ private void InitializeComponent() this.tcCapture.Controls.Add(this.tpCaptureGeneral); this.tcCapture.Controls.Add(this.tpRegionCapture); this.tcCapture.Controls.Add(this.tpScreenRecorder); + this.tcCapture.Controls.Add(this.tpScrollingCapture); this.tcCapture.Controls.Add(this.tpRectangleAnnotate); resources.ApplyResources(this.tcCapture, "tcCapture"); this.tcCapture.Name = "tcCapture"; @@ -1655,6 +1659,21 @@ private void InitializeComponent() this.tttvMain.TreeViewSize = 190; this.tttvMain.TabChanged += new ShareX.HelpersLib.TabToTreeView.TabChangedEventHandler(this.tttvMain_TabChanged); // + // tpScrollingCapture + // + this.tpScrollingCapture.Controls.Add(this.pgScrollingCapture); + resources.ApplyResources(this.tpScrollingCapture, "tpScrollingCapture"); + this.tpScrollingCapture.Name = "tpScrollingCapture"; + this.tpScrollingCapture.UseVisualStyleBackColor = true; + // + // pgScrollingCapture + // + this.pgScrollingCapture.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText; + resources.ApplyResources(this.pgScrollingCapture, "pgScrollingCapture"); + this.pgScrollingCapture.Name = "pgScrollingCapture"; + this.pgScrollingCapture.PropertySort = System.Windows.Forms.PropertySort.NoSort; + this.pgScrollingCapture.ToolbarVisible = false; + // // TaskSettingsForm // resources.ApplyResources(this, "$this"); @@ -1730,6 +1749,7 @@ private void InitializeComponent() this.tpIRCClient.ResumeLayout(false); this.tpAdvanced.ResumeLayout(false); this.tpAdvanced.PerformLayout(); + this.tpScrollingCapture.ResumeLayout(false); this.ResumeLayout(false); } @@ -1906,5 +1926,7 @@ private void InitializeComponent() private System.Windows.Forms.PropertyGrid pgVideoThumbnailer; private System.Windows.Forms.TabPage tpIRCClient; private System.Windows.Forms.PropertyGrid pgIRCClient; + private System.Windows.Forms.TabPage tpScrollingCapture; + private System.Windows.Forms.PropertyGrid pgScrollingCapture; } } \ No newline at end of file diff --git a/ShareX/Forms/TaskSettingsForm.cs b/ShareX/Forms/TaskSettingsForm.cs index 62c1646bf..ccbde254d 100644 --- a/ShareX/Forms/TaskSettingsForm.cs +++ b/ShareX/Forms/TaskSettingsForm.cs @@ -235,6 +235,10 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false) chkRunScreencastCLI.Checked = cboEncoder.Enabled = btnEncoderConfig.Enabled = TaskSettings.CaptureSettings.RunScreencastCLI; UpdateVideoEncoders(); + // Capture / Scrolling capture + if (TaskSettings.CaptureSettings.ScrollingCaptureOptions == null) TaskSettings.CaptureSettings.ScrollingCaptureOptions = new ScrollingCaptureOptions(); + pgScrollingCapture.SelectedObject = TaskSettings.CaptureSettings.ScrollingCaptureOptions; + // Actions TaskHelpers.AddDefaultExternalPrograms(TaskSettings); TaskSettings.ExternalPrograms.ForEach(AddFileAction); diff --git a/ShareX/Forms/TaskSettingsForm.resx b/ShareX/Forms/TaskSettingsForm.resx index 89b311505..91d5713e8 100644 --- a/ShareX/Forms/TaskSettingsForm.resx +++ b/ShareX/Forms/TaskSettingsForm.resx @@ -1187,7 +1187,7 @@ 0 - 100 - @Invariant + lblImageJPEGQualityHint @@ -1817,7 +1817,7 @@ >> - @Invariant + btnCaptureTransmitBoundsFromMonitorToCustomBounds @@ -1907,7 +1907,7 @@ Y - @Invariant + lblCaptureCustomRegionY @@ -1937,7 +1937,7 @@ X - @Invariant + lblCaptureCustomRegionX @@ -2994,6 +2994,57 @@ 2 + + Fill + + + 3, 3 + + + 551, 322 + + + 0 + + + pgScrollingCapture + + + System.Windows.Forms.PropertyGrid, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpScrollingCapture + + + 0 + + + 4, 22 + + + 3, 3, 3, 3 + + + 557, 328 + + + 4 + + + Scrolling capture + + + tpScrollingCapture + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcCapture + + + 3 + Fill @@ -3043,7 +3094,7 @@ tcCapture - 3 + 4 Fill diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index e6360d2d8..b92a1f615 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -453,7 +453,6 @@ public static void OpenScrollingCapture(TaskSettings taskSettings = null, bool f { if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings(); - taskSettings.CaptureSettingsReference.ScrollingCaptureOptions.AutoClose = taskSettings.AdvancedSettings.AutoCloseScrollingCaptureWindow; ScrollingCaptureForm scrollingCaptureForm = new ScrollingCaptureForm(taskSettings.CaptureSettingsReference.ScrollingCaptureOptions, forceSelection); scrollingCaptureForm.ProcessRequested += image => UploadManager.RunImageTask(image, taskSettings); scrollingCaptureForm.Show(); diff --git a/ShareX/TaskSettings.cs b/ShareX/TaskSettings.cs index aeaa30ed9..ec2bb8496 100644 --- a/ShareX/TaskSettings.cs +++ b/ShareX/TaskSettings.cs @@ -417,9 +417,6 @@ public class TaskSettingsAdvanced Editor(typeof(DirectoryNameEditor), typeof(UITypeEditor))] public string CapturePath { get; set; } - [Category("Scrolling capture"), DefaultValue(false), Description("Automatically close scrolling capture window after completing the task.")] - public bool AutoCloseScrollingCaptureWindow { get; set; } - [Category("Upload"), Description("Files with these file extensions will be uploaded using image uploader."), Editor("System.Windows.Forms.Design.StringCollectionEditor,System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))] public List ImageExtensions { get; set; }