BizHawk/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.IToolForm.cs

93 lines
1.8 KiB
C#
Raw Normal View History

2014-07-09 15:04:16 +00:00
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class TAStudio : IToolForm
{
public bool UpdateBefore { get { return false; } }
2014-07-09 15:04:16 +00:00
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed || _currentTasMovie == null)
{
return;
}
SetVisibleIndex();
RefreshDialog();
2014-07-09 15:04:16 +00:00
}
public void FastUpdate()
{
2014-08-31 16:51:19 +00:00
if (!IsHandleCreated || IsDisposed || _currentTasMovie == null)
{
return;
}
TasView.RowCount = _currentTasMovie.InputLogLength + 1;
SetVisibleIndex();
}
2014-07-09 15:04:16 +00:00
public void Restart()
{
if (!IsHandleCreated || IsDisposed)
{
return;
}
if (_currentTasMovie != null)
{
RefreshDialog();
}
2014-07-09 15:04:16 +00:00
}
public bool AskSaveChanges()
2014-07-09 15:04:16 +00:00
{
if (_currentTasMovie != null && _currentTasMovie.Changes)
2014-07-09 15:04:16 +00:00
{
GlobalWin.Sound.StopSound();
var result = MessageBox.Show(
"Save Changes?",
"Tastudio",
MessageBoxButtons.YesNoCancel,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button3);
2014-07-09 15:04:16 +00:00
GlobalWin.Sound.StartSound();
if (result == DialogResult.Yes)
{
SaveTasMenuItem_Click(null, null);
}
else if (result == DialogResult.No)
{
_currentTasMovie.ClearChanges();
2014-07-09 15:04:16 +00:00
return true;
}
else if (result == DialogResult.Cancel)
{
return false;
}
}
return true;
}
private void SetVisibleIndex(int? indexThatMustBeVisible = null)
{
if (!indexThatMustBeVisible.HasValue)
{
indexThatMustBeVisible = _currentTasMovie.IsRecording
? _currentTasMovie.InputLogLength
: Global.Emulator.Frame + 1;
}
if (!TasView.IsVisible(indexThatMustBeVisible.Value))
{
TasView.LastVisibleRow = indexThatMustBeVisible.Value;
}
}
2014-07-09 15:04:16 +00:00
}
}