diff --git a/src/BizHawk.Client.EmuHawk/Properties/Resources.cs b/src/BizHawk.Client.EmuHawk/Properties/Resources.cs index 896112e818..c406b7c074 100644 --- a/src/BizHawk.Client.EmuHawk/Properties/Resources.cs +++ b/src/BizHawk.Client.EmuHawk/Properties/Resources.cs @@ -141,6 +141,7 @@ namespace BizHawk.Client.EmuHawk.Properties internal static readonly Icon PceIcon = ReadEmbeddedIcon("pce"); internal static readonly Bitmap Pencil = ReadEmbeddedBitmap("pencil"); internal static readonly Icon PencilIcon = ReadEmbeddedIcon("pencil"); + internal static readonly Bitmap Clock = ReadEmbeddedBitmap("Clock"); internal static readonly Bitmap Play = ReadEmbeddedBitmap("Play"); internal static readonly Bitmap Placeholder = ReadEmbeddedBitmap("placeholder_bitmap"); internal static readonly Icon PokeIcon = ReadEmbeddedIcon("poke"); diff --git a/src/BizHawk.Client.EmuHawk/images/Clock.png b/src/BizHawk.Client.EmuHawk/images/Clock.png new file mode 100644 index 0000000000..d5bede9964 Binary files /dev/null and b/src/BizHawk.Client.EmuHawk/images/Clock.png differ diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.Designer.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.Designer.cs index c6350f7fa1..a141eecbd7 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.Designer.cs @@ -33,12 +33,14 @@ this.JumpToMarkerToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.ScrollToMarkerToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.EditMarkerToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); + this.EditMarkerFrameToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.AddMarkerToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.toolStripSeparator1 = new BizHawk.WinForms.Controls.ToolStripSeparatorEx(); this.RemoveMarkerToolStripMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx(); this.JumpToMarkerButton = new System.Windows.Forms.Button(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.EditMarkerButton = new System.Windows.Forms.Button(); + this.EditMarkerFrameButton = new System.Windows.Forms.Button(); this.AddMarkerButton = new System.Windows.Forms.Button(); this.RemoveMarkerButton = new System.Windows.Forms.Button(); this.ScrollToMarkerButton = new System.Windows.Forms.Button(); @@ -55,6 +57,7 @@ this.JumpToMarkerToolStripMenuItem, this.ScrollToMarkerToolStripMenuItem, this.EditMarkerToolStripMenuItem, + this.EditMarkerFrameToolStripMenuItem, this.AddMarkerToolStripMenuItem, this.toolStripSeparator1, this.RemoveMarkerToolStripMenuItem}); @@ -74,9 +77,14 @@ // // EditMarkerToolStripMenuItem // - this.EditMarkerToolStripMenuItem.Text = "Edit"; + this.EditMarkerToolStripMenuItem.Text = "Edit Text"; this.EditMarkerToolStripMenuItem.Click += new System.EventHandler(this.EditMarkerToolStripMenuItem_Click); // + // EditMarkerFrameToolStripMenuItem + // + this.EditMarkerFrameToolStripMenuItem.Text = "Edit Frame (Alt + Drag)"; + this.EditMarkerFrameToolStripMenuItem.Click += new System.EventHandler(this.EditMarkerFrameToolStripMenuItem_Click); + // // AddMarkerToolStripMenuItem // this.AddMarkerToolStripMenuItem.Text = "Add"; @@ -91,7 +99,7 @@ // this.JumpToMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.JumpToMarkerButton.Enabled = false; - this.JumpToMarkerButton.Location = new System.Drawing.Point(66, 247); + this.JumpToMarkerButton.Location = new System.Drawing.Point(61, 247); this.JumpToMarkerButton.Name = "JumpToMarkerButton"; this.JumpToMarkerButton.Size = new System.Drawing.Size(24, 24); this.JumpToMarkerButton.TabIndex = 3; @@ -103,7 +111,7 @@ // this.EditMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.EditMarkerButton.Enabled = false; - this.EditMarkerButton.Location = new System.Drawing.Point(126, 247); + this.EditMarkerButton.Location = new System.Drawing.Point(117, 247); this.EditMarkerButton.Name = "EditMarkerButton"; this.EditMarkerButton.Size = new System.Drawing.Size(24, 24); this.EditMarkerButton.TabIndex = 5; @@ -111,10 +119,22 @@ this.EditMarkerButton.UseVisualStyleBackColor = true; this.EditMarkerButton.Click += new System.EventHandler(this.EditMarkerToolStripMenuItem_Click); // + // EditMarkerFrameButton + // + this.EditMarkerFrameButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.EditMarkerFrameButton.Enabled = false; + this.EditMarkerFrameButton.Location = new System.Drawing.Point(145, 247); + this.EditMarkerFrameButton.Name = "EditMarkerFrameButton"; + this.EditMarkerFrameButton.Size = new System.Drawing.Size(24, 24); + this.EditMarkerFrameButton.TabIndex = 6; + this.toolTip1.SetToolTip(this.EditMarkerFrameButton, "Edit Marker Frame (Alt + Drag)"); + this.EditMarkerFrameButton.UseVisualStyleBackColor = true; + this.EditMarkerFrameButton.Click += new System.EventHandler(this.EditMarkerFrameToolStripMenuItem_Click); + // // AddMarkerButton // this.AddMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.AddMarkerButton.Location = new System.Drawing.Point(6, 247); + this.AddMarkerButton.Location = new System.Drawing.Point(5, 247); this.AddMarkerButton.Name = "AddMarkerButton"; this.AddMarkerButton.Size = new System.Drawing.Size(24, 24); this.AddMarkerButton.TabIndex = 1; @@ -126,10 +146,10 @@ // this.RemoveMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.RemoveMarkerButton.Enabled = false; - this.RemoveMarkerButton.Location = new System.Drawing.Point(156, 247); + this.RemoveMarkerButton.Location = new System.Drawing.Point(173, 247); this.RemoveMarkerButton.Name = "RemoveMarkerButton"; this.RemoveMarkerButton.Size = new System.Drawing.Size(24, 24); - this.RemoveMarkerButton.TabIndex = 6; + this.RemoveMarkerButton.TabIndex = 7; this.toolTip1.SetToolTip(this.RemoveMarkerButton, "Remove Marker"); this.RemoveMarkerButton.UseVisualStyleBackColor = true; this.RemoveMarkerButton.Click += new System.EventHandler(this.RemoveMarkerToolStripMenuItem_Click); @@ -138,7 +158,7 @@ // this.ScrollToMarkerButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.ScrollToMarkerButton.Enabled = false; - this.ScrollToMarkerButton.Location = new System.Drawing.Point(96, 247); + this.ScrollToMarkerButton.Location = new System.Drawing.Point(89, 247); this.ScrollToMarkerButton.Name = "ScrollToMarkerButton"; this.ScrollToMarkerButton.Size = new System.Drawing.Size(24, 24); this.ScrollToMarkerButton.TabIndex = 4; @@ -149,7 +169,7 @@ // AddMarkerWithTextButton // this.AddMarkerWithTextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.AddMarkerWithTextButton.Location = new System.Drawing.Point(36, 247); + this.AddMarkerWithTextButton.Location = new System.Drawing.Point(33, 247); this.AddMarkerWithTextButton.Name = "AddMarkerWithTextButton"; this.AddMarkerWithTextButton.Size = new System.Drawing.Size(24, 24); this.AddMarkerWithTextButton.TabIndex = 2; @@ -193,6 +213,7 @@ this.MarkersGroupBox.Controls.Add(this.RemoveMarkerButton); this.MarkersGroupBox.Controls.Add(this.ScrollToMarkerButton); this.MarkersGroupBox.Controls.Add(this.EditMarkerButton); + this.MarkersGroupBox.Controls.Add(this.EditMarkerFrameButton); this.MarkersGroupBox.Controls.Add(this.JumpToMarkerButton); this.MarkersGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; this.MarkersGroupBox.Location = new System.Drawing.Point(0, 0); @@ -221,11 +242,13 @@ private System.Windows.Forms.Button RemoveMarkerButton; private System.Windows.Forms.Button JumpToMarkerButton; private System.Windows.Forms.Button EditMarkerButton; + private System.Windows.Forms.Button EditMarkerFrameButton; private System.Windows.Forms.Button ScrollToMarkerButton; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ContextMenuStrip MarkerContextMenu; private BizHawk.WinForms.Controls.ToolStripMenuItemEx ScrollToMarkerToolStripMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx EditMarkerToolStripMenuItem; + private BizHawk.WinForms.Controls.ToolStripMenuItemEx EditMarkerFrameToolStripMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx AddMarkerToolStripMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx RemoveMarkerToolStripMenuItem; private BizHawk.WinForms.Controls.ToolStripMenuItemEx JumpToMarkerToolStripMenuItem; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index 8268855870..0888ab177b 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -25,10 +25,12 @@ namespace BizHawk.Client.EmuHawk JumpToMarkerToolStripMenuItem.Image = Resources.JumpTo; ScrollToMarkerToolStripMenuItem.Image = Resources.ScrollTo; EditMarkerToolStripMenuItem.Image = Resources.Pencil; + EditMarkerFrameToolStripMenuItem.Image = Resources.Clock; AddMarkerToolStripMenuItem.Image = Resources.Add; RemoveMarkerToolStripMenuItem.Image = Resources.Delete; JumpToMarkerButton.Image = Resources.JumpTo; EditMarkerButton.Image = Resources.Pencil; + EditMarkerFrameButton.Image = Resources.Clock; AddMarkerButton.Image = Resources.Add; RemoveMarkerButton.Image = Resources.Delete; ScrollToMarkerButton.Image = Resources.ScrollTo; @@ -123,6 +125,7 @@ namespace BizHawk.Client.EmuHawk private void MarkerContextMenu_Opening(object sender, CancelEventArgs e) { EditMarkerToolStripMenuItem.Enabled = + EditMarkerFrameToolStripMenuItem.Enabled = RemoveMarkerToolStripMenuItem.Enabled = MarkerInputRoll.AnyRowsSelected && MarkerView.FirstSelectedRowIndex is not 0; @@ -150,6 +153,11 @@ namespace BizHawk.Client.EmuHawk if (MarkerView.AnyRowsSelected) EditMarkerPopUp(FirstSelectedMarker); } + private void EditMarkerFrameToolStripMenuItem_Click(object sender, EventArgs e) + { + if (MarkerView.AnyRowsSelected) EditMarkerFramePopUp(FirstSelectedMarker); + } + private void AddMarkerToolStripMenuItem_Click(object sender, EventArgs e) { AddMarker(Tastudio.Emulator.Frame); @@ -254,6 +262,31 @@ namespace BizHawk.Client.EmuHawk } } + public void EditMarkerFramePopUp(TasMovieMarker marker) + { + var markerFrame = marker.Frame; + var i = new InputPrompt + { + Text = $"Marker for frame {markerFrame}", + TextInputType = InputPrompt.InputType.Unsigned, + Message = "Enter a frame number", + InitialValue = Markers.IsMarker(markerFrame) + ? Markers.PreviousOrCurrent(markerFrame).Frame.ToString() + : "0", + }; + + if (!this.ShowDialogWithTempMute(i).IsOk() + || !int.TryParse(i.PromptText, out var promptValue) + || Markers.IsMarker(promptValue)) // don't move to frame with an existing marker + { + return; + } + Markers.Move(marker.Frame, promptValue); + UpdateTextColumnWidth(); + UpdateValues(); + Tastudio.RefreshDialog(); + } + public void UpdateValues() { if (MarkerView != null && Tastudio?.CurrentTasMovie != null && Markers != null) @@ -272,6 +305,7 @@ namespace BizHawk.Client.EmuHawk private void MarkerView_SelectedIndexChanged(object sender, EventArgs e) { EditMarkerButton.Enabled = + EditMarkerFrameButton.Enabled = RemoveMarkerButton.Enabled = MarkerInputRoll.AnyRowsSelected && MarkerView.FirstSelectedRowIndex is not 0;