mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 21:13:23 -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_SCREEN,
|
||||||
CAPTURE_CLIPBOARD,
|
CAPTURE_CLIPBOARD,
|
||||||
CAPTURE_WINDOW,
|
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()
|
new PickerDestination()
|
||||||
};
|
};
|
||||||
|
|
||||||
bool useEditor = true;
|
bool useEditor = false;
|
||||||
if (WindowsVersion.IsWindows10OrLater)
|
if (WindowsVersion.IsWindows10OrLater)
|
||||||
{
|
{
|
||||||
int len = 250;
|
int len = 250;
|
||||||
|
@ -527,8 +527,11 @@ namespace Greenshot.Forms
|
||||||
var err = Kernel32.GetPackageFullName(proc.Handle, ref len, stringBuilder);
|
var err = Kernel32.GetPackageFullName(proc.Handle, ref len, stringBuilder);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
useEditor = false;
|
useEditor = true;
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
useEditor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useEditor)
|
if (useEditor)
|
||||||
|
@ -931,7 +934,7 @@ namespace Greenshot.Forms
|
||||||
CaptureHelper.CaptureRegion(true);
|
CaptureHelper.CaptureRegion(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CaptureFile()
|
private void CaptureFile(IDestination destination = null)
|
||||||
{
|
{
|
||||||
var openFileDialog = new OpenFileDialog
|
var openFileDialog = new OpenFileDialog
|
||||||
{
|
{
|
||||||
|
@ -944,7 +947,7 @@ namespace Greenshot.Forms
|
||||||
|
|
||||||
if (File.Exists(openFileDialog.FileName))
|
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)
|
private void CaptureClipboardToolStripMenuItemClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
BeginInvoke((MethodInvoker) CaptureHelper.CaptureClipboard);
|
BeginInvoke((MethodInvoker) delegate { CaptureHelper.CaptureClipboard(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenFileToolStripMenuItemClick(object sender, EventArgs e)
|
private void OpenFileToolStripMenuItemClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
BeginInvoke((MethodInvoker) CaptureFile);
|
BeginInvoke((MethodInvoker) delegate { CaptureFile(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CaptureFullScreenToolStripMenuItemClick(object sender, EventArgs e)
|
private void CaptureFullScreenToolStripMenuItemClick(object sender, EventArgs e)
|
||||||
|
@ -1748,6 +1751,12 @@ namespace Greenshot.Forms
|
||||||
case ClickActions.CAPTURE_CLIPBOARD:
|
case ClickActions.CAPTURE_CLIPBOARD:
|
||||||
CaptureHelper.CaptureClipboard();
|
CaptureHelper.CaptureClipboard();
|
||||||
break;
|
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:
|
case ClickActions.CAPTURE_REGION:
|
||||||
CaptureHelper.CaptureRegion(false);
|
CaptureHelper.CaptureRegion(false);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -93,13 +93,7 @@ namespace Greenshot.Helpers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CaptureClipboard()
|
public static void CaptureClipboard(IDestination destination = null)
|
||||||
{
|
|
||||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.Clipboard);
|
|
||||||
captureHelper.MakeCapture();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CaptureClipboard(IDestination destination)
|
|
||||||
{
|
{
|
||||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.Clipboard);
|
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.Clipboard);
|
||||||
if (destination != null)
|
if (destination != null)
|
||||||
|
@ -173,16 +167,16 @@ namespace Greenshot.Helpers
|
||||||
captureHelper.MakeCapture();
|
captureHelper.MakeCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CaptureFile(string filename)
|
public static void CaptureFile(string filename, IDestination destination = null)
|
||||||
{
|
{
|
||||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
||||||
captureHelper.MakeCapture(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CaptureFile(string filename, IDestination destination)
|
if (destination != null)
|
||||||
{
|
{
|
||||||
using CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
captureHelper.AddDestination(destination);
|
||||||
captureHelper.AddDestination(destination).MakeCapture(filename);
|
}
|
||||||
|
|
||||||
|
captureHelper.MakeCapture(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ImportCapture(ICapture captureToImport)
|
public static void ImportCapture(ICapture captureToImport)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue