Put frame clears and macro placements in undo batches

Better undo descriptions for right-click edits
This commit is contained in:
Suuper 2015-07-16 14:39:33 -05:00
parent 73686d53dc
commit 194d988a5f
3 changed files with 24 additions and 6 deletions

View File

@ -116,7 +116,8 @@ namespace BizHawk.Client.EmuHawk
public void PlaceZone(IMovie movie) public void PlaceZone(IMovie movie)
{ {
// TODO: This should probably do something with undo history batches/naming. if (movie is TasMovie)
(movie as TasMovie).ChangeLog.BeginNewBatch("Place Macro at " + Start);
if (Start > movie.InputLogLength) if (Start > movie.InputLogLength)
{ // Cannot place a frame here. Find a nice way around this. { // Cannot place a frame here. Find a nice way around this.
@ -150,6 +151,7 @@ namespace BizHawk.Client.EmuHawk
if (movie is TasMovie) // Assume TAStudio is open? if (movie is TasMovie) // Assume TAStudio is open?
{ {
(movie as TasMovie).ChangeLog.EndBatch();
if (Global.Emulator.Frame > Start) if (Global.Emulator.Frame > Start)
{ {
// TODO: Go to start of macro? Ask TAStudio to do that? // TODO: Go to start of macro? Ask TAStudio to do that?

View File

@ -450,7 +450,21 @@ namespace BizHawk.Client.EmuHawk
JumpToGreenzone(); JumpToGreenzone();
// TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here. // TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here.
CurrentTasMovie.ChangeLog.BeginNewBatch("Right-Click Edit"); string undoStepName = "Right-Click Edit:";
if (_rightClickShift)
{
undoStepName += " Extend Input";
if (_rightClickControl)
undoStepName += ", Insert";
}
else
{
if (_rightClickControl)
undoStepName += " Copy";
else
undoStepName += " Move";
}
CurrentTasMovie.ChangeLog.BeginNewBatch(undoStepName);
} }
} }
} }

View File

@ -394,14 +394,16 @@ namespace BizHawk.Client.EmuHawk
{ {
if (TasView.SelectedRows.Any()) if (TasView.SelectedRows.Any())
{ {
var wasPaused = GlobalWin.MainForm.EmulatorPaused; bool wasPaused = GlobalWin.MainForm.EmulatorPaused;
var needsToRollback = !(TasView.FirstSelectedIndex > Emulator.Frame); bool needsToRollback = !(TasView.FirstSelectedIndex > Emulator.Frame);
var rollBackFrame = TasView.FirstSelectedIndex.Value; int rollBackFrame = TasView.FirstSelectedIndex.Value;
foreach (var frame in TasView.SelectedRows) CurrentTasMovie.ChangeLog.BeginNewBatch("Clear frames " + TasView.SelectedRows.Min() + "-" + TasView.SelectedRows.Max());
foreach (int frame in TasView.SelectedRows)
{ {
CurrentTasMovie.ClearFrame(frame); CurrentTasMovie.ClearFrame(frame);
} }
CurrentTasMovie.ChangeLog.EndBatch();
if (needsToRollback) if (needsToRollback)
{ {