A few edits to TAStudio:

-Double-click markers to jump to that frame.
-Drag painting input was one frame behind cursor.
-Some commented-out code for stuff I was messing with may also be present. (All edits were marked with SuuperW comment line.)
This commit is contained in:
SuuperW 2015-02-24 03:06:57 +00:00
parent 634acd8fe1
commit e3b9b7c795
6 changed files with 119 additions and 78 deletions

View File

@ -105,7 +105,7 @@ namespace BizHawk.Client.EmuHawk
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Properties #region Properties
/// <summary> /// <summary>

View File

@ -28,66 +28,66 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.AddBtn = new System.Windows.Forms.Button(); this.AddBtn = new System.Windows.Forms.Button();
this.RemoveBtn = new System.Windows.Forms.Button(); this.RemoveBtn = new System.Windows.Forms.Button();
this.MarkerView = new BizHawk.Client.EmuHawk.InputRoll(); this.MarkerView = new BizHawk.Client.EmuHawk.InputRoll();
this.SuspendLayout(); this.SuspendLayout();
// //
// AddBtn // AddBtn
// //
this.AddBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.AddBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AddBtn.Location = new System.Drawing.Point(157, 214); this.AddBtn.Location = new System.Drawing.Point(157, 214);
this.AddBtn.Name = "AddBtn"; this.AddBtn.Name = "AddBtn";
this.AddBtn.Size = new System.Drawing.Size(44, 23); this.AddBtn.Size = new System.Drawing.Size(44, 23);
this.AddBtn.TabIndex = 6; this.AddBtn.TabIndex = 6;
this.AddBtn.Text = "Add"; this.AddBtn.Text = "Add";
this.AddBtn.UseVisualStyleBackColor = true; this.AddBtn.UseVisualStyleBackColor = true;
this.AddBtn.Click += new System.EventHandler(this.AddBtn_Click); this.AddBtn.Click += new System.EventHandler(this.AddBtn_Click);
// //
// RemoveBtn // RemoveBtn
// //
this.RemoveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.RemoveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.RemoveBtn.Enabled = false; this.RemoveBtn.Enabled = false;
this.RemoveBtn.Location = new System.Drawing.Point(3, 214); this.RemoveBtn.Location = new System.Drawing.Point(3, 214);
this.RemoveBtn.Name = "RemoveBtn"; this.RemoveBtn.Name = "RemoveBtn";
this.RemoveBtn.Size = new System.Drawing.Size(58, 23); this.RemoveBtn.Size = new System.Drawing.Size(58, 23);
this.RemoveBtn.TabIndex = 7; this.RemoveBtn.TabIndex = 7;
this.RemoveBtn.Text = "Remove"; this.RemoveBtn.Text = "Remove";
this.RemoveBtn.UseVisualStyleBackColor = true; this.RemoveBtn.UseVisualStyleBackColor = true;
this.RemoveBtn.Click += new System.EventHandler(this.RemoveBtn_Click); this.RemoveBtn.Click += new System.EventHandler(this.RemoveBtn_Click);
// //
// MarkerView // MarkerView
// //
this.MarkerView.AllowColumnReorder = false; this.MarkerView.AllowColumnReorder = false;
this.MarkerView.AllowColumnResize = false; this.MarkerView.AllowColumnResize = false;
this.MarkerView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.MarkerView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.MarkerView.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.MarkerView.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MarkerView.FullRowSelect = true; this.MarkerView.FullRowSelect = true;
this.MarkerView.HorizontalOrientation = false; this.MarkerView.HorizontalOrientation = false;
this.MarkerView.LastVisibleRow = 11; this.MarkerView.LastVisibleRow = 9;
this.MarkerView.Location = new System.Drawing.Point(3, 0); this.MarkerView.Location = new System.Drawing.Point(3, 0);
this.MarkerView.MaxCharactersInHorizontal = 1; this.MarkerView.MaxCharactersInHorizontal = 1;
this.MarkerView.MultiSelect = false; this.MarkerView.MultiSelect = false;
this.MarkerView.Name = "MarkerView"; this.MarkerView.Name = "MarkerView";
this.MarkerView.RowCount = 0; this.MarkerView.RowCount = 0;
this.MarkerView.Size = new System.Drawing.Size(198, 209); this.MarkerView.Size = new System.Drawing.Size(198, 209);
this.MarkerView.TabIndex = 5; this.MarkerView.TabIndex = 5;
this.MarkerView.TabStop = false; this.MarkerView.TabStop = false;
this.MarkerView.SelectedIndexChanged += new System.EventHandler(this.MarkerView_SelectedIndexChanged); this.MarkerView.SelectedIndexChanged += new System.EventHandler(this.MarkerView_SelectedIndexChanged);
this.MarkerView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.MarkerView_MouseDoubleClick); this.MarkerView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.MarkerView_MouseDoubleClick);
// //
// MarkerControl // MarkerControl
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.RemoveBtn); this.Controls.Add(this.RemoveBtn);
this.Controls.Add(this.AddBtn); this.Controls.Add(this.AddBtn);
this.Controls.Add(this.MarkerView); this.Controls.Add(this.MarkerView);
this.Name = "MarkerControl"; this.Name = "MarkerControl";
this.Size = new System.Drawing.Size(204, 241); this.Size = new System.Drawing.Size(204, 241);
this.Load += new System.EventHandler(this.MarkerControl_Load); this.Load += new System.EventHandler(this.MarkerControl_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@ -140,15 +140,18 @@ namespace BizHawk.Client.EmuHawk
Tastudio.GoToMarker(SelectedMarkers.First()); Tastudio.GoToMarker(SelectedMarkers.First());
} }
private void MarkerView_MouseDoubleClick(object sender, MouseEventArgs e) // SuuperW: Marker renaming can be done with a right-click.
{ // A much more useful feature would be to easily jump to it. I'll put that in TAStudio.Navigation.cs
if (MarkerView.CurrentCell != null && MarkerView.CurrentCell.RowIndex.HasValue && private void MarkerView_MouseDoubleClick(object sender, MouseEventArgs e)
MarkerView.CurrentCell.RowIndex < MarkerView.RowCount) {
{ if (MarkerView.CurrentCell != null && MarkerView.CurrentCell.RowIndex.HasValue &&
var marker = Tastudio.CurrentTasMovie.Markers[MarkerView.CurrentCell.RowIndex.Value]; MarkerView.CurrentCell.RowIndex < MarkerView.RowCount)
Tastudio.CallEditMarkerPopUp(marker); {
} var marker = Tastudio.CurrentTasMovie.Markers[MarkerView.CurrentCell.RowIndex.Value];
} // Tastudio.CallEditMarkerPopUp(marker);
Tastudio.GoToFrame(marker.Frame);
}
}
public void EditMarker() public void EditMarker()
{ {
@ -171,6 +174,6 @@ namespace BizHawk.Client.EmuHawk
{ {
RemoveBtn_Click(null, null); RemoveBtn_Click(null, null);
} }
} }
} }
} }

View File

@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk
{ {
color = (record.HasState ? color = Color.FromArgb(0xEEEEEE) : Color.White); color = (record.HasState ? color = Color.FromArgb(0xEEEEEE) : Color.White);
} }
return; return;
} }
@ -173,7 +173,7 @@ namespace BizHawk.Client.EmuHawk
{ {
CurrentTasMovie.Markers.Add(TasView.LastSelectedIndex.Value, ""); CurrentTasMovie.Markers.Add(TasView.LastSelectedIndex.Value, "");
RefreshDialog(); RefreshDialog();
} }
else if (columnName != MarkerColumnName) // TODO: what about float? else if (columnName != MarkerColumnName) // TODO: what about float?
{ {
@ -251,13 +251,13 @@ namespace BizHawk.Client.EmuHawk
{ {
Global.ClickyVirtualPadController.IsPressed(buttonName); Global.ClickyVirtualPadController.IsPressed(buttonName);
} }
} }
else else
{ {
_startFloatDrawColumn = buttonName; _startFloatDrawColumn = buttonName;
float _floatPaintState = 0; float _floatPaintState = 0; // SuuperW: This variable isn't used, and hides another.
if (frame < CurrentTasMovie.InputLogLength) if (frame < CurrentTasMovie.InputLogLength)
{ {
_floatPaintState = CurrentTasMovie.GetFloatValue(frame, buttonName); _floatPaintState = CurrentTasMovie.GetFloatValue(frame, buttonName);
@ -268,6 +268,23 @@ namespace BizHawk.Client.EmuHawk
} }
} }
} }
//else if (e.Button == System.Windows.Forms.MouseButtons.Right)
//{ // SuuperW: This will be a simple way to 'toggle' float values.
// if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName))
// {
// ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
// _triggerAutoRestore = true;
// _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
// RefreshDialog();
// }
// else
// {
// ToggleFloatState(frame, buttonName);
// _triggerAutoRestore = true;
// _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;
// RefreshDialog();
// }
//}
} }
} }
} }
@ -372,7 +389,7 @@ namespace BizHawk.Client.EmuHawk
{ {
if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
{ {
for (var i = startVal; i < endVal; i++) for (var i = startVal; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
{ {
SetBoolState(i, _startBoolDrawColumn, _boolPaintState); // Notice it uses new row, old column, you can only paint across a single column SetBoolState(i, _startBoolDrawColumn, _boolPaintState); // Notice it uses new row, old column, you can only paint across a single column
_triggerAutoRestore = true; _triggerAutoRestore = true;
@ -386,10 +403,12 @@ namespace BizHawk.Client.EmuHawk
{ {
if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue) if (e.OldCell.RowIndex.HasValue && e.NewCell.RowIndex.HasValue)
{ {
for (var i = startVal; i < endVal; i++) for (var i = startVal; i <= endVal; i++) // SuuperW: <= so that it will edit the cell you are hovering over. (Inclusive)
{ {
if (i < CurrentTasMovie.InputLogLength) // TODO: how do we really want to handle the user setting the float state of the pending frame? if (i < CurrentTasMovie.InputLogLength) // TODO: how do we really want to handle the user setting the float state of the pending frame?
{ {
// Temp SuuperW
_floatPaintState = 0.5f;
CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, _floatPaintState); // Notice it uses new row, old column, you can only paint across a single column CurrentTasMovie.SetFloatState(i, _startFloatDrawColumn, _floatPaintState); // Notice it uses new row, old column, you can only paint across a single column
_triggerAutoRestore = true; _triggerAutoRestore = true;
_triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value; _triggerAutoRestoreFromFrame = TasView.CurrentCell.RowIndex.Value;

View File

@ -25,7 +25,8 @@ namespace BizHawk.Client.EmuHawk
} }
} }
private void GoToFrame(int frame) // SuuperW: I changed this to public so that it could be used by MarkerControl.cs
public void GoToFrame(int frame)
{ {
// If past greenzone, emulate and capture states // If past greenzone, emulate and capture states
// If past greenzone AND movie, record input and capture states // If past greenzone AND movie, record input and capture states
@ -155,6 +156,6 @@ namespace BizHawk.Client.EmuHawk
public void GoToMarker(TasMovieMarker marker) public void GoToMarker(TasMovieMarker marker)
{ {
GoToFrame(marker.Frame); GoToFrame(marker.Frame);
} }
} }
} }

View File

@ -475,6 +475,24 @@ namespace BizHawk.Client.EmuHawk
} }
} }
//// SuuperW: 'toggle' float state
//private void ToggleFloatState(int frame, string buttonName)
//{
// if (frame < CurrentTasMovie.InputLogLength)
// {
// float curState = CurrentTasMovie.GetFloatValue(frame, buttonName);
// if (curState == 0f)
// CurrentTasMovie.SetFloatState(frame, buttonName, 1.0f);
// else
// CurrentTasMovie.SetFloatState(frame, buttonName, 0f);
// }
// else if (frame == Emulator.Frame && frame == CurrentTasMovie.InputLogLength)
// {
// // Global.ClickyVirtualPadController.Toggle(buttonName);
// }
//}
private void SetColumnsFromCurrentStickies() private void SetColumnsFromCurrentStickies()
{ {
foreach (var column in TasView.VisibleColumns) foreach (var column in TasView.VisibleColumns)