Tastudio - context menu for the Marker list, fix bug where double clicking the marker list beyond the actual markers resulted in an exception
This commit is contained in:
parent
d5aad8d0e2
commit
7b4f5c4a1b
|
@ -44,6 +44,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
}
|
||||
|
||||
public InputRoll MarkerInputRoll { get { return MarkerView; } }
|
||||
|
||||
private void MarkerView_QueryItemBkColor(int index, InputRoll.RollColumn column, ref Color color)
|
||||
{
|
||||
var prev = Tastudio.CurrentTasMovie.Markers.PreviousOrCurrent(Global.Emulator.Frame);
|
||||
|
@ -147,11 +149,35 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void MarkerView_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (MarkerView.CurrentCell.RowIndex.HasValue)
|
||||
if (MarkerView.CurrentCell != null && MarkerView.CurrentCell.RowIndex.HasValue &&
|
||||
MarkerView.CurrentCell.RowIndex < MarkerView.RowCount)
|
||||
{
|
||||
var marker = Tastudio.CurrentTasMovie.Markers[MarkerView.CurrentCell.RowIndex.Value];
|
||||
Tastudio.CallEditMarkerPopUp(marker);
|
||||
}
|
||||
}
|
||||
|
||||
public void EditMarker()
|
||||
{
|
||||
if (MarkerView.SelectedRows.Any())
|
||||
{
|
||||
var index = MarkerView.SelectedRows.First();
|
||||
var marker = Tastudio.CurrentTasMovie.Markers[index];
|
||||
Tastudio.CallEditMarkerPopUp(marker);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddMarker()
|
||||
{
|
||||
AddBtn_Click(null, null);
|
||||
}
|
||||
|
||||
public void RemoveMarker()
|
||||
{
|
||||
if (RemoveBtn.Enabled)
|
||||
{
|
||||
RemoveBtn_Click(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,6 +115,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.SplicerStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.TasPlaybackBox = new BizHawk.Client.EmuHawk.PlaybackBox();
|
||||
this.MarkerControl = new BizHawk.Client.EmuHawk.MarkerControl();
|
||||
this.MarkerContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.EditMarkerContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AddMarkerContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RemoveMarkerContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RightClickMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.SetMarkersContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RemoveMarkersContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -135,6 +139,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.TASMenu.SuspendLayout();
|
||||
this.TasStatusStrip.SuspendLayout();
|
||||
this.MarkerContextMenu.SuspendLayout();
|
||||
this.RightClickMenu.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -826,12 +831,44 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.MarkerControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.MarkerControl.ContextMenuStrip = this.MarkerContextMenu;
|
||||
this.MarkerControl.Location = new System.Drawing.Point(2, 16);
|
||||
this.MarkerControl.Name = "MarkerControl";
|
||||
this.MarkerControl.Size = new System.Drawing.Size(198, 343);
|
||||
this.MarkerControl.TabIndex = 6;
|
||||
this.MarkerControl.Tastudio = null;
|
||||
//
|
||||
// MarkerContextMenu
|
||||
//
|
||||
this.MarkerContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.EditMarkerContextMenuItem,
|
||||
this.AddMarkerContextMenuItem,
|
||||
this.RemoveMarkerContextMenuItem});
|
||||
this.MarkerContextMenu.Name = "MarkerContextMenu";
|
||||
this.MarkerContextMenu.Size = new System.Drawing.Size(118, 70);
|
||||
this.MarkerContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.MarkerContextMenu_Opening);
|
||||
//
|
||||
// EditMarkerContextMenuItem
|
||||
//
|
||||
this.EditMarkerContextMenuItem.Name = "EditMarkerContextMenuItem";
|
||||
this.EditMarkerContextMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.EditMarkerContextMenuItem.Text = "Edit";
|
||||
this.EditMarkerContextMenuItem.Click += new System.EventHandler(this.EditMarkerContextMenuItem_Click);
|
||||
//
|
||||
// AddMarkerContextMenuItem
|
||||
//
|
||||
this.AddMarkerContextMenuItem.Name = "AddMarkerContextMenuItem";
|
||||
this.AddMarkerContextMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.AddMarkerContextMenuItem.Text = "Add";
|
||||
this.AddMarkerContextMenuItem.Click += new System.EventHandler(this.AddMarkerContextMenuItem_Click);
|
||||
//
|
||||
// RemoveMarkerContextMenuItem
|
||||
//
|
||||
this.RemoveMarkerContextMenuItem.Name = "RemoveMarkerContextMenuItem";
|
||||
this.RemoveMarkerContextMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.RemoveMarkerContextMenuItem.Text = "Remove";
|
||||
this.RemoveMarkerContextMenuItem.Click += new System.EventHandler(this.RemoveMarkerContextMenuItem_Click);
|
||||
//
|
||||
// RightClickMenu
|
||||
//
|
||||
this.RightClickMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -1005,6 +1042,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
this.TASMenu.PerformLayout();
|
||||
this.TasStatusStrip.ResumeLayout(false);
|
||||
this.TasStatusStrip.PerformLayout();
|
||||
this.MarkerContextMenu.ResumeLayout(false);
|
||||
this.RightClickMenu.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
@ -1115,5 +1153,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
private System.Windows.Forms.ToolStripMenuItem DefaultStateSettingsMenuItem;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ToolStripMenuItem CancelSeekContextMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip MarkerContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem EditMarkerContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem AddMarkerContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RemoveMarkerContextMenuItem;
|
||||
}
|
||||
}
|
|
@ -656,5 +656,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void MarkerContextMenu_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
EditMarkerContextMenuItem.Enabled =
|
||||
RemoveMarkerContextMenuItem.Enabled =
|
||||
MarkerControl.MarkerInputRoll.SelectedRows.Any();
|
||||
}
|
||||
|
||||
private void EditMarkerContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MarkerControl.EditMarker();
|
||||
}
|
||||
|
||||
private void AddMarkerContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MarkerControl.AddMarker();
|
||||
}
|
||||
|
||||
private void RemoveMarkerContextMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MarkerControl.RemoveMarker();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,6 +184,9 @@
|
|||
<metadata name="TasStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>121, 17</value>
|
||||
</metadata>
|
||||
<metadata name="MarkerContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>386, 17</value>
|
||||
</metadata>
|
||||
<metadata name="RightClickMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>249, 17</value>
|
||||
</metadata>
|
||||
|
|
Loading…
Reference in New Issue