tastudio - implement follow cursor

This commit is contained in:
adelikat 2014-10-11 19:43:05 +00:00
parent f7939125e7
commit 2fb986715e
4 changed files with 43 additions and 4 deletions

View File

@ -531,6 +531,7 @@ namespace BizHawk.Client.Common
public bool TAStudioDrawInput = true; public bool TAStudioDrawInput = true;
public bool TAStudioAutoPause = true; public bool TAStudioAutoPause = true;
public bool TAStudioAutoRestoreLastPosition = false; public bool TAStudioAutoRestoreLastPosition = false;
public bool TAStudioFollowCursor = true;
// VirtualPad Dialog // VirtualPad Dialog
public ToolDialogSettings VirtualPadSettings = new ToolDialogSettings(); public ToolDialogSettings VirtualPadSettings = new ToolDialogSettings();

View File

@ -85,13 +85,13 @@
// FollowCursorCheckbox // FollowCursorCheckbox
// //
this.FollowCursorCheckbox.AutoSize = true; this.FollowCursorCheckbox.AutoSize = true;
this.FollowCursorCheckbox.Enabled = false;
this.FollowCursorCheckbox.Location = new System.Drawing.Point(10, 48); this.FollowCursorCheckbox.Location = new System.Drawing.Point(10, 48);
this.FollowCursorCheckbox.Name = "FollowCursorCheckbox"; this.FollowCursorCheckbox.Name = "FollowCursorCheckbox";
this.FollowCursorCheckbox.Size = new System.Drawing.Size(89, 17); this.FollowCursorCheckbox.Size = new System.Drawing.Size(89, 17);
this.FollowCursorCheckbox.TabIndex = 5; this.FollowCursorCheckbox.TabIndex = 5;
this.FollowCursorCheckbox.Text = "Follow Cursor"; this.FollowCursorCheckbox.Text = "Follow Cursor";
this.FollowCursorCheckbox.UseVisualStyleBackColor = true; this.FollowCursorCheckbox.UseVisualStyleBackColor = true;
this.FollowCursorCheckbox.CheckedChanged += new System.EventHandler(this.FollowCursorCheckbox_CheckedChanged);
// //
// NextMarkerButton // NextMarkerButton
// //

View File

@ -47,6 +47,21 @@ namespace BizHawk.Client.EmuHawk
} }
} }
[Browsable(false)]
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
public bool FollowCursor
{
get
{
return Global.Config.TAStudioFollowCursor;
}
set
{
FollowCursorCheckbox.Checked = Global.Config.TAStudioFollowCursor = value;
}
}
public PlaybackBox() public PlaybackBox()
{ {
InitializeComponent(); InitializeComponent();
@ -55,6 +70,7 @@ namespace BizHawk.Client.EmuHawk
{ {
TurboSeekCheckbox.Checked = Global.Config.TurboSeek; TurboSeekCheckbox.Checked = Global.Config.TurboSeek;
AutoRestoreCheckbox.Checked = Global.Config.TAStudioAutoRestoreLastPosition; AutoRestoreCheckbox.Checked = Global.Config.TAStudioAutoRestoreLastPosition;
FollowCursorCheckbox.Checked = Global.Config.TAStudioFollowCursor;
} }
_programmaticallyChangingValue = false; _programmaticallyChangingValue = false;
} }
@ -99,5 +115,19 @@ namespace BizHawk.Client.EmuHawk
Global.Config.TAStudioAutoRestoreLastPosition ^= true; Global.Config.TAStudioAutoRestoreLastPosition ^= true;
} }
} }
private void FollowCursorCheckbox_CheckedChanged(object sender, EventArgs e)
{
if (!_programmaticallyChangingValue)
{
Global.Config.TAStudioFollowCursor ^= true;
if (Global.Config.TAStudioFollowCursor)
{
Tastudio.SetVisibleIndex();
Tastudio.RefreshDialog();
}
}
}
} }
} }

View File

@ -21,7 +21,11 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
SetVisibleIndex(); if (TasPlaybackBox.FollowCursor)
{
SetVisibleIndex();
}
RefreshDialog(); RefreshDialog();
} }
@ -33,7 +37,11 @@ namespace BizHawk.Client.EmuHawk
} }
TasView.RowCount = _currentTasMovie.InputLogLength + 1; TasView.RowCount = _currentTasMovie.InputLogLength + 1;
SetVisibleIndex();
if (TasPlaybackBox.FollowCursor)
{
SetVisibleIndex();
}
} }
public void Restart() public void Restart()
@ -81,7 +89,7 @@ namespace BizHawk.Client.EmuHawk
return true; return true;
} }
private void SetVisibleIndex(int? indexThatMustBeVisible = null) public void SetVisibleIndex(int? indexThatMustBeVisible = null)
{ {
if (!indexThatMustBeVisible.HasValue) if (!indexThatMustBeVisible.HasValue)
{ {