From 1e397432af462665dd47023d457f9fd82df012e6 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Sun, 16 Mar 2025 21:56:31 +0100 Subject: [PATCH] change TAStudio layout when rotation changes - addresses #3708 --- .../CustomControls/InputRoll/InputRoll.cs | 5 ++++ .../tools/TAStudio/TAStudio.Designer.cs | 1 + .../tools/TAStudio/TAStudio.MenuItems.cs | 1 - .../tools/TAStudio/TAStudio.cs | 26 ++++++++++++------- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index d01d04b083..7651ebb0a0 100644 --- a/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/src/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -477,6 +477,10 @@ namespace BizHawk.Client.EmuHawk [Description("Occurs when a cell is dragged and then dropped into a new cell, old cell is the cell that was being dragged, new cell is its new destination")] public event CellDroppedEvent CellDropped; + [Category("Property Changed")] + [Description("Fires after rotation has been changed.")] + public event EventHandler RotationChanged; + /// /// Retrieve the text for a cell /// @@ -1568,6 +1572,7 @@ namespace BizHawk.Client.EmuHawk private void OrientationChanged() { + RotationChanged?.Invoke(this, EventArgs.Empty); // TODO scroll to correct positions ColumnChangedCallback(); Refresh(); diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 6997cb1822..07e9e8ffb0 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -895,6 +895,7 @@ namespace BizHawk.Client.EmuHawk this.TasView.RightMouseScrolled += new BizHawk.Client.EmuHawk.InputRoll.RightMouseScrollEventHandler(this.TasView_MouseWheel); this.TasView.ColumnReordered += new BizHawk.Client.EmuHawk.InputRoll.ColumnReorderedEventHandler(this.TasView_ColumnReordered); this.TasView.CellDropped += new BizHawk.Client.EmuHawk.InputRoll.CellDroppedEvent(this.TasView_CellDropped); + this.TasView.RotationChanged += new System.EventHandler(this.HandleRotationChanged); this.TasView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TasView_KeyDown); this.TasView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.TasView_MouseDoubleClick); this.TasView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TasView_MouseDown); diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 65827341e8..9a556f78b2 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -1019,7 +1019,6 @@ namespace BizHawk.Client.EmuHawk private void RotateMenuItem_Click(object sender, EventArgs e) { TasView.HorizontalOrientation = !TasView.HorizontalOrientation; - CurrentTasMovie.FlagChanges(); } private void HideLagFramesX_Click(object sender, EventArgs e) diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index a663dda2c4..8aeaa498d9 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -180,16 +180,7 @@ namespace BizHawk.Client.EmuHawk return; } - if (TasView.Rotatable) - { - RightClickMenu.Items.AddRange(TasView.GenerateContextMenuItems() - .ToArray()); - - RightClickMenu.Items - .OfType() - .First(t => t.Name == "RotateMenuItem") - .Click += (o, ov) => { CurrentTasMovie.FlagChanges(); }; - } + RightClickMenu.Items.AddRange(TasView.GenerateContextMenuItems().ToArray()); TasView.ScrollSpeed = Settings.ScrollSpeed; TasView.AlwaysScroll = Settings.FollowCursorAlwaysScroll; @@ -1251,5 +1242,20 @@ namespace BizHawk.Client.EmuHawk } } } + + private void HandleRotationChanged(object sender, EventArgs e) + { + CurrentTasMovie.FlagChanges(); + if (TasView.HorizontalOrientation) + { + BranchesMarkersSplit.Orientation = Orientation.Vertical; + BranchesMarkersSplit.SplitterDistance = 200; + } + else + { + BranchesMarkersSplit.Orientation = Orientation.Horizontal; + BranchesMarkersSplit.SplitterDistance = _defaultBranchMarkerSplitDistance; + } + } } }