From f024986ffce42a37ebac02218743371d3dd62946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Valad=C3=A3o=20Cunha?= Date: Fri, 2 Sep 2022 23:08:23 -0300 Subject: [PATCH] Added 'Edit marker frame' feature (squashed PR #3351) * Added 'Edit marker frame' feature * Changed Edit Marker Frame icon to clock * Hotkey tooltip + Prevent changing to a frame that already has marker * Forgot to delete this icon, was replaced by Clock.png * De-rookie here and there * Clean up diff --- .../Properties/Resources.cs | 1 + src/BizHawk.Client.EmuHawk/images/Clock.png | Bin 0 -> 869 bytes .../tools/TAStudio/MarkerControl.Designer.cs | 39 ++++++++++++++---- .../tools/TAStudio/MarkerControl.cs | 34 +++++++++++++++ 4 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 src/BizHawk.Client.EmuHawk/images/Clock.png 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 0000000000000000000000000000000000000000..d5bede99646bf7954603eb1088f1174346e1844f GIT binary patch literal 869 zcmV-r1DgDaP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TWXle|02z31Hf&U^5$AUw|lOixXy+M3@m zqXYe3OkBc!4uCW1N2?Q4)9pEh#eE^_h-FWy8;1niv~P2J+FNf01}Yd@>Mae6(1bhI>Qcek}vYhsg_wBwlqSx^uGgeT3hu(7%V zy54SQ&!-RVCr%dJC@L+Vz$p?3G`6hkz4n?WHaTXTK1Ov~{Rj$^IkW+u1CkVgw@e8s z=^1obctmDnUF~(V$>@W*0vwo7WwMvVt12t^l>ZjtPttAL#9a3T6(#2y)G}-=RmougF%fMr|2gph>U?u{Nd#Gzkx-Ucr0mR5T$d97H#S-ou27ygM z4&isVfN^Z(_UyEImq%`6@H`JT+Xh^Ucfi#o7Faixhy8sPoDK&+Wi;%W$BmD0ty>^5 zHN)lF-Epn2ECWSR@MCimw(WMbf6~41VW6&PP#)%{r?}PSC0k5F()@uyPT^U@s&#pM zu&P*1A&QA?P6=qfkW*X1?7cz#o% z3XYb^<-Xz342^zsQ{#pm+xIm)>O5O?q4HsIS!Kg-#$N&$69&ENRqeBQ!|$S literal 0 HcmV?d00001 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;