From ab570aa47da056c0e883606ae89619e31c4487b7 Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 11 Dec 2012 20:27:08 +0000 Subject: [PATCH] snesgfxdebugger-make clipboard image copying less flaky. natt may be interested in this. --- .../SNESTools/SNESGraphicsDebugger.Designer.cs | 1 - .../SNESTools/SNESGraphicsDebugger.cs | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.Designer.cs b/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.Designer.cs index 02ec26fae1..532d461491 100644 --- a/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.Designer.cs +++ b/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.Designer.cs @@ -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); diff --git a/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.cs b/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.cs index 4cb70b03df..add3dd3138 100644 --- a/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.cs +++ b/BizHawk.MultiClient/SNESTools/SNESGraphicsDebugger.cs @@ -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();