diff --git a/ShareX.HelpersLib/Helpers/Helpers.cs b/ShareX.HelpersLib/Helpers/Helpers.cs index 808247640..45f57d97f 100644 --- a/ShareX.HelpersLib/Helpers/Helpers.cs +++ b/ShareX.HelpersLib/Helpers/Helpers.cs @@ -1612,5 +1612,39 @@ public static IEnumerable GetFilesByExtensions(DirectoryInfo directoryIn HashSet allowedExtensions = new HashSet(extensions, StringComparer.OrdinalIgnoreCase); return directoryInfo.EnumerateFiles().Where(f => allowedExtensions.Contains(f.Extension)).Select(x => x.FullName); } + + public static Icon GetProgressIcon(int percentage) + { + return GetProgressIcon(percentage, Color.FromArgb(16, 116, 193)); + } + + public static Icon GetProgressIcon(int percentage, Color color) + { + percentage = percentage.Clamp(0, 99); + + Size size = SystemInformation.SmallIconSize; + using (Bitmap bmp = new Bitmap(size.Width, size.Height)) + using (Graphics g = Graphics.FromImage(bmp)) + { + int y = (int)(size.Height * (percentage / 100f)); + + if (y > 0) + { + using (Brush brush = new SolidBrush(color)) + { + g.FillRectangle(brush, 0, size.Height - 1 - y, size.Width, y); + } + } + + using (Font font = new Font("Arial", 10)) + using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }) + { + g.DrawString(percentage.ToString(), font, Brushes.Black, size.Width / 2f, size.Height / 2f, sf); + g.DrawString(percentage.ToString(), font, Brushes.White, size.Width / 2f, (size.Height / 2f) - 1, sf); + } + + return Icon.FromHandle(bmp.GetHicon()); + } + } } } \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Enums.cs b/ShareX.ScreenCaptureLib/Enums.cs index 032d5ab86..dda6c155f 100644 --- a/ShareX.ScreenCaptureLib/Enums.cs +++ b/ShareX.ScreenCaptureLib/Enums.cs @@ -333,4 +333,9 @@ public enum BorderStyle DashDot, DashDotDot } + + public enum ScreenRecordState + { + Waiting, BeforeStart, AfterStart, AfterRecordingStart, Encoding + } } \ No newline at end of file diff --git a/ShareX/Forms/ScreenRecordForm.Designer.cs b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.Designer.cs similarity index 95% rename from ShareX/Forms/ScreenRecordForm.Designer.cs rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.Designer.cs index 71a509d06..7f9f927c0 100644 --- a/ShareX/Forms/ScreenRecordForm.Designer.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.Designer.cs @@ -1,4 +1,4 @@ -namespace ShareX +namespace ShareX.ScreenCaptureLib { partial class ScreenRecordForm { @@ -75,14 +75,14 @@ private void InitializeComponent() // // tsmiStart // - this.tsmiStart.Image = global::ShareX.Properties.Resources.control_record; + this.tsmiStart.Image = global::ShareX.ScreenCaptureLib.Properties.Resources.control_record; this.tsmiStart.Name = "tsmiStart"; resources.ApplyResources(this.tsmiStart, "tsmiStart"); this.tsmiStart.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnStart_MouseClick); // // tsmiAbort // - this.tsmiAbort.Image = global::ShareX.Properties.Resources.cross; + this.tsmiAbort.Image = global::ShareX.ScreenCaptureLib.Properties.Resources.cross; this.tsmiAbort.Name = "tsmiAbort"; resources.ApplyResources(this.tsmiAbort, "tsmiAbort"); this.tsmiAbort.MouseUp += new System.Windows.Forms.MouseEventHandler(this.btnAbort_MouseClick); diff --git a/ShareX/Forms/ScreenRecordForm.cs b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.cs similarity index 88% rename from ShareX/Forms/ScreenRecordForm.cs rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.cs index 0c671f22d..894eb82cc 100644 --- a/ShareX/Forms/ScreenRecordForm.cs +++ b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.cs @@ -24,14 +24,14 @@ #endregion License Information (GPL v3) using ShareX.HelpersLib; -using ShareX.Properties; +using ShareX.ScreenCaptureLib.Properties; using System; using System.Diagnostics; using System.Drawing; using System.Threading; using System.Windows.Forms; -namespace ShareX +namespace ShareX.ScreenCaptureLib { public partial class ScreenRecordForm : Form { @@ -46,24 +46,21 @@ public partial class ScreenRecordForm : Form public bool IsStopRequested { get; private set; } public bool IsAbortRequested { get; private set; } - private TaskSettings taskSettings; + public bool ActivateWindow { get; set; } = true; + public float Duration { get; set; } = 0; + public bool AskConfirmationOnAbort { get; set; } = false; + private Color borderColor = Color.Red; private Rectangle borderRectangle; private Rectangle borderRectangle0Based; - private bool activateWindow; - private float duration; private static int lastIconStatus = -1; - public ScreenRecordForm(Rectangle regionRectangle, TaskSettings taskSettings, bool activateWindow = true, float duration = 0) + public ScreenRecordForm(Rectangle regionRectangle) { InitializeComponent(); Icon = ShareXResources.Icon; niTray.Icon = ShareXResources.Icon; - this.taskSettings = taskSettings; - this.activateWindow = activateWindow; - this.duration = duration; - borderRectangle = regionRectangle.Offset(1); borderRectangle0Based = new Rectangle(0, 0, borderRectangle.Width, borderRectangle.Height); @@ -97,7 +94,7 @@ protected override bool ShowWithoutActivation { get { - return !activateWindow; + return !ActivateWindow; } } @@ -131,7 +128,7 @@ protected override void Dispose(bool disposing) private void ScreenRegionForm_Shown(object sender, EventArgs e) { - if (activateWindow) + if (ActivateWindow) { this.ForceActivate(); } @@ -167,8 +164,8 @@ public void StartCountdown(int milliseconds) public void StartRecordingTimer() { - IsCountdown = duration > 0; - Countdown = TimeSpan.FromSeconds(duration); + IsCountdown = Duration > 0; + Countdown = TimeSpan.FromSeconds(Duration); lblTimer.ForeColor = Color.White; borderColor = Color.FromArgb(0, 255, 0); @@ -229,8 +226,8 @@ private void btnAbort_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { - if (!taskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort || - MessageBox.Show(Resources.ScreenRecord_ConfirmCancel, "ShareX", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + if (!AskConfirmationOnAbort || MessageBox.Show(Resources.ScreenRecordForm_ConfirmCancel, "ShareX", MessageBoxButtons.YesNo, + MessageBoxIcon.Warning) == DialogResult.Yes) { AbortRecording(); } @@ -278,7 +275,7 @@ public void ChangeState(ScreenRecordState state) case ScreenRecordState.BeforeStart: string trayTextBeforeStart = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Click_tray_icon_to_start_recording_; niTray.Text = trayTextBeforeStart.Truncate(63); - tsmiStart.Text = Resources.AutoCaptureForm_Execute_Start; + tsmiStart.Text = Resources.ScreenRecordForm_Start; cmsMain.Enabled = true; break; case ScreenRecordState.AfterStart: @@ -286,8 +283,8 @@ public void ChangeState(ScreenRecordState state) string trayTextAfterStart = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_; niTray.Text = trayTextAfterStart.Truncate(63); niTray.Icon = Resources.control_record.ToIcon(); - tsmiStart.Text = Resources.AutoCaptureForm_Execute_Stop; - btnStart.Text = Resources.AutoCaptureForm_Execute_Stop; + tsmiStart.Text = Resources.ScreenRecordForm_Stop; + btnStart.Text = Resources.ScreenRecordForm_Stop; break; case ScreenRecordState.AfterRecordingStart: IsRecording = true; @@ -297,7 +294,7 @@ public void ChangeState(ScreenRecordState state) Hide(); string trayTextAfterStop = "ShareX - " + Resources.ScreenRecordForm_StartRecording_Encoding___; niTray.Text = trayTextAfterStop.Truncate(63); - niTray.Icon = Resources.camcorder_pencil.ToIcon(); + niTray.Icon = Resources.camcorder__pencil.ToIcon(); cmsMain.Enabled = false; break; } @@ -316,19 +313,19 @@ public void ChangeStateProgress(int progress) { try { - icon = TaskHelpers.GetProgressIcon(progress, Color.FromArgb(140, 0, 36)); + icon = Helpers.GetProgressIcon(progress, Color.FromArgb(140, 0, 36)); } catch (Exception e) { DebugHelper.WriteException(e); progress = -1; if (lastIconStatus == progress) return; - icon = Resources.camcorder_pencil.ToIcon(); + icon = Resources.camcorder__pencil.ToIcon(); } } else { - icon = Resources.camcorder_pencil.ToIcon(); + icon = Resources.camcorder__pencil.ToIcon(); } using (Icon oldIcon = niTray.Icon) diff --git a/ShareX/Forms/ScreenRecordForm.de.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.de.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.de.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.de.resx diff --git a/ShareX/Forms/ScreenRecordForm.es-MX.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.es-MX.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.es-MX.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.es-MX.resx diff --git a/ShareX/Forms/ScreenRecordForm.es.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.es.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.es.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.es.resx diff --git a/ShareX/Forms/ScreenRecordForm.fa-IR.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.fa-IR.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.fa-IR.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.fa-IR.resx diff --git a/ShareX/Forms/ScreenRecordForm.fr.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.fr.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.fr.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.fr.resx diff --git a/ShareX/Forms/ScreenRecordForm.hu.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.hu.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.hu.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.hu.resx diff --git a/ShareX/Forms/ScreenRecordForm.id-ID.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.id-ID.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.id-ID.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.id-ID.resx diff --git a/ShareX/Forms/ScreenRecordForm.it-IT.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.it-IT.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.it-IT.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.it-IT.resx diff --git a/ShareX/Forms/ScreenRecordForm.ja-JP.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.ja-JP.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.ja-JP.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.ja-JP.resx diff --git a/ShareX/Forms/ScreenRecordForm.ko-KR.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.ko-KR.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.ko-KR.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.ko-KR.resx diff --git a/ShareX/Forms/ScreenRecordForm.nl-NL.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.nl-NL.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.nl-NL.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.nl-NL.resx diff --git a/ShareX/Forms/ScreenRecordForm.pt-BR.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.pt-BR.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.pt-BR.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.pt-BR.resx diff --git a/ShareX/Forms/ScreenRecordForm.pt-PT.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.pt-PT.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.pt-PT.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.pt-PT.resx diff --git a/ShareX/Forms/ScreenRecordForm.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.resx diff --git a/ShareX/Forms/ScreenRecordForm.ru.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.ru.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.ru.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.ru.resx diff --git a/ShareX/Forms/ScreenRecordForm.tr.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.tr.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.tr.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.tr.resx diff --git a/ShareX/Forms/ScreenRecordForm.uk.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.uk.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.uk.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.uk.resx diff --git a/ShareX/Forms/ScreenRecordForm.vi-VN.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.vi-VN.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.vi-VN.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.vi-VN.resx diff --git a/ShareX/Forms/ScreenRecordForm.zh-CN.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.zh-CN.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.zh-CN.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.zh-CN.resx diff --git a/ShareX/Forms/ScreenRecordForm.zh-TW.resx b/ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.zh-TW.resx similarity index 100% rename from ShareX/Forms/ScreenRecordForm.zh-TW.resx rename to ShareX.ScreenCaptureLib/Forms/ScreenRecordForm.zh-TW.resx diff --git a/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs b/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs index e153eccd1..652051384 100644 --- a/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs +++ b/ShareX.ScreenCaptureLib/Properties/Resources.Designer.cs @@ -119,6 +119,16 @@ internal class Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap camcorder__pencil { + get { + object obj = ResourceManager.GetObject("camcorder__pencil", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -178,6 +188,26 @@ internal class Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap control_record { + get { + object obj = ResourceManager.GetObject("control_record", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap control_record_yellow { + get { + object obj = ResourceManager.GetObject("control_record_yellow", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1254,6 +1284,69 @@ internal class Resources { } } + /// + /// Looks up a localized string similar to Are you sure you want to abort this recording?. + /// + internal static string ScreenRecordForm_ConfirmCancel { + get { + return ResourceManager.GetString("ScreenRecordForm_ConfirmCancel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Start. + /// + internal static string ScreenRecordForm_Start { + get { + return ResourceManager.GetString("ScreenRecordForm_Start", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Click to start recording.. + /// + internal static string ScreenRecordForm_StartRecording_Click_tray_icon_to_start_recording_ { + get { + return ResourceManager.GetString("ScreenRecordForm_StartRecording_Click_tray_icon_to_start_recording_", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Click to stop recording.. + /// + internal static string ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_ { + get { + return ResourceManager.GetString("ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Encoding.... + /// + internal static string ScreenRecordForm_StartRecording_Encoding___ { + get { + return ResourceManager.GetString("ScreenRecordForm_StartRecording_Encoding___", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Waiting.... + /// + internal static string ScreenRecordForm_StartRecording_Waiting___ { + get { + return ResourceManager.GetString("ScreenRecordForm_StartRecording_Waiting___", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Stop. + /// + internal static string ScreenRecordForm_Stop { + get { + return ResourceManager.GetString("ScreenRecordForm_Stop", resourceCulture); + } + } + /// /// Looks up a localized string similar to Stop capture. /// diff --git a/ShareX.ScreenCaptureLib/Properties/Resources.resx b/ShareX.ScreenCaptureLib/Properties/Resources.resx index bc7419f85..742d5e4da 100644 --- a/ShareX.ScreenCaptureLib/Properties/Resources.resx +++ b/ShareX.ScreenCaptureLib/Properties/Resources.resx @@ -740,4 +740,38 @@ X: {4} Y: {5} Step type: + + ..\Resources\camcorder--pencil.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control-record.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\control-record-yellow.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Are you sure you want to abort this recording? + + + Click to start recording. + Text must be equal to or lower than 54 characters because of tray icon text length limit. + + + Click to stop recording. + Text must be equal to or lower than 54 characters because of tray icon text length limit. + + + Encoding... + Text must be equal to or lower than 54 characters because of tray icon text length limit. + + + Waiting... + Text must be equal to or lower than 54 characters because of tray icon text length limit. + + + Start + + + Stop + \ No newline at end of file diff --git a/ShareX.ScreenCaptureLib/Resources/camcorder--pencil.png b/ShareX.ScreenCaptureLib/Resources/camcorder--pencil.png new file mode 100644 index 000000000..ce59eb430 Binary files /dev/null and b/ShareX.ScreenCaptureLib/Resources/camcorder--pencil.png differ diff --git a/ShareX/Resources/control-record-yellow.png b/ShareX.ScreenCaptureLib/Resources/control-record-yellow.png similarity index 100% rename from ShareX/Resources/control-record-yellow.png rename to ShareX.ScreenCaptureLib/Resources/control-record-yellow.png diff --git a/ShareX/Resources/control-record.png b/ShareX.ScreenCaptureLib/Resources/control-record.png similarity index 100% rename from ShareX/Resources/control-record.png rename to ShareX.ScreenCaptureLib/Resources/control-record.png diff --git a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj index 58aac92d6..8c3a77785 100644 --- a/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj +++ b/ShareX.ScreenCaptureLib/ShareX.ScreenCaptureLib.csproj @@ -115,6 +115,12 @@ ImageSizeForm.cs + + Form + + + ScreenRecordForm.cs + Form @@ -332,6 +338,9 @@ + + + @@ -579,6 +588,66 @@ NewImageForm.cs + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + + + ScreenRecordForm.cs + ScrollingCaptureForm.cs diff --git a/ShareX/Enums.cs b/ShareX/Enums.cs index a70d6e649..9afdd518c 100644 --- a/ShareX/Enums.cs +++ b/ShareX/Enums.cs @@ -286,11 +286,6 @@ public enum ThumbnailTitleLocation Top, Bottom } - public enum ScreenRecordState - { - Waiting, BeforeStart, AfterStart, AfterRecordingStart, Encoding - } - public enum RegionCaptureType { Default, Light, Transparent diff --git a/ShareX/Properties/Resources.Designer.cs b/ShareX/Properties/Resources.Designer.cs index f2a7121b4..953f011d3 100644 --- a/ShareX/Properties/Resources.Designer.cs +++ b/ShareX/Properties/Resources.Designer.cs @@ -1033,26 +1033,6 @@ public class Resources { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap control_record { - get { - object obj = ResourceManager.GetObject("control_record", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap control_record_yellow { - get { - object obj = ResourceManager.GetObject("control_record_yellow", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1340,6 +1320,62 @@ public class Resources { } } + /// + /// Looks up a localized string similar to {0} does not exist. + /// + ///Would you like to automatically download it?. + /// + public static string FFmpeg_does_not_exist { + get { + return ResourceManager.GetString("FFmpeg_does_not_exist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Download of FFmpeg failed.. + /// + public static string FFmpeg_Download_of_FFmpeg_failed { + get { + return ResourceManager.GetString("FFmpeg_Download_of_FFmpeg_failed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to FFmpeg error. + /// + public static string FFmpeg_FFmpeg_error { + get { + return ResourceManager.GetString("FFmpeg_FFmpeg_error", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to FFmpeg successfully downloaded.. + /// + public static string FFmpeg_FFmpeg_successfully_downloaded { + get { + return ResourceManager.GetString("FFmpeg_FFmpeg_successfully_downloaded", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to FFmpeg video and audio source can't both be "None".. + /// + public static string FFmpeg_FFmpeg_video_and_audio_source_both_can_t_be__None__ { + get { + return ResourceManager.GetString("FFmpeg_FFmpeg_video_and_audio_source_both_can_t_be__None__", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Missing. + /// + public static string FFmpeg_Missing { + get { + return ResourceManager.GetString("FFmpeg_Missing", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use new name: . /// @@ -2309,108 +2345,6 @@ public class Resources { } } - /// - /// Looks up a localized string similar to Are you sure you want to abort this recording?. - /// - public static string ScreenRecord_ConfirmCancel { - get { - return ResourceManager.GetString("ScreenRecord_ConfirmCancel", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Download of FFmpeg failed.. - /// - public static string ScreenRecordForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_ { - get { - return ResourceManager.GetString("ScreenRecordForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to FFmpeg successfully downloaded.. - /// - public static string ScreenRecordForm_DownloaderForm_InstallRequested_FFmpeg_successfully_downloaded_ { - get { - return ResourceManager.GetString("ScreenRecordForm_DownloaderForm_InstallRequested_FFmpeg_successfully_downloaded_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Click to start recording.. - /// - public static string ScreenRecordForm_StartRecording_Click_tray_icon_to_start_recording_ { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_Click_tray_icon_to_start_recording_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Click to stop recording.. - /// - public static string ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_ { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_Click_tray_icon_to_stop_recording_", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0} does not exist. - /// - ///Would you like to automatically download it?. - /// - public static string ScreenRecordForm_StartRecording_does_not_exist { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_does_not_exist", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Encoding.... - /// - public static string ScreenRecordForm_StartRecording_Encoding___ { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_Encoding___", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to FFmpeg error. - /// - public static string ScreenRecordForm_StartRecording_FFmpeg_error { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_FFmpeg_error", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to FFmpeg video and audio source can't both be "None".. - /// - public static string ScreenRecordForm_StartRecording_FFmpeg_video_and_audio_source_both_can_t_be__None__ { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_FFmpeg_video_and_audio_source_both_can_t_be__None" + - "__", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Missing. - /// - public static string ScreenRecordForm_StartRecording_Missing { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_Missing", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Waiting.... - /// - public static string ScreenRecordForm_StartRecording_Waiting___ { - get { - return ResourceManager.GetString("ScreenRecordForm_StartRecording_Waiting___", resourceCulture); - } - } - /// /// Looks up a localized string similar to Screenshot delay: {0}s. /// diff --git a/ShareX/Properties/Resources.resx b/ShareX/Properties/Resources.resx index 5aa39d07e..1d4226b31 100644 --- a/ShareX/Properties/Resources.resx +++ b/ShareX/Properties/Resources.resx @@ -297,9 +297,6 @@ Would you like to restart ShareX? Disable hotkeys - - FFmpeg video and audio source can't both be "None". - Reset all quick tasks to defaults? @@ -367,9 +364,6 @@ Press 'No' to cancel the current upload and disable screenshot auto uploading. ..\Resources\layer-transparent.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Download of FFmpeg failed. - Input text to encode @@ -444,9 +438,6 @@ Are you sure you want to continue? File uploader: {0} - - ..\Resources\control-record.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\application-list.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -492,10 +483,6 @@ Are you sure you want to continue? ..\Resources\application-home.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Encoding... - Text must be equal to or lower than 54 characters because of tray icon text length limit. - ..\Resources\drive-globe.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -520,9 +507,6 @@ Are you sure you want to continue? Shorten URL ({0}) - - FFmpeg error - Separator @@ -585,19 +569,12 @@ You can later disable it from "After capture tasks" menu. Edit with ShareX - - Click to start recording. - Text must be equal to or lower than 54 characters because of tray icon text length limit. - Error ..\Resources\disk-rename.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\control-record-yellow.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\image-export.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -610,9 +587,6 @@ You can later disable it from "After capture tasks" menu. ..\Resources\keyboard--plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - FFmpeg successfully downloaded. - After capture: {0} @@ -676,9 +650,6 @@ You can later disable it from "After capture tasks" menu. Continue - - Missing - ..\Resources\arrow-270.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -795,9 +766,6 @@ Would you like to restart ShareX? ..\Resources\traffic-cone.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Are you sure you want to abort this recording? - You can add workflows from hotkey settings... @@ -890,10 +858,6 @@ Please run ShareX as administrator to change personal folder path. ..\Resources\disk.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Waiting... - Text must be equal to or lower than 54 characters because of tray icon text length limit. - ..\Resources\uac.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -924,11 +888,6 @@ Please run ShareX as administrator to change personal folder path. Failed to save settings - - {0} does not exist. - -Would you like to automatically download it? - ..\Resources\Twitter-32x32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -1039,10 +998,6 @@ Middle click to close ..\Resources\drive-upload.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Click to stop recording. - Text must be equal to or lower than 54 characters because of tray icon text length limit. - ..\Resources\cross.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -1101,4 +1056,24 @@ Middle click to close ..\Resources\Twitter-16x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + {0} does not exist. + +Would you like to automatically download it? + + + Download of FFmpeg failed. + + + FFmpeg error + + + FFmpeg successfully downloaded. + + + FFmpeg video and audio source can't both be "None". + + + Missing + \ No newline at end of file diff --git a/ShareX/ScreenRecordManager.cs b/ShareX/ScreenRecordManager.cs index ad6f43aae..be9a91b8e 100644 --- a/ShareX/ScreenRecordManager.cs +++ b/ShareX/ScreenRecordManager.cs @@ -105,8 +105,8 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t if (!taskSettings.CaptureSettings.FFmpegOptions.IsSourceSelected) { - MessageBox.Show(Resources.ScreenRecordForm_StartRecording_FFmpeg_video_and_audio_source_both_can_t_be__None__, - "ShareX - " + Resources.ScreenRecordForm_StartRecording_FFmpeg_error, MessageBoxButtons.OK, MessageBoxIcon.Warning); + MessageBox.Show(Resources.FFmpeg_FFmpeg_video_and_audio_source_both_can_t_be__None__, + "ShareX - " + Resources.FFmpeg_FFmpeg_error, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } @@ -164,7 +164,13 @@ private static void StartRecording(ScreenRecordOutput outputType, TaskSettings t float duration = taskSettings.CaptureSettings.ScreenRecordFixedDuration ? taskSettings.CaptureSettings.ScreenRecordDuration : 0; - recordForm = new ScreenRecordForm(captureRectangle, taskSettings, startMethod == ScreenRecordStartMethod.Region, duration); + recordForm = new ScreenRecordForm(captureRectangle) + { + ActivateWindow = startMethod == ScreenRecordStartMethod.Region, + Duration = duration, + AskConfirmationOnAbort = taskSettings.CaptureSettings.ScreenRecordAskConfirmationOnAbort + }; + recordForm.StopRequested += StopRecording; recordForm.Show(); diff --git a/ShareX/ShareX.csproj b/ShareX/ShareX.csproj index 2e3cbbf1b..9148fb966 100644 --- a/ShareX/ShareX.csproj +++ b/ShareX/ShareX.csproj @@ -296,12 +296,6 @@ - - Form - - - ScreenRecordForm.cs - Form @@ -1427,78 +1421,18 @@ QuickTaskMenuEditorForm.cs - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - ApplicationSettingsForm.cs MainForm.cs - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - - - ScreenRecordForm.cs - FirstTimeConfigForm.cs ActionsToolbarEditForm.cs - - ScreenRecordForm.cs - TaskSettingsForm.cs Designer @@ -1765,7 +1699,6 @@ - @@ -1863,7 +1796,6 @@ - diff --git a/ShareX/TaskHelpers.cs b/ShareX/TaskHelpers.cs index 3c8a62f9f..eb0e2942a 100644 --- a/ShareX/TaskHelpers.cs +++ b/ShareX/TaskHelpers.cs @@ -651,40 +651,6 @@ private static void AddExternalProgramFromRegistry(TaskSettings taskSettings, st } } - public static Icon GetProgressIcon(int percentage) - { - return GetProgressIcon(percentage, Color.FromArgb(16, 116, 193)); - } - - public static Icon GetProgressIcon(int percentage, Color color) - { - percentage = percentage.Clamp(0, 99); - - Size size = SystemInformation.SmallIconSize; - using (Bitmap bmp = new Bitmap(size.Width, size.Height)) - using (Graphics g = Graphics.FromImage(bmp)) - { - int y = (int)(size.Height * (percentage / 100f)); - - if (y > 0) - { - using (Brush brush = new SolidBrush(color)) - { - g.FillRectangle(brush, 0, size.Height - 1 - y, size.Width, y); - } - } - - using (Font font = new Font("Arial", 10)) - using (StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }) - { - g.DrawString(percentage.ToString(), font, Brushes.Black, size.Width / 2f, size.Height / 2f, sf); - g.DrawString(percentage.ToString(), font, Brushes.White, size.Width / 2f, (size.Height / 2f) - 1, sf); - } - - return Icon.FromHandle(bmp.GetHicon()); - } - } - public static string HandleExistsFile(string folder, string filename, TaskSettings taskSettings) { string filepath = Path.Combine(folder, filename); @@ -1375,8 +1341,8 @@ public static bool CheckFFmpeg(TaskSettings taskSettings) if (!File.Exists(ffmpegPath)) { - if (MessageBox.Show(string.Format(Resources.ScreenRecordForm_StartRecording_does_not_exist, ffmpegPath), - "ShareX - " + Resources.ScreenRecordForm_StartRecording_Missing + " ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) + if (MessageBox.Show(string.Format(Resources.FFmpeg_does_not_exist, ffmpegPath), + "ShareX - " + Resources.FFmpeg_Missing + " ffmpeg.exe", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { DialogResult downloadDialogResult = FFmpegGitHubDownloader.DownloadFFmpeg(false, DownloaderForm_InstallRequested); @@ -1410,11 +1376,11 @@ private static void DownloaderForm_InstallRequested(string filePath) if (result) { - MessageBox.Show(Resources.ScreenRecordForm_DownloaderForm_InstallRequested_FFmpeg_successfully_downloaded_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(Resources.FFmpeg_FFmpeg_successfully_downloaded, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { - MessageBox.Show(Resources.ScreenRecordForm_DownloaderForm_InstallRequested_Download_of_FFmpeg_failed_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show(Resources.FFmpeg_Download_of_FFmpeg_failed, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error); } } diff --git a/ShareX/TaskManager.cs b/ShareX/TaskManager.cs index f2f128a6a..3dce7d05a 100644 --- a/ShareX/TaskManager.cs +++ b/ShareX/TaskManager.cs @@ -483,7 +483,7 @@ public static void UpdateTrayIcon(int progress = -1) { try { - icon = TaskHelpers.GetProgressIcon(progress); + icon = Helpers.GetProgressIcon(progress); } catch (Exception e) {