Add 'Edit Image' to context file list right click menu when an image is selected.

This commit is contained in:
DevAtHome 2014-07-16 21:43:20 +01:00
parent 036a0190c4
commit 7316e2d9d5
4 changed files with 32 additions and 1 deletions

View file

@ -142,6 +142,7 @@ private void InitializeComponent()
this.tsmiCopyFolder = new System.Windows.Forms.ToolStripMenuItem();
this.tssCopy5 = new System.Windows.Forms.ToolStripSeparator();
this.tsmiUploadSelectedFile = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiEditSelectedFile = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShortenSelectedURL = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShareSelectedURL = new System.Windows.Forms.ToolStripMenuItem();
this.tsmiShowQRCode = new System.Windows.Forms.ToolStripMenuItem();
@ -947,6 +948,7 @@ private void InitializeComponent()
this.tsmiOpen,
this.tsmiCopy,
this.tsmiUploadSelectedFile,
this.tsmiEditSelectedFile,
this.tsmiShortenSelectedURL,
this.tsmiShareSelectedURL,
this.tsmiShowQRCode,
@ -1239,6 +1241,13 @@ private void InitializeComponent()
this.tsmiUploadSelectedFile.Text = "Upload";
this.tsmiUploadSelectedFile.Click += new System.EventHandler(this.tsmiUploadSelectedFile_Click);
//
// tsmiEditSelectedFile
//
this.tsmiEditSelectedFile.Name = "tsmiEditSelectedFile";
this.tsmiEditSelectedFile.Size = new System.Drawing.Size(128, 22);
this.tsmiEditSelectedFile.Text = "Edit Image";
this.tsmiEditSelectedFile.Click += new System.EventHandler(this.tsmiEditSelectedFile_Click);
//
// tsmiShortenSelectedURL
//
this.tsmiShortenSelectedURL.Name = "tsmiShortenSelectedURL";
@ -2057,5 +2066,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem tsmiShortenSelectedURL;
private System.Windows.Forms.ToolStripMenuItem tsmiRectangleAnnotate;
private System.Windows.Forms.ToolStripMenuItem tsmiTrayRectangleAnnotate;
private System.Windows.Forms.ToolStripMenuItem tsmiEditSelectedFile;
}
}

View file

@ -295,7 +295,7 @@ private void UpdateControls()
{
cmsUploadInfo.SuspendLayout();
tsmiStopUpload.Visible = tsmiOpen.Visible = tsmiCopy.Visible = tsmiShowErrors.Visible = tsmiShowResponse.Visible = tsmiShowQRCode.Visible =
tsmiStopUpload.Visible = tsmiOpen.Visible = tsmiCopy.Visible = tsmiShowErrors.Visible = tsmiShowResponse.Visible = tsmiShowQRCode.Visible = tsmiEditSelectedFile.Visible =
tsmiUploadSelectedFile.Visible = tsmiShortenSelectedURL.Visible = tsmiShareSelectedURL.Visible = tsmiClearList.Visible = tssUploadInfo1.Visible = false;
pbPreview.Reset();
uim.RefreshSelectedItems();
@ -362,6 +362,9 @@ private void UpdateControls()
tsmiCopyFileNameWithExtension.Enabled = uim.SelectedItems.Any(x => x.IsFilePathValid);
tsmiCopyFolder.Enabled = uim.SelectedItems.Any(x => x.IsFilePathValid);
// Edit
tsmiEditSelectedFile.Visible = uim.SelectedItem.IsImageFile;
CleanCustomClipboardFormats();
if (Program.Settings.ClipboardContentFormats != null && Program.Settings.ClipboardContentFormats.Count > 0)
@ -1185,6 +1188,11 @@ private void tsmiUploadSelectedFile_Click(object sender, EventArgs e)
uim.Upload();
}
private void tsmiEditSelectedFile_Click(object sender, EventArgs e)
{
uim.EditImage();
}
private void tsmiClearList_Click(object sender, EventArgs e)
{
RemoveAllItems();

View file

@ -513,6 +513,14 @@ public static void OpenImageEditor()
}
}
public static void OpenImageEditor(string filePath)
{
if (!string.IsNullOrEmpty(filePath))
{
TaskHelpers.AnnotateImage(filePath);
}
}
public static void OpenImageEffects()
{
string filePath = ImageHelpers.OpenImageFileDialog();

View file

@ -309,6 +309,11 @@ public void ShowResponse()
}
}
public void EditImage()
{
if (IsItemSelected && SelectedItem.IsImageFile) TaskHelpers.OpenImageEditor(SelectedItem.Info.FilePath);
}
#endregion Other
}
}