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.Name = "SNESGraphicsDebugger";
this.Text = "SNES Graphics Debugger"; this.Text = "SNES Graphics Debugger";
this.Load += new System.EventHandler(this.SNESGraphicsDebugger_Load); this.Load += new System.EventHandler(this.SNESGraphicsDebugger_Load);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SNESGraphicsDebugger_KeyDown);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false); 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 // find the control under the mouse
Point m = System.Windows.Forms.Cursor.Position; Point m = System.Windows.Forms.Cursor.Position;
@ -1286,8 +1286,11 @@ namespace BizHawk.MultiClient
if (found != null && found is SNESGraphicsViewer) if (found != null && found is SNESGraphicsViewer)
{ {
var v = found as SNESGraphicsViewer; var v = found as SNESGraphicsViewer;
lock(v) lock (v)
Clipboard.SetImage(v.GetBitmap()); {
var bmp = v.GetBitmap();
Clipboard.SetImage(bmp);
}
string label = ""; string label = "";
if (found.Name == "viewer") if (found.Name == "viewer")
label = displayTypeItems.Find((x) => x.type == CurrDisplaySelection).descr; label = displayTypeItems.Find((x) => x.type == CurrDisplaySelection).descr;
@ -1295,15 +1298,20 @@ namespace BizHawk.MultiClient
label = "Tile"; label = "Tile";
if (found.Name == "viewerMapEntryTile") if (found.Name == "viewerMapEntryTile")
label = "Map Entry"; label = "Map Entry";
if(found.Name == "paletteViewer") if (found.Name == "paletteViewer")
label = "Palette"; label = "Palette";
labelClipboard.Text = label + " copied to clipboard."; labelClipboard.Text = label + " copied to clipboard.";
messagetimer.Stop(); messagetimer.Stop();
messagetimer.Start(); messagetimer.Start();
return true;
} }
} }
return base.ProcessCmdKey(ref msg, keyData);
} }
private void messagetimer_Tick(object sender, EventArgs e) private void messagetimer_Tick(object sender, EventArgs e)
{ {
messagetimer.Stop(); messagetimer.Stop();