From 36c7d50528f3a8c277aacbcbb7cce5bbd8dfdf6b Mon Sep 17 00:00:00 2001 From: SuuperW Date: Tue, 10 Mar 2015 00:33:58 +0000 Subject: [PATCH] TAStudio: Columns menu set up during initialization; toggling visibility of a player's input keeps individual column selections; toggling a button's visibility leaves the menu open. --- .../tools/TAStudio/TAStudio.Designer.cs | 1 - .../tools/TAStudio/TAStudio.MenuItems.cs | 32 +++++++++---------- .../tools/TAStudio/TAStudio.cs | 3 ++ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index c431bc4270..8c955ee542 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -816,7 +816,6 @@ namespace BizHawk.Client.EmuHawk this.ColumnsSubMenu.Name = "ColumnsSubMenu"; this.ColumnsSubMenu.Size = new System.Drawing.Size(67, 20); this.ColumnsSubMenu.Text = "&Columns"; - this.ColumnsSubMenu.DropDownOpened += new System.EventHandler(this.ColumnsSubMenu_DropDownOpened); // // toolStripSeparator19 // diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 07d5bfbea4..c367f7c550 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -756,7 +756,7 @@ namespace BizHawk.Client.EmuHawk #region Columns - private void ColumnsSubMenu_DropDownOpened(object sender, EventArgs e) + private void SetUpToolStripColumns() { ColumnsSubMenu.DropDownItems.Clear(); @@ -774,21 +774,23 @@ namespace BizHawk.Client.EmuHawk foreach (var column in columns) { - var dummyColumnObject = column; - var menuItem = new ToolStripMenuItem { Text = column.Text + " (" + column.Name + ")", Checked = column.Visible, - CheckOnClick = true + CheckOnClick = true, + Tag = column }; menuItem.CheckedChanged += (o, ev) => { - dummyColumnObject.Visible = (o as ToolStripMenuItem).Checked; + var sender = o as ToolStripMenuItem; + (sender.Tag as InputRoll.RollColumn).Visible = sender.Checked; TasView.AllColumns.ColumnsChanged(); CurrentTasMovie.FlagChanges(); RefreshTasView(); + ColumnsSubMenu.ShowDropDown(); + (sender.OwnerItem as ToolStripMenuItem).ShowDropDown(); }; if (column.Name.StartsWith("P" + (player + 1))) @@ -804,21 +806,17 @@ namespace BizHawk.Client.EmuHawk { ToolStripMenuItem item = new ToolStripMenuItem("Show Player " + i); item.CheckOnClick = true; - item.Checked = false; - for (int j = 1; j < playerMenus[i].DropDownItems.Count; j++) - { - if ((playerMenus[i].DropDownItems[j] as ToolStripMenuItem).Checked) - { - item.Checked = true; - break; - } - } + item.Checked = true; - var dummyObject = playerMenus[i]; + int dummyInt = i; + ToolStripMenuItem dummyObject = playerMenus[i]; item.CheckedChanged += (o, ev) => { - foreach (ToolStripMenuItem subItem in dummyObject.DropDownItems) - subItem.Checked = item.Checked; + foreach (ToolStripMenuItem menuItem in dummyObject.DropDownItems) + { + (menuItem.Tag as InputRoll.RollColumn).Visible = + (o as ToolStripMenuItem).Checked && menuItem.Checked; + } CurrentTasMovie.FlagChanges(); RefreshTasView(); diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 4b9b6f9b4c..25843597a2 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -350,6 +350,7 @@ namespace BizHawk.Client.EmuHawk AddColumn(kvp.Key, kvp.Value, 20 * kvp.Value.Length); } + // Patterns int bStart = 0; int fStart = 0; if (BoolPatterns == null) @@ -376,6 +377,8 @@ namespace BizHawk.Client.EmuHawk FloatPatterns[FloatPatterns.Length - 2] = new AutoPatternFloat(new float[] { 1f }); FloatPatterns[FloatPatterns.Length - 1] = new AutoPatternFloat( 1f, Global.Config.AutofireOn, 0f, Global.Config.AutofireOff); + + SetUpToolStripColumns(); } public void AddColumn(string columnName, string columnText, int columnWidth)