Tastudio - refactor some context menu logic

This commit is contained in:
adelikat 2014-09-19 20:49:51 +00:00
parent 10a8b9a26c
commit d6859b64a3
3 changed files with 10 additions and 6 deletions

View File

@ -698,11 +698,11 @@ namespace BizHawk.Client.EmuHawk
this.TasView.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.TasView.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.TasView.FullRowSelect = true; this.TasView.FullRowSelect = true;
this.TasView.HorizontalOrientation = false; this.TasView.HorizontalOrientation = false;
this.TasView.RowCount = 0; this.TasView.LastVisibleRow = 23;
this.TasView.LastVisibleRow = 22;
this.TasView.Location = new System.Drawing.Point(8, 27); this.TasView.Location = new System.Drawing.Point(8, 27);
this.TasView.MultiSelect = true; this.TasView.MaxCharactersInHorizontal = 1;
this.TasView.Name = "TasView"; this.TasView.Name = "TasView";
this.TasView.RowCount = 0;
this.TasView.Size = new System.Drawing.Size(288, 471); this.TasView.Size = new System.Drawing.Size(288, 471);
this.TasView.TabIndex = 1; this.TasView.TabIndex = 1;
this.TasView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.TasView_ColumnClick); this.TasView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.TasView_ColumnClick);
@ -776,7 +776,8 @@ namespace BizHawk.Client.EmuHawk
this.toolStripSeparator18, this.toolStripSeparator18,
this.TruncateContextMenuItem}); this.TruncateContextMenuItem});
this.RightClickMenu.Name = "RightClickMenu"; this.RightClickMenu.Name = "RightClickMenu";
this.RightClickMenu.Size = new System.Drawing.Size(273, 270); this.RightClickMenu.Size = new System.Drawing.Size(273, 292);
this.RightClickMenu.Opened += new System.EventHandler(this.RightClickMenu_Opened);
// //
// SetMarkersContextMenuItem // SetMarkersContextMenuItem
// //

View File

@ -286,8 +286,6 @@ namespace BizHawk.Client.EmuHawk
var buttonName = TasView.CurrentCell.Column.Name; var buttonName = TasView.CurrentCell.Column.Name;
if (TasView.SelectedRows.IndexOf(frame) != -1 && (buttonName == MarkerColumnName || buttonName == FrameColumnName)) if (TasView.SelectedRows.IndexOf(frame) != -1 && (buttonName == MarkerColumnName || buttonName == FrameColumnName))
{ {
//Disable the option to remove markers if no markers are selected (FCUEX does this).
RemoveMarkersContextMenuItem.Enabled = _currentTasMovie.Markers.Any(m => TasView.SelectedRows.Contains(m.Frame));
RightClickMenu.Show(TasView, e.X, e.Y); RightClickMenu.Show(TasView, e.X, e.Y);
} }
} }

View File

@ -1024,6 +1024,11 @@ namespace BizHawk.Client.EmuHawk
SetTextProperty(); SetTextProperty();
} }
private void RightClickMenu_Opened(object sender, EventArgs e)
{
RemoveMarkersContextMenuItem.Enabled = _currentTasMovie.Markers.Any(m => TasView.SelectedRows.Contains(m.Frame)); // Disable the option to remove markers if no markers are selected (FCUEX does this).
}
#endregion #endregion
#endregion #endregion