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 static string HotkeyType_StartScreenRecorderGIF_Category {
} }
} }
/// <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> /// <summary>
/// Looks up a localized string similar to Stop all active uploads. /// Looks up a localized string similar to Stop all active uploads.
/// </summary> /// </summary>

View file

@ -1373,4 +1373,10 @@ Would you like to download and install it?</value>
<data name="RegionCaptureAction_CaptureLastRegion" xml:space="preserve"> <data name="RegionCaptureAction_CaptureLastRegion" xml:space="preserve">
<value>Capture last region</value> <value>Capture last region</value>
</data> </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> </root>

View file

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

View file

@ -797,6 +797,16 @@ public static System.Drawing.Bitmap camcorder__exclamation {
} }
} }
/// <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> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View file

@ -1103,4 +1103,7 @@ Middle click to close</value>
<data name="application-resize-full" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\application-resize-full.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </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> </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() public static void AbortRecording()
{ {
if (IsRecording && recordForm != null && !recordForm.IsDisposed) 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) private static void StartRecording(ScreenRecordOutput outputType, TaskSettings taskSettings, ScreenRecordStartMethod startMethod = ScreenRecordStartMethod.Region)
{ {
if (outputType == ScreenRecordOutput.GIF) if (outputType == ScreenRecordOutput.GIF)

View file

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

View file

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