From 7fa6e0093d0d0812b328fa400f7138a32a18875f Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 15 Oct 2014 22:52:23 +0000 Subject: [PATCH] Tastudio - change context menu activation to be on right-mouse up instead of down, only show it if the user did not move the mouse wheel first (fixes the conflict between right-click-mousewheel scrolling vs context menu activation), wire up the clear greenzone context menu item. Instead of only activating right-click if there are selected items, show it anyway, and disable menu items that need selected items (which is a majority of them but not all) --- .../tools/TAStudio/TAStudio.Designer.cs | 6 ++-- .../tools/TAStudio/TAStudio.ListView.cs | 30 ++++++++++--------- .../tools/TAStudio/TAStudio.cs | 12 ++++++++ 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index df84d3d39b..b4560514dd 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -708,7 +708,7 @@ namespace BizHawk.Client.EmuHawk // toolStripSeparator19 // this.toolStripSeparator19.Name = "toolStripSeparator19"; - this.toolStripSeparator19.Size = new System.Drawing.Size(57, 6); + this.toolStripSeparator19.Size = new System.Drawing.Size(149, 6); // // HelpSubMenu // @@ -874,10 +874,10 @@ namespace BizHawk.Client.EmuHawk // // UngreenzoneContextMenuItem // - this.UngreenzoneContextMenuItem.Enabled = false; this.UngreenzoneContextMenuItem.Name = "UngreenzoneContextMenuItem"; this.UngreenzoneContextMenuItem.Size = new System.Drawing.Size(272, 22); - this.UngreenzoneContextMenuItem.Text = "Ungreenzone"; + this.UngreenzoneContextMenuItem.Text = "Clear Greenzone"; + this.UngreenzoneContextMenuItem.Click += new System.EventHandler(this.ClearGreenzoneMenuItem_Click); // // toolStripSeparator17 // diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index ca7daa5936..03c5fd33bc 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -17,6 +17,7 @@ namespace BizHawk.Client.EmuHawk private float _floatPaintState; private bool _startMarkerDrag; private bool _startFrameDrag; + private bool _supressContextMenu = false; public static Color CurrentFrame_FrameCol = Color.FromArgb(0xCFEDFC); public static Color CurrentFrame_InputLog = Color.FromArgb(0xB5E7F7); @@ -271,31 +272,32 @@ namespace BizHawk.Client.EmuHawk } } } - else if (e.Button == MouseButtons.Right) - { - var frame = TasView.CurrentCell.RowIndex.Value; - var buttonName = TasView.CurrentCell.Column.Name; - if (TasView.SelectedRows.ToList().IndexOf(frame) != -1 && (buttonName == MarkerColumnName || buttonName == FrameColumnName)) - { - RightClickMenu.Show(TasView, e.X, e.Y); - } - } } } private void TasView_MouseUp(object sender, MouseEventArgs e) { - _startMarkerDrag = false; - _startFrameDrag = false; - _startBoolDrawColumn = string.Empty; - _startFloatDrawColumn = string.Empty; - _floatPaintState = 0; + if (e.Button == MouseButtons.Right && !_supressContextMenu) + { + RightClickMenu.Show(TasView, e.X, e.Y); + } + else if (e.Button == MouseButtons.Left) + { + _startMarkerDrag = false; + _startFrameDrag = false; + _startBoolDrawColumn = string.Empty; + _startFloatDrawColumn = string.Empty; + _floatPaintState = 0; + } + + _supressContextMenu = false; } private void TasView_MouseWheel(object sender, MouseEventArgs e) { if (TasView.RightButtonHeld && TasView.CurrentCell.RowIndex.HasValue) { + _supressContextMenu = true; if (e.Delta < 0) { GoToFrame(Global.Emulator.Frame + 1); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 96f686a70f..65834a3e18 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -1172,6 +1172,18 @@ namespace BizHawk.Client.EmuHawk private void RightClickMenu_Opened(object sender, EventArgs e) { + SetMarkersContextMenuItem.Enabled = + SelectBetweenMarkersContextMenuItem.Enabled = + RemoveMarkersContextMenuItem.Enabled = + DeselectContextMenuItem.Enabled = + ClearContextMenuItem.Enabled = + DeleteFramesContextMenuItem.Enabled = + CloneContextMenuItem.Enabled = + InsertFrameContextMenuItem.Enabled = + InsertNumFramesContextMenuItem.Enabled = + TruncateContextMenuItem.Enabled = + TasView.SelectedRows.Any(); + 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). }