Hex Find - simplify some code
This commit is contained in:
parent
bdfdd96686
commit
8b48bd3e26
|
@ -1302,14 +1302,17 @@ namespace BizHawk.Client.EmuHawk
|
||||||
_findStr = GetFindValues();
|
_findStr = GetFindValues();
|
||||||
if (!_hexFind.IsHandleCreated || _hexFind.IsDisposed)
|
if (!_hexFind.IsHandleCreated || _hexFind.IsDisposed)
|
||||||
{
|
{
|
||||||
_hexFind = new HexFind();
|
_hexFind = new HexFind
|
||||||
_hexFind.SetLocation(PointToScreen(AddressesLabel.Location));
|
{
|
||||||
_hexFind.SetInitialValue(_findStr);
|
InitialLocation = PointToScreen(AddressesLabel.Location),
|
||||||
|
InitialValue = _findStr
|
||||||
|
};
|
||||||
|
|
||||||
_hexFind.Show();
|
_hexFind.Show();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_hexFind.SetInitialValue(_findStr);
|
_hexFind.InitialValue = _findStr;
|
||||||
_hexFind.Focus();
|
_hexFind.Focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,29 +8,25 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class HexFind : Form
|
public partial class HexFind : Form
|
||||||
{
|
{
|
||||||
private Point _location;
|
|
||||||
|
|
||||||
public HexFind()
|
public HexFind()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ChangeCasing();
|
ChangeCasing();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetInitialValue(string value)
|
public Point InitialLocation { get; set; }
|
||||||
{
|
|
||||||
FindBox.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetLocation(Point p)
|
public string InitialValue
|
||||||
{
|
{
|
||||||
_location = p;
|
get { return FindBox.Text; }
|
||||||
|
set { FindBox.Text = value ?? string.Empty; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HexFind_Load(object sender, EventArgs e)
|
private void HexFind_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_location.X > 0 && _location.Y > 0)
|
if (InitialLocation.X > 0 && InitialLocation.Y > 0)
|
||||||
{
|
{
|
||||||
Location = _location;
|
Location = InitialLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,8 +73,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Controls.Remove(FindBox);
|
Controls.Remove(FindBox);
|
||||||
if (HexRadio.Checked)
|
if (HexRadio.Checked)
|
||||||
{
|
{
|
||||||
FindBox = new HexTextBox { CharacterCasing = CharacterCasing.Upper };
|
FindBox = new HexTextBox
|
||||||
(FindBox as HexTextBox).Nullable = true;
|
{
|
||||||
|
CharacterCasing = CharacterCasing.Upper,
|
||||||
|
Nullable = true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -117,6 +116,5 @@ namespace BizHawk.Client.EmuHawk
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue