From 32be07ce03bfcfbf7e9ccd9139840d97e506a3a3 Mon Sep 17 00:00:00 2001 From: feos Date: Sat, 11 Jun 2016 12:48:11 +0300 Subject: [PATCH] tastudio: don't record marker history edits to history this generates a warning regarding "new is not required" for the functions I edited, dunno what to do with it --- .../movie/tasproj/TasMovie.History.cs | 12 ++++---- .../movie/tasproj/TasMovieMarker.cs | 28 +++++++++++-------- .../TAStudio/UndoHistoryForm.Designer.cs | 11 ++++---- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs index 1562eac56e..6b89f0dd7b 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs @@ -414,24 +414,24 @@ namespace BizHawk.Client.Common public void Undo(TasMovie movie) { if (FirstFrame == -1) // Action: Place marker - movie.Markers.Remove(movie.Markers.Get(LastFrame)); + movie.Markers.Remove(movie.Markers.Get(LastFrame), true); else if (LastFrame == -1) // Action: Remove marker - movie.Markers.Add(FirstFrame, oldMessage); + movie.Markers.Add(FirstFrame, oldMessage, true); else // Action: Move/rename marker { - movie.Markers.Move(LastFrame, FirstFrame); + movie.Markers.Move(LastFrame, FirstFrame, true); movie.Markers.Get(LastFrame).Message = oldMessage; } } public void Redo(TasMovie movie) { if (FirstFrame == -1) // Action: Place marker - movie.Markers.Add(LastFrame, oldMessage); + movie.Markers.Add(LastFrame, oldMessage, true); else if (LastFrame == -1) // Action: Remove marker - movie.Markers.Remove(movie.Markers.Get(FirstFrame)); + movie.Markers.Remove(movie.Markers.Get(FirstFrame), true); else // Action: Move/rename marker { - movie.Markers.Move(FirstFrame, LastFrame); + movie.Markers.Move(FirstFrame, LastFrame, true); movie.Markers.Get(LastFrame).Message = newMessage; } } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs b/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs index 3328df7ed4..7e1832e6b0 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs @@ -109,30 +109,32 @@ namespace BizHawk.Client.Common return sb.ToString(); } - public new void Add(TasMovieMarker item) + public new void Add(TasMovieMarker item, bool fromHistory = false) { var existingItem = this.FirstOrDefault(m => m.Frame == item.Frame); if (existingItem != null) { if (existingItem.Message != item.Message) { - _movie.ChangeLog.AddMarkerChange(item, item.Frame, existingItem.Message); + if (!fromHistory) + _movie.ChangeLog.AddMarkerChange(item, item.Frame, existingItem.Message); existingItem.Message = item.Message; OnListChanged(NotifyCollectionChangedAction.Replace); } } else { - _movie.ChangeLog.AddMarkerChange(item); + if (!fromHistory) + _movie.ChangeLog.AddMarkerChange(item); base.Add(item); this.Sort((m1, m2) => m1.Frame.CompareTo(m2.Frame)); OnListChanged(NotifyCollectionChangedAction.Add); } } - public void Add(int frame, string message) + public void Add(int frame, string message, bool fromHistory = false) { - Add(new TasMovieMarker(frame, message)); + Add(new TasMovieMarker(frame, message), fromHistory); } public new void AddRange(IEnumerable collection) @@ -146,9 +148,10 @@ namespace BizHawk.Client.Common _movie.ChangeLog.EndBatch(); } - public new void Insert(int index, TasMovieMarker item) + public new void Insert(int index, TasMovieMarker item, bool fromHistory = false) { - _movie.ChangeLog.AddMarkerChange(item); + if (!fromHistory) + _movie.ChangeLog.AddMarkerChange(item); base.Insert(index, item); this.Sort((m1, m2) => m1.Frame.CompareTo(m2.Frame)); OnListChanged(NotifyCollectionChangedAction.Add); @@ -167,11 +170,12 @@ namespace BizHawk.Client.Common OnListChanged(NotifyCollectionChangedAction.Add); } - public new void Remove(TasMovieMarker item) + public new void Remove(TasMovieMarker item, bool fromHistory = false) { if (item == null || item.Frame == 0) // TODO: Don't do this. return; - _movie.ChangeLog.AddMarkerChange(null, item.Frame, item.Message); + if (!fromHistory) + _movie.ChangeLog.AddMarkerChange(null, item.Frame, item.Message); base.Remove(item); OnListChanged(NotifyCollectionChangedAction.Remove); } @@ -195,14 +199,14 @@ namespace BizHawk.Client.Common return removeCount; } - public void Move(int fromFrame, int toFrame) + public void Move(int fromFrame, int toFrame, bool fromHistory = false) { TasMovieMarker m = Get(fromFrame); if (m == null) // TODO: Don't do this. return; _movie.ChangeLog.AddMarkerChange(m, m.Frame); - Insert(0, new TasMovieMarker(toFrame, m.Message)); - Remove(m); + Insert(0, new TasMovieMarker(toFrame, m.Message), fromHistory); + Remove(m, fromHistory); } /// diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs index 39fe8220b7..ad6a57aa75 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs @@ -88,31 +88,31 @@ this.sepToolStripMenuItem, this.clearHistoryToHereToolStripMenuItem}); this.RightClickMenu.Name = "RightClickMenu"; - this.RightClickMenu.Size = new System.Drawing.Size(211, 76); + this.RightClickMenu.Size = new System.Drawing.Size(209, 76); // // undoHereToolStripMenuItem // this.undoHereToolStripMenuItem.Name = "undoHereToolStripMenuItem"; - this.undoHereToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.undoHereToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.undoHereToolStripMenuItem.Text = "Undo To Selection"; this.undoHereToolStripMenuItem.Click += new System.EventHandler(this.undoHereToolStripMenuItem_Click); // // redoHereToolStripMenuItem // this.redoHereToolStripMenuItem.Name = "redoHereToolStripMenuItem"; - this.redoHereToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.redoHereToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.redoHereToolStripMenuItem.Text = "Redo To Selection"; this.redoHereToolStripMenuItem.Click += new System.EventHandler(this.redoHereToolStripMenuItem_Click); // // sepToolStripMenuItem // this.sepToolStripMenuItem.Name = "sepToolStripMenuItem"; - this.sepToolStripMenuItem.Size = new System.Drawing.Size(207, 6); + this.sepToolStripMenuItem.Size = new System.Drawing.Size(205, 6); // // clearHistoryToHereToolStripMenuItem // this.clearHistoryToHereToolStripMenuItem.Name = "clearHistoryToHereToolStripMenuItem"; - this.clearHistoryToHereToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.clearHistoryToHereToolStripMenuItem.Size = new System.Drawing.Size(208, 22); this.clearHistoryToHereToolStripMenuItem.Text = "Clear History To Selection"; this.clearHistoryToHereToolStripMenuItem.Click += new System.EventHandler(this.clearHistoryToHereToolStripMenuItem_Click); // @@ -212,6 +212,7 @@ this.Controls.Add(this.HistoryView); this.Name = "UndoHistoryForm"; this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Undo History"; this.RightClickMenu.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.MaxStepsNum)).EndInit();