Ram Watch - remove debugging stuff and hook up listview

This commit is contained in:
andres.delikat 2011-01-19 05:46:08 +00:00
parent 9d86fa0eb3
commit 8d0ff04b4b
2 changed files with 31 additions and 55 deletions

View File

@ -57,7 +57,6 @@
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
this.listBox1 = new System.Windows.Forms.ListBox();
this.WatchCountLabel = new System.Windows.Forms.Label();
this.noneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
@ -74,7 +73,7 @@
this.watchesToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(485, 24);
this.menuStrip1.Size = new System.Drawing.Size(364, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@ -236,17 +235,20 @@
//
// WatchListView
//
this.WatchListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.WatchListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.WatchListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.Address,
this.Value,
this.Notes});
this.WatchListView.Location = new System.Drawing.Point(34, 76);
this.WatchListView.GridLines = true;
this.WatchListView.Location = new System.Drawing.Point(25, 76);
this.WatchListView.Name = "WatchListView";
this.WatchListView.Size = new System.Drawing.Size(232, 436);
this.WatchListView.Size = new System.Drawing.Size(314, 324);
this.WatchListView.TabIndex = 1;
this.WatchListView.UseCompatibleStateImageBehavior = false;
this.WatchListView.View = System.Windows.Forms.View.Details;
//
// Address
//
@ -260,6 +262,7 @@
// Notes
//
this.Notes.Text = "Notes";
this.Notes.Width = 190;
//
// toolStrip1
//
@ -269,7 +272,7 @@
this.toolStripButton3});
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(485, 25);
this.toolStrip1.Size = new System.Drawing.Size(364, 25);
this.toolStrip1.TabIndex = 2;
this.toolStrip1.Text = "toolStrip1";
//
@ -300,20 +303,10 @@
this.toolStripButton3.Size = new System.Drawing.Size(23, 22);
this.toolStripButton3.Text = "toolStripButton3";
//
// listBox1
//
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(311, 88);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(120, 355);
this.listBox1.TabIndex = 3;
//
// WatchCountLabel
//
this.WatchCountLabel.AutoSize = true;
this.WatchCountLabel.Location = new System.Drawing.Point(34, 57);
this.WatchCountLabel.Location = new System.Drawing.Point(22, 57);
this.WatchCountLabel.Name = "WatchCountLabel";
this.WatchCountLabel.Size = new System.Drawing.Size(56, 13);
this.WatchCountLabel.TabIndex = 4;
@ -346,9 +339,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(485, 524);
this.ClientSize = new System.Drawing.Size(364, 412);
this.Controls.Add(this.WatchCountLabel);
this.Controls.Add(this.listBox1);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.WatchListView);
this.Controls.Add(this.menuStrip1);
@ -395,7 +387,6 @@
private System.Windows.Forms.ColumnHeader Address;
private System.Windows.Forms.ColumnHeader Value;
private System.Windows.Forms.ColumnHeader Notes;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label WatchCountLabel;
private System.Windows.Forms.ToolStripMenuItem noneToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;

View File

@ -13,9 +13,11 @@ namespace BizHawk.MultiClient
{
public partial class RamWatch : Form
{
//TODO: Recent files & autoload
//TODO:
//Recent files & autoload
//Keep track of changes to watch list in order to prompt the user to save changes
//TODO: implement separator feature
//implement separator feature
//Display address as hex
List<Watch> watchList = new List<Watch>();
@ -24,13 +26,6 @@ namespace BizHawk.MultiClient
InitializeComponent();
}
//Debug
void TempDisplayWatchInTempList(Watch watch)
{
string temp = watch.address + " " + watch.value + " " + watch.notes;
listBox1.Items.Add(temp);
}
public int HowMany(string str, char c) //Shouldn't something like this exist already? Counts how many times c in in str
{
int count = 0;
@ -51,10 +46,7 @@ namespace BizHawk.MultiClient
if (result == DialogResult.Yes)
Global.Config.RecentWatches.Remove(file);
}
//Debug
for (int x = 0; x < watchList.Count; x++)
TempDisplayWatchInTempList(watchList[x]);
DisplayWatchList();
}
bool LoadWatchFile(string path)
@ -116,7 +108,6 @@ namespace BizHawk.MultiClient
Global.Config.RecentWatches.Add(file.FullName);
//Update the number of watches
listBox1.Items.Clear(); //Debug
WatchCountLabel.Text = count.ToString() + " watches";
}
@ -172,10 +163,7 @@ namespace BizHawk.MultiClient
var file = new FileInfo(ofd.FileName);
Global.Config.LastRomPath = file.DirectoryName;
LoadWatchFile(file.FullName);
//Debug
for (int x = 0; x < watchList.Count; x++)
TempDisplayWatchInTempList(watchList[x]);
DisplayWatchList();
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
@ -233,25 +221,22 @@ namespace BizHawk.MultiClient
MoveDown();
}
private void DisplayWatchList()
{
WatchListView.Items.Clear();
for (int x = 0; x < watchList.Count; x++)
{
ListViewItem item = new ListViewItem(watchList[x].address.ToString());
item.SubItems.Add(watchList[x].value.ToString());
item.SubItems.Add(watchList[x].notes);
WatchListView.Items.Add(item);
}
}
private void RamWatch_Load(object sender, EventArgs e)
{
//TODO: Debug
Watch watch1 = new Watch();
watch1.notes = "Test1";
watchList.Add(watch1);
ListViewItem item1 = new ListViewItem(watch1.address.ToString(), 0);
WatchListView.Items.Add(item1);
item1 = new ListViewItem(watch1.value.ToString(), 0);
WatchListView.Items.Add(item1);
item1 = new ListViewItem(watch1.notes, 0);
WatchListView.Items.Add(item1);
//Debug
for (int x = 0; x < watchList.Count; x++)
TempDisplayWatchInTempList(watchList[x]);
}
private void filesToolStripMenuItem_DropDownOpened(object sender, EventArgs e)