mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 09:17:36 +13:00
Scrolling capture hotkey now also supports start/stop
This commit is contained in:
parent
0ab967f14b
commit
636f8ed8d4
6 changed files with 51 additions and 11 deletions
|
@ -1759,7 +1759,7 @@ internal static string HotkeyType_ScreenRecorderGIFCustomRegion {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Scrolling capture.
|
/// Looks up a localized string similar to Start/Stop scrolling capture.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string HotkeyType_ScrollingCapture {
|
internal static string HotkeyType_ScrollingCapture {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
<value>1 Hour</value>
|
<value>1 Hour</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="HotkeyType_ScrollingCapture" xml:space="preserve">
|
<data name="HotkeyType_ScrollingCapture" xml:space="preserve">
|
||||||
<value>Scrolling capture</value>
|
<value>Start/Stop scrolling capture</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ReplCodeMenuEntry_iAa_Auto_increment_alphanumeric_all" xml:space="preserve">
|
<data name="ReplCodeMenuEntry_iAa_Auto_increment_alphanumeric_all" xml:space="preserve">
|
||||||
<value>Auto increment alphanumeric case-sensitive (0 pad left using {n})</value>
|
<value>Auto increment alphanumeric case-sensitive (0 pad left using {n})</value>
|
||||||
|
|
|
@ -646,7 +646,7 @@ Dosya boyutu: {2:n0} / {3:n0} KB</value>
|
||||||
<value>Bilgisayar</value>
|
<value>Bilgisayar</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="HotkeyType_ScrollingCapture" xml:space="preserve">
|
<data name="HotkeyType_ScrollingCapture" xml:space="preserve">
|
||||||
<value>Kaydırarak yakalama</value>
|
<value>Kaydırarak yakalamayı başlat/durdur</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="HotkeyType_ImageCombiner" xml:space="preserve">
|
<data name="HotkeyType_ImageCombiner" xml:space="preserve">
|
||||||
<value>Resim birleştirici</value>
|
<value>Resim birleştirici</value>
|
||||||
|
|
|
@ -34,6 +34,10 @@ namespace ShareX.ScreenCaptureLib
|
||||||
{
|
{
|
||||||
public partial class ScrollingCaptureForm : Form
|
public partial class ScrollingCaptureForm : Form
|
||||||
{
|
{
|
||||||
|
private static readonly object lockObject = new object();
|
||||||
|
|
||||||
|
private static ScrollingCaptureForm instance;
|
||||||
|
|
||||||
public event Action<Bitmap> UploadRequested;
|
public event Action<Bitmap> UploadRequested;
|
||||||
|
|
||||||
public ScrollingCaptureOptions Options { get; private set; }
|
public ScrollingCaptureOptions Options { get; private set; }
|
||||||
|
@ -41,7 +45,7 @@ public partial class ScrollingCaptureForm : Form
|
||||||
private ScrollingCaptureManager manager;
|
private ScrollingCaptureManager manager;
|
||||||
private Point dragStartPosition;
|
private Point dragStartPosition;
|
||||||
|
|
||||||
public ScrollingCaptureForm(ScrollingCaptureOptions options)
|
private ScrollingCaptureForm(ScrollingCaptureOptions options)
|
||||||
{
|
{
|
||||||
Options = options;
|
Options = options;
|
||||||
|
|
||||||
|
@ -51,6 +55,43 @@ public ScrollingCaptureForm(ScrollingCaptureOptions options)
|
||||||
manager = new ScrollingCaptureManager(Options);
|
manager = new ScrollingCaptureManager(Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task StartStopScrollingCapture(ScrollingCaptureOptions options, Action<Bitmap> uploadRequested = null)
|
||||||
|
{
|
||||||
|
if (instance == null || instance.IsDisposed)
|
||||||
|
{
|
||||||
|
lock (lockObject)
|
||||||
|
{
|
||||||
|
if (instance == null || instance.IsDisposed)
|
||||||
|
{
|
||||||
|
instance = new ScrollingCaptureForm(options);
|
||||||
|
|
||||||
|
if (uploadRequested != null)
|
||||||
|
{
|
||||||
|
instance.UploadRequested += uploadRequested;
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await instance.StartStopScrollingCapture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task StartStopScrollingCapture()
|
||||||
|
{
|
||||||
|
if (manager.IsCapturing)
|
||||||
|
{
|
||||||
|
manager.StopCapture();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await SelectWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
|
|
|
@ -1621,9 +1621,9 @@ private void tsmiScreenRecordingGIF_Click(object sender, EventArgs e)
|
||||||
TaskHelpers.StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.Region);
|
TaskHelpers.StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.Region);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsmiScrollingCapture_Click(object sender, EventArgs e)
|
private async void tsmiScrollingCapture_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
TaskHelpers.OpenScrollingCapture();
|
await TaskHelpers.OpenScrollingCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsmiAutoCapture_Click(object sender, EventArgs e)
|
private void tsmiAutoCapture_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -129,7 +129,7 @@ public static async Task ExecuteJob(TaskSettings taskSettings, HotkeyType job, C
|
||||||
new CaptureLastRegion().Capture(safeTaskSettings);
|
new CaptureLastRegion().Capture(safeTaskSettings);
|
||||||
break;
|
break;
|
||||||
case HotkeyType.ScrollingCapture:
|
case HotkeyType.ScrollingCapture:
|
||||||
OpenScrollingCapture(safeTaskSettings);
|
await OpenScrollingCapture(safeTaskSettings);
|
||||||
break;
|
break;
|
||||||
case HotkeyType.AutoCapture:
|
case HotkeyType.AutoCapture:
|
||||||
OpenAutoCapture(safeTaskSettings);
|
OpenAutoCapture(safeTaskSettings);
|
||||||
|
@ -692,13 +692,12 @@ public static void AbortScreenRecording()
|
||||||
ScreenRecordManager.AbortRecording();
|
ScreenRecordManager.AbortRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenScrollingCapture(TaskSettings taskSettings = null)
|
public static async Task OpenScrollingCapture(TaskSettings taskSettings = null)
|
||||||
{
|
{
|
||||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||||
|
|
||||||
ScrollingCaptureForm scrollingCaptureForm = new ScrollingCaptureForm(taskSettings.CaptureSettingsReference.ScrollingCaptureOptions);
|
await ScrollingCaptureForm.StartStopScrollingCapture(taskSettings.CaptureSettingsReference.ScrollingCaptureOptions,
|
||||||
scrollingCaptureForm.UploadRequested += img => UploadManager.RunImageTask(img, taskSettings);
|
img => UploadManager.RunImageTask(img, taskSettings));
|
||||||
scrollingCaptureForm.Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OpenAutoCapture(TaskSettings taskSettings = null)
|
public static void OpenAutoCapture(TaskSettings taskSettings = null)
|
||||||
|
|
Loading…
Reference in a new issue