TAStudio - edit dropdown opened event logic, insert menu items - insert at frame 0 if no frame is selected

This commit is contained in:
adelikat 2014-07-16 19:23:05 +00:00
parent 1a4168d14d
commit 3f51119b70
2 changed files with 692 additions and 677 deletions

View File

@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
this.ToBk2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.EditSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.UndoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RedoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SelectionUndoMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -117,7 +117,7 @@ namespace BizHawk.Client.EmuHawk
this.TASMenu.ClickThrough = true;
this.TASMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu,
this.editToolStripMenuItem,
this.EditSubMenu,
this.ConfigSubMenu,
this.MetaSubMenu,
this.SettingsSubMenu,
@ -218,9 +218,9 @@ namespace BizHawk.Client.EmuHawk
this.ExitMenuItem.Text = "E&xit";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// editToolStripMenuItem
// EditSubMenu
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.EditSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.UndoMenuItem,
this.RedoMenuItem,
this.SelectionUndoMenuItem,
@ -243,9 +243,10 @@ namespace BizHawk.Client.EmuHawk
this.InsertNumFramesMenuItem,
this.toolStripSeparator6,
this.TruncateMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "&Edit";
this.EditSubMenu.Name = "EditSubMenu";
this.EditSubMenu.Size = new System.Drawing.Size(39, 20);
this.EditSubMenu.Text = "&Edit";
this.EditSubMenu.DropDownOpened += new System.EventHandler(this.EditSubMenu_DropDownOpened);
//
// UndoMenuItem
//
@ -745,6 +746,7 @@ namespace BizHawk.Client.EmuHawk
this.MarkerControl.Name = "MarkerControl";
this.MarkerControl.Size = new System.Drawing.Size(204, 215);
this.MarkerControl.TabIndex = 6;
this.MarkerControl.Tastudio = null;
//
// TAStudio
//
@ -783,7 +785,7 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem SaveAsTASMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem EditSubMenu;
private System.Windows.Forms.ToolStripMenuItem ConfigSubMenu;
private TasListView TasView;
private System.Windows.Forms.ColumnHeader Log;

View File

@ -437,6 +437,23 @@ namespace BizHawk.Client.EmuHawk
#region Edit
private void EditSubMenu_DropDownOpened(object sender, EventArgs e)
{
DeselectMenuItem.Enabled =
CopyMenuItem.Enabled =
CutMenuItem.Enabled =
ClearMenuItem.Enabled =
DeleteFramesMenuItem.Enabled =
CloneMenuItem.Enabled =
TruncateMenuItem.Enabled =
SelectedIndices.Any();
ReselectClipboardMenuItem.Enabled =
PasteMenuItem.Enabled =
PasteInsertMenuItem.Enabled =
_tasClipboard.Any();
}
private void DeselectMenuItem_Click(object sender, EventArgs e)
{
TasView.DeselectAll();
@ -568,23 +585,19 @@ namespace BizHawk.Client.EmuHawk
private void InsertFrameMenuItem_Click(object sender, EventArgs e)
{
if (SelectedIndices.Any())
{
_tas.InsertEmptyFrame(LastSelectedIndex + 1);
var insertionFrame = SelectedIndices.Any() ? LastSelectedIndex + 1 : 0;
_tas.InsertEmptyFrame(insertionFrame);
RefreshDialog();
}
}
private void InsertNumFramesMenuItem_Click(object sender, EventArgs e)
{
if (SelectedIndices.Any())
{
var insertionFrame = SelectedIndices.Any() ? LastSelectedIndex + 1 : 0;
var framesPrompt = new FramesPrompt();
var result = framesPrompt.ShowDialog();
if (result == DialogResult.OK)
{
_tas.InsertEmptyFrame(LastSelectedIndex + 1, framesPrompt.Frames);
}
_tas.InsertEmptyFrame(insertionFrame, framesPrompt.Frames);
}
RefreshDialog();