Ram Search - implement undo

This commit is contained in:
andres.delikat 2011-02-19 20:29:07 +00:00
parent c8b6713367
commit 1be99bcd68
3 changed files with 38 additions and 8 deletions

View File

@ -120,7 +120,7 @@
this.PoketoolStripButton1});
this.SearchtoolStrip1.Location = new System.Drawing.Point(3, 0);
this.SearchtoolStrip1.Name = "SearchtoolStrip1";
this.SearchtoolStrip1.Size = new System.Drawing.Size(156, 25);
this.SearchtoolStrip1.Size = new System.Drawing.Size(154, 25);
this.SearchtoolStrip1.TabIndex = 0;
this.SearchtoolStrip1.Text = "Search";
//
@ -365,7 +365,7 @@
this.UndotoolStripButton});
this.toolStrip1.Location = new System.Drawing.Point(3, 25);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(104, 25);
this.toolStrip1.Size = new System.Drawing.Size(133, 25);
this.toolStrip1.TabIndex = 1;
//
// NewSearchtoolStripButton
@ -406,6 +406,7 @@
this.UndotoolStripButton.Name = "UndotoolStripButton";
this.UndotoolStripButton.Size = new System.Drawing.Size(23, 22);
this.UndotoolStripButton.Text = "Undo Search";
this.UndotoolStripButton.Click += new System.EventHandler(this.UndotoolStripButton_Click);
//
// toolStrip2
//
@ -416,7 +417,7 @@
this.EndiantoolSplitButton});
this.toolStrip2.Location = new System.Drawing.Point(3, 50);
this.toolStrip2.Name = "toolStrip2";
this.toolStrip2.Size = new System.Drawing.Size(208, 25);
this.toolStrip2.Size = new System.Drawing.Size(206, 25);
this.toolStrip2.TabIndex = 2;
//
// DataSizetoolStripSplitButton1

View File

@ -296,6 +296,7 @@ namespace BizHawk.MultiClient
ListView.SelectedIndexCollection indexes = SearchListView.SelectedIndices;
if (indexes.Count > 0)
{
SaveUndo();
for (int x = 0; x < indexes.Count; x++)
{
searchList.Remove(searchList[indexes[x]-x]);
@ -308,5 +309,33 @@ namespace BizHawk.MultiClient
{
RemoveAddresses();
}
/// <summary>
/// Saves the current search list to the undo list
/// This function should be called before any destructive operation to the list!
/// </summary>
private void SaveUndo()
{
undoList.Clear();
for (int x = 0; x < searchList.Count; x++)
undoList.Add(searchList[x]);
}
private void DoUndo()
{
if (undoList.Count > 0)
{
searchList.Clear();
for (int x = 0; x < undoList.Count; x++)
searchList.Add(undoList[x]);
undoList.Clear();
DisplaySearchList();
}
}
private void UndotoolStripButton_Click(object sender, EventArgs e)
{
DoUndo();
}
}
}

View File

@ -171,9 +171,6 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>259, 17</value>
</metadata>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
@ -184,10 +181,10 @@
nwacI1lUVWkeyyF/Ztx0hAeDn4DoHOCl5MsAfgEYXgCeMXCIZ2da+rI0jxXqQGH3JRGg4H3P1tlIkJ1E
ySh5Q8JfgKuul6DcVDDgbn8+oHM8XzlCKUk4CT6QGLnRKwV0FAy4cutFwM+2e96xXbYtVhZl3ic4AeLE
ZOmeXzGgocF2wR5IYYB3IM4stj1F+DGkFZ/JoqLi+GjBEXJdh5oedTuemFsf4H4og+ccIfw138UYmUgJ
0NS1TlO2EvWyERYfVtq+eVQItR2BTqt9q1bXx863eYXr7lfoGp7AbdvrXLVKM0bJRmrJtp8Bi86Dkhwx
0NS1TlO2EvWyERYfVtq+eVQItR2BTqt9q1bXx863eYXr7lfoGp7AbevrXLVKM0bJRmrJtp8Bi86Dkhwx
HoBDp8OpWnOCh+3kHLkoz3uNu0n+fKKc/5HEtuFVIWbaL8mNjfa5kpL1Lh6dJLvJFrKD7CRbyQayRpIX
3Idr4KleJiuV5b080pE9chUF919ZGr2v48RgwrwPzrN1UmVZ1vONvWStLC4Jvz8ZDAbPpXpRtqaVyrIe
nv+Q1/1TlsM2ypfSzF0rV/5v+Tuo+YISgo8SYgAAAABJRU5ErkJggg==
nv+Q1/1TlsM2ypfSzF0rV/5v+TunYIIRd07M4gAAAABJRU5ErkJggg==
</value>
</data>
<data name="ClearChangeCountstoolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -205,6 +202,9 @@
s1c0gHPmbrPTpHNJKOCo2G1mZs20zcwUJ5yp1AB5+8/zEwgF5GMVDxh4AAAAAElFTkSuQmCC
</value>
</data>
<metadata name="toolStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>358, 17</value>
</metadata>
<data name="DataSizetoolStripSplitButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8