Comparison type can be set if and only if comparison field is non-empty

This commit is contained in:
Adam Sturge 2016-02-08 20:56:11 -08:00
parent 5dc31d3eb9
commit c59f1c1761
2 changed files with 57 additions and 31 deletions

View File

@ -56,7 +56,7 @@
//
this.NameBox.Location = new System.Drawing.Point(70, 12);
this.NameBox.Name = "NameBox";
this.NameBox.Size = new System.Drawing.Size(108, 20);
this.NameBox.Size = new System.Drawing.Size(108, 31);
this.NameBox.TabIndex = 5;
//
// NameLabel
@ -64,7 +64,7 @@
this.NameLabel.AutoSize = true;
this.NameLabel.Location = new System.Drawing.Point(32, 16);
this.NameLabel.Name = "NameLabel";
this.NameLabel.Size = new System.Drawing.Size(35, 13);
this.NameLabel.Size = new System.Drawing.Size(68, 25);
this.NameLabel.TabIndex = 4;
this.NameLabel.Text = "Name";
//
@ -73,7 +73,7 @@
this.AddressLabel.AutoSize = true;
this.AddressLabel.Location = new System.Drawing.Point(22, 43);
this.AddressLabel.Name = "AddressLabel";
this.AddressLabel.Size = new System.Drawing.Size(45, 13);
this.AddressLabel.Size = new System.Drawing.Size(91, 25);
this.AddressLabel.TabIndex = 6;
this.AddressLabel.Text = "Address";
//
@ -82,7 +82,7 @@
this.AddressHexIndLabel.AutoSize = true;
this.AddressHexIndLabel.Location = new System.Drawing.Point(92, 43);
this.AddressHexIndLabel.Name = "AddressHexIndLabel";
this.AddressHexIndLabel.Size = new System.Drawing.Size(18, 13);
this.AddressHexIndLabel.Size = new System.Drawing.Size(35, 25);
this.AddressHexIndLabel.TabIndex = 8;
this.AddressHexIndLabel.Text = "0x";
//
@ -93,7 +93,7 @@
this.AddressBox.MaxLength = 8;
this.AddressBox.Name = "AddressBox";
this.AddressBox.Nullable = true;
this.AddressBox.Size = new System.Drawing.Size(65, 20);
this.AddressBox.Size = new System.Drawing.Size(65, 31);
this.AddressBox.TabIndex = 9;
//
// ValueHexIndLabel
@ -101,7 +101,7 @@
this.ValueHexIndLabel.AutoSize = true;
this.ValueHexIndLabel.Location = new System.Drawing.Point(92, 69);
this.ValueHexIndLabel.Name = "ValueHexIndLabel";
this.ValueHexIndLabel.Size = new System.Drawing.Size(18, 13);
this.ValueHexIndLabel.Size = new System.Drawing.Size(35, 25);
this.ValueHexIndLabel.TabIndex = 11;
this.ValueHexIndLabel.Text = "0x";
//
@ -110,7 +110,7 @@
this.ValueLabel.AutoSize = true;
this.ValueLabel.Location = new System.Drawing.Point(33, 69);
this.ValueLabel.Name = "ValueLabel";
this.ValueLabel.Size = new System.Drawing.Size(34, 13);
this.ValueLabel.Size = new System.Drawing.Size(67, 25);
this.ValueLabel.TabIndex = 10;
this.ValueLabel.Text = "Value";
//
@ -119,7 +119,7 @@
this.CompareHexIndLabel.AutoSize = true;
this.CompareHexIndLabel.Location = new System.Drawing.Point(92, 95);
this.CompareHexIndLabel.Name = "CompareHexIndLabel";
this.CompareHexIndLabel.Size = new System.Drawing.Size(18, 13);
this.CompareHexIndLabel.Size = new System.Drawing.Size(35, 25);
this.CompareHexIndLabel.TabIndex = 14;
this.CompareHexIndLabel.Text = "0x";
//
@ -128,7 +128,7 @@
this.CompareLabel.AutoSize = true;
this.CompareLabel.Location = new System.Drawing.Point(24, 95);
this.CompareLabel.Name = "CompareLabel";
this.CompareLabel.Size = new System.Drawing.Size(49, 13);
this.CompareLabel.Size = new System.Drawing.Size(99, 25);
this.CompareLabel.TabIndex = 13;
this.CompareLabel.Text = "Compare";
//
@ -137,7 +137,7 @@
this.DomainLabel.AutoSize = true;
this.DomainLabel.Location = new System.Drawing.Point(24, 158);
this.DomainLabel.Name = "DomainLabel";
this.DomainLabel.Size = new System.Drawing.Size(43, 13);
this.DomainLabel.Size = new System.Drawing.Size(85, 25);
this.DomainLabel.TabIndex = 16;
this.DomainLabel.Text = "Domain";
//
@ -147,7 +147,7 @@
this.DomainDropDown.FormattingEnabled = true;
this.DomainDropDown.Location = new System.Drawing.Point(78, 154);
this.DomainDropDown.Name = "DomainDropDown";
this.DomainDropDown.Size = new System.Drawing.Size(100, 21);
this.DomainDropDown.Size = new System.Drawing.Size(100, 33);
this.DomainDropDown.TabIndex = 17;
this.DomainDropDown.SelectedIndexChanged += new System.EventHandler(this.DomainDropDown_SelectedIndexChanged);
//
@ -156,7 +156,7 @@
this.SizeLabel.AutoSize = true;
this.SizeLabel.Location = new System.Drawing.Point(40, 190);
this.SizeLabel.Name = "SizeLabel";
this.SizeLabel.Size = new System.Drawing.Size(27, 13);
this.SizeLabel.Size = new System.Drawing.Size(54, 25);
this.SizeLabel.TabIndex = 18;
this.SizeLabel.Text = "Size";
//
@ -170,7 +170,7 @@
"4 Byte"});
this.SizeDropDown.Location = new System.Drawing.Point(78, 184);
this.SizeDropDown.Name = "SizeDropDown";
this.SizeDropDown.Size = new System.Drawing.Size(100, 21);
this.SizeDropDown.Size = new System.Drawing.Size(100, 33);
this.SizeDropDown.TabIndex = 19;
this.SizeDropDown.SelectedIndexChanged += new System.EventHandler(this.SizeDropDown_SelectedIndexChanged);
//
@ -179,7 +179,7 @@
this.DisplayTypeLael.AutoSize = true;
this.DisplayTypeLael.Location = new System.Drawing.Point(11, 219);
this.DisplayTypeLael.Name = "DisplayTypeLael";
this.DisplayTypeLael.Size = new System.Drawing.Size(56, 13);
this.DisplayTypeLael.Size = new System.Drawing.Size(114, 25);
this.DisplayTypeLael.TabIndex = 20;
this.DisplayTypeLael.Text = "Display As";
//
@ -193,7 +193,7 @@
"4 Byte"});
this.DisplayTypeDropDown.Location = new System.Drawing.Point(78, 213);
this.DisplayTypeDropDown.Name = "DisplayTypeDropDown";
this.DisplayTypeDropDown.Size = new System.Drawing.Size(100, 21);
this.DisplayTypeDropDown.Size = new System.Drawing.Size(100, 33);
this.DisplayTypeDropDown.TabIndex = 21;
this.DisplayTypeDropDown.SelectedIndexChanged += new System.EventHandler(this.DisplayTypeDropDown_SelectedIndexChanged);
//
@ -202,7 +202,7 @@
this.BigEndianCheckBox.AutoSize = true;
this.BigEndianCheckBox.Location = new System.Drawing.Point(101, 242);
this.BigEndianCheckBox.Name = "BigEndianCheckBox";
this.BigEndianCheckBox.Size = new System.Drawing.Size(77, 17);
this.BigEndianCheckBox.Size = new System.Drawing.Size(148, 29);
this.BigEndianCheckBox.TabIndex = 22;
this.BigEndianCheckBox.Text = "Big Endian";
this.BigEndianCheckBox.UseVisualStyleBackColor = true;
@ -239,9 +239,10 @@
this.CompareBox.MaxLength = 2;
this.CompareBox.Name = "CompareBox";
this.CompareBox.Nullable = true;
this.CompareBox.Size = new System.Drawing.Size(65, 20);
this.CompareBox.Size = new System.Drawing.Size(65, 31);
this.CompareBox.TabIndex = 15;
this.CompareBox.Type = BizHawk.Client.Common.DisplayType.Hex;
this.CompareBox.TextChanged += new System.EventHandler(this.CompareBox_TextChanged);
//
// ValueBox
//
@ -251,7 +252,7 @@
this.ValueBox.MaxLength = 2;
this.ValueBox.Name = "ValueBox";
this.ValueBox.Nullable = true;
this.ValueBox.Size = new System.Drawing.Size(65, 20);
this.ValueBox.Size = new System.Drawing.Size(65, 31);
this.ValueBox.TabIndex = 12;
this.ValueBox.Text = "00";
this.ValueBox.Type = BizHawk.Client.Common.DisplayType.Hex;
@ -262,26 +263,15 @@
this.CompareTypeDropDown.FormattingEnabled = true;
this.CompareTypeDropDown.Location = new System.Drawing.Point(113, 122);
this.CompareTypeDropDown.Name = "CompareTypeDropDown";
this.CompareTypeDropDown.Size = new System.Drawing.Size(65, 21);
this.CompareTypeDropDown.Size = new System.Drawing.Size(65, 33);
this.CompareTypeDropDown.TabIndex = 26;
this.CompareTypeDropDown.Items.AddRange(
new object[] {
"=",
">",
">=",
"<",
"<=",
"!="
}
);
this.CompareTypeDropDown.SelectedIndex = 0;
//
// CompareTypeLabel
//
this.CompareTypeLabel.AutoSize = true;
this.CompareTypeLabel.Location = new System.Drawing.Point(24, 125);
this.CompareTypeLabel.Name = "CompareTypeLabel";
this.CompareTypeLabel.Size = new System.Drawing.Size(76, 13);
this.CompareTypeLabel.Size = new System.Drawing.Size(153, 25);
this.CompareTypeLabel.TabIndex = 25;
this.CompareTypeLabel.Text = "Compare Type";
this.CompareTypeLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;

View File

@ -359,5 +359,41 @@ namespace BizHawk.Client.EmuHawk
}
#endregion
private void CompareBox_TextChanged(object sender, EventArgs e)
{
WatchValueBox compareBox = (WatchValueBox)sender;
PopulateComparisonTypeBox(String.IsNullOrWhiteSpace(compareBox.Text));
}
/// <summary>
/// Populates the comparison type drop down
/// </summary>
/// <param name="empty">True if drop down should be left empty</param>
private void PopulateComparisonTypeBox(bool empty = false)
{
// Don't need to do anything in this case
if (!empty && this.CompareTypeDropDown.Items.Count > 0)
{
return;
}
this.CompareTypeDropDown.Items.Clear();
if (!empty)
{
this.CompareTypeDropDown.Items.AddRange(new object[] {
"=",
">",
">=",
"<",
"<=",
"!="
});
}
}
}
}