diff --git a/BizHawk.MultiClient/tools/RamSearch.Designer.cs b/BizHawk.MultiClient/tools/RamSearch.Designer.cs index 857fd16da8..ee76f24aba 100644 --- a/BizHawk.MultiClient/tools/RamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/RamSearch.Designer.cs @@ -794,7 +794,6 @@ // RedotoolStripButton2 // this.RedotoolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.RedotoolStripButton2.Enabled = false; this.RedotoolStripButton2.Image = global::BizHawk.MultiClient.Properties.Resources.redo; this.RedotoolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; this.RedotoolStripButton2.Name = "RedotoolStripButton2"; diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/RamSearch.cs index 37481b4906..313810b5fe 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -28,6 +28,7 @@ namespace BizHawk.MultiClient List undoList = new List(); List weededList = new List(); //When addresses are weeded out, the new list goes here, before going into searchList List prevList = new List(); + List redoList = new List(); private bool IsAWeededList = false; //For deciding whether the weeded list is relevant (0 size could mean all were removed in a legit preview List domainMenuItems = new List(); MemoryDomain Domain = new MemoryDomain("NULL", 1, Endian.Little, addr => 0, (a, v) => { }); @@ -94,6 +95,8 @@ namespace BizHawk.MultiClient private void RamSearch_Load(object sender, EventArgs e) { + ClearUndo(); + ClearRedo(); LoadConfigSettings(); StartNewSearch(); SetMemoryDomainMenu(); @@ -360,10 +363,11 @@ namespace BizHawk.MultiClient private void StartNewSearch() { + ClearUndo(); + ClearRedo(); weededList.Clear(); IsAWeededList = false; searchList.Clear(); - undoList.Clear(); SetPlatformAndMemoryDomainLabel(); int count = 0; int divisor = 1; @@ -515,6 +519,7 @@ namespace BizHawk.MultiClient undoList.Clear(); for (int x = 0; x < searchList.Count; x++) undoList.Add(new Watch(searchList[x])); + UndotoolStripButton.Enabled = true; } private void DoUndo() @@ -522,16 +527,43 @@ namespace BizHawk.MultiClient if (undoList.Count > 0) { OutputLabel.Text = MakeAddressString(undoList.Count - searchList.Count) + " restored"; + redoList = new List(searchList); searchList = new List(undoList); prevList = new List(undoList); - undoList.Clear(); + ClearUndo(); + RedotoolStripButton2.Enabled = true; DisplaySearchList(); + //OutputLabel.Text = "Undo: s" + searchList.Count.ToString() + " u" + + // undoList.Count.ToString() + " r" + redoList.Count.ToString(); } } + private void ClearUndo() + { + undoList.Clear(); + UndotoolStripButton.Enabled = false; + } + + private void ClearRedo() + { + redoList.Clear(); + RedotoolStripButton2.Enabled = false; + } + private void DoRedo() { - //TODO + if (redoList.Count > 0) + { + OutputLabel.Text = MakeAddressString(searchList.Count - redoList.Count) + " removed"; + undoList = new List(searchList); + searchList = new List(redoList); + prevList = new List(redoList); + ClearRedo(); + UndotoolStripButton.Enabled = true; + DisplaySearchList(); + //OutputLabel.Text = "Redo: s" + searchList.Count.ToString() + " u" + + // undoList.Count.ToString() + " r" + redoList.Count.ToString(); + } } private void UndotoolStripButton_Click(object sender, EventArgs e) diff --git a/DiscoHawk/DiscoHawk.csproj b/DiscoHawk/DiscoHawk.csproj index 3bf502d218..a778f40b08 100644 --- a/DiscoHawk/DiscoHawk.csproj +++ b/DiscoHawk/DiscoHawk.csproj @@ -76,7 +76,9 @@ - + + Form + DiscoHawkDialog.cs