diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 47f89d27e3..6926212c83 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -109,6 +109,11 @@ namespace BizHawk.Client.Common Changes = false; } + public void FlagChanges() // TODO: it is pointless to have these two methods rather than a public setter + { + Changes = true; + } + public override void StartNewRecording() { LagLog.Clear(); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 4bbb685af0..799cd3b8b6 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -273,6 +273,10 @@ namespace BizHawk.Client.EmuHawk [Category("Behavior")] public event RightMouseScrollEventHandler RightMouseScrolled; + [Category("Property Changed")] + [Description("Occurs when the column header has been reordered")] + public event ColumnReorderedEventHandler ColumnReordered; + /// /// Retrieve the text for a cell /// @@ -294,6 +298,8 @@ namespace BizHawk.Client.EmuHawk public delegate void ColumnClickEventHandler(object sender, ColumnClickEventArgs e); + public delegate void ColumnReorderedEventHandler(object sender, ColumnReorderedEventArgs e); + public class CellEventArgs { public CellEventArgs(Cell oldCell, Cell newCell) @@ -316,6 +322,20 @@ namespace BizHawk.Client.EmuHawk public RollColumn Column { get; private set; } } + public class ColumnReorderedEventArgs + { + public ColumnReorderedEventArgs(int oldDisplayIndex, int newDisplayIndex, RollColumn column) + { + Column = column; + OldDisplayIndex = oldDisplayIndex; + NewDisplayIndex = NewDisplayIndex; + } + + public RollColumn Column { get; private set; } + public int OldDisplayIndex { get; private set; } + public int NewDisplayIndex { get; private set; } + } + #endregion #region Api @@ -1478,7 +1498,14 @@ namespace BizHawk.Client.EmuHawk { if (_columnDown != CurrentCell.Column) { + var oldIndex = _columns.IndexOf(_columnDown); var newIndex = _columns.IndexOf(CurrentCell.Column); + + if (ColumnReordered != null) + { + ColumnReordered(this, new ColumnReorderedEventArgs(oldIndex, newIndex, _columnDown)); + } + _columns.Remove(_columnDown); _columns.Insert(newIndex, _columnDown); } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 1a195aa1cf..e42b7497ff 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -779,6 +779,7 @@ namespace BizHawk.Client.EmuHawk this.TasView.ColumnRightClick += new BizHawk.Client.EmuHawk.InputRoll.ColumnClickEventHandler(this.TasView_ColumnRightClick); this.TasView.SelectedIndexChanged += new System.EventHandler(this.TasView_SelectedIndexChanged); this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.InputRoll.RightMouseScrollEventHandler(this.TasView_MouseWheel); + this.TasView.ColumnReordered += new BizHawk.Client.EmuHawk.InputRoll.ColumnReorderedEventHandler(this.TasView_ColumnReordered); this.TasView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TasView_KeyDown); this.TasView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TasView_MouseDoubleClick); this.TasView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TasView_MouseDown); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 67b215abc6..4b0127b14b 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -198,6 +198,11 @@ namespace BizHawk.Client.EmuHawk TasView.Refresh(); } + private void TasView_ColumnReordered(object sender, InputRoll.ColumnReorderedEventArgs e) + { + _currentTasMovie.FlagChanges(); + } + private void TasView_MouseEnter(object sender, EventArgs e) { TasView.Focus();