Ram Watch - New Watch winform uses the defaults set in a Watch object constructor

This commit is contained in:
andres.delikat 2011-01-21 15:58:01 +00:00
parent a82037c605
commit 69fc5697ba
3 changed files with 32 additions and 12 deletions

View File

@ -20,7 +20,6 @@ namespace BizHawk.MultiClient
//Make Edit/Add/Duplicate Watch windows appear in relation to the listview box
//Make a context menu for add/remove/Dup/etc, make the context menu & edit watch windows appear in relation to where they right clicked
//TODO: Call AskSave in main client X function
//TODO: RaWatchNewWatch dialog - when setting defaults for the edit watch - declare a new watch and use its values (so that it can set to defaults even if the watch class defaults change)
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
List<Watch> watchList = new List<Watch>();

View File

@ -14,21 +14,16 @@ namespace BizHawk.MultiClient
{
public Watch watch = new Watch();
public bool userSelected = false;
public bool customSetup = false;
public RamWatchNewWatch()
{
InitializeComponent();
}
public void SetToEditWatch(Watch w, string message)
private void SetTypeRadio(atype a)
{
//Sets this dialog to Edit Watch and receives default values
this.Text = message;
AddressBox.Text = string.Format("{0:X4}", w.address);
NotesBox.Text = w.notes;
switch (w.type)
switch (a)
{
case atype.BYTE:
Byte1Radio.Checked = true;
@ -42,8 +37,11 @@ namespace BizHawk.MultiClient
default:
break;
}
}
switch (w.signed)
private void SetSignedRadio(asigned a)
{
switch (a)
{
case asigned.SIGNED:
SignedRadio.Checked = true;
@ -57,7 +55,20 @@ namespace BizHawk.MultiClient
default:
break;
}
}
public void SetToEditWatch(Watch w, string message)
{
//Sets this dialog to Edit Watch and receives default values
this.Text = message;
customSetup = true;
AddressBox.Text = string.Format("{0:X4}", w.address);
NotesBox.Text = w.notes;
SetTypeRadio(w.type);
SetSignedRadio(w.signed);
if (w.bigendian == true)
BigEndianRadio.Checked = true;
else
@ -66,7 +77,17 @@ namespace BizHawk.MultiClient
private void RamWatchNewWatch_Load(object sender, EventArgs e)
{
if (!customSetup)
{
Watch w = new Watch();
SetTypeRadio(w.type);
SetSignedRadio(w.signed);
if (w.bigendian == true)
BigEndianRadio.Checked = true;
else
LittleEndianRadio.Checked = true;
}
}
private void Cancel_Click(object sender, EventArgs e)

View File

@ -15,8 +15,8 @@ namespace BizHawk.MultiClient
address = 0;
value = 0;
type = atype.BYTE;
signed = asigned.SIGNED;
bigendian = false;
signed = asigned.UNSIGNED;
bigendian = true;
notes = "";
}
public Watch(int Address, int Value, atype Type, asigned Signed, bool BigEndian, string Notes)