From 6000a499e723cbfcc789abb5db8a82a74b6809a9 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 19 Jul 2015 21:57:41 -0400 Subject: [PATCH] Tastudio - Branch context menu item available if pointing at the current frame --- .../tools/TAStudio/BookmarksBranchesBox.cs | 6 ++++++ .../tools/TAStudio/TAStudio.Designer.cs | 13 ++++++++++++- .../tools/TAStudio/TAStudio.MenuItems.cs | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 370a03e529..9cecd75046 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -184,5 +184,11 @@ namespace BizHawk.Client.EmuHawk { BranchView.ItemCount = Branches.Count; } + + public void Branch() + { + // TODO: refactor, creating a branch shouldn't be in context menu click event + AddContextMenu_Click(null, null); + } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 8956670237..2b461a8491 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -172,6 +172,7 @@ namespace BizHawk.Client.EmuHawk this.StartNewProjectFromNowMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.BookMarkControl = new BizHawk.Client.EmuHawk.BookmarksBranchesBox(); + this.BranchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.TASMenu.SuspendLayout(); this.TasStatusStrip.SuspendLayout(); this.MarkerContextMenu.SuspendLayout(); @@ -1168,10 +1169,11 @@ namespace BizHawk.Client.EmuHawk this.InsertNumFramesContextMenuItem, this.toolStripSeparator18, this.TruncateContextMenuItem, + this.BranchContextMenuItem, this.StartFromNowSeparator, this.StartNewProjectFromNowMenuItem}); this.RightClickMenu.Name = "RightClickMenu"; - this.RightClickMenu.Size = new System.Drawing.Size(273, 414); + this.RightClickMenu.Size = new System.Drawing.Size(273, 458); this.RightClickMenu.Opened += new System.EventHandler(this.RightClickMenu_Opened); // // SetMarkersContextMenuItem @@ -1354,6 +1356,14 @@ namespace BizHawk.Client.EmuHawk this.BookMarkControl.Name = "BookMarkControl"; this.BookMarkControl.Size = new System.Drawing.Size(204, 205); this.BookMarkControl.TabIndex = 8; + this.BookMarkControl.Tastudio = null; + // + // BranchContextMenuItem + // + this.BranchContextMenuItem.Name = "BranchContextMenuItem"; + this.BranchContextMenuItem.Size = new System.Drawing.Size(272, 22); + this.BranchContextMenuItem.Text = "&Branch"; + this.BranchContextMenuItem.Click += new System.EventHandler(this.BranchContextMenuItem_Click); // // TAStudio // @@ -1534,5 +1544,6 @@ namespace BizHawk.Client.EmuHawk private System.Windows.Forms.ToolStripMenuItem applyPatternToPaintedInputToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem onlyOnAutoFireColumnsToolStripMenuItem; private BookmarksBranchesBox BookMarkControl; + private System.Windows.Forms.ToolStripMenuItem BranchContextMenuItem; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 8f2991d5d6..b3a03505de 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -979,6 +979,8 @@ namespace BizHawk.Client.EmuHawk RemoveMarkersContextMenuItem.Enabled = CurrentTasMovie.Markers.Any(m => TasView.SelectedRows.Contains(m.Frame)); // Disable the option to remove markers if no markers are selected (FCEUX does this). CancelSeekContextMenuItem.Enabled = GlobalWin.MainForm.PauseOnFrame.HasValue; + + BranchContextMenuItem.Visible = TasView.CurrentCell.RowIndex == Global.Emulator.Frame; } private void CancelSeekContextMenuItem_Click(object sender, EventArgs e) @@ -987,6 +989,11 @@ namespace BizHawk.Client.EmuHawk RefreshTasView(); } + private void BranchContextMenuItem_Click(object sender, EventArgs e) + { + BookMarkControl.Branch(); + } + private void StartNewProjectFromNowMenuItem_Click(object sender, EventArgs e) { if (TasView.SelectedRows.Count() == 1 &&