Ram Watch - attempt to use virtuallist instead of listview

This commit is contained in:
andres.delikat 2011-02-20 01:41:58 +00:00
parent b7edf19c5b
commit 3aeae6e771
2 changed files with 26 additions and 4 deletions

View File

@ -56,7 +56,7 @@
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WatchListView = new System.Windows.Forms.ListView();
this.WatchListView = new VirtualListView();
this.Address = new System.Windows.Forms.ColumnHeader();
this.Value = new System.Windows.Forms.ColumnHeader();
this.Notes = new System.Windows.Forms.ColumnHeader();
@ -327,6 +327,7 @@
this.WatchListView.View = System.Windows.Forms.View.Details;
this.WatchListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.WatchListView_MouseDoubleClick);
this.WatchListView.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.WatchListView_AfterLabelEdit);
this.WatchListView.SelectedIndexChanged += new System.EventHandler(this.WatchListView_SelectedIndexChanged);
//
// Address
//
@ -620,7 +621,7 @@
private System.Windows.Forms.ToolStripMenuItem recentToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ListView WatchListView;
VirtualListView WatchListView;
private System.Windows.Forms.ToolStripMenuItem newWatchToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editWatchToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeWatchToolStripMenuItem;

View File

@ -61,7 +61,8 @@ namespace BizHawk.MultiClient
case atype.DWORD:
break;
}
WatchListView.Refresh();
/*
switch (watchList[x].signed)
{
case asigned.HEX:
@ -74,6 +75,7 @@ namespace BizHawk.MultiClient
WatchListView.Items[x].SubItems[1].Text = watchList[x].value.ToString();
break;
}
*/
}
}
@ -86,6 +88,16 @@ namespace BizHawk.MultiClient
public RamWatch()
{
InitializeComponent();
WatchListView.QueryItemText += new QueryItemTextHandler(WatchListView_QueryItemText);
WatchListView.VirtualMode = true;
}
void WatchListView_QueryItemText(int index, int column, out string text)
{
text = "";
if (column == 0) text = watchList[index].address.ToString();
if (column == 1) text = watchList[index].value.ToString();
if (column == 2) text = watchList[index].notes;
}
public int HowMany(string str, char c)
@ -277,7 +289,7 @@ namespace BizHawk.MultiClient
if (r.userSelected == true)
{
watchList.Add(r.watch);
DisplayWatchList();
DisplayWatchList(); //TODO: Do I need these calls?
}
}
@ -517,6 +529,8 @@ namespace BizHawk.MultiClient
public void DisplayWatchList()
{
WatchListView.VirtualListSize = watchList.Count;
/*
WatchListView.Items.Clear();
for (int x = 0; x < watchList.Count; x++)
{
@ -556,7 +570,9 @@ namespace BizHawk.MultiClient
item.SubItems.Add(watchList[x].notes);
WatchListView.Items.Add(item);
}
}
*/
}
private void RamWatch_Load(object sender, EventArgs e)
@ -879,5 +895,10 @@ namespace BizHawk.MultiClient
{
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;string[] filePaths = (string[]) e.Data.GetData(DataFormats.FileDrop);
}
private void WatchListView_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}