Added "Stop screen recording" hotkey

This commit is contained in:
Jaex 2021-09-27 14:09:04 +03:00
parent 25b2e6b474
commit 4bfc9ce071
9 changed files with 58 additions and 8 deletions

View file

@ -2082,6 +2082,24 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Stop screen recording.
/// </summary>
internal static string HotkeyType_StopScreenRecording {
get {
return ResourceManager.GetString("HotkeyType_StopScreenRecording", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Screen record.
/// </summary>
internal static string HotkeyType_StopScreenRecording_Category {
get {
return ResourceManager.GetString("HotkeyType_StopScreenRecording_Category", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Stop all active uploads.
/// </summary>

View file

@ -1373,4 +1373,10 @@ Would you like to download and install it?</value>
<data name="RegionCaptureAction_CaptureLastRegion" xml:space="preserve">
<value>Capture last region</value>
</data>
<data name="HotkeyType_StopScreenRecording" xml:space="preserve">
<value>Stop screen recording</value>
</data>
<data name="HotkeyType_StopScreenRecording_Category" xml:space="preserve">
<value>Screen record</value>
</data>
</root>

View file

@ -203,6 +203,7 @@ public enum HotkeyType // Localized + Category
ScreenRecorderGIFActiveWindow,
ScreenRecorderGIFCustomRegion,
StartScreenRecorderGIF,
StopScreenRecording,
AbortScreenRecording,
// Tools
ColorPicker,

View file

@ -797,6 +797,16 @@ public class Resources {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap camcorder__minus {
get {
object obj = ResourceManager.GetObject("camcorder__minus", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -1103,4 +1103,7 @@ Middle click to close</value>
<data name="application-resize-full" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\application-resize-full.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="camcorder__minus" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\camcorder--minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

View file

@ -56,6 +56,14 @@ public static void StartStopRecording(ScreenRecordOutput outputType, ScreenRecor
}
}
public static void StopRecording()
{
if (IsRecording && screenRecorder != null)
{
screenRecorder.StopRecording();
}
}
public static void AbortRecording()
{
if (IsRecording && recordForm != null && !recordForm.IsDisposed)
@ -64,14 +72,6 @@ public static void AbortRecording()
}
}
private static void StopRecording()
{
if (IsRecording && screenRecorder != null)
{
screenRecorder.StopRecording();
}
}
private static void StartRecording(ScreenRecordOutput outputType, TaskSettings taskSettings, ScreenRecordStartMethod startMethod = ScreenRecordStartMethod.Region)
{
if (outputType == ScreenRecordOutput.GIF)

View file

@ -1934,6 +1934,9 @@
<ItemGroup>
<None Include="Resources\application-resize-full.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\camcorder--minus.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>

View file

@ -163,6 +163,9 @@ public static void ExecuteJob(TaskSettings taskSettings, HotkeyType job, CLIComm
case HotkeyType.StartScreenRecorderGIF:
StartScreenRecording(ScreenRecordOutput.GIF, ScreenRecordStartMethod.LastRegion, safeTaskSettings);
break;
case HotkeyType.StopScreenRecording:
StopScreenRecording();
break;
case HotkeyType.AbortScreenRecording:
AbortScreenRecording();
break;
@ -594,6 +597,11 @@ public static void StartScreenRecording(ScreenRecordOutput outputType, ScreenRec
ScreenRecordManager.StartStopRecording(outputType, startMethod, taskSettings);
}
public static void StopScreenRecording()
{
ScreenRecordManager.StopRecording();
}
public static void AbortScreenRecording()
{
ScreenRecordManager.AbortRecording();
@ -1482,6 +1490,7 @@ public static void OpenCustomUploaderSettingsWindow()
case HotkeyType.ScreenRecorderGIFActiveWindow: return Resources.film__arrow;
case HotkeyType.ScreenRecorderGIFCustomRegion: return Resources.film__arrow;
case HotkeyType.StartScreenRecorderGIF: return Resources.film__arrow;
case HotkeyType.StopScreenRecording: return Resources.camcorder__minus;
case HotkeyType.AbortScreenRecording: return Resources.camcorder__exclamation;
// Tools
case HotkeyType.ColorPicker: return Resources.color;