From f33837bf5df2c1063807954c02c46c2c8b4061c7 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 10 Mar 2011 19:25:01 +0000 Subject: [PATCH] Hex Editor - arrow & tab keys navigate the memory viewer --- .../tools/HexEditor.Designer.cs | 17 ++++----- BizHawk.MultiClient/tools/MemoryViewer.cs | 35 +++++++++++++++++++ 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/BizHawk.MultiClient/tools/HexEditor.Designer.cs b/BizHawk.MultiClient/tools/HexEditor.Designer.cs index 2375443be9..e9cadabf68 100644 --- a/BizHawk.MultiClient/tools/HexEditor.Designer.cs +++ b/BizHawk.MultiClient/tools/HexEditor.Designer.cs @@ -48,13 +48,13 @@ this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveWindowsSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.AddressBox = new System.Windows.Forms.TextBox(); this.ViewerContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.pokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.freezeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToRamWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MemoryViewer = new BizHawk.MultiClient.MemoryViewer(); - this.saveWindowsSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.ViewerContextMenuStrip.SuspendLayout(); this.SuspendLayout(); @@ -203,8 +203,16 @@ this.autoloadToolStripMenuItem.Text = "Auto-load"; this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click); // + // saveWindowsSettingsToolStripMenuItem + // + this.saveWindowsSettingsToolStripMenuItem.Name = "saveWindowsSettingsToolStripMenuItem"; + this.saveWindowsSettingsToolStripMenuItem.Size = new System.Drawing.Size(194, 22); + this.saveWindowsSettingsToolStripMenuItem.Text = "Save windows settings"; + this.saveWindowsSettingsToolStripMenuItem.Click += new System.EventHandler(this.saveWindowsSettingsToolStripMenuItem_Click); + // // AddressBox // + this.AddressBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.AddressBox.Location = new System.Drawing.Point(487, 37); this.AddressBox.Name = "AddressBox"; this.AddressBox.ReadOnly = true; @@ -256,13 +264,6 @@ this.MemoryViewer.Paint += new System.Windows.Forms.PaintEventHandler(this.MemoryViewer_Paint); this.MemoryViewer.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.MemoryViewer_MouseDoubleClick); // - // saveWindowsSettingsToolStripMenuItem - // - this.saveWindowsSettingsToolStripMenuItem.Name = "saveWindowsSettingsToolStripMenuItem"; - this.saveWindowsSettingsToolStripMenuItem.Size = new System.Drawing.Size(194, 22); - this.saveWindowsSettingsToolStripMenuItem.Text = "Save windows settings"; - this.saveWindowsSettingsToolStripMenuItem.Click += new System.EventHandler(this.saveWindowsSettingsToolStripMenuItem_Click); - // // HexEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/BizHawk.MultiClient/tools/MemoryViewer.cs b/BizHawk.MultiClient/tools/MemoryViewer.cs index dea8b38e68..73a9581f4b 100644 --- a/BizHawk.MultiClient/tools/MemoryViewer.cs +++ b/BizHawk.MultiClient/tools/MemoryViewer.cs @@ -66,6 +66,41 @@ namespace BizHawk.MultiClient this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.MemoryViewer_KeyDown); } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + if (keyData == Keys.Up) + { + addressHighlighted -= 16; + this.Refresh(); + } + + else if (keyData == Keys.Down) + { + addressHighlighted += 16; + this.Refresh(); + } + + else if (keyData == Keys.Left) + { + addressHighlighted -= 1; + this.Refresh(); + } + + else if (keyData == Keys.Right) + { + addressHighlighted += 1; + this.Refresh(); + } + + else if (keyData == Keys.Tab) + { + addressHighlighted += 8; + this.Refresh(); + } + + return true; + } + private void ClearNibbles() { for (int x = 0; x < 4; x++)