Ram Search - Context menu item "View in Hex Editor" implemented

This commit is contained in:
andres.delikat 2011-03-10 04:22:56 +00:00
parent 28a093adac
commit ae2b97050e
4 changed files with 40 additions and 16 deletions

View File

@ -979,7 +979,7 @@ namespace BizHawk.MultiClient
RamSearch1.Focus();
}
private void LoadHexEditor()
public void LoadHexEditor()
{
if (!HexEditor1.IsHandleCreated || HexEditor1.IsDisposed)
{

View File

@ -156,6 +156,15 @@ namespace BizHawk.MultiClient
memoryDomainsToolStripMenuItem.Enabled = false;
}
public void GoToAddress(int address)
{
if (address < MemoryViewer.GetSize())
{
MemoryViewer.SetHighlighted(address);
MemoryViewer.Refresh();
}
}
private void goToAddressToolStripMenuItem_Click(object sender, EventArgs e)
{
InputPrompt i = new InputPrompt();
@ -167,13 +176,7 @@ namespace BizHawk.MultiClient
{
if (InputValidate.IsValidHexNumber(i.UserText))
{
int address = int.Parse(i.UserText, NumberStyles.HexNumber);
if (address < MemoryViewer.GetSize())
{
MemoryViewer.SetHighlighted(address);
MemoryViewer.Refresh();
}
GoToAddress(int.Parse(i.UserText, NumberStyles.HexNumber));
}
}
}

View File

@ -96,6 +96,7 @@
this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton();
this.WatchCountLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.viewInHexEditorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
@ -416,6 +417,7 @@
this.removeToolStripMenuItem,
this.duplicateToolStripMenuItem,
this.pokeToolStripMenuItem,
this.viewInHexEditorToolStripMenuItem,
this.toolStripSeparator6,
this.insertSeperatorToolStripMenuItem,
this.moveUpToolStripMenuItem1,
@ -425,7 +427,7 @@
this.showPreviousValueToolStripMenuItem1,
this.prevValueAsChangeAmountToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(228, 258);
this.contextMenuStrip1.Size = new System.Drawing.Size(228, 280);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// editToolStripMenuItem
@ -686,6 +688,13 @@
this.MessageLabel.TabIndex = 5;
this.MessageLabel.Text = " ";
//
// viewInHexEditorToolStripMenuItem
//
this.viewInHexEditorToolStripMenuItem.Name = "viewInHexEditorToolStripMenuItem";
this.viewInHexEditorToolStripMenuItem.Size = new System.Drawing.Size(227, 22);
this.viewInHexEditorToolStripMenuItem.Text = "View in Hex Editor";
this.viewInHexEditorToolStripMenuItem.Click += new System.EventHandler(this.viewInHexEditorToolStripMenuItem_Click);
//
// RamWatch
//
this.AllowDrop = true;
@ -783,5 +792,6 @@
private System.Windows.Forms.ToolStripMenuItem showChangeCountsToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem showPreviousValueToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem prevValueAsChangeAmountToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewInHexEditorToolStripMenuItem;
}
}

View File

@ -929,8 +929,9 @@ namespace BizHawk.MultiClient
contextMenuStrip1.Items[2].Visible = false;
contextMenuStrip1.Items[3].Visible = false;
contextMenuStrip1.Items[4].Visible = false;
contextMenuStrip1.Items[6].Visible = false;
contextMenuStrip1.Items[5].Visible = false;
contextMenuStrip1.Items[7].Visible = false;
contextMenuStrip1.Items[8].Visible = false;
}
else
@ -940,19 +941,19 @@ namespace BizHawk.MultiClient
}
if (Global.Config.RamWatchShowChangeColumn)
contextMenuStrip1.Items[9].Text = "Hide change counts";
contextMenuStrip1.Items[10].Text = "Hide change counts";
else
contextMenuStrip1.Items[9].Text = "Show change counts";
contextMenuStrip1.Items[10].Text = "Show change counts";
if (Global.Config.RamWatchShowPrevColumn)
contextMenuStrip1.Items[10].Text = "Hide previous value";
contextMenuStrip1.Items[11].Text = "Hide previous value";
else
contextMenuStrip1.Items[10].Text = "Show previous value";
contextMenuStrip1.Items[11].Text = "Show previous value";
if (Global.Config.RamWatchShowChangeFromPrev)
contextMenuStrip1.Items[11].Text = "Display Previous value as previous";
contextMenuStrip1.Items[12].Text = "Display Previous value as previous";
else
contextMenuStrip1.Items[11].Text = "Display Previosu value as change amount";
contextMenuStrip1.Items[12].Text = "Display Previosu value as change amount";
}
private void WatchListView_MouseDoubleClick(object sender, MouseEventArgs e)
@ -1041,5 +1042,15 @@ namespace BizHawk.MultiClient
{
prevValueShowsChangeAmountToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeFromPrev;
}
private void viewInHexEditorToolStripMenuItem_Click(object sender, EventArgs e)
{
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
if (indexes.Count > 0)
{
Global.MainForm.LoadHexEditor();
Global.MainForm.HexEditor1.GoToAddress(watchList[indexes[0]].address);
}
}
}
}