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
This commit is contained in:
feos 2016-06-11 12:48:11 +03:00
parent 2a952cebef
commit 32be07ce03
3 changed files with 28 additions and 23 deletions

View File

@ -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;
}
}

View File

@ -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<TasMovieMarker> 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);
}
/// <summary>

View File

@ -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();