Ram Search - show restored/removed messages when undoing/redoing, fixes #749

This commit is contained in:
adelikat 2017-01-14 20:00:55 -06:00
parent 9408c3fc1a
commit 44a1e691f3
2 changed files with 14 additions and 4 deletions

View File

@ -524,20 +524,28 @@ namespace BizHawk.Client.Common
_history.Clear(); _history.Clear();
} }
public void Undo() public int Undo()
{ {
int origCount = _watchList.Count;
if (_keepHistory) if (_keepHistory)
{ {
_watchList = _history.Undo().ToList(); _watchList = _history.Undo().ToList();
} return _watchList.Count - origCount;
} }
public void Redo() return _watchList.Count;
}
public int Redo()
{ {
int origCount = _watchList.Count;
if (_keepHistory) if (_keepHistory)
{ {
_watchList = _history.Redo().ToList(); _watchList = _history.Redo().ToList();
return origCount - _watchList.Count;
} }
return _watchList.Count;
} }
#endregion #endregion

View File

@ -1243,11 +1243,12 @@ namespace BizHawk.Client.EmuHawk
{ {
if (_searches.CanUndo) if (_searches.CanUndo)
{ {
_searches.Undo(); int restoredCount = _searches.Undo();
UpdateList(); UpdateList();
ToggleSearchDependentToolBarItems(); ToggleSearchDependentToolBarItems();
_forcePreviewClear = true; _forcePreviewClear = true;
UpdateUndoToolBarButtons(); UpdateUndoToolBarButtons();
MessageLabel.Text = restoredCount.ToString() + " address" + (restoredCount != 1 ? "es" : "") + " restored";
} }
} }
@ -1255,11 +1256,12 @@ namespace BizHawk.Client.EmuHawk
{ {
if (_searches.CanRedo) if (_searches.CanRedo)
{ {
_searches.Redo(); int restoredCount = _searches.Redo();
UpdateList(); UpdateList();
ToggleSearchDependentToolBarItems(); ToggleSearchDependentToolBarItems();
_forcePreviewClear = true; _forcePreviewClear = true;
UpdateUndoToolBarButtons(); UpdateUndoToolBarButtons();
MessageLabel.Text = restoredCount.ToString() + " address" + (restoredCount != 1 ? "es" : "") + " removed";
} }
} }