From e900a5b1baf1c982b3b05ea29cdf51213b45970d Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 17 Aug 2012 01:26:00 +0000 Subject: [PATCH] TAStudio - fix up Insert Frame functionality, add it to non-interim builds, and map hotkey as ctrl+shift+ins --- .../tools/TAStudio.Designer.cs | 49 ++++++++++--------- BizHawk.MultiClient/tools/TAStudio.cs | 35 ++++++++++++- 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/BizHawk.MultiClient/tools/TAStudio.Designer.cs b/BizHawk.MultiClient/tools/TAStudio.Designer.cs index 1e6335ab26..03ac1e3872 100644 --- a/BizHawk.MultiClient/tools/TAStudio.Designer.cs +++ b/BizHawk.MultiClient/tools/TAStudio.Designer.cs @@ -64,8 +64,8 @@ this.ReadOnlyCheckBox = new System.Windows.Forms.CheckBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.Insert = new System.Windows.Forms.ToolStripMenuItem(); - this.Delete = new System.Windows.Forms.ToolStripMenuItem(); + this.ContextMenu_Insert = new System.Windows.Forms.ToolStripMenuItem(); + this.ContextMenu_Delete = new System.Windows.Forms.ToolStripMenuItem(); this.SelectAll = new System.Windows.Forms.ToolStripMenuItem(); this.ControllerBox = new System.Windows.Forms.GroupBox(); this.ControllersContext = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -213,20 +213,21 @@ // insertFrameToolStripMenuItem // this.insertFrameToolStripMenuItem.Name = "insertFrameToolStripMenuItem"; - this.insertFrameToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A))); - this.insertFrameToolStripMenuItem.Size = new System.Drawing.Size(191, 22); - this.insertFrameToolStripMenuItem.Text = "Insert Frame"; + this.insertFrameToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) + | System.Windows.Forms.Keys.Insert))); + this.insertFrameToolStripMenuItem.Size = new System.Drawing.Size(247, 22); + this.insertFrameToolStripMenuItem.Text = "Insert New Frame"; this.insertFrameToolStripMenuItem.Click += new System.EventHandler(this.insertFrameToolStripMenuItem_Click); // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; - this.toolStripSeparator7.Size = new System.Drawing.Size(188, 6); + this.toolStripSeparator7.Size = new System.Drawing.Size(244, 6); // // clearVirtualPadsToolStripMenuItem // this.clearVirtualPadsToolStripMenuItem.Name = "clearVirtualPadsToolStripMenuItem"; - this.clearVirtualPadsToolStripMenuItem.Size = new System.Drawing.Size(191, 22); + this.clearVirtualPadsToolStripMenuItem.Size = new System.Drawing.Size(247, 22); this.clearVirtualPadsToolStripMenuItem.Text = "&Clear Controller Holds"; this.clearVirtualPadsToolStripMenuItem.Click += new System.EventHandler(this.clearVirtualPadsToolStripMenuItem_Click); // @@ -294,31 +295,33 @@ // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.Insert, - this.Delete, + this.ContextMenu_Insert, + this.ContextMenu_Delete, this.SelectAll}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(157, 70); + this.contextMenuStrip1.Size = new System.Drawing.Size(248, 70); + this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // - // Insert + // ContextMenu_Insert // - this.Insert.Name = "Insert"; - this.Insert.Size = new System.Drawing.Size(156, 22); - this.Insert.Text = "Insert Frame(s)"; - this.Insert.Click += new System.EventHandler(this.Insert_Click); + this.ContextMenu_Insert.Name = "ContextMenu_Insert"; + this.ContextMenu_Insert.ShortcutKeyDisplayString = "Ctrl+Shift+Ins"; + this.ContextMenu_Insert.Size = new System.Drawing.Size(247, 22); + this.ContextMenu_Insert.Text = "Insert New Frame"; + this.ContextMenu_Insert.Click += new System.EventHandler(this.Insert_Click); // - // Delete + // ContextMenu_Delete // - this.Delete.Name = "Delete"; - this.Delete.Size = new System.Drawing.Size(156, 22); - this.Delete.Text = "Delete Frame(s)"; - this.Delete.Click += new System.EventHandler(this.Delete_Click); + this.ContextMenu_Delete.Name = "ContextMenu_Delete"; + this.ContextMenu_Delete.Size = new System.Drawing.Size(247, 22); + this.ContextMenu_Delete.Text = "Delete Frame(s)"; + this.ContextMenu_Delete.Click += new System.EventHandler(this.Delete_Click); // // SelectAll // this.SelectAll.Enabled = false; this.SelectAll.Name = "SelectAll"; - this.SelectAll.Size = new System.Drawing.Size(156, 22); + this.SelectAll.Size = new System.Drawing.Size(247, 22); this.SelectAll.Text = "Select All"; // // ControllerBox @@ -551,7 +554,7 @@ private System.Windows.Forms.ToolStripButton FastFowardToEnd; private System.Windows.Forms.ToolStripMenuItem insertFrameToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem Insert; + private System.Windows.Forms.ToolStripMenuItem ContextMenu_Insert; private System.Windows.Forms.ToolStripMenuItem SelectAll; private System.Windows.Forms.GroupBox ControllerBox; private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; @@ -564,6 +567,6 @@ private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem1; private System.Windows.Forms.ToolStripButton FastForward; private System.Windows.Forms.ToolStripButton TurboFastForward; - private System.Windows.Forms.ToolStripMenuItem Delete; + private System.Windows.Forms.ToolStripMenuItem ContextMenu_Delete; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/TAStudio.cs b/BizHawk.MultiClient/tools/TAStudio.cs index db80d40c8e..2cb72d32d3 100644 --- a/BizHawk.MultiClient/tools/TAStudio.cs +++ b/BizHawk.MultiClient/tools/TAStudio.cs @@ -272,7 +272,6 @@ namespace BizHawk.MultiClient saveProjectAsToolStripMenuItem.Enabled = false; recentToolStripMenuItem.Enabled = false; importTASFileToolStripMenuItem.Enabled = false; - insertFrameToolStripMenuItem.Enabled = false; } LoadTAStudio(); @@ -361,6 +360,7 @@ namespace BizHawk.MultiClient { if (ReadOnlyCheckBox.Checked) { + Global.MainForm.SetReadOnly(true); ReadOnlyCheckBox.BackColor = System.Drawing.SystemColors.Control; if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE) @@ -371,6 +371,7 @@ namespace BizHawk.MultiClient } else { + Global.MainForm.SetReadOnly(false); ReadOnlyCheckBox.BackColor = Color.LightCoral; if (Global.MovieSession.Movie.Mode != MOVIEMODE.INACTIVE) { @@ -420,8 +421,14 @@ namespace BizHawk.MultiClient private void insertFrameToolStripMenuItem_Click(object sender, EventArgs e) { - if (Global.MainForm.ReadOnly) + if (ReadOnlyCheckBox.Checked) + { return; + } + else + { + InsertNewFrame(); + } } private void updatePadsOnMovePlaybackToolStripMenuItem_Click(object sender, EventArgs e) @@ -507,6 +514,11 @@ namespace BizHawk.MultiClient } private void Insert_Click(object sender, EventArgs e) + { + InsertNewFrame(); + } + + private void InsertNewFrame() { ListView.SelectedIndexCollection list = TASView.SelectedIndices; for (int index = 0; index < list.Count; index++) @@ -516,6 +528,11 @@ namespace BizHawk.MultiClient } private void Delete_Click(object sender, EventArgs e) + { + DeleteFrame(); + } + + private void DeleteFrame() { ListView.SelectedIndexCollection list = TASView.SelectedIndices; for (int index = 0; index < list.Count; index++) @@ -559,5 +576,19 @@ namespace BizHawk.MultiClient } } } + + private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) + { + if (ReadOnlyCheckBox.Checked) + { + ContextMenu_Insert.Enabled = false; //TODO: just hide them, but right now only read-only depenent items are in this menu and I need something to show! + ContextMenu_Delete.Enabled = false; + } + else + { + ContextMenu_Insert.Enabled = true; + ContextMenu_Delete.Enabled = true; + } + } } }