tastudio: autosave feature.
supposedly safe saving indication (hourglass cursor and status bar report).
This commit is contained in:
parent
28fe9bb888
commit
bc30e87921
|
@ -83,6 +83,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.SetMaxUndoLevelsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SetBranchCellHoverIntervalMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SetSeekingCutoffIntervalMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.setAutosaveIntervalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AutosaveAsBk2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.AutoadjustInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
|
||||
|
@ -606,6 +608,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.SetMaxUndoLevelsMenuItem,
|
||||
this.SetBranchCellHoverIntervalMenuItem,
|
||||
this.SetSeekingCutoffIntervalMenuItem,
|
||||
this.setAutosaveIntervalToolStripMenuItem,
|
||||
this.AutosaveAsBk2MenuItem,
|
||||
this.toolStripSeparator9,
|
||||
this.AutoadjustInputMenuItem,
|
||||
this.toolStripSeparator11,
|
||||
|
@ -650,6 +654,20 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.SetSeekingCutoffIntervalMenuItem.Visible = false;
|
||||
this.SetSeekingCutoffIntervalMenuItem.Click += new System.EventHandler(this.SetSeekingCutoffIntervalMenuItem_Click);
|
||||
//
|
||||
// setAutosaveIntervalToolStripMenuItem
|
||||
//
|
||||
this.setAutosaveIntervalToolStripMenuItem.Name = "setAutosaveIntervalToolStripMenuItem";
|
||||
this.setAutosaveIntervalToolStripMenuItem.Size = new System.Drawing.Size(253, 22);
|
||||
this.setAutosaveIntervalToolStripMenuItem.Text = "Set Autosave Interval";
|
||||
this.setAutosaveIntervalToolStripMenuItem.Click += new System.EventHandler(this.SetAutosaveIntervalMenuItem_Click);
|
||||
//
|
||||
// AutosaveAsBk2MenuItem
|
||||
//
|
||||
this.AutosaveAsBk2MenuItem.Name = "AutosaveAsBk2MenuItem";
|
||||
this.AutosaveAsBk2MenuItem.Size = new System.Drawing.Size(253, 22);
|
||||
this.AutosaveAsBk2MenuItem.Text = "Autosave As Bk2";
|
||||
this.AutosaveAsBk2MenuItem.Click += new System.EventHandler(this.AutosaveAsBk2MenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator9
|
||||
//
|
||||
this.toolStripSeparator9.Name = "toolStripSeparator9";
|
||||
|
@ -1155,7 +1173,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.TasView.TabIndex = 1;
|
||||
this.TasView.ColumnClick += new BizHawk.Client.EmuHawk.InputRoll.ColumnClickEventHandler(this.TasView_ColumnClick);
|
||||
this.TasView.ColumnRightClick += new BizHawk.Client.EmuHawk.InputRoll.ColumnClickEventHandler(this.TasView_ColumnRightClick);
|
||||
//this.TasView.SelectedIndexChanged += new System.EventHandler(this.TasView_SelectedIndexChanged);
|
||||
this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.InputRoll.RightMouseScrollEventHandler(this.TasView_MouseWheel);
|
||||
this.TasView.ColumnReordered += new BizHawk.Client.EmuHawk.InputRoll.ColumnReorderedEventHandler(this.TasView_ColumnReordered);
|
||||
this.TasView.CellDropped += new BizHawk.Client.EmuHawk.InputRoll.CellDroppedEvent(this.TasView_CellDropped);
|
||||
|
@ -1703,5 +1720,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private System.Windows.Forms.ToolStripMenuItem SetBranchCellHoverIntervalMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SetMarkerWithTextContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SetSeekingCutoffIntervalMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem setAutosaveIntervalToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem AutosaveAsBk2MenuItem;
|
||||
}
|
||||
}
|
|
@ -85,13 +85,21 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
else
|
||||
{
|
||||
_autosaveTimer.Stop();
|
||||
MessageStatusLabel.Text = "Saving...";
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
Update();
|
||||
CurrentTasMovie.Save();
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
_autosaveTimer.Start();
|
||||
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAsTasMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_autosaveTimer.Stop();
|
||||
var filename = CurrentTasMovie.Filename;
|
||||
if (string.IsNullOrWhiteSpace(filename) || filename == DefaultTasProjName())
|
||||
{
|
||||
|
@ -107,9 +115,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (file != null)
|
||||
{
|
||||
CurrentTasMovie.Filename = file.FullName;
|
||||
MessageStatusLabel.Text = "Saving...";
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
Update();
|
||||
CurrentTasMovie.Save();
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
SetTextProperty();
|
||||
_autosaveTimer.Start();
|
||||
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,10 +160,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ToBk2MenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_autosaveTimer.Stop();
|
||||
var bk2 = CurrentTasMovie.ToBk2(true);
|
||||
MessageStatusLabel.Text = "Exporting to .bk2...";
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
Update();
|
||||
bk2.Save();
|
||||
MessageStatusLabel.Text = Path.GetFileName(bk2.Filename) + " created.";
|
||||
|
||||
_autosaveTimer.Start();
|
||||
MessageStatusLabel.Text = Path.GetFileName(bk2.Filename) + " exported.";
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
private void ExitMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -186,10 +205,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void showUndoHistoryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
undoForm = new UndoHistoryForm(this);
|
||||
undoForm.Owner = this;
|
||||
undoForm.Show();
|
||||
undoForm.UpdateValues();
|
||||
_undoForm = new UndoHistoryForm(this);
|
||||
_undoForm.Owner = this;
|
||||
_undoForm.Show();
|
||||
_undoForm.UpdateValues();
|
||||
}
|
||||
|
||||
private void EditSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
|
@ -706,11 +725,39 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private void SetAutosaveIntervalMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var prompt = new InputPrompt
|
||||
{
|
||||
TextInputType = InputPrompt.InputType.Unsigned,
|
||||
Message = "Autosave Interval in seconds",
|
||||
InitialValue = (Settings.AutosaveInterval / 1000).ToString()
|
||||
})
|
||||
{
|
||||
DialogResult result = prompt.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
int val = int.Parse(prompt.PromptText) * 1000;
|
||||
if (val > 0)
|
||||
{
|
||||
Settings.AutosaveInterval = val;
|
||||
_autosaveTimer.Interval = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AutosaveAsBk2MenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Settings.AutosaveAsBk2 ^= true;
|
||||
}
|
||||
|
||||
private void ConfigSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
DrawInputByDraggingMenuItem.Checked = Settings.DrawInput;
|
||||
AutopauseAtEndOfMovieMenuItem.Checked = Settings.AutoPause;
|
||||
EmptyNewMarkerNotesMenuItem.Checked = Settings.EmptyMarkers;
|
||||
AutosaveAsBk2MenuItem.Checked = Settings.AutosaveAsBk2;
|
||||
}
|
||||
|
||||
private void DrawInputByDraggingMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -36,7 +36,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
return (lg as Bk2LogEntryGenerator).Map();
|
||||
}
|
||||
|
||||
private UndoHistoryForm undoForm;
|
||||
private UndoHistoryForm _undoForm;
|
||||
private Timer _autosaveTimer = new Timer();
|
||||
|
||||
public ScreenshotPopupControl ScreenshotControl = new ScreenshotPopupControl
|
||||
{
|
||||
|
@ -66,6 +67,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
FollowCursorScrollMethod = "near";
|
||||
BranchCellHoverInterval = 1;
|
||||
SeekingCutoffInterval = 2; // unused, relying on VisibleRows is smarter
|
||||
AutosaveInterval = 120000;
|
||||
AutosaveAsBk2 = false;
|
||||
// default to taseditor fashion
|
||||
denoteStatesWithIcons = false;
|
||||
denoteStatesWithBGColor = true;
|
||||
|
@ -84,6 +87,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string FollowCursorScrollMethod { get; set; }
|
||||
public int BranchCellHoverInterval { get; set; }
|
||||
public int SeekingCutoffInterval { get; set; }
|
||||
public int AutosaveInterval { get; set; }
|
||||
public bool AutosaveAsBk2 { get; set; }
|
||||
|
||||
public bool denoteStatesWithIcons { get; set; }
|
||||
public bool denoteStatesWithBGColor { get; set; }
|
||||
|
@ -146,6 +151,25 @@ namespace BizHawk.Client.EmuHawk
|
|||
TasView.MultiSelect = true;
|
||||
TasView.MaxCharactersInHorizontal = 1;
|
||||
WantsToControlRestartMovie = true;
|
||||
|
||||
_autosaveTimer.Interval = Settings.AutosaveInterval;
|
||||
_autosaveTimer.Tick += AutosaveTimerEventProcessor;
|
||||
_autosaveTimer.Start();
|
||||
}
|
||||
|
||||
private void AutosaveTimerEventProcessor(object sender, EventArgs e)
|
||||
{
|
||||
if (!CurrentTasMovie.Changes)
|
||||
return;
|
||||
|
||||
if (Settings.AutosaveAsBk2)
|
||||
{
|
||||
ToBk2MenuItem_Click(sender, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveTasMenuItem_Click(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeSaveWorker()
|
||||
|
@ -705,8 +729,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (BookMarkControl != null)
|
||||
BookMarkControl.UpdateValues();
|
||||
|
||||
if (undoForm != null && !undoForm.IsDisposed)
|
||||
undoForm.UpdateValues();
|
||||
if (_undoForm != null && !_undoForm.IsDisposed)
|
||||
_undoForm.UpdateValues();
|
||||
}
|
||||
|
||||
private void RefreshTasView()
|
||||
|
@ -861,8 +885,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
_exiting = false;
|
||||
}
|
||||
|
||||
if (undoForm != null)
|
||||
undoForm.Close();
|
||||
if (_undoForm != null)
|
||||
_undoForm.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue