New Ram Search - Undo/Redo functionality
This commit is contained in:
parent
ece435555d
commit
b80f5a276e
|
@ -690,6 +690,7 @@
|
||||||
<Compile Include="tools\Watch\WatchEditor.Designer.cs">
|
<Compile Include="tools\Watch\WatchEditor.Designer.cs">
|
||||||
<DependentUpon>WatchEditor.cs</DependentUpon>
|
<DependentUpon>WatchEditor.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="tools\Watch\WatchHistory.cs" />
|
||||||
<Compile Include="tools\Watch\WatchLegacy.cs" />
|
<Compile Include="tools\Watch\WatchLegacy.cs" />
|
||||||
<Compile Include="tools\Watch\WatchList.cs" />
|
<Compile Include="tools\Watch\WatchList.cs" />
|
||||||
<Compile Include="tools\Watch\WatchValueBox.cs">
|
<Compile Include="tools\Watch\WatchValueBox.cs">
|
||||||
|
|
|
@ -692,6 +692,7 @@
|
||||||
<Compile Include="tools\Watch\WatchEditor.designer.cs">
|
<Compile Include="tools\Watch\WatchEditor.designer.cs">
|
||||||
<DependentUpon>WatchEditor.cs</DependentUpon>
|
<DependentUpon>WatchEditor.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="tools\Watch\WatchHistory.cs" />
|
||||||
<Compile Include="tools\Watch\WatchLegacy.cs" />
|
<Compile Include="tools\Watch\WatchLegacy.cs" />
|
||||||
<Compile Include="tools\Watch\WatchList.cs" />
|
<Compile Include="tools\Watch\WatchList.cs" />
|
||||||
<Compile Include="tools\Watch\WatchValueBox.cs">
|
<Compile Include="tools\Watch\WatchValueBox.cs">
|
||||||
|
|
|
@ -84,8 +84,8 @@
|
||||||
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.newSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.newSearchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.UndoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.RedoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.CopyValueToPrevMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.CopyValueToPrevMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.ClearChangeCountsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ClearChangeCountsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.RemoveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.RemoveMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
this.PokeAddressMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.PokeAddressMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.FreezeAddressMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.FreezeAddressMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripSeparator13 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.clearUndoHistoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.ClearUndoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.PreviewModeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.PreviewModeMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.AutoSearchMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.AutoSearchMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -142,6 +142,9 @@
|
||||||
this.GreaterThanRadio = new System.Windows.Forms.RadioButton();
|
this.GreaterThanRadio = new System.Windows.Forms.RadioButton();
|
||||||
this.LessThanRadio = new System.Windows.Forms.RadioButton();
|
this.LessThanRadio = new System.Windows.Forms.RadioButton();
|
||||||
this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||||
|
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.UndoToolBarButton = new System.Windows.Forms.ToolStripButton();
|
||||||
|
this.RedoToolBarItem = new System.Windows.Forms.ToolStripButton();
|
||||||
this.SpecificValueBox = new BizHawk.MultiClient.WatchValueBox();
|
this.SpecificValueBox = new BizHawk.MultiClient.WatchValueBox();
|
||||||
SearchMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
SearchMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.contextMenuStrip1.SuspendLayout();
|
this.contextMenuStrip1.SuspendLayout();
|
||||||
|
@ -590,8 +593,8 @@
|
||||||
this.newSearchToolStripMenuItem,
|
this.newSearchToolStripMenuItem,
|
||||||
this.toolStripSeparator7,
|
this.toolStripSeparator7,
|
||||||
SearchMenuItem,
|
SearchMenuItem,
|
||||||
this.undoToolStripMenuItem,
|
this.UndoMenuItem,
|
||||||
this.redoToolStripMenuItem,
|
this.RedoMenuItem,
|
||||||
this.CopyValueToPrevMenuItem,
|
this.CopyValueToPrevMenuItem,
|
||||||
this.ClearChangeCountsMenuItem,
|
this.ClearChangeCountsMenuItem,
|
||||||
this.RemoveMenuItem,
|
this.RemoveMenuItem,
|
||||||
|
@ -600,7 +603,7 @@
|
||||||
this.PokeAddressMenuItem,
|
this.PokeAddressMenuItem,
|
||||||
this.FreezeAddressMenuItem,
|
this.FreezeAddressMenuItem,
|
||||||
this.toolStripSeparator13,
|
this.toolStripSeparator13,
|
||||||
this.clearUndoHistoryToolStripMenuItem});
|
this.ClearUndoMenuItem});
|
||||||
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
|
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
|
||||||
this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
this.searchToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||||
this.searchToolStripMenuItem.Text = "&Search";
|
this.searchToolStripMenuItem.Text = "&Search";
|
||||||
|
@ -619,24 +622,24 @@
|
||||||
this.toolStripSeparator7.Name = "toolStripSeparator7";
|
this.toolStripSeparator7.Name = "toolStripSeparator7";
|
||||||
this.toolStripSeparator7.Size = new System.Drawing.Size(212, 6);
|
this.toolStripSeparator7.Size = new System.Drawing.Size(212, 6);
|
||||||
//
|
//
|
||||||
// undoToolStripMenuItem
|
// UndoMenuItem
|
||||||
//
|
//
|
||||||
this.undoToolStripMenuItem.Enabled = false;
|
this.UndoMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.undo;
|
||||||
this.undoToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.undo;
|
this.UndoMenuItem.Name = "UndoMenuItem";
|
||||||
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
|
this.UndoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
|
||||||
this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
|
this.UndoMenuItem.Size = new System.Drawing.Size(215, 22);
|
||||||
this.undoToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
|
this.UndoMenuItem.Text = "&Undo";
|
||||||
this.undoToolStripMenuItem.Text = "&Undo";
|
this.UndoMenuItem.Click += new System.EventHandler(this.UndoMenuItem_Click);
|
||||||
//
|
//
|
||||||
// redoToolStripMenuItem
|
// RedoMenuItem
|
||||||
//
|
//
|
||||||
this.redoToolStripMenuItem.Enabled = false;
|
this.RedoMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.redo;
|
||||||
this.redoToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.redo;
|
this.RedoMenuItem.Name = "RedoMenuItem";
|
||||||
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
|
this.RedoMenuItem.ShortcutKeyDisplayString = "";
|
||||||
this.redoToolStripMenuItem.ShortcutKeyDisplayString = "";
|
this.RedoMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
|
||||||
this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
|
this.RedoMenuItem.Size = new System.Drawing.Size(215, 22);
|
||||||
this.redoToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
|
this.RedoMenuItem.Text = "&Redo";
|
||||||
this.redoToolStripMenuItem.Text = "&Redo";
|
this.RedoMenuItem.Click += new System.EventHandler(this.RedoMenuItem_Click);
|
||||||
//
|
//
|
||||||
// CopyValueToPrevMenuItem
|
// CopyValueToPrevMenuItem
|
||||||
//
|
//
|
||||||
|
@ -699,12 +702,12 @@
|
||||||
this.toolStripSeparator13.Name = "toolStripSeparator13";
|
this.toolStripSeparator13.Name = "toolStripSeparator13";
|
||||||
this.toolStripSeparator13.Size = new System.Drawing.Size(212, 6);
|
this.toolStripSeparator13.Size = new System.Drawing.Size(212, 6);
|
||||||
//
|
//
|
||||||
// clearUndoHistoryToolStripMenuItem
|
// ClearUndoMenuItem
|
||||||
//
|
//
|
||||||
this.clearUndoHistoryToolStripMenuItem.Enabled = false;
|
this.ClearUndoMenuItem.Name = "ClearUndoMenuItem";
|
||||||
this.clearUndoHistoryToolStripMenuItem.Name = "clearUndoHistoryToolStripMenuItem";
|
this.ClearUndoMenuItem.Size = new System.Drawing.Size(215, 22);
|
||||||
this.clearUndoHistoryToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
|
this.ClearUndoMenuItem.Text = "Clear Undo History";
|
||||||
this.clearUndoHistoryToolStripMenuItem.Text = "Clear Undo History";
|
this.ClearUndoMenuItem.Click += new System.EventHandler(this.ClearUndoMenuItem_Click);
|
||||||
//
|
//
|
||||||
// optionsToolStripMenuItem
|
// optionsToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
@ -948,7 +951,10 @@
|
||||||
this.RemoveToolBarItem,
|
this.RemoveToolBarItem,
|
||||||
this.AddToRamWatchToolBarItem,
|
this.AddToRamWatchToolBarItem,
|
||||||
this.PokeAddressToolBarItem,
|
this.PokeAddressToolBarItem,
|
||||||
this.FreezeAddressToolBarItem});
|
this.FreezeAddressToolBarItem,
|
||||||
|
this.toolStripSeparator12,
|
||||||
|
this.UndoToolBarButton,
|
||||||
|
this.RedoToolBarItem});
|
||||||
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
|
this.toolStrip1.Location = new System.Drawing.Point(0, 24);
|
||||||
this.toolStrip1.Name = "toolStrip1";
|
this.toolStrip1.Name = "toolStrip1";
|
||||||
this.toolStrip1.Size = new System.Drawing.Size(470, 25);
|
this.toolStrip1.Size = new System.Drawing.Size(470, 25);
|
||||||
|
@ -1168,6 +1174,33 @@
|
||||||
//
|
//
|
||||||
this.DiffColumn.Text = "Diff";
|
this.DiffColumn.Text = "Diff";
|
||||||
//
|
//
|
||||||
|
// toolStripSeparator12
|
||||||
|
//
|
||||||
|
this.toolStripSeparator12.Name = "toolStripSeparator12";
|
||||||
|
this.toolStripSeparator12.Size = new System.Drawing.Size(6, 25);
|
||||||
|
//
|
||||||
|
// UndoToolBarButton
|
||||||
|
//
|
||||||
|
this.UndoToolBarButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.UndoToolBarButton.Enabled = false;
|
||||||
|
this.UndoToolBarButton.Image = global::BizHawk.MultiClient.Properties.Resources.undo;
|
||||||
|
this.UndoToolBarButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.UndoToolBarButton.Name = "UndoToolBarButton";
|
||||||
|
this.UndoToolBarButton.Size = new System.Drawing.Size(23, 22);
|
||||||
|
this.UndoToolBarButton.Text = "Undo Search";
|
||||||
|
this.UndoToolBarButton.Click += new System.EventHandler(this.UndoMenuItem_Click);
|
||||||
|
//
|
||||||
|
// RedoToolBarItem
|
||||||
|
//
|
||||||
|
this.RedoToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||||
|
this.RedoToolBarItem.Enabled = false;
|
||||||
|
this.RedoToolBarItem.Image = global::BizHawk.MultiClient.Properties.Resources.redo;
|
||||||
|
this.RedoToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||||
|
this.RedoToolBarItem.Name = "RedoToolBarItem";
|
||||||
|
this.RedoToolBarItem.Size = new System.Drawing.Size(23, 22);
|
||||||
|
this.RedoToolBarItem.Text = "Redo";
|
||||||
|
this.RedoToolBarItem.Click += new System.EventHandler(this.RedoMenuItem_Click);
|
||||||
|
//
|
||||||
// SpecificValueBox
|
// SpecificValueBox
|
||||||
//
|
//
|
||||||
this.SpecificValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte;
|
this.SpecificValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte;
|
||||||
|
@ -1239,7 +1272,7 @@
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||||
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ClearChangeCountsMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ClearChangeCountsMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem UndoMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem RemoveMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem RemoveMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||||
private System.Windows.Forms.ToolStripMenuItem AddToRamWatchMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AddToRamWatchMenuItem;
|
||||||
|
@ -1258,7 +1291,7 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem FreezeContextMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem FreezeContextMenuItem;
|
||||||
private MenuStripEx menuStrip1;
|
private MenuStripEx menuStrip1;
|
||||||
private System.Windows.Forms.ToolTip toolTip1;
|
private System.Windows.Forms.ToolTip toolTip1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem RedoMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ViewInHexEditorContextMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ViewInHexEditorContextMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem AutoloadDialogMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AutoloadDialogMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
|
||||||
|
@ -1266,7 +1299,7 @@
|
||||||
private System.Windows.Forms.ToolStripSeparator ContextMenuSeparator3;
|
private System.Windows.Forms.ToolStripSeparator ContextMenuSeparator3;
|
||||||
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator13;
|
||||||
private System.Windows.Forms.ToolStripMenuItem clearUndoHistoryToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ClearUndoMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem useUndoHistoryToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem useUndoHistoryToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator ContextMenuSeparator2;
|
private System.Windows.Forms.ToolStripSeparator ContextMenuSeparator2;
|
||||||
private System.Windows.Forms.ToolStripMenuItem ClearPreviewContextMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem ClearPreviewContextMenuItem;
|
||||||
|
@ -1329,5 +1362,8 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem AutoSearchMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem AutoSearchMenuItem;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
|
||||||
private System.Windows.Forms.ColumnHeader DiffColumn;
|
private System.Windows.Forms.ColumnHeader DiffColumn;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
|
||||||
|
private System.Windows.Forms.ToolStripButton UndoToolBarButton;
|
||||||
|
private System.Windows.Forms.ToolStripButton RedoToolBarItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -216,6 +216,7 @@ namespace BizHawk.MultiClient
|
||||||
DoSearchToolButton.Enabled =
|
DoSearchToolButton.Enabled =
|
||||||
CopyValueToPrevToolBarItem.Enabled =
|
CopyValueToPrevToolBarItem.Enabled =
|
||||||
Searches.Count > 0;
|
Searches.Count > 0;
|
||||||
|
UpdateUndoToolBarButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoSearch()
|
private void DoSearch()
|
||||||
|
@ -225,7 +226,6 @@ namespace BizHawk.MultiClient
|
||||||
WatchListView.ItemCount = Searches.Count;
|
WatchListView.ItemCount = Searches.Count;
|
||||||
SetRemovedMessage(removed);
|
SetRemovedMessage(removed);
|
||||||
ToggleSearchDependentToolBarItems();
|
ToggleSearchDependentToolBarItems();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<int> SelectedIndices
|
private List<int> SelectedIndices
|
||||||
|
@ -499,6 +499,12 @@ namespace BizHawk.MultiClient
|
||||||
SetTotal();
|
SetTotal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateUndoToolBarButtons()
|
||||||
|
{
|
||||||
|
UndoToolBarButton.Enabled = Searches.CanUndo;
|
||||||
|
RedoToolBarItem.Enabled = Searches.CanRedo;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Winform Events
|
#region Winform Events
|
||||||
|
@ -718,6 +724,12 @@ namespace BizHawk.MultiClient
|
||||||
PokeAddressMenuItem.Enabled =
|
PokeAddressMenuItem.Enabled =
|
||||||
FreezeAddressMenuItem.Enabled =
|
FreezeAddressMenuItem.Enabled =
|
||||||
SelectedIndices.Any();
|
SelectedIndices.Any();
|
||||||
|
|
||||||
|
UndoMenuItem.Enabled =
|
||||||
|
ClearUndoMenuItem.Enabled =
|
||||||
|
Searches.CanUndo;
|
||||||
|
|
||||||
|
RedoMenuItem.Enabled = Searches.CanRedo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewSearchMenuMenuItem_Click(object sender, EventArgs e)
|
private void NewSearchMenuMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -730,6 +742,24 @@ namespace BizHawk.MultiClient
|
||||||
DoSearch();
|
DoSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UndoMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Searches.CanUndo)
|
||||||
|
{
|
||||||
|
Searches.Undo();
|
||||||
|
UpdateUndoToolBarButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RedoMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (Searches.CanRedo)
|
||||||
|
{
|
||||||
|
Searches.Redo();
|
||||||
|
UpdateUndoToolBarButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CopyValueToPrevMenuItem_Click(object sender, EventArgs e)
|
private void CopyValueToPrevMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Searches.SetPrevousToCurrent();
|
Searches.SetPrevousToCurrent();
|
||||||
|
@ -762,6 +792,12 @@ namespace BizHawk.MultiClient
|
||||||
FreezeAddress();
|
FreezeAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClearUndoMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Searches.ClearHistory();
|
||||||
|
UpdateUndoToolBarButtons();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Options
|
#region Options
|
||||||
|
|
|
@ -8,33 +8,31 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BizHawk.MultiClient
|
namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
class RamSearchEngine
|
public class RamSearchEngine
|
||||||
{
|
{
|
||||||
public enum ComparisonOperator { Equal, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, NotEqual, DifferentBy };
|
public enum ComparisonOperator { Equal, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, NotEqual, DifferentBy };
|
||||||
public enum Compare { Previous, SpecificValue, SpecificAddress, Changes, Difference }
|
public enum Compare { Previous, SpecificValue, SpecificAddress, Changes, Difference }
|
||||||
|
|
||||||
private List<IMiniWatch> _watchList = new List<IMiniWatch>();
|
|
||||||
private Settings _settings;
|
|
||||||
|
|
||||||
public Compare CompareTo = Compare.Previous;
|
public Compare CompareTo = Compare.Previous;
|
||||||
public int? CompareValue = null;
|
public int? CompareValue = null;
|
||||||
public ComparisonOperator Operator = ComparisonOperator.Equal;
|
public ComparisonOperator Operator = ComparisonOperator.Equal;
|
||||||
public int? DifferentBy = null;
|
public int? DifferentBy = null;
|
||||||
|
|
||||||
#region Constructors
|
private List<IMiniWatch> _watchList = new List<IMiniWatch>();
|
||||||
|
private Settings _settings;
|
||||||
|
private WatchHistory _history = new WatchHistory(true);
|
||||||
|
|
||||||
public RamSearchEngine(Settings settings)
|
public RamSearchEngine(Settings settings)
|
||||||
{
|
{
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region API
|
#region API
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
_watchList.Clear();
|
_watchList.Clear();
|
||||||
|
_history.Clear();
|
||||||
switch (_settings.Size)
|
switch (_settings.Size)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -87,6 +85,8 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_history.AddState(_watchList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -126,6 +126,7 @@ namespace BizHawk.MultiClient
|
||||||
public int DoSearch()
|
public int DoSearch()
|
||||||
{
|
{
|
||||||
int before = _watchList.Count;
|
int before = _watchList.Count;
|
||||||
|
|
||||||
switch (CompareTo)
|
switch (CompareTo)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -151,6 +152,8 @@ namespace BizHawk.MultiClient
|
||||||
SetPrevousToCurrent();
|
SetPrevousToCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_history.AddState(_watchList);
|
||||||
|
|
||||||
return before - _watchList.Count;
|
return before - _watchList.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +294,28 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Undo API
|
||||||
|
|
||||||
|
public bool CanUndo { get { return _history.CanUndo; } }
|
||||||
|
public bool CanRedo { get { return _history.CanRedo; } }
|
||||||
|
|
||||||
|
public void ClearHistory()
|
||||||
|
{
|
||||||
|
_history.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
_watchList = _history.Undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Redo()
|
||||||
|
{
|
||||||
|
_watchList = _history.Redo();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Comparisons
|
#region Comparisons
|
||||||
|
@ -512,7 +537,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
#region Classes
|
#region Classes
|
||||||
|
|
||||||
private interface IMiniWatch
|
public interface IMiniWatch
|
||||||
{
|
{
|
||||||
int Address { get; }
|
int Address { get; }
|
||||||
int Previous { get; }
|
int Previous { get; }
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace BizHawk.MultiClient
|
||||||
|
{
|
||||||
|
public class WatchHistory
|
||||||
|
{
|
||||||
|
private List<List<RamSearchEngine.IMiniWatch>> _history = new List<List<RamSearchEngine.IMiniWatch>>();
|
||||||
|
private int curPos; //1-based
|
||||||
|
public bool Enabled { get; private set; }
|
||||||
|
|
||||||
|
public WatchHistory(bool enabled)
|
||||||
|
{
|
||||||
|
Enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WatchHistory(List<RamSearchEngine.IMiniWatch> newState, bool enabled)
|
||||||
|
{
|
||||||
|
AddState(newState);
|
||||||
|
Enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
_history = new List<List<RamSearchEngine.IMiniWatch>>();
|
||||||
|
curPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanUndo
|
||||||
|
{
|
||||||
|
get { return Enabled && curPos > 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanRedo
|
||||||
|
{
|
||||||
|
get { return Enabled && curPos < _history.Count; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasHistory
|
||||||
|
{
|
||||||
|
get { return Enabled && _history.Any(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddState(List<RamSearchEngine.IMiniWatch> newState)
|
||||||
|
{
|
||||||
|
if (Enabled)
|
||||||
|
{
|
||||||
|
if (curPos < _history.Count)
|
||||||
|
{
|
||||||
|
for (int i = curPos + 1; i <= _history.Count; i++)
|
||||||
|
{
|
||||||
|
_history.Remove(_history[i - 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_history.Add(newState);
|
||||||
|
curPos = _history.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RamSearchEngine.IMiniWatch> Undo()
|
||||||
|
{
|
||||||
|
if (CanUndo && Enabled)
|
||||||
|
{
|
||||||
|
curPos--;
|
||||||
|
return _history[curPos - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RamSearchEngine.IMiniWatch> Redo()
|
||||||
|
{
|
||||||
|
if (CanRedo && Enabled)
|
||||||
|
{
|
||||||
|
curPos++;
|
||||||
|
return _history[curPos - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue