fixed #382: -StartScreenRecorder hotkey for be able to start it using last region

This commit is contained in:
Jaex 2014-12-10 21:33:47 +02:00
parent c4f16bdcf3
commit 9fe256c66d
4 changed files with 27 additions and 8 deletions

View file

@ -188,5 +188,11 @@ public ApplicationConfig()
public bool AutoCaptureWaitUpload = true;
#endregion AutoCapture Form
#region ScreenRecord Form
public Rectangle ScreenRecordRegion = Rectangle.Empty;
#endregion ScreenRecord Form
}
}

View file

@ -1498,7 +1498,10 @@ private void ExecuteJob(TaskSettings taskSettings, HotkeyType job)
CaptureScreenshot(CaptureType.LastRegion, safeTaskSettings, false);
break;
case HotkeyType.ScreenRecorder:
TaskHelpers.DoScreenRecording(safeTaskSettings);
TaskHelpers.StartScreenRecording(safeTaskSettings, false);
break;
case HotkeyType.StartScreenRecorder:
TaskHelpers.StartScreenRecording(safeTaskSettings, true);
break;
case HotkeyType.AutoCapture:
TaskHelpers.OpenAutoCapture();

View file

@ -88,7 +88,7 @@ private void TrayIcon_MouseClick(object sender, MouseEventArgs e)
}
}
public void StartRecording(TaskSettings taskSettings)
public void StartRecording(TaskSettings taskSettings, bool skipRegionSelection = false)
{
if (taskSettings.CaptureSettings.RunScreencastCLI)
{
@ -138,14 +138,24 @@ public void StartRecording(TaskSettings taskSettings)
}
Rectangle captureRectangle;
TaskHelpers.SelectRegion(out captureRectangle, taskSettings);
captureRectangle = CaptureHelpers.EvenRectangleSize(captureRectangle);
if (skipRegionSelection)
{
captureRectangle = Program.Settings.ScreenRecordRegion;
}
else
{
TaskHelpers.SelectRegion(out captureRectangle, taskSettings);
captureRectangle = CaptureHelpers.EvenRectangleSize(captureRectangle);
}
if (IsRecording || !captureRectangle.IsValid() || screenRecorder != null)
{
return;
}
Program.Settings.ScreenRecordRegion = captureRectangle;
IsRecording = true;
Screenshot.CaptureCursor = taskSettings.CaptureSettings.ShowCursor;

View file

@ -451,17 +451,17 @@ public static void DoScreenRecordingFFmpeg()
{
TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings();
taskSettings.CaptureSettings.ScreenRecordOutput = ScreenRecordOutput.FFmpeg;
DoScreenRecording(taskSettings);
StartScreenRecording(taskSettings);
}
public static void DoScreenRecordingGIF()
{
TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings();
taskSettings.CaptureSettings.ScreenRecordOutput = ScreenRecordOutput.GIF;
DoScreenRecording(taskSettings);
StartScreenRecording(taskSettings);
}
public static void DoScreenRecording(TaskSettings taskSettings = null)
public static void StartScreenRecording(TaskSettings taskSettings = null, bool skipRegionSelection = false)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
@ -473,7 +473,7 @@ public static void DoScreenRecording(TaskSettings taskSettings = null)
}
else
{
form.StartRecording(taskSettings);
form.StartRecording(taskSettings, skipRegionSelection);
}
}