From d98c04cd45a780c70b51083e8991d256ac925aec Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Thu, 28 Nov 2024 07:18:25 +1000 Subject: [PATCH] Centre branch/marker edit dialogs relative to the interacted pane that is, the input roll if the interaction was with the input roll, and the Markers box if the interaction was with that see #3714/128c8e621 --- .../tools/TAStudio/BookmarksBranchesBox.cs | 2 +- .../tools/TAStudio/MarkerControl.cs | 10 +++++----- .../tools/TAStudio/TAStudio.ListView.cs | 2 +- .../tools/TAStudio/TAStudio.MenuItems.cs | 5 ++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs index 832e63ab52b..913fdd98b98 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/BookmarksBranchesBox.cs @@ -574,7 +574,7 @@ public bool EditBranchTextPopUp(int index) Message = "Enter a message", InitialValue = branch.UserText }; - + i.CenterOn(this); if (this.ShowDialogWithTempMute(i).IsOk()) { branch.UserText = i.PromptText; diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs index 3bfbf6c7b44..1453196b387 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/MarkerControl.cs @@ -159,7 +159,7 @@ public void UpdateMarkerCount() MarkerView.RowCount = Markers.Count; } - public void AddMarker(int frame, bool editText = false) + public void AddMarker(int frame, bool editText = false, Control/*?*/ centerOn = null) { TasMovieMarker marker; if (editText) @@ -174,7 +174,7 @@ public void AddMarker(int frame, bool editText = false) Markers.PreviousOrCurrent(frame).Message : "" }; - + i.CenterOn(centerOn ?? this); if (!this.ShowDialogWithTempMute(i).IsOk()) return; UpdateTextColumnWidth(); @@ -205,7 +205,7 @@ public void UpdateTextColumnWidth() } } - public void EditMarkerPopUp(TasMovieMarker marker) + public void EditMarkerPopUp(TasMovieMarker marker, Control/*?*/ centerOn = null) { var markerFrame = marker.Frame; var i = new InputPrompt @@ -218,7 +218,7 @@ public void EditMarkerPopUp(TasMovieMarker marker) ? Markers.PreviousOrCurrent(markerFrame).Message : "" }; - + i.CenterOn(centerOn ?? this); if (!this.ShowDialogWithTempMute(i).IsOk()) return; marker.Message = i.PromptText; @@ -238,7 +238,7 @@ public void EditMarkerFramePopUp(TasMovieMarker marker) ? Markers.PreviousOrCurrent(markerFrame).Frame.ToString() : "0", }; - + i.CenterOn(this); if (!this.ShowDialogWithTempMute(i).IsOk() || !int.TryParse(i.PromptText, out var promptValue) || Markers.IsMarker(promptValue)) // don't move to frame with an existing marker diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index cf0ddd5214c..2237e234d16 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -903,7 +903,7 @@ private void TasView_MouseDoubleClick(object sender, MouseEventArgs e) if (existingMarker != null) { - MarkerControl.EditMarkerPopUp(existingMarker); + MarkerControl.EditMarkerPopUp(existingMarker, centerOn: TasView); } else { diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 930ace0351d..d55324b74ef 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -695,7 +695,10 @@ private void SetMarkersMenuItem_Click(object sender, EventArgs e) private void SetMarkerWithTextMenuItem_Click(object sender, EventArgs e) { - MarkerControl.AddMarker(TasView.AnyRowsSelected ? TasView.FirstSelectedRowIndex : 0, true); + MarkerControl.AddMarker( + frame: TasView.AnyRowsSelected ? TasView.FirstSelectedRowIndex : 0, + editText: true, + centerOn: TasView); } private void RemoveMarkersMenuItem_Click(object sender, EventArgs e)