diff --git a/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs b/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs index 09231ef260..bc733e9a47 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs @@ -101,7 +101,7 @@ this.AutoSearchMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator(); this.ExcludeRamWatchMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.useUndoHistoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.UseUndoHistoryMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator(); this.AutoloadDialogMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveWinPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -196,7 +196,7 @@ this.WatchListView.Location = new System.Drawing.Point(9, 65); this.WatchListView.Name = "WatchListView"; this.WatchListView.selectedItem = -1; - this.WatchListView.Size = new System.Drawing.Size(216, 366); + this.WatchListView.Size = new System.Drawing.Size(223, 366); this.WatchListView.TabIndex = 1; this.WatchListView.UseCompatibleStateImageBehavior = false; this.WatchListView.View = System.Windows.Forms.View.Details; @@ -347,7 +347,7 @@ this.ColumnsMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(438, 24); + this.menuStrip1.Size = new System.Drawing.Size(445, 24); this.menuStrip1.TabIndex = 4; this.menuStrip1.Text = "menuStrip1"; // @@ -725,7 +725,7 @@ this.AutoSearchMenuItem, this.toolStripSeparator9, this.ExcludeRamWatchMenuItem, - this.useUndoHistoryToolStripMenuItem, + this.UseUndoHistoryMenuItem, this.toolStripSeparator11, this.AutoloadDialogMenuItem, this.SaveWinPositionMenuItem, @@ -763,12 +763,12 @@ this.ExcludeRamWatchMenuItem.Text = "Always Exclude Ram Search List"; this.ExcludeRamWatchMenuItem.Click += new System.EventHandler(this.ExcludeRamWatchMenuItem_Click); // - // useUndoHistoryToolStripMenuItem + // UseUndoHistoryMenuItem // - this.useUndoHistoryToolStripMenuItem.Enabled = false; - this.useUndoHistoryToolStripMenuItem.Name = "useUndoHistoryToolStripMenuItem"; - this.useUndoHistoryToolStripMenuItem.Size = new System.Drawing.Size(240, 22); - this.useUndoHistoryToolStripMenuItem.Text = "&Use Undo History"; + this.UseUndoHistoryMenuItem.Name = "UseUndoHistoryMenuItem"; + this.UseUndoHistoryMenuItem.Size = new System.Drawing.Size(240, 22); + this.UseUndoHistoryMenuItem.Text = "&Use Undo History"; + this.UseUndoHistoryMenuItem.Click += new System.EventHandler(this.UseUndoHistoryMenuItem_Click); // // toolStripSeparator11 // @@ -840,7 +840,7 @@ this.CompareToBox.Controls.Add(this.SpecificAddressRadio); this.CompareToBox.Controls.Add(this.SpecificValueRadio); this.CompareToBox.Controls.Add(this.PreviousValueRadio); - this.CompareToBox.Location = new System.Drawing.Point(230, 65); + this.CompareToBox.Location = new System.Drawing.Point(237, 65); this.CompareToBox.Name = "CompareToBox"; this.CompareToBox.Size = new System.Drawing.Size(197, 125); this.CompareToBox.TabIndex = 10; @@ -966,7 +966,7 @@ this.RedoToolBarItem}); this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(438, 25); + this.toolStrip1.Size = new System.Drawing.Size(445, 25); this.toolStrip1.TabIndex = 11; this.toolStrip1.Text = "toolStrip1"; // @@ -1109,7 +1109,7 @@ this.ComparisonBox.Controls.Add(this.LessThanOrEqualToRadio); this.ComparisonBox.Controls.Add(this.GreaterThanRadio); this.ComparisonBox.Controls.Add(this.LessThanRadio); - this.ComparisonBox.Location = new System.Drawing.Point(230, 196); + this.ComparisonBox.Location = new System.Drawing.Point(237, 196); this.ComparisonBox.Name = "ComparisonBox"; this.ComparisonBox.Size = new System.Drawing.Size(197, 159); this.ComparisonBox.TabIndex = 12; @@ -1256,7 +1256,7 @@ this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(438, 459); + this.ClientSize = new System.Drawing.Size(445, 459); this.Controls.Add(this.ComparisonBox); this.Controls.Add(this.toolStrip1); this.Controls.Add(this.CompareToBox); @@ -1337,7 +1337,7 @@ private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator13; private System.Windows.Forms.ToolStripMenuItem ClearUndoMenuItem; - private System.Windows.Forms.ToolStripMenuItem useUndoHistoryToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem UseUndoHistoryMenuItem; private System.Windows.Forms.ToolStripSeparator ContextMenuSeparator2; private System.Windows.Forms.ToolStripMenuItem ClearPreviewContextMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; diff --git a/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs b/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs index a33e5634a1..7edf74a564 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs @@ -873,6 +873,7 @@ namespace BizHawk.MultiClient AutoloadDialogMenuItem.Checked = Global.Config.RecentSearches.AutoLoad; SaveWinPositionMenuItem.Checked = Global.Config.RamSearchSaveWindowPosition; ExcludeRamWatchMenuItem.Checked = Global.Config.RamSearchAlwaysExcludeRamWatch; + UseUndoHistoryMenuItem.Checked = Searches.UndoEnabled; PreviewModeMenuItem.Checked = Global.Config.RamSearchPreviewMode; AlwaysOnTopMenuItem.Checked = Global.Config.RamSearchAlwaysOnTop; AutoSearchMenuItem.Checked = autoSearch; @@ -897,6 +898,11 @@ namespace BizHawk.MultiClient } } + private void UseUndoHistoryMenuItem_Click(object sender, EventArgs e) + { + Searches.UndoEnabled ^= true; + } + private void AutoloadDialogMenuItem_Click(object sender, EventArgs e) { Global.Config.RecentSearches.AutoLoad ^= true; diff --git a/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs b/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs index 41734424e4..34279936c0 100644 --- a/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs +++ b/BizHawk.MultiClient/tools/Watch/RamSearchEngine.cs @@ -17,10 +17,12 @@ namespace BizHawk.MultiClient public int? CompareValue = null; public ComparisonOperator Operator = ComparisonOperator.Equal; public int? DifferentBy = null; + private List _watchList = new List(); private Settings _settings; private WatchHistory _history = new WatchHistory(true); + private bool _keepHistory = true; public RamSearchEngine(Settings settings) { @@ -86,7 +88,10 @@ namespace BizHawk.MultiClient break; } - _history.AddState(_watchList); + if (_keepHistory) + { + _history.AddState(_watchList); + } } /// @@ -152,7 +157,10 @@ namespace BizHawk.MultiClient SetPrevousToCurrent(); } - _history.AddState(_watchList); + if (_keepHistory) + { + _history.AddState(_watchList); + } return before - _watchList.Count; } @@ -297,9 +305,22 @@ namespace BizHawk.MultiClient #endregion #region Undo API - - public bool CanUndo { get { return _history.CanUndo; } } - public bool CanRedo { get { return _history.CanRedo; } } + + public bool UndoEnabled + { + get { return _keepHistory; } + set { _keepHistory = value; } + } + + public bool CanUndo + { + get { return _keepHistory && _history.CanUndo; } + } + + public bool CanRedo + { + get { return _keepHistory && _history.CanRedo; } + } public void ClearHistory() { @@ -308,12 +329,18 @@ namespace BizHawk.MultiClient public void Undo() { - _watchList = _history.Undo(); + if (_keepHistory) + { + _watchList = _history.Undo(); + } } public void Redo() { - _watchList = _history.Redo(); + if (_keepHistory) + { + _watchList = _history.Redo(); + } } #endregion