protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Escape) {
this.Close();
} else if (keyData == Keys.P) {
if (this.Selection.Width > 0 && this.Selection.Height > 0) {
Bitmap img = null;
try {
img = this.SelectionImage;
} catch { }
if (img != null) {
if (this.settings.GetInt("DragEditor") == 0) {
Addon.SetShortcuts(true);
new FormEditor(img, this.DoneDragging).Show();
} else if (this.settings.GetInt("DragEditor") == 1) {
string exePath = this.settings.GetString("DragExtraPath");
if (File.Exists(exePath)) {
string localTempPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Temp\\" + Addon.RandomString(16) + ".png";
MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Png);
File.WriteAllBytes(localTempPath, ms.GetBuffer());
Process.Start(exePath, "\"" + localTempPath + "\"");
}
}
this.Close();
if (DoneDragging != null) {
//TODO: What do with this? Could return NULL as image, but then every addon must respond
// accordingly to that. Can also not be triggered, but could break some addon code
// in the progress. Same goes with doing a DragCallback with DragCallbackType.None,
// it could potentially break existing addon code. Decisions, decisions...
}
}
}
} else if (keyData == Keys.O) {
if (this.AnimationAllowed) {
this.Close();
Addon.SetShortcuts(true);
new FormAnimation(this, this.Selection, this.DoneDragging).Show();
}
}
return base.ProcessCmdKey(ref msg, keyData);
}