snesgfxdebugger-make clipboard image copying less flaky. natt may be interested in this.

This commit is contained in:
zeromus 2012-12-11 20:27:08 +00:00
parent 31fba1ec2b
commit ab570aa47d
2 changed files with 13 additions and 6 deletions

View File

@ -2703,7 +2703,6 @@
this.Name = "SNESGraphicsDebugger";
this.Text = "SNES Graphics Debugger";
this.Load += new System.EventHandler(this.SNESGraphicsDebugger_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SNESGraphicsDebugger_KeyDown);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);

View File

@ -1269,9 +1269,9 @@ namespace BizHawk.MultiClient
}
}
private void SNESGraphicsDebugger_KeyDown(object sender, KeyEventArgs e)
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (Control.ModifierKeys.HasFlag(Keys.Control) && e.KeyCode == Keys.C)
if(keyData == (Keys.C | Keys.Control))
{
// find the control under the mouse
Point m = System.Windows.Forms.Cursor.Position;
@ -1286,8 +1286,11 @@ namespace BizHawk.MultiClient
if (found != null && found is SNESGraphicsViewer)
{
var v = found as SNESGraphicsViewer;
lock(v)
Clipboard.SetImage(v.GetBitmap());
lock (v)
{
var bmp = v.GetBitmap();
Clipboard.SetImage(bmp);
}
string label = "";
if (found.Name == "viewer")
label = displayTypeItems.Find((x) => x.type == CurrDisplaySelection).descr;
@ -1295,15 +1298,20 @@ namespace BizHawk.MultiClient
label = "Tile";
if (found.Name == "viewerMapEntryTile")
label = "Map Entry";
if(found.Name == "paletteViewer")
if (found.Name == "paletteViewer")
label = "Palette";
labelClipboard.Text = label + " copied to clipboard.";
messagetimer.Stop();
messagetimer.Start();
return true;
}
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void messagetimer_Tick(object sender, EventArgs e)
{
messagetimer.Stop();