Ram Watch - add conditional Unfreeze All context menu item, allow unfreeze on multiple highlighted frozen addresses

This commit is contained in:
adelikat 2012-09-23 15:19:58 +00:00
parent c3c3fd6c20
commit efbeac59b5
2 changed files with 87 additions and 28 deletions

View File

@ -87,6 +87,7 @@
this.showChangeCountsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.showPreviousValueToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.showDifferenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showDomainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WatchCountLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.MemDomainLabel = new System.Windows.Forms.Label();
@ -114,7 +115,7 @@
this.Diff = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Notes = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.showDomainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.unfreezeAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
@ -490,6 +491,7 @@
this.duplicateToolStripMenuItem,
this.pokeToolStripMenuItem,
this.freezeToolStripMenuItem,
this.unfreezeAllToolStripMenuItem,
this.viewInHexEditorToolStripMenuItem,
this.toolStripSeparator6,
this.insertSeperatorToolStripMenuItem,
@ -501,7 +503,7 @@
this.showDifferenceToolStripMenuItem,
this.showDomainToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(189, 324);
this.contextMenuStrip1.Size = new System.Drawing.Size(189, 346);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// editToolStripMenuItem
@ -606,6 +608,13 @@
this.showDifferenceToolStripMenuItem.Text = "Show Difference";
this.showDifferenceToolStripMenuItem.Click += new System.EventHandler(this.showDifferenceToolStripMenuItem_Click);
//
// showDomainToolStripMenuItem
//
this.showDomainToolStripMenuItem.Name = "showDomainToolStripMenuItem";
this.showDomainToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.showDomainToolStripMenuItem.Text = "Show Domain";
this.showDomainToolStripMenuItem.Click += new System.EventHandler(this.showDomainToolStripMenuItem_Click);
//
// WatchCountLabel
//
this.WatchCountLabel.AutoSize = true;
@ -876,12 +885,12 @@
this.Notes.Text = "Notes";
this.Notes.Width = 128;
//
// showDomainToolStripMenuItem
// unfreezeAllToolStripMenuItem
//
this.showDomainToolStripMenuItem.Name = "showDomainToolStripMenuItem";
this.showDomainToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.showDomainToolStripMenuItem.Text = "Show Domain";
this.showDomainToolStripMenuItem.Click += new System.EventHandler(this.showDomainToolStripMenuItem_Click);
this.unfreezeAllToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Unfreeze;
this.unfreezeAllToolStripMenuItem.Name = "unfreezeAllToolStripMenuItem";
this.unfreezeAllToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
this.unfreezeAllToolStripMenuItem.Text = "Unfreeze &All";
//
// RamWatch
//
@ -1003,5 +1012,6 @@
private System.Windows.Forms.ColumnHeader DomainColumn;
private System.Windows.Forms.ToolStripMenuItem domainToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem showDomainToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem unfreezeAllToolStripMenuItem;
}
}

View File

@ -998,53 +998,93 @@ namespace BizHawk.MultiClient
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
if (indexes.Count == 0)
{
contextMenuStrip1.Items[0].Visible = false;
contextMenuStrip1.Items[1].Visible = false;
contextMenuStrip1.Items[2].Visible = false;
contextMenuStrip1.Items[3].Visible = false;
contextMenuStrip1.Items[4].Visible = false;
contextMenuStrip1.Items[5].Visible = false;
contextMenuStrip1.Items[6].Visible = false;
contextMenuStrip1.Items[8].Visible = false;
contextMenuStrip1.Items[9].Visible = false;
editToolStripMenuItem.Visible = false;
removeToolStripMenuItem.Visible = false;
duplicateToolStripMenuItem.Visible = false;
pokeToolStripMenuItem.Visible = false;
freezeToolStripMenuItem.Visible = false;
viewInHexEditorToolStripMenuItem.Visible = false;
toolStripSeparator6.Visible = false;
insertSeperatorToolStripMenuItem.Visible = false;
moveUpToolStripMenuItem1.Visible = false;
moveDownToolStripMenuItem1.Visible = false;
toolStripSeparator2.Visible = false;
}
else
{
for (int x = 0; x < contextMenuStrip1.Items.Count; x++)
contextMenuStrip1.Items[x].Visible = true;
for (int i = 0; i < contextMenuStrip1.Items.Count; i++)
{
contextMenuStrip1.Items[i].Visible = true;
}
if (indexes.Count == 1)
{
if (Global.CheatList.IsActiveCheat(Domain, Watches[indexes[0]].Address))
{
contextMenuStrip1.Items[4].Text = "&Unfreeze address";
contextMenuStrip1.Items[4].Image =
freezeToolStripMenuItem.Text = "&Unfreeze address";
freezeToolStripMenuItem.Image =
BizHawk.MultiClient.Properties.Resources.Unfreeze;
}
else
{
contextMenuStrip1.Items[4].Text = "&Freeze address";
contextMenuStrip1.Items[4].Image =
freezeToolStripMenuItem.Text = "&Freeze address";
freezeToolStripMenuItem.Image =
BizHawk.MultiClient.Properties.Resources.Freeze;
}
}
else
{
bool allCheats = true;
foreach (int i in indexes)
{
if (!Global.CheatList.IsActiveCheat(Domain, Watches[i].Address))
{
allCheats = false;
}
}
if (allCheats)
{
freezeToolStripMenuItem.Text = "&Unfreeze address";
freezeToolStripMenuItem.Image =
BizHawk.MultiClient.Properties.Resources.Unfreeze;
}
else
{
freezeToolStripMenuItem.Text = "&Freeze address";
freezeToolStripMenuItem.Image =
BizHawk.MultiClient.Properties.Resources.Freeze;
}
}
}
if (Global.Config.RamWatchShowChangeColumn)
contextMenuStrip1.Items[11].Text = "Hide change counts";
{
showChangeCountsToolStripMenuItem1.Text = "Hide change counts";
}
else
contextMenuStrip1.Items[11].Text = "Show change counts";
{
showChangeCountsToolStripMenuItem1.Text = "Show change counts";
}
if (Global.Config.RamWatchShowPrevColumn)
contextMenuStrip1.Items[12].Text = "Hide previous value";
{
showPreviousValueToolStripMenuItem1.Text = "Hide previous value";
}
else
contextMenuStrip1.Items[12].Text = "Show previous value";
{
showPreviousValueToolStripMenuItem1.Text = "Show previous value";
}
if (Global.Config.RamWatchShowDiffColumn)
contextMenuStrip1.Items[13].Text = "Hide difference value";
{
showDifferenceToolStripMenuItem.Text = "Hide difference value";
}
else
contextMenuStrip1.Items[13].Text = "Show difference value";
{
showDifferenceToolStripMenuItem.Text = "Show difference value";
}
if (Global.Config.RamWatchShowDomainColumn)
{
@ -1055,6 +1095,15 @@ namespace BizHawk.MultiClient
showDomainToolStripMenuItem.Text = "Show domain";
}
if (Global.CheatList.HasActiveCheats)
{
unfreezeAllToolStripMenuItem.Visible = true;
}
else
{
unfreezeAllToolStripMenuItem.Visible = false;
}
}
private void WatchListView_MouseDoubleClick(object sender, MouseEventArgs e)