mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 10:47:02 -07:00
Additional improvements for the ClickActions, now possible to open a file directly in the editor. Inspired by FEATURE-1321
This commit is contained in:
parent
99fb245537
commit
973cf871c8
3 changed files with 26 additions and 21 deletions
|
@ -35,6 +35,8 @@ namespace Greenshot.Base.Core.Enums
|
|||
CAPTURE_SCREEN,
|
||||
CAPTURE_CLIPBOARD,
|
||||
CAPTURE_WINDOW,
|
||||
OPEN_EMPTY_EDITOR
|
||||
OPEN_EMPTY_EDITOR,
|
||||
OPEN_FILE_IN_EDITOR,
|
||||
OPEN_CLIPBOARD_IN_EDITOR
|
||||
}
|
||||
}
|
|
@ -518,7 +518,7 @@ namespace Greenshot.Forms
|
|||
new PickerDestination()
|
||||
};
|
||||
|
||||
bool useEditor = true;
|
||||
bool useEditor = false;
|
||||
if (WindowsVersion.IsWindows10OrLater)
|
||||
{
|
||||
int len = 250;
|
||||
|
@ -527,8 +527,11 @@ namespace Greenshot.Forms
|
|||
var err = Kernel32.GetPackageFullName(proc.Handle, ref len, stringBuilder);
|
||||
if (err != 0)
|
||||
{
|
||||
useEditor = false;
|
||||
useEditor = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
useEditor = true;
|
||||
}
|
||||
|
||||
if (useEditor)
|
||||
|
@ -931,7 +934,7 @@ namespace Greenshot.Forms
|
|||
CaptureHelper.CaptureRegion(true);
|
||||
}
|
||||
|
||||
private void CaptureFile()
|
||||
private void CaptureFile(IDestination destination = null)
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
|
@ -944,7 +947,7 @@ namespace Greenshot.Forms
|
|||
|
||||
if (File.Exists(openFileDialog.FileName))
|
||||
{
|
||||
CaptureHelper.CaptureFile(openFileDialog.FileName);
|
||||
CaptureHelper.CaptureFile(openFileDialog.FileName, destination);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1255,12 +1258,12 @@ namespace Greenshot.Forms
|
|||
|
||||
private void CaptureClipboardToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke((MethodInvoker) CaptureHelper.CaptureClipboard);
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureClipboard(); });
|
||||
}
|
||||
|
||||
private void OpenFileToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
BeginInvoke((MethodInvoker) CaptureFile);
|
||||
BeginInvoke((MethodInvoker) delegate { CaptureFile(); });
|
||||
}
|
||||
|
||||
private void CaptureFullScreenToolStripMenuItemClick(object sender, EventArgs e)
|
||||
|
@ -1748,6 +1751,12 @@ namespace Greenshot.Forms
|
|||
case ClickActions.CAPTURE_CLIPBOARD:
|
||||
CaptureHelper.CaptureClipboard();
|
||||
break;
|
||||
case ClickActions.OPEN_CLIPBOARD_IN_EDITOR:
|
||||
CaptureHelper.CaptureClipboard(DestinationHelper.GetDestination(EditorDestination.DESIGNATION));
|
||||
break;
|
||||
case ClickActions.OPEN_FILE_IN_EDITOR:
|
||||
CaptureFile(DestinationHelper.GetDestination(EditorDestination.DESIGNATION));
|
||||
break;
|
||||
case ClickActions.CAPTURE_REGION:
|
||||
CaptureHelper.CaptureRegion(false);
|
||||
break;
|
||||
|
|
|
@ -93,13 +93,7 @@ namespace Greenshot.Helpers
|
|||
}
|
||||
}
|
||||
|
||||
public static void CaptureClipboard()
|
||||
{
|
||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.Clipboard);
|
||||
captureHelper.MakeCapture();
|
||||
}
|
||||
|
||||
public static void CaptureClipboard(IDestination destination)
|
||||
public static void CaptureClipboard(IDestination destination = null)
|
||||
{
|
||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.Clipboard);
|
||||
if (destination != null)
|
||||
|
@ -173,16 +167,16 @@ namespace Greenshot.Helpers
|
|||
captureHelper.MakeCapture();
|
||||
}
|
||||
|
||||
public static void CaptureFile(string filename)
|
||||
public static void CaptureFile(string filename, IDestination destination = null)
|
||||
{
|
||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
||||
captureHelper.MakeCapture(filename);
|
||||
}
|
||||
|
||||
public static void CaptureFile(string filename, IDestination destination)
|
||||
{
|
||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
||||
captureHelper.AddDestination(destination).MakeCapture(filename);
|
||||
if (destination != null)
|
||||
{
|
||||
captureHelper.AddDestination(destination);
|
||||
}
|
||||
|
||||
captureHelper.MakeCapture(filename);
|
||||
}
|
||||
|
||||
public static void ImportCapture(ICapture captureToImport)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue