misc code cleanup on some tool dialogs

This commit is contained in:
andres.delikat 2011-08-27 14:49:13 +00:00
parent 5e9f90eea9
commit 8dff368bcc
4 changed files with 70 additions and 88 deletions

View File

@ -126,12 +126,9 @@ namespace BizHawk.MultiClient
static char Remap(byte val)
{
unchecked
{
if (val < ' ') return '.';
else if (val >= 0x80) return '.';
else return (char)val;
}
if (val < ' ') return '.';
else if (val >= 0x80) return '.';
else return (char)val;
}
private int MakeValue(int addr)
@ -279,12 +276,9 @@ namespace BizHawk.MultiClient
private int GetNumDigits(Int32 i)
{
unchecked
{
if (i <= 0x10000) return 4;
if (i <= 0x1000000) return 6;
else return 8;
}
if (i <= 0x10000) return 4;
if (i <= 0x1000000) return 6;
else return 8;
}
public void GoToSpecifiedAddress()
@ -357,15 +351,12 @@ namespace BizHawk.MultiClient
public bool IsVisible(int addr)
{
unchecked
{
int row = addr >> 4;
int row = addr >> 4;
if (row >= vScrollBar1.Value && row < (RowsVisible + vScrollBar1.Value))
return true;
else
return false;
}
if (row >= vScrollBar1.Value && row < (RowsVisible + vScrollBar1.Value))
return true;
else
return false;
}
private void HexEditor_Resize(object sender, EventArgs e)
@ -720,7 +711,7 @@ namespace BizHawk.MultiClient
if (row >= 0 && row <= maxRow && column >= 0 && column < (16 / Global.Config.HexEditorDataSize))
{
addressOver = row * 16 + (column * Global.Config.HexEditorDataSize);
info = String.Format("{0:X" + GetNumDigits(Domain.Size).ToString() + "}", addressOver);
info = String.Format(NumDigitsStr, addressOver);
}
else
{

View File

@ -43,10 +43,10 @@
this.FreezeAddressToolStrip = new System.Windows.Forms.ToolStripButton();
this.TotalSearchLabel = new System.Windows.Forms.Label();
this.SearchListView = new BizHawk.VirtualListView();
this.Address = new System.Windows.Forms.ColumnHeader();
this.Value = new System.Windows.Forms.ColumnHeader();
this.Previous = new System.Windows.Forms.ColumnHeader();
this.Changes = new System.Windows.Forms.ColumnHeader();
this.Address = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Value = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Previous = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.Changes = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.startNewSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.searchToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
@ -297,20 +297,19 @@
this.SearchListView.UseCompatibleStateImageBehavior = false;
this.SearchListView.View = System.Windows.Forms.View.Details;
this.SearchListView.VirtualMode = true;
this.SearchListView.Enter += new System.EventHandler(this.SearchListView_Enter);
this.SearchListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.SearchListView_ColumnClick);
this.SearchListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SearchListView_MouseDoubleClick);
this.SearchListView.QueryItemBkColor += new BizHawk.QueryItemBkColorHandler(this.SearchListView_QueryItemBkColor);
this.SearchListView.ColumnReordered += new System.Windows.Forms.ColumnReorderedEventHandler(this.SearchListView_ColumnReordered);
this.SearchListView.QueryItemIndent += new BizHawk.QueryItemIndentHandler(this.SearchListView_QueryItemIndent);
this.SearchListView.QueryItemImage += new BizHawk.QueryItemImageHandler(this.SearchListView_QueryItemImage);
this.SearchListView.QueryItemText += new BizHawk.QueryItemTextHandler(this.SearchListView_QueryItemText);
this.SearchListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.SearchListView_ColumnClick);
this.SearchListView.ColumnReordered += new System.Windows.Forms.ColumnReorderedEventHandler(this.SearchListView_ColumnReordered);
this.SearchListView.Enter += new System.EventHandler(this.SearchListView_Enter);
this.SearchListView.KeyUp += new System.Windows.Forms.KeyEventHandler(this.SearchListView_KeyUp);
this.SearchListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SearchListView_MouseDoubleClick);
//
// Address
//
this.Address.Text = "Address";
this.Address.Width = 66;
this.Address.Width = 65;
//
// Value
//
@ -969,8 +968,8 @@
this.NumberOfChangesBox.Size = new System.Drawing.Size(65, 20);
this.NumberOfChangesBox.TabIndex = 28;
this.NumberOfChangesBox.TextChanged += new System.EventHandler(this.NumberOfChangesBox_TextChanged);
this.NumberOfChangesBox.Leave += new System.EventHandler(this.NumberOfChangesBox_Leave);
this.NumberOfChangesBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.NumberOfChangesBox_KeyPress);
this.NumberOfChangesBox.Leave += new System.EventHandler(this.NumberOfChangesBox_Leave);
//
// SpecificAddressBox
//
@ -982,8 +981,8 @@
this.SpecificAddressBox.Size = new System.Drawing.Size(65, 20);
this.SpecificAddressBox.TabIndex = 26;
this.SpecificAddressBox.TextChanged += new System.EventHandler(this.SpecificAddressBox_TextChanged);
this.SpecificAddressBox.Leave += new System.EventHandler(this.SpecificAddressBox_Leave);
this.SpecificAddressBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.SpecificAddressBox_KeyPress);
this.SpecificAddressBox.Leave += new System.EventHandler(this.SpecificAddressBox_Leave);
//
// SpecificValueBox
//
@ -994,8 +993,8 @@
this.SpecificValueBox.Size = new System.Drawing.Size(65, 20);
this.SpecificValueBox.TabIndex = 24;
this.SpecificValueBox.TextChanged += new System.EventHandler(this.SpecificValueBox_TextChanged);
this.SpecificValueBox.Leave += new System.EventHandler(this.SpecificValueBox_Leave);
this.SpecificValueBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.SpecificValueBox_KeyPress);
this.SpecificValueBox.Leave += new System.EventHandler(this.SpecificValueBox_Leave);
//
// NumberOfChangesRadio
//
@ -1070,8 +1069,8 @@
this.DifferentByBox.Size = new System.Drawing.Size(50, 20);
this.DifferentByBox.TabIndex = 34;
this.DifferentByBox.TextChanged += new System.EventHandler(this.DifferentByBox_TextChanged);
this.DifferentByBox.Leave += new System.EventHandler(this.DifferentByBox_Leave);
this.DifferentByBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.DifferentByBox_KeyPress);
this.DifferentByBox.Leave += new System.EventHandler(this.DifferentByBox_Leave);
//
// DifferentByRadio
//
@ -1207,8 +1206,8 @@
this.MainMenuStrip = this.menuStrip1;
this.Name = "RamSearch";
this.Text = "Ram Search";
this.Load += new System.EventHandler(this.RamSearch_Load);
this.Activated += new System.EventHandler(this.RamSearch_Activated);
this.Load += new System.EventHandler(this.RamSearch_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.RamSearch_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.RamSearch_DragEnter);
this.SearchtoolStrip1.ResumeLayout(false);

View File

@ -73,31 +73,28 @@ namespace BizHawk.MultiClient
public void UpdateValues()
{
unchecked
if (!this.IsHandleCreated || this.IsDisposed) return;
if (searchList.Count > 8)
SearchListView.BlazingFast = true;
sortReverse = false;
sortedCol = "";
for (int x = 0; x < searchList.Count; x++)
{
if (!this.IsHandleCreated || this.IsDisposed) return;
searchList[x].prev = searchList[x].value;
searchList[x].PeekAddress(Domain);
if (searchList.Count > 8)
SearchListView.BlazingFast = true;
sortReverse = false;
sortedCol = "";
for (int x = 0; x < searchList.Count; x++)
{
searchList[x].prev = searchList[x].value;
searchList[x].PeekAddress(Domain);
if (searchList[x].prev != searchList[x].value)
searchList[x].changecount++;
if (searchList[x].prev != searchList[x].value)
searchList[x].changecount++;
}
if (AutoSearchCheckBox.Checked)
DoSearch();
else if (Global.Config.RamSearchPreviewMode)
DoPreview();
SearchListView.Refresh();
SearchListView.BlazingFast = false;
}
if (AutoSearchCheckBox.Checked)
DoSearch();
else if (Global.Config.RamSearchPreviewMode)
DoPreview();
SearchListView.Refresh();
SearchListView.BlazingFast = false;
}
private void RamSearch_Load(object sender, EventArgs e)
@ -547,20 +544,22 @@ namespace BizHawk.MultiClient
private void SearchListView_QueryItemBkColor(int index, int column, ref Color color)
{
if (column == 0)
if (IsAWeededList && column == 0)
{
if (IsAWeededList)
if (!weededList.Contains(searchList[index]))
{
if (!weededList.Contains(searchList[index]))
{
color = Color.Pink;
if (Global.CheatList.IsActiveCheat(Domain, searchList[index].address))
color = Color.Purple;
}
else if (Global.CheatList.IsActiveCheat(Domain, searchList[index].address))
color = Color.LightCyan;
if (color == Color.Pink) return;
if (Global.CheatList.IsActiveCheat(Domain, searchList[index].address))
color = Color.Purple;
else
color = Color.White;
color = Color.Pink;
}
else if (Global.CheatList.IsActiveCheat(Domain, searchList[index].address))
color = Color.LightCyan;
else
{
if (color == Color.White) return;
color = Color.White;
}
}
}
@ -650,16 +649,6 @@ namespace BizHawk.MultiClient
}
}
private void SearchListView_QueryItemIndent(int index, out int itemIndent)
{
itemIndent = 0;
}
private void SearchListView_QueryItemImage(int index, int column, out int imageIndex)
{
imageIndex = -1;
}
private void ClearChangeCounts()
{
SaveUndo();

View File

@ -112,15 +112,15 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="SearchtoolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="SearchtoolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="openToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -154,13 +154,13 @@
Cv71r/4OTrQ4xWMwWlcAAAAASUVORK5CYII=
</value>
</data>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>457, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>150, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>259, 17</value>
</metadata>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -194,7 +194,7 @@
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="DataSizetoolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -242,7 +242,10 @@
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>602, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>602, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">