From 194d988a5f45275bae326cf1f889d661d1e1e245 Mon Sep 17 00:00:00 2001 From: Suuper Date: Thu, 16 Jul 2015 14:39:33 -0500 Subject: [PATCH] Put frame clears and macro placements in undo batches Better undo descriptions for right-click edits --- BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs | 4 +++- .../tools/TAStudio/TAStudio.ListView.cs | 16 +++++++++++++++- .../tools/TAStudio/TAStudio.MenuItems.cs | 10 ++++++---- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs b/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs index 3a689eb582..7921627af7 100644 --- a/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs +++ b/BizHawk.Client.EmuHawk/tools/Macros/MovieZone.cs @@ -116,7 +116,8 @@ namespace BizHawk.Client.EmuHawk 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) { // 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? { + (movie as TasMovie).ChangeLog.EndBatch(); if (Global.Emulator.Frame > Start) { // TODO: Go to start of macro? Ask TAStudio to do that? diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 6f25fce1d6..3f0a3bf05f 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -450,7 +450,21 @@ namespace BizHawk.Client.EmuHawk JumpToGreenzone(); // 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); } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 6062149e19..8f2991d5d6 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -394,14 +394,16 @@ namespace BizHawk.Client.EmuHawk { if (TasView.SelectedRows.Any()) { - var wasPaused = GlobalWin.MainForm.EmulatorPaused; - var needsToRollback = !(TasView.FirstSelectedIndex > Emulator.Frame); - var rollBackFrame = TasView.FirstSelectedIndex.Value; + bool wasPaused = GlobalWin.MainForm.EmulatorPaused; + bool needsToRollback = !(TasView.FirstSelectedIndex > Emulator.Frame); + 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.ChangeLog.EndBatch(); if (needsToRollback) {