diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs index 343aa3d674..a8503d093e 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/InputRoll.cs @@ -1270,7 +1270,9 @@ namespace BizHawk.Client.EmuHawk { if (this.Any(c => c.Name == column.Name)) { - throw new InvalidOperationException("A column with this name already exists."); + // The designer sucks, doing nothing for now + return; + //throw new InvalidOperationException("A column with this name already exists."); } base.Add(column); @@ -1283,6 +1285,9 @@ namespace BizHawk.Client.EmuHawk { if (this.Any(c => c.Name == column.Name)) { + // The designer sucks, doing nothing for now + return; + throw new InvalidOperationException("A column with this name already exists."); } } @@ -1368,31 +1373,6 @@ namespace BizHawk.Client.EmuHawk public string Name { get; set; } public string Text { get; set; } public InputType Type { get; set; } - - public static bool operator ==(RollColumn column, string name) - { - return column.Name == name; - } - - public static bool operator !=(RollColumn column, string name) - { - return column.Name != name; - } - - public override int GetHashCode() - { - return Name.GetHashCode(); - } - - public override bool Equals(object obj) - { - if (obj is string) - { - return Name == (string)obj; - } - - return base.Equals(obj); - } } public class Cell diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 1de1ee1ffe..4863375c71 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk this.EnableTooltipsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.TasView = new BizHawk.Client.EmuHawk.TasListView(); + this.TasView = new InputRoll(); this.Frame = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.Log = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.TasStatusStrip = new StatusStripEx(); @@ -711,13 +711,11 @@ namespace BizHawk.Client.EmuHawk this.TasView.selectedItem = -1; this.TasView.Size = new System.Drawing.Size(288, 471); this.TasView.TabIndex = 1; - this.TasView.UseCompatibleStateImageBehavior = false; this.TasView.UseCustomBackground = true; this.TasView.View = System.Windows.Forms.View.Details; - this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.TasListView.RightMouseScrollEventHandler(this.TasView_MouseWheel); + this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.InputRoll.RightMouseScrollEventHandler(this.TasView_MouseWheel); this.TasView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.TasView_ColumnClick); this.TasView.SelectedIndexChanged += new System.EventHandler(this.TasView_SelectedIndexChanged); - this.TasView.VirtualItemsSelectionRangeChanged += new System.Windows.Forms.ListViewVirtualItemsSelectionRangeChangedEventHandler(this.TasView_VirtualItemsSelectionRangeChanged); 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); @@ -942,7 +940,7 @@ namespace BizHawk.Client.EmuHawk private System.Windows.Forms.ToolStripMenuItem ExitMenuItem; private System.Windows.Forms.ToolStripMenuItem EditSubMenu; private System.Windows.Forms.ToolStripMenuItem ConfigSubMenu; - private TasListView TasView; + private InputRoll TasView; private System.Windows.Forms.ColumnHeader Log; private System.Windows.Forms.ToolStripMenuItem RecentSubMenu; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs index da516494d0..3f86293274 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs @@ -12,7 +12,6 @@ namespace BizHawk.Client.EmuHawk return; } - RefreshDialog(); if (_currentTasMovie.IsRecording) { TasView.ensureVisible(_currentTasMovie.InputLogLength - 1); @@ -21,6 +20,8 @@ namespace BizHawk.Client.EmuHawk { TasView.ensureVisible(Global.Emulator.Frame); } + + RefreshDialog(); } public void FastUpdate() diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 2e750c3745..0f1e98f1ed 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -192,27 +192,27 @@ namespace BizHawk.Client.EmuHawk return; } - if (TasView.CurrentCell.RowIndex.HasValue && !string.IsNullOrEmpty(TasView.CurrentCell.Column)) + if (TasView.CurrentCell.RowIndex.HasValue && TasView.CurrentCell.Column != null) { if (e.Button == MouseButtons.Left) { - if (TasView.CurrentCell.Column == MarkerColumnName) + if (TasView.CurrentCell.Column.Name == MarkerColumnName) { _startMarkerDrag = true; GoToFrame(TasView.CurrentCell.RowIndex.Value); } - else if (TasView.CurrentCell.Column == FrameColumnName) + else if (TasView.CurrentCell.Column.Name == FrameColumnName) { _startFrameDrag = true; } else//User changed input { var frame = TasView.CurrentCell.RowIndex.Value; - var buttonName = TasView.CurrentCell.Column; + var buttonName = TasView.CurrentCell.Column.Name; if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName)) { - ToggleBoolState(TasView.CurrentCell.RowIndex.Value, TasView.CurrentCell.Column); + ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName); GoToLastEmulatedFrameIfNecessary(TasView.CurrentCell.RowIndex.Value); TasView.Refresh(); @@ -222,12 +222,12 @@ namespace BizHawk.Client.EmuHawk GlobalWin.MainForm.PauseOnFrame = Global.Emulator.Frame; } - _startBoolDrawColumn = TasView.CurrentCell.Column; + _startBoolDrawColumn = buttonName; _boolPaintState = _currentTasMovie.BoolIsPressed(frame, buttonName); } else { - _startFloatDrawColumn = TasView.CurrentCell.Column; + _startFloatDrawColumn = buttonName; _floatPaintState = _currentTasMovie.GetFloatValue(frame, buttonName); } } @@ -235,7 +235,7 @@ namespace BizHawk.Client.EmuHawk else if (e.Button == MouseButtons.Right) { var frame = TasView.CurrentCell.RowIndex.Value; - var buttonName = TasView.CurrentCell.Column; + var buttonName = TasView.CurrentCell.Column.Name; if (TasView.SelectedIndices.IndexOf(frame) != -1 && (buttonName == MarkerColumnName || buttonName == FrameColumnName)) { //Disable the option to remove markers if no markers are selected (FCUEX does this). @@ -273,15 +273,24 @@ namespace BizHawk.Client.EmuHawk private void TasView_MouseDoubleClick(object sender, MouseEventArgs e) { if (TasView.CurrentCell.RowIndex.HasValue && - !string.IsNullOrEmpty(TasView.CurrentCell.Column) && - TasView.CurrentCell.Column == FrameColumnName) + TasView.CurrentCell != null && + TasView.CurrentCell.Column.Name == FrameColumnName) { CallAddMarkerPopUp(TasView.CurrentCell.RowIndex.Value); } } - private void TasView_PointedCellChanged(object sender, TasListView.CellEventArgs e) + private void TasView_PointedCellChanged(object sender, InputRoll.CellEventArgs e) { + // TODO: think about nullability + // For now return if a null because this happens OnEnter which doesn't have any of the below behaviors yet? + // Most of these are stupid but I got annoyed at null crashes + if (e.OldCell == null || e.OldCell.Column == null || e.OldCell.RowIndex == null || + e.NewCell == null || e.NewCell.RowIndex == null || e.NewCell.Column == null) + { + return; + } + int startVal, endVal; if (e.OldCell.RowIndex.Value < e.NewCell.RowIndex.Value) { @@ -347,11 +356,6 @@ namespace BizHawk.Client.EmuHawk SetSplicer(); } - private void TasView_VirtualItemsSelectionRangeChanged(object sender, ListViewVirtualItemsSelectionRangeChangedEventArgs e) - { - SetSplicer(); - } - private void TasView_KeyDown(object sender, KeyEventArgs e) { if (e.Control && !e.Shift && !e.Alt && e.KeyCode == Keys.Left) // Ctrl + Left diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 38f0225d20..00f071d0b2 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -175,6 +175,7 @@ namespace BizHawk.Client.EmuHawk { TasView.BlazingFast = true; TasView.ItemCount = _currentTasMovie.InputLogLength + 1; + TasView.Refresh(); TasView.BlazingFast = false; if (MarkerControl != null) {