mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
Fixed file handling, fixed wrong order in the title of the editor, changed left-click handling of the context menu. Added a boolean in the ProcessCmdKey of the surface.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2327 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
c5fef12c9b
commit
2a26be0a37
4 changed files with 56 additions and 8 deletions
|
@ -1556,10 +1556,11 @@ namespace Greenshot.Drawing {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Process key
|
/// Process key presses on the surface, this is called from the editor (and NOT an override from the Control)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="k"></param>
|
/// <param name="k">Keys</param>
|
||||||
public void ProcessCmdKey(Keys k) {
|
/// <returns>false if no keys were processed</returns>
|
||||||
|
public bool ProcessCmdKey(Keys k) {
|
||||||
if (selectedElements.Count > 0) {
|
if (selectedElements.Count > 0) {
|
||||||
bool shiftModifier = (Control.ModifierKeys & Keys.Shift) == Keys.Shift;
|
bool shiftModifier = (Control.ModifierKeys & Keys.Shift) == Keys.Shift;
|
||||||
int px = shiftModifier ? 10 : 1;
|
int px = shiftModifier ? 10 : 1;
|
||||||
|
@ -1604,13 +1605,15 @@ namespace Greenshot.Drawing {
|
||||||
RemoveSelectedElements();
|
RemoveSelectedElements();
|
||||||
break;*/
|
break;*/
|
||||||
default:
|
default:
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Point.Empty.Equals(moveBy)) {
|
if (!Point.Empty.Equals(moveBy)) {
|
||||||
selectedElements.MakeBoundsChangeUndoable(true);
|
selectedElements.MakeBoundsChangeUndoable(true);
|
||||||
selectedElements.MoveBy(moveBy.X, moveBy.Y);
|
selectedElements.MoveBy(moveBy.X, moveBy.Y);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -384,7 +384,7 @@ namespace Greenshot {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateStatusLabel(Language.GetFormattedString(LangKey.editor_imagesaved, fullpath), fileSavedStatusContextMenu);
|
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) {
|
void surface_DrawingModeChanged(object source, DrawingModes drawingMode) {
|
||||||
|
|
|
@ -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";
|
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 (openFileDialog.ShowDialog() == DialogResult.OK) {
|
||||||
if (File.Exists(openFileDialog.FileName)) {
|
if (File.Exists(openFileDialog.FileName)) {
|
||||||
CaptureHelper.CaptureFile(openFileDialog.FileName);
|
CaptureHelper.CaptureFile(openFileDialog.FileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1087,10 +1087,43 @@ namespace Greenshot {
|
||||||
new BugReportForm(exceptionText).ShowDialog();
|
new BugReportForm(exceptionText).ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle the notify icon click
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void NotifyIconClick(object sender, MouseEventArgs e) {
|
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) {
|
if (e.Button == MouseButtons.Left) {
|
||||||
MethodInfo oMethodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
|
switch (conf.LeftClickAction) {
|
||||||
oMethodInfo.Invoke(notifyIcon, null);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,24 +86,36 @@ namespace Greenshot.Helpers {
|
||||||
public static void CaptureWindow(bool captureMouse) {
|
public static void CaptureWindow(bool captureMouse) {
|
||||||
new CaptureHelper(CaptureMode.ActiveWindow, captureMouse).MakeCapture();
|
new CaptureHelper(CaptureMode.ActiveWindow, captureMouse).MakeCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CaptureWindow(WindowDetails windowToCapture) {
|
public static void CaptureWindow(WindowDetails windowToCapture) {
|
||||||
CaptureHelper captureHelper = new CaptureHelper(CaptureMode.ActiveWindow);
|
CaptureHelper captureHelper = new CaptureHelper(CaptureMode.ActiveWindow);
|
||||||
captureHelper.SelectedCaptureWindow = windowToCapture;
|
captureHelper.SelectedCaptureWindow = windowToCapture;
|
||||||
captureHelper.MakeCapture();
|
captureHelper.MakeCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CaptureWindowInteractive(bool captureMouse) {
|
public static void CaptureWindowInteractive(bool captureMouse) {
|
||||||
new CaptureHelper(CaptureMode.Window, captureMouse).MakeCapture();
|
new CaptureHelper(CaptureMode.Window, captureMouse).MakeCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CaptureFile(string filename) {
|
public static void CaptureFile(string filename) {
|
||||||
new CaptureHelper(CaptureMode.File).MakeCapture(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) {
|
public static void ImportCapture(ICapture captureToImport) {
|
||||||
CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
CaptureHelper captureHelper = new CaptureHelper(CaptureMode.File);
|
||||||
captureHelper.capture = captureToImport;
|
captureHelper.capture = captureToImport;
|
||||||
captureHelper.HandleCapture();
|
captureHelper.HandleCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CaptureHelper AddDestination(IDestination destination) {
|
||||||
|
capture.CaptureDetails.AddDestination(destination);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CaptureHelper(CaptureMode captureMode) {
|
public CaptureHelper(CaptureMode captureMode) {
|
||||||
this.captureMode = captureMode;
|
this.captureMode = captureMode;
|
||||||
capture = new Capture();
|
capture = new Capture();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue