Added "Pin to screen" after capture task

This commit is contained in:
Jaex 2022-07-22 09:56:20 +03:00
parent 09d25aa4ef
commit 792d26c257
9 changed files with 54 additions and 13 deletions

View file

@ -217,6 +217,15 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Pin to screen.
/// </summary>
internal static string AfterCaptureTasks_PinToScreen {
get {
return ResourceManager.GetString("AfterCaptureTasks_PinToScreen", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Save image to file.
/// </summary>

View file

@ -1445,4 +1445,7 @@ Would you like to download and install it?</value>
<data name="HotkeyType_BorderlessWindow_Category" xml:space="preserve">
<value>Tools</value>
</data>
<data name="AfterCaptureTasks_PinToScreen" xml:space="preserve">
<value>Pin to screen</value>
</data>
</root>

View file

@ -124,19 +124,20 @@ public enum AfterCaptureTasks // Localized
AddImageEffects = 1 << 2,
AnnotateImage = 1 << 3,
CopyImageToClipboard = 1 << 4,
SendImageToPrinter = 1 << 5,
SaveImageToFile = 1 << 6,
SaveImageToFileWithDialog = 1 << 7,
SaveThumbnailImageToFile = 1 << 8,
PerformActions = 1 << 9,
CopyFileToClipboard = 1 << 10,
CopyFilePathToClipboard = 1 << 11,
ShowInExplorer = 1 << 12,
ScanQRCode = 1 << 13,
DoOCR = 1 << 14,
ShowBeforeUploadWindow = 1 << 15,
UploadImageToHost = 1 << 16,
DeleteFile = 1 << 17
PinToScreen = 1 << 5,
SendImageToPrinter = 1 << 6,
SaveImageToFile = 1 << 7,
SaveImageToFileWithDialog = 1 << 8,
SaveThumbnailImageToFile = 1 << 9,
PerformActions = 1 << 10,
CopyFileToClipboard = 1 << 11,
CopyFilePathToClipboard = 1 << 12,
ShowInExplorer = 1 << 13,
ScanQRCode = 1 << 14,
DoOCR = 1 << 15,
ShowBeforeUploadWindow = 1 << 16,
UploadImageToHost = 1 << 17,
DeleteFile = 1 << 18
}
[Flags]

View file

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

View file

@ -1102,4 +1102,7 @@ Middle click to close</value>
<data name="AboutForm_AboutForm_Language_pl" xml:space="preserve">
<value>Polish</value>
</data>
<data name="pin" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pin.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
ShareX/Resources/pin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

View file

@ -2085,6 +2085,9 @@
<ItemGroup>
<None Include="Resources\pl.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\pin.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>

View file

@ -1274,6 +1274,11 @@ private static async Task AsyncOCRImage(Bitmap bmp, OCROptions options, string f
}
}
public static void PinToScreen(Image image)
{
PinToScreenForm.PinToScreen(image);
}
public static void TweetMessage()
{
if (IsUploadAllowed())
@ -1491,6 +1496,7 @@ public static void OpenCustomUploaderSettingsWindow()
case AfterCaptureTasks.AddImageEffects: return Resources.image_saturation;
case AfterCaptureTasks.AnnotateImage: return Resources.image_pencil;
case AfterCaptureTasks.CopyImageToClipboard: return Resources.clipboard_paste_image;
case AfterCaptureTasks.PinToScreen: return Resources.pin;
case AfterCaptureTasks.SendImageToPrinter: return Resources.printer;
case AfterCaptureTasks.SaveImageToFile: return Resources.disk;
case AfterCaptureTasks.SaveImageToFileWithDialog: return Resources.disk_rename;

View file

@ -632,6 +632,12 @@ private bool DoAfterCaptureJobs()
DebugHelper.WriteLine("Image copied to clipboard.");
}
if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.PinToScreen))
{
Image imageCopy = Image.CloneSafe();
threadWorker.InvokeAsync(() => TaskHelpers.PinToScreen(imageCopy));
}
if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.SendImageToPrinter))
{
TaskHelpers.PrintImage(Image);