Ram Search - add "Clear Preview" to context menu, clears out the red coloring preview. Also some misc tweaks to colors and some code cleanup

This commit is contained in:
adelikat 2013-08-21 20:54:33 +00:00
parent 872a3208d3
commit 706a863caa
2 changed files with 78 additions and 45 deletions

View File

@ -102,6 +102,7 @@
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
this.alwaysOnTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreOriginalWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.useUndoHistoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStrip1 = new ToolStripEx();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
@ -148,7 +149,8 @@
this.MemDomainLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.useUndoHistoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
this.clearPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SearchtoolStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
@ -348,9 +350,11 @@
this.pokeAddressToolStripMenuItem1,
this.unfreezeAllToolStripMenuItem,
this.toolStripSeparator12,
this.viewInHexEditorToolStripMenuItem});
this.viewInHexEditorToolStripMenuItem,
this.toolStripSeparator14,
this.clearPreviewToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(216, 192);
this.contextMenuStrip1.Size = new System.Drawing.Size(216, 242);
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
//
// startNewSearchToolStripMenuItem
@ -801,6 +805,13 @@
this.restoreOriginalWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreOriginalWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreOriginalWindowSizeToolStripMenuItem_Click);
//
// useUndoHistoryToolStripMenuItem
//
this.useUndoHistoryToolStripMenuItem.Name = "useUndoHistoryToolStripMenuItem";
this.useUndoHistoryToolStripMenuItem.Size = new System.Drawing.Size(240, 22);
this.useUndoHistoryToolStripMenuItem.Text = "&Use Undo History";
this.useUndoHistoryToolStripMenuItem.Click += new System.EventHandler(this.useUndoHistoryToolStripMenuItem_Click);
//
// toolStrip1
//
this.toolStrip1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -1279,12 +1290,17 @@
this.MessageLabel.TabIndex = 9;
this.MessageLabel.Text = " ";
//
// useUndoHistoryToolStripMenuItem
// toolStripSeparator14
//
this.useUndoHistoryToolStripMenuItem.Name = "useUndoHistoryToolStripMenuItem";
this.useUndoHistoryToolStripMenuItem.Size = new System.Drawing.Size(240, 22);
this.useUndoHistoryToolStripMenuItem.Text = "&Use Undo History";
this.useUndoHistoryToolStripMenuItem.Click += new System.EventHandler(this.useUndoHistoryToolStripMenuItem_Click);
this.toolStripSeparator14.Name = "toolStripSeparator14";
this.toolStripSeparator14.Size = new System.Drawing.Size(212, 6);
//
// clearPreviewToolStripMenuItem
//
this.clearPreviewToolStripMenuItem.Name = "clearPreviewToolStripMenuItem";
this.clearPreviewToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
this.clearPreviewToolStripMenuItem.Text = "&Clear Preview";
this.clearPreviewToolStripMenuItem.Click += new System.EventHandler(this.clearPreviewToolStripMenuItem_Click);
//
// RamSearch
//
@ -1451,5 +1467,7 @@
private System.Windows.Forms.ToolStripMenuItem clearUndoHistoryToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fastModeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem useUndoHistoryToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripMenuItem clearPreviewToolStripMenuItem;
}
}

View File

@ -41,6 +41,7 @@ namespace BizHawk.MultiClient
private string addressFormatStr = "{0:X4} ";
private bool sortReverse;
private string sortedCol;
private bool forcePreviewClear = false;
public void SaveConfigSettings()
{
@ -572,57 +573,65 @@ namespace BizHawk.MultiClient
private void SearchListView_QueryItemBkColor(int index, int column, ref Color color)
{
if (IsAWeededList && column == 0)
if (IsAWeededList && column == 0 && Searches[index].Deleted)
{
if (Searches[index].Deleted)
if (color == Color.Pink)
{
if (color == Color.Pink) return;
if (Global.CheatList.IsActiveCheat(Domain, Searches[index].Address))
{
if (color == Color.Purple)
{
return;
}
else
{
color = Color.Purple;
}
}
else
{
if (color == Color.Pink)
{
return;
}
else
{
color = Color.Pink;
}
}
return;
}
else if (Global.CheatList.IsActiveCheat(Domain, Searches[index].Address))
{
if (color == Color.LightCyan)
if (forcePreviewClear)
{
color = Color.LightCyan;
}
else if (color == Color.Lavender)
{
return;
}
else
{
color = Color.LightCyan;
color = Color.Lavender;
}
}
else
{
if (color == Color.White)
if (forcePreviewClear)
{
color = Color.White;
}
else if (color == Color.Pink)
{
return;
}
else
{
color = Color.White;
color = Color.Pink;
}
}
}
else if (Global.CheatList.IsActiveCheat(Domain, Searches[index].Address))
{
if (color == Color.LightCyan)
{
return;
}
else
{
color = Color.LightCyan;
}
}
else
{
if (color == Color.White)
{
return;
}
else
{
color = Color.White;
}
}
}
private void SearchListView_QueryItemText(int index, int column, out string text)
@ -691,6 +700,7 @@ namespace BizHawk.MultiClient
{
if (Global.Config.RamSearchPreviewMode)
{
forcePreviewClear = false;
GenerateWeedOutList();
}
}
@ -2377,6 +2387,8 @@ namespace BizHawk.MultiClient
addToRamWatchToolStripMenuItem.Visible = false;
pokeAddressToolStripMenuItem1.Visible = false;
freezeAddressToolStripMenuItem1.Visible = false;
toolStripSeparator14.Visible = false;
clearPreviewToolStripMenuItem.Visible = false;
}
else
{
@ -2420,16 +2432,13 @@ namespace BizHawk.MultiClient
freezeAddressToolStripMenuItem1.Image = Properties.Resources.Freeze;
}
}
toolStripSeparator14.Visible = Global.Config.RamSearchPreviewMode;
clearPreviewToolStripMenuItem.Visible = Global.Config.RamSearchPreviewMode;
}
if (Global.CheatList.HasActiveCheats)
{
unfreezeAllToolStripMenuItem.Visible = true;
}
else
{
unfreezeAllToolStripMenuItem.Visible = false;
}
unfreezeAllToolStripMenuItem.Visible = Global.CheatList.HasActiveCheats;
}
private void removeSelectedToolStripMenuItem1_Click(object sender, EventArgs e)
@ -2743,5 +2752,11 @@ namespace BizHawk.MultiClient
useUndoHistoryToolStripMenuItem.Checked ^= true;
SearchHistory = new HistoryCollection(Searches, useUndoHistoryToolStripMenuItem.Checked);
}
private void clearPreviewToolStripMenuItem_Click(object sender, EventArgs e)
{
forcePreviewClear = true;
SearchListView.Refresh();
}
}
}