Tastudio - tweak logic for determining which frame should be visible

This commit is contained in:
adelikat 2014-09-17 23:51:16 +00:00
parent d1d414d10e
commit f78e4bb1b2
2 changed files with 22 additions and 20 deletions

View File

@ -452,6 +452,11 @@ namespace BizHawk.Client.EmuHawk
} }
} }
public bool IsVisible(int index)
{
return (index >= FirstVisibleRow) && (index <= LastVisibleRow);
}
/// <summary> /// <summary>
/// Gets the number of rows currently visible including partially visible rows. /// Gets the number of rows currently visible including partially visible rows.
/// </summary> /// </summary>
@ -465,12 +470,12 @@ namespace BizHawk.Client.EmuHawk
{ {
var width = DrawWidth - (NeedsVScrollbar ? VBar.Width : 0); var width = DrawWidth - (NeedsVScrollbar ? VBar.Width : 0);
return (int)Math.Floor((decimal)(width - ColumnWidth) / CellWidth); return (int)((width - ColumnWidth) / CellWidth);
} }
var height = DrawHeight - (NeedsHScrollbar ? HBar.Height : 0); var height = DrawHeight - (NeedsHScrollbar ? HBar.Height : 0);
return (int)((decimal)height / CellHeight); return (int)height / CellHeight;
} }
} }

View File

@ -5,6 +5,8 @@ namespace BizHawk.Client.EmuHawk
{ {
public partial class TAStudio : IToolForm public partial class TAStudio : IToolForm
{ {
public bool UpdateBefore { get { return false; } }
public void UpdateValues() public void UpdateValues()
{ {
if (!IsHandleCreated || IsDisposed || _currentTasMovie == null) if (!IsHandleCreated || IsDisposed || _currentTasMovie == null)
@ -12,15 +14,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (_currentTasMovie.IsRecording) SetVisibleIndex();
{
TasView.LastVisibleRow = _currentTasMovie.InputLogLength - 1;
}
else
{
TasView.LastVisibleRow = Global.Emulator.Frame;
}
RefreshDialog(); RefreshDialog();
} }
@ -31,14 +25,7 @@ namespace BizHawk.Client.EmuHawk
return; return;
} }
if (_currentTasMovie.IsRecording) SetVisibleIndex();
{
TasView.LastVisibleRow = _currentTasMovie.InputLogLength - 1;
}
else
{
TasView.LastVisibleRow = Global.Emulator.Frame;
}
} }
public void Restart() public void Restart()
@ -86,6 +73,16 @@ namespace BizHawk.Client.EmuHawk
return true; return true;
} }
public bool UpdateBefore { get { return false; } } private void SetVisibleIndex()
{
int indexThatMustBeVisible = _currentTasMovie.IsRecording
? _currentTasMovie.InputLogLength
: Global.Emulator.Frame + 1;
if (!TasView.IsVisible(indexThatMustBeVisible))
{
TasView.LastVisibleRow = indexThatMustBeVisible;
}
}
} }
} }