From f5a3d28f21ca952ced90571ed2aa1cb4edef4fba Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 28 Sep 2014 17:16:00 +0000 Subject: [PATCH] Tastudio - fix a problem with stale marker list when restarting a project or loading a new one --- .../tools/TAStudio/MarkerControl.cs | 23 ++++++++++--------- .../tools/TAStudio/TAStudio.Designer.cs | 1 - .../tools/TAStudio/TAStudio.cs | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index bddbaf8152..3ebaff2258 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -13,8 +13,6 @@ namespace BizHawk.Client.EmuHawk { public partial class MarkerControl : UserControl { - public TasMovieMarkerList Markers {get; set; } - public TAStudio Tastudio { get; set; } public MarkerControl() @@ -48,9 +46,9 @@ namespace BizHawk.Client.EmuHawk private void MarkerView_QueryItemBkColor(int index, int column, ref Color color) { - var prev = Markers.PreviousOrCurrent(Global.Emulator.Frame); + var prev = Tastudio.CurrentMovie.Markers.PreviousOrCurrent(Global.Emulator.Frame); - if (prev != null && index == Markers.IndexOf(prev)) + if (prev != null && index == Tastudio.CurrentMovie.Markers.IndexOf(prev)) { color = TAStudio.Marker_FrameCol; } @@ -82,11 +80,11 @@ namespace BizHawk.Client.EmuHawk if (column == 0) { - text = Markers[index].Frame.ToString(); + text = Tastudio.CurrentMovie.Markers[index].Frame.ToString(); } else if (column == 1) { - text = Markers[index].Message; + text = Tastudio.CurrentMovie.Markers[index].Message; } } @@ -98,9 +96,12 @@ namespace BizHawk.Client.EmuHawk public void UpdateValues() { - if (MarkerView != null && Markers != null) + if (MarkerView != null && + Tastudio != null && + Tastudio.CurrentMovie != null && + Tastudio.CurrentMovie.Markers != null) { - MarkerView.RowCount = Markers.Count; + MarkerView.RowCount = Tastudio.CurrentMovie.Markers.Count; } MarkerView.Refresh(); @@ -108,12 +109,12 @@ namespace BizHawk.Client.EmuHawk private void MarkerView_SelectedIndexChanged(object sender, EventArgs e) { - RemoveBtn.Enabled = SelectedIndices.Any(i => i < Markers.Count); + RemoveBtn.Enabled = SelectedIndices.Any(i => i < Tastudio.CurrentMovie.Markers.Count); } private void RemoveBtn_Click(object sender, EventArgs e) { - SelectedMarkers.ForEach(i => Markers.Remove(i)); + SelectedMarkers.ForEach(i => Tastudio.CurrentMovie.Markers.Remove(i)); Tastudio.RefreshDialog(); MarkerView_SelectedIndexChanged(sender, e); } @@ -132,7 +133,7 @@ namespace BizHawk.Client.EmuHawk get { return SelectedIndices - .Select(index => Markers[index]) + .Select(index => Tastudio.CurrentMovie.Markers[index]) .ToList(); } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 4f26d2f20e..b4d90d7c5b 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -754,7 +754,6 @@ namespace BizHawk.Client.EmuHawk // this.MarkerControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.MarkerControl.Location = new System.Drawing.Point(302, 129); - this.MarkerControl.Markers = null; this.MarkerControl.Name = "MarkerControl"; this.MarkerControl.Size = new System.Drawing.Size(204, 215); this.MarkerControl.TabIndex = 6; diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 4d78fa5d6f..e1a2a3396b 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -80,7 +80,6 @@ namespace BizHawk.Client.EmuHawk GlobalWin.MainForm.PauseEmulator(); GlobalWin.MainForm.RelinquishControl(this); _originalEndAction = Global.Config.MovieEndAction; - MarkerControl.Markers = _currentTasMovie.Markers; GlobalWin.MainForm.ClearRewindData(); Global.Config.MovieEndAction = MovieEndAction.Record; GlobalWin.MainForm.SetMainformMovieInfo();