Tastudio - implement a Clear Greenzone menu item

This commit is contained in:
adelikat 2014-10-02 22:58:36 +00:00
parent 6e563a455c
commit 4addd7fcbc
4 changed files with 42 additions and 1 deletions

View File

@ -323,5 +323,22 @@ namespace BizHawk.Client.Common
{
StateManager.Capture();
}
public void ClearGreenzone()
{
if (StateManager.StateCount > 0)
{
StateManager.Clear();
Changes = true;
}
}
public bool HasGreenzone
{
get
{
return StateManager.Any();
}
}
}
}

View File

@ -193,6 +193,11 @@ namespace BizHawk.Client.Common
}
}
public bool Any()
{
return States.Count > 1; // TODO: power-on MUST have a state, savestate-anchored movies do not, take this into account
}
public int LastKey
{
get

View File

@ -123,6 +123,7 @@ namespace BizHawk.Client.EmuHawk
this.InsertNumFramesContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
this.TruncateContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ClearGreenzoneMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.TASMenu.SuspendLayout();
this.TasStatusStrip.SuspendLayout();
this.RightClickMenu.SuspendLayout();
@ -258,7 +259,8 @@ namespace BizHawk.Client.EmuHawk
this.InsertFrameMenuItem,
this.InsertNumFramesMenuItem,
this.toolStripSeparator6,
this.TruncateMenuItem});
this.TruncateMenuItem,
this.ClearGreenzoneMenuItem});
this.EditSubMenu.Name = "EditSubMenu";
this.EditSubMenu.Size = new System.Drawing.Size(39, 20);
this.EditSubMenu.Text = "&Edit";
@ -886,6 +888,13 @@ namespace BizHawk.Client.EmuHawk
this.TruncateContextMenuItem.Text = "Truncate Movie";
this.TruncateContextMenuItem.Click += new System.EventHandler(this.TruncateMenuItem_Click);
//
// ClearGreenzoneMenuItem
//
this.ClearGreenzoneMenuItem.Name = "ClearGreenzoneMenuItem";
this.ClearGreenzoneMenuItem.Size = new System.Drawing.Size(272, 22);
this.ClearGreenzoneMenuItem.Text = "&Clear Greenzone";
this.ClearGreenzoneMenuItem.Click += new System.EventHandler(this.ClearGreenzoneMenuItem_Click);
//
// TAStudio
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1007,5 +1016,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem CloneContextMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator18;
private System.Windows.Forms.ToolStripMenuItem TruncateContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem ClearGreenzoneMenuItem;
}
}

View File

@ -626,6 +626,9 @@ namespace BizHawk.Client.EmuHawk
PasteMenuItem.Enabled =
PasteInsertMenuItem.Enabled =
_tasClipboard.Any();
ClearGreenzoneMenuItem.Enabled =
_currentTasMovie != null && _currentTasMovie.HasGreenzone;
}
private void DeselectMenuItem_Click(object sender, EventArgs e)
@ -909,6 +912,12 @@ namespace BizHawk.Client.EmuHawk
RefreshDialog();
}
private void ClearGreenzoneMenuItem_Click(object sender, EventArgs e)
{
_currentTasMovie.ClearGreenzone();
RefreshDialog();
}
#endregion
#region Config