diff --git a/Greenshot/Drawing/Surface.cs b/Greenshot/Drawing/Surface.cs
index 5c0ecdac8..49584b054 100644
--- a/Greenshot/Drawing/Surface.cs
+++ b/Greenshot/Drawing/Surface.cs
@@ -1556,10 +1556,11 @@ namespace Greenshot.Drawing {
}
///
- /// Process key
+ /// Process key presses on the surface, this is called from the editor (and NOT an override from the Control)
///
- ///
- public void ProcessCmdKey(Keys k) {
+ /// Keys
+ /// false if no keys were processed
+ public bool ProcessCmdKey(Keys k) {
if (selectedElements.Count > 0) {
bool shiftModifier = (Control.ModifierKeys & Keys.Shift) == Keys.Shift;
int px = shiftModifier ? 10 : 1;
@@ -1604,13 +1605,15 @@ namespace Greenshot.Drawing {
RemoveSelectedElements();
break;*/
default:
- return;
+ return false;
}
if (!Point.Empty.Equals(moveBy)) {
selectedElements.MakeBoundsChangeUndoable(true);
selectedElements.MoveBy(moveBy.X, moveBy.Y);
}
+ return true;
}
+ return false;
}
///
diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs
index ced6588f5..1b76bea26 100644
--- a/Greenshot/Forms/ImageEditorForm.cs
+++ b/Greenshot/Forms/ImageEditorForm.cs
@@ -384,7 +384,7 @@ namespace Greenshot {
return;
}
updateStatusLabel(Language.GetFormattedString(LangKey.editor_imagesaved, fullpath), fileSavedStatusContextMenu);
- this.Text = Language.GetString(LangKey.editor_title) + " - " + Path.GetFileName(fullpath);
+ this.Text = Path.GetFileName(fullpath) + " - " + Language.GetString(LangKey.editor_title);
}
void surface_DrawingModeChanged(object source, DrawingModes drawingMode) {
diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs
index fb385de5d..a62ccf73d 100644
--- a/Greenshot/Forms/MainForm.cs
+++ b/Greenshot/Forms/MainForm.cs
@@ -592,7 +592,7 @@ namespace Greenshot {
openFileDialog.Filter = "Image files (*.png, *.jpg, *.gif, *.bmp, *.ico, *.tiff, *.wmf)|*.png; *.jpg; *.jpeg; *.gif; *.bmp; *.ico; *.tiff; *.tif; *.wmf";
if (openFileDialog.ShowDialog() == DialogResult.OK) {
if (File.Exists(openFileDialog.FileName)) {
- CaptureHelper.CaptureFile(openFileDialog.FileName);
+ CaptureHelper.CaptureFile(openFileDialog.FileName);
}
}
}
@@ -1087,10 +1087,43 @@ namespace Greenshot {
new BugReportForm(exceptionText).ShowDialog();
}
+ ///
+ /// Handle the notify icon click
+ ///
+ ///
+ ///
private void NotifyIconClick(object sender, MouseEventArgs e) {
+ // The right button will automatically be handled with the context menu, here we only check the left.
if (e.Button == MouseButtons.Left) {
- MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
- oMethodInfo.Invoke(notifyIcon, null);
+ switch (conf.LeftClickAction) {
+ case LeftClickActions.OPEN_LAST_IN_EXPLORER:
+ string path = null;
+ string configPath = FilenameHelper.FillVariables(conf.OutputFilePath, false);
+ string lastFilePath = Path.GetDirectoryName(conf.OutputFileAsFullpath);
+ if (Directory.Exists(lastFilePath)) {
+ path = lastFilePath;
+ } else if (Directory.Exists(configPath)) {
+ path = configPath;
+ }
+
+ try {
+ System.Diagnostics.Process.Start(path);
+ } catch (Exception ex) {
+ // Make sure we show what we tried to open in the exception
+ ex.Data.Add("path", path);
+ throw ex;
+ }
+ break;
+ case LeftClickActions.OPEN_LAST_IN_EDITOR:
+ if (File.Exists(conf.OutputFileAsFullpath)) {
+ CaptureHelper.CaptureFile(conf.OutputFileAsFullpath, DestinationHelper.GetDestination(EditorDestination.DESIGNATION));
+ }
+ break;
+ default:
+ MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
+ oMethodInfo.Invoke(notifyIcon, null);
+ break;
+ }
}
}
diff --git a/Greenshot/Helpers/CaptureHelper.cs b/Greenshot/Helpers/CaptureHelper.cs
index 790ddf390..1d602a1df 100644
--- a/Greenshot/Helpers/CaptureHelper.cs
+++ b/Greenshot/Helpers/CaptureHelper.cs
@@ -86,24 +86,36 @@ namespace Greenshot.Helpers {
public static void CaptureWindow(bool captureMouse) {
new CaptureHelper(CaptureMode.ActiveWindow, captureMouse).MakeCapture();
}
+
public static void CaptureWindow(WindowDetails windowToCapture) {
CaptureHelper captureHelper = new CaptureHelper(CaptureMode.ActiveWindow);
captureHelper.SelectedCaptureWindow = windowToCapture;
captureHelper.MakeCapture();
}
+
public static void CaptureWindowInteractive(bool captureMouse) {
new CaptureHelper(CaptureMode.Window, captureMouse).MakeCapture();
}
+
public static void CaptureFile(string filename) {
new CaptureHelper(CaptureMode.File).MakeCapture(filename);
}
+ public static void CaptureFile(string filename, IDestination destination) {
+ new CaptureHelper(CaptureMode.File).AddDestination(destination).MakeCapture(filename);
+ }
+
public static void ImportCapture(ICapture captureToImport) {
CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
captureHelper.capture = captureToImport;
captureHelper.HandleCapture();
}
+ public CaptureHelper AddDestination(IDestination destination) {
+ capture.CaptureDetails.AddDestination(destination);
+ return this;
+ }
+
public CaptureHelper(CaptureMode captureMode) {
this.captureMode = captureMode;
capture = new Capture();