From 189ecfeb2e32e1480e02fe5ffd227a620ad19d3f Mon Sep 17 00:00:00 2001 From: SuuperW Date: Wed, 4 Mar 2015 19:03:00 +0000 Subject: [PATCH] TAStudio: -Undo History UI, some history bugfixes -Painting input past the movie no longer moves markers --- .../movie/tasproj/TasMovie.Editing.cs | 69 +++-- .../movie/tasproj/TasMovie.History.cs | 42 +-- .../movie/tasproj/TasMovieMarker.cs | 8 +- .../BizHawk.Client.EmuHawk.csproj | 18 +- .../CustomControls/VirtualListView.cs | 2 +- .../tools/TAStudio/TAStudio.Designer.cs | 66 ++--- .../tools/TAStudio/TAStudio.ListView.cs | 11 +- .../tools/TAStudio/TAStudio.MenuItems.cs | 7 + .../tools/TAStudio/TAStudio.cs | 16 +- .../TAStudio/UndoHistoryForm.Designer.cs | 239 ++++++++++++++++++ .../tools/TAStudio/UndoHistoryForm.cs | 146 +++++++++++ .../tools/TAStudio/UndoHistoryForm.resx | 123 +++++++++ 12 files changed, 634 insertions(+), 113 deletions(-) create mode 100644 BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs create mode 100644 BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs create mode 100644 BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.resx diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs index b294360130..11a7ad3a2b 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.Editing.cs @@ -15,7 +15,8 @@ namespace BizHawk.Client.Common public override void RecordFrame(int frame, IController source) { - ChangeLog.AddGeneralUndo(frame, frame); + if (frame != 0) + ChangeLog.AddGeneralUndo(frame, frame, "Record Frame: " + frame); base.RecordFrame(frame, source); @@ -24,12 +25,13 @@ namespace BizHawk.Client.Common StateManager.Capture(); - ChangeLog.SetGeneralRedo(); + if (frame != 0) + ChangeLog.SetGeneralRedo(); } public override void Truncate(int frame) { - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Truncate Movie: " + frame, true); ChangeLog.AddGeneralUndo(frame, InputLogLength - 1); if (frame < _log.Count - 1) @@ -50,7 +52,7 @@ namespace BizHawk.Client.Common public override void PokeFrame(int frame, IController source) { - ChangeLog.AddGeneralUndo(frame, frame); + ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame); base.PokeFrame(frame, source); InvalidateAfter(frame); @@ -59,7 +61,7 @@ namespace BizHawk.Client.Common } public void SetFrame(int frame, string source) { - ChangeLog.AddGeneralUndo(frame, frame); + ChangeLog.AddGeneralUndo(frame, frame, "Set Frame At: " + frame); base.SetFrameAt(frame, source); InvalidateAfter(frame); @@ -69,7 +71,7 @@ namespace BizHawk.Client.Common public override void ClearFrame(int frame) { - ChangeLog.AddGeneralUndo(frame, frame); + ChangeLog.AddGeneralUndo(frame, frame, "Clear Frame: " + frame); base.ClearFrame(frame); InvalidateAfter(frame); @@ -79,7 +81,7 @@ namespace BizHawk.Client.Common public void RemoveFrame(int frame) { - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Remove Frame: " + frame, true); ChangeLog.AddGeneralUndo(frame, InputLogLength - 1); _log.RemoveAt(frame); @@ -112,7 +114,7 @@ namespace BizHawk.Client.Common { var invalidateAfter = frames.Min(); - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Remove Multiple Frames", true); ChangeLog.AddGeneralUndo(invalidateAfter, InputLogLength - 1); foreach (var frame in frames.OrderByDescending(x => x)) // Removin them in reverse order allows us to remove by index; @@ -145,7 +147,7 @@ namespace BizHawk.Client.Common } public void RemoveFrames(int removeStart, int removeUpTo) { - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Remove Frames: " + removeStart + "-" + removeUpTo, true); ChangeLog.AddGeneralUndo(removeStart, InputLogLength - 1); for (int i = removeUpTo - 1; i >= removeStart; i--) @@ -177,7 +179,7 @@ namespace BizHawk.Client.Common public void InsertInput(int frame, string inputState) { - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true); ChangeLog.AddGeneralUndo(frame, InputLogLength); _log.Insert(frame, inputState); @@ -203,7 +205,7 @@ namespace BizHawk.Client.Common } public void InsertInput(int frame, IEnumerable inputLog) { - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Insert Frame: " + frame, true); ChangeLog.AddGeneralUndo(frame, InputLogLength + inputLog.Count() - 1); _log.InsertRange(frame, inputLog); @@ -227,7 +229,7 @@ namespace BizHawk.Client.Common ChangeLog.SetGeneralRedo(); if (endBatch) ChangeLog.EndBatch(); -} + } public void InsertInput(int frame, IEnumerable inputStates) { // ChangeLog is done in the InsertInput call. @@ -246,7 +248,7 @@ namespace BizHawk.Client.Common public void CopyOverInput(int frame, IEnumerable inputStates) { - ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1); + ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, "Copy Over Input: " + frame); var lg = LogGeneratorInstance(); var states = inputStates.ToList(); @@ -264,7 +266,7 @@ namespace BizHawk.Client.Common public void InsertEmptyFrame(int frame, int count = 1) { - bool endBatch = ChangeLog.BeginNewBatch(true); + bool endBatch = ChangeLog.BeginNewBatch("Insert Empty Frame: " + frame, true); ChangeLog.AddGeneralUndo(frame, InputLogLength + count - 1); var lg = LogGeneratorInstance(); @@ -298,10 +300,29 @@ namespace BizHawk.Client.Common this.SwitchToPlay(); } + private void ExtendMovieForEdit(int numFrames) + { + bool endBatch = ChangeLog.BeginNewBatch("Auto-Extend Movie", true); + int oldLength = InputLogLength; + ChangeLog.AddGeneralUndo(oldLength, oldLength + numFrames - 1); + + var lg = LogGeneratorInstance(); + lg.SetSource(Global.MovieSession.MovieControllerInstance()); + + for (int i = 0; i < numFrames; i++) + _log.Add(lg.EmptyEntry); + + Changes = true; + InvalidateAfter(oldLength - 1); + + ChangeLog.SetGeneralRedo(); + if (endBatch) + ChangeLog.EndBatch(); + } public void ToggleBoolState(int frame, string buttonName) { if (frame >= _log.Count) // Insert blank frames up to this point - InsertEmptyFrame(_log.Count, frame - _log.Count + 1); + ExtendMovieForEdit(frame - _log.Count + 1); var adapter = GetInputState(frame) as Bk2ControllerAdapter; adapter[buttonName] = !adapter.IsPressed(buttonName); @@ -312,13 +333,13 @@ namespace BizHawk.Client.Common Changes = true; InvalidateAfter(frame); - ChangeLog.AddBoolToggle(frame, buttonName, !adapter[buttonName]); + ChangeLog.AddBoolToggle(frame, buttonName, !adapter[buttonName], "Toggle " + buttonName + ": " + frame); } public void SetBoolState(int frame, string buttonName, bool val) { if (frame >= _log.Count) // Insert blank frames up to this point - InsertEmptyFrame(_log.Count, frame - _log.Count + 1); + ExtendMovieForEdit(frame - _log.Count + 1); var adapter = GetInputState(frame) as Bk2ControllerAdapter; var old = adapter[buttonName]; @@ -332,15 +353,15 @@ namespace BizHawk.Client.Common { InvalidateAfter(frame); Changes = true; - ChangeLog.AddBoolToggle(frame, buttonName, old); + ChangeLog.AddBoolToggle(frame, buttonName, old, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame); } } public void SetBoolStates(int frame, int count, string buttonName, bool val) { if (frame + count >= _log.Count) // Insert blank frames up to this point - InsertEmptyFrame(_log.Count, frame + count - _log.Count + 1); + ExtendMovieForEdit(frame - _log.Count + 1); - ChangeLog.AddGeneralUndo(frame, frame + count - 1); + ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + (val ? "On" : "Off") + "): " + frame + "-" + (frame + count - 1)); int changed = -1; for (int i = 0; i < count; i++) @@ -369,7 +390,7 @@ namespace BizHawk.Client.Common public void SetFloatState(int frame, string buttonName, float val) { if (frame >= _log.Count) // Insert blank frames up to this point - InsertEmptyFrame(_log.Count, frame - _log.Count + 1); + ExtendMovieForEdit(frame - _log.Count + 1); var adapter = GetInputState(frame) as Bk2ControllerAdapter; var old = adapter.GetFloat(buttonName); @@ -383,15 +404,15 @@ namespace BizHawk.Client.Common { InvalidateAfter(frame); Changes = true; - ChangeLog.AddFloatChange(frame, buttonName, old, val); + ChangeLog.AddFloatChange(frame, buttonName, old, val, "Set " + buttonName + "(" + val + "): " + frame); } } public void SetFloatStates(int frame, int count, string buttonName, float val) { if (frame + count >= _log.Count) // Insert blank frames up to this point - InsertEmptyFrame(_log.Count, frame + count - _log.Count + 1); + ExtendMovieForEdit(frame - _log.Count + 1); - ChangeLog.AddGeneralUndo(frame, frame + count - 1); + ChangeLog.AddGeneralUndo(frame, frame + count - 1, "Set " + buttonName + "(" + val + "): " + frame + "-" + (frame + count - 1)); int changed = -1; for (int i = 0; i < count; i++) diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs b/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs index 6eab4c2acd..d0871f9f0f 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovie.History.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.Common { List> History; public List Names; - int UndoIndex = -1; + public int UndoIndex = -1; int _maxSteps = 100; public int MaxSteps { @@ -29,6 +29,8 @@ namespace BizHawk.Client.Common } } + private int _totalSteps = 0; + private bool RecordingBatch = false; /// /// This is not intended to turn off the ChangeLog, but to disable the normal recording process. @@ -79,7 +81,7 @@ namespace BizHawk.Client.Common /// /// If set and a batch is in progress, a new batch will not be created. /// Returns true if a new batch was started; otherwise false. - public bool BeginNewBatch(bool keepOldBatch = false) + public bool BeginNewBatch(string name = "", bool keepOldBatch = false) { if (!IsRecording) return false; @@ -95,7 +97,7 @@ namespace BizHawk.Client.Common if (ret) { - ret = AddMovieAction(); + ret = AddMovieAction(name); } RecordingBatch = true; @@ -115,6 +117,7 @@ namespace BizHawk.Client.Common if (last.Count == 0) // Remove batch if it's empty. { History.RemoveAt(History.Count - 1); + Names.RemoveAt(Names.Count - 1); UndoIndex--; } else @@ -195,26 +198,33 @@ namespace BizHawk.Client.Common } #region "Change History" - private bool AddMovieAction() + private bool AddMovieAction(string name) { if (UndoIndex + 1 != History.Count) TruncateLog(UndoIndex + 1); + if (name == "") + name = "Undo step " + _totalSteps; + + bool ret = false; if (!RecordingBatch) { + ret = true; History.Add(new List(1)); - Names.Add(""); + Names.Add(name); + _totalSteps += 1; - if (History.Count < MaxSteps) + if (History.Count <= MaxSteps) UndoIndex += 1; else { History.RemoveAt(0); Names.RemoveAt(0); + ret = false; } } - return true; + return ret; } public void SetName(string name) { @@ -223,11 +233,11 @@ namespace BizHawk.Client.Common // TODO: These probably aren't the best way to handle undo/redo. private int lastGeneral; - public void AddGeneralUndo(int first, int last, bool force = false) + public void AddGeneralUndo(int first, int last, string name = "", bool force = false) { if (IsRecording || force) { - AddMovieAction(); + AddMovieAction(name); History.Last().Add(new MovieAction(first, last, Movie)); lastGeneral = History.Last().Count - 1; } @@ -240,29 +250,29 @@ namespace BizHawk.Client.Common } } - public void AddBoolToggle(int frame, string button, bool oldState, bool force = false) + public void AddBoolToggle(int frame, string button, bool oldState, string name = "", bool force = false) { if (IsRecording || force) { - AddMovieAction(); + AddMovieAction(name); History.Last().Add(new MovieActionFrameEdit(frame, button, oldState, !oldState)); } } - public void AddFloatChange(int frame, string button, float oldState, float newState, bool force = false) + public void AddFloatChange(int frame, string button, float oldState, float newState, string name = "", bool force = false) { if (IsRecording || force) { - AddMovieAction(); + AddMovieAction(name); History.Last().Add(new MovieActionFrameEdit(frame, button, oldState, newState)); } } - public void AddMarkerChange(TasMovieMarker newMarker, int oldPosition = -1, string old_message = "", bool force = false) + public void AddMarkerChange(TasMovieMarker newMarker, int oldPosition = -1, string old_message = "", string name = "", bool force = false) { if (IsRecording || force) { - AddMovieAction(); + AddMovieAction(name); History.Last().Add(new MovieActionMarker(newMarker, oldPosition, old_message)); } } @@ -423,7 +433,7 @@ namespace BizHawk.Client.Common { oldState = oldS; newState = newS; - FirstFrame = 0; + FirstFrame = frame; buttonName = button; isFloat = true; } diff --git a/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs b/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs index 8e5f13600c..5b2a1aae43 100644 --- a/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs +++ b/BizHawk.Client.Common/movie/tasproj/TasMovieMarker.cs @@ -128,7 +128,7 @@ namespace BizHawk.Client.Common public new void AddRange(IEnumerable collection) { - bool endBatch = _movie.ChangeLog.BeginNewBatch(true); + bool endBatch = _movie.ChangeLog.BeginNewBatch("Add Markers", true); foreach (TasMovieMarker m in collection) { Add(m); @@ -147,7 +147,7 @@ namespace BizHawk.Client.Common public new void InsertRange(int index, IEnumerable collection) { - bool endBatch = _movie.ChangeLog.BeginNewBatch(true); + bool endBatch = _movie.ChangeLog.BeginNewBatch("Add Markers", true); foreach (TasMovieMarker m in collection) _movie.ChangeLog.AddMarkerChange(m); if (endBatch) @@ -167,7 +167,7 @@ namespace BizHawk.Client.Common public new int RemoveAll(Predicate match) { - bool endBatch = _movie.ChangeLog.BeginNewBatch(true); + bool endBatch = _movie.ChangeLog.BeginNewBatch("Remove All Markers", true); foreach (TasMovieMarker m in this) { if (match.Invoke(m)) @@ -200,7 +200,7 @@ namespace BizHawk.Client.Common public int TruncateAt(int startFrame) { int deletedCount = 0; - bool endBatch = _movie.ChangeLog.BeginNewBatch(true); + bool endBatch = _movie.ChangeLog.BeginNewBatch("Truncate Markers", true); for (int i = Count - 1; i > -1; i--) { if (this[i].Frame >= startFrame) diff --git a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj index a589af03f5..751a428a5f 100644 --- a/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj +++ b/BizHawk.Client.EmuHawk/BizHawk.Client.EmuHawk.csproj @@ -924,12 +924,6 @@ HeaderEditor.cs - - UserControl - - - HistoryBox.cs - Component @@ -972,6 +966,12 @@ Form + + Form + + + UndoHistoryForm.cs + Form @@ -1378,9 +1378,6 @@ HeaderEditor.cs - - HistoryBox.cs - MarkerControl.cs @@ -1390,6 +1387,9 @@ TAStudio.cs + + UndoHistoryForm.cs + TI83KeyPad.cs diff --git a/BizHawk.Client.EmuHawk/CustomControls/VirtualListView.cs b/BizHawk.Client.EmuHawk/CustomControls/VirtualListView.cs index d303379126..9edf7ad251 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/VirtualListView.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/VirtualListView.cs @@ -623,7 +623,7 @@ namespace BizHawk.Client.EmuHawk public static extern int GetScrollPos(IntPtr hWnd, Orientation nBar); /// - /// Gets and Sets the Vertical Scroll position of the control. + /// Gets the Vertical Scroll position of the control. /// public int VScrollPos { diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs index 75f42ec40f..1f870731cd 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.Designer.cs @@ -47,6 +47,7 @@ namespace BizHawk.Client.EmuHawk this.EditSubMenu = new System.Windows.Forms.ToolStripMenuItem(); this.UndoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RedoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.showUndoHistoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SelectionUndoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SelectionRedoMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); @@ -59,13 +60,13 @@ namespace BizHawk.Client.EmuHawk this.PasteMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.PasteInsertMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CutMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.ClearMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DeleteFramesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.CloneMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.InsertFrameMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.InsertNumFramesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); this.TruncateMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ClearGreenzoneMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.GreenzoneICheckSeparator = new System.Windows.Forms.ToolStripSeparator(); @@ -143,15 +144,11 @@ namespace BizHawk.Client.EmuHawk this.StartFromNowSeparator = new System.Windows.Forms.ToolStripSeparator(); this.StartNewProjectFromNowMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.historyBox1 = new BizHawk.Client.EmuHawk.HistoryBox(); - this.btnShowUndoHistory = new System.Windows.Forms.Button(); this.TASMenu.SuspendLayout(); this.TasStatusStrip.SuspendLayout(); this.MarkerContextMenu.SuspendLayout(); this.RightClickMenu.SuspendLayout(); this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // TASMenu @@ -266,6 +263,7 @@ namespace BizHawk.Client.EmuHawk this.EditSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.UndoMenuItem, this.RedoMenuItem, + this.showUndoHistoryToolStripMenuItem, this.SelectionUndoMenuItem, this.SelectionRedoMenuItem, this.toolStripSeparator5, @@ -278,13 +276,13 @@ namespace BizHawk.Client.EmuHawk this.PasteMenuItem, this.PasteInsertMenuItem, this.CutMenuItem, - this.toolStripSeparator8, this.ClearMenuItem, this.DeleteFramesMenuItem, this.CloneMenuItem, this.InsertFrameMenuItem, this.InsertNumFramesMenuItem, this.toolStripSeparator6, + this.toolStripSeparator8, this.TruncateMenuItem, this.ClearGreenzoneMenuItem, this.GreenzoneICheckSeparator, @@ -311,6 +309,13 @@ namespace BizHawk.Client.EmuHawk this.RedoMenuItem.Text = "&Redo"; this.RedoMenuItem.Click += new System.EventHandler(this.RedoMenuItem_Click); // + // showUndoHistoryToolStripMenuItem + // + this.showUndoHistoryToolStripMenuItem.Name = "showUndoHistoryToolStripMenuItem"; + this.showUndoHistoryToolStripMenuItem.Size = new System.Drawing.Size(282, 22); + this.showUndoHistoryToolStripMenuItem.Text = "Show Undo History"; + this.showUndoHistoryToolStripMenuItem.Click += new System.EventHandler(this.showUndoHistoryToolStripMenuItem_Click); + // // SelectionUndoMenuItem // this.SelectionUndoMenuItem.Enabled = false; @@ -403,11 +408,6 @@ namespace BizHawk.Client.EmuHawk this.CutMenuItem.Text = "&Cut"; this.CutMenuItem.Click += new System.EventHandler(this.CutMenuItem_Click); // - // toolStripSeparator8 - // - this.toolStripSeparator8.Name = "toolStripSeparator8"; - this.toolStripSeparator8.Size = new System.Drawing.Size(279, 6); - // // ClearMenuItem // this.ClearMenuItem.Name = "ClearMenuItem"; @@ -456,6 +456,11 @@ namespace BizHawk.Client.EmuHawk this.toolStripSeparator6.Name = "toolStripSeparator6"; this.toolStripSeparator6.Size = new System.Drawing.Size(279, 6); // + // toolStripSeparator8 + // + this.toolStripSeparator8.Name = "toolStripSeparator8"; + this.toolStripSeparator8.Size = new System.Drawing.Size(279, 6); + // // TruncateMenuItem // this.TruncateMenuItem.Name = "TruncateMenuItem"; @@ -854,7 +859,7 @@ namespace BizHawk.Client.EmuHawk this.MarkerControl.Emulator = null; this.MarkerControl.Location = new System.Drawing.Point(2, 16); this.MarkerControl.Name = "MarkerControl"; - this.MarkerControl.Size = new System.Drawing.Size(198, 258); + this.MarkerControl.Size = new System.Drawing.Size(198, 320); this.MarkerControl.TabIndex = 6; this.MarkerControl.Tastudio = null; // @@ -1087,47 +1092,17 @@ namespace BizHawk.Client.EmuHawk this.groupBox1.Controls.Add(this.MarkerControl); this.groupBox1.Location = new System.Drawing.Point(302, 129); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(201, 280); + this.groupBox1.Size = new System.Drawing.Size(201, 365); this.groupBox1.TabIndex = 7; this.groupBox1.TabStop = false; this.groupBox1.Text = "Markers"; // - // groupBox2 - // - this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox2.Controls.Add(this.historyBox1); - this.groupBox2.Controls.Add(this.btnShowUndoHistory); - this.groupBox2.Location = new System.Drawing.Point(302, 409); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(200, 85); - this.groupBox2.TabIndex = 8; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Undo History"; - // - // historyBox1 - // - this.historyBox1.Location = new System.Drawing.Point(5, 19); - this.historyBox1.Name = "historyBox1"; - this.historyBox1.Size = new System.Drawing.Size(192, 63); - this.historyBox1.TabIndex = 1; - this.historyBox1.Tastudio = null; - // - // btnShowUndoHistory - // - this.btnShowUndoHistory.Location = new System.Drawing.Point(174, -1); - this.btnShowUndoHistory.Name = "btnShowUndoHistory"; - this.btnShowUndoHistory.Size = new System.Drawing.Size(20, 21); - this.btnShowUndoHistory.TabIndex = 0; - this.btnShowUndoHistory.Text = "v"; - this.btnShowUndoHistory.UseVisualStyleBackColor = true; - // // TAStudio // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(506, 519); - this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Controls.Add(this.TasPlaybackBox); this.Controls.Add(this.TasStatusStrip); @@ -1151,7 +1126,6 @@ namespace BizHawk.Client.EmuHawk this.MarkerContextMenu.ResumeLayout(false); this.RightClickMenu.ResumeLayout(false); this.groupBox1.ResumeLayout(false); - this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -1270,8 +1244,6 @@ namespace BizHawk.Client.EmuHawk private System.Windows.Forms.ToolStripSeparator separateToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem pasteInsertToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.Button btnShowUndoHistory; - private HistoryBox historyBox1; + private System.Windows.Forms.ToolStripMenuItem showUndoHistoryToolStripMenuItem; } } \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs index 6a44365ba4..d419398c3c 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.ListView.cs @@ -313,7 +313,7 @@ namespace BizHawk.Client.EmuHawk { if (Global.MovieSession.MovieControllerAdapter.Type.BoolButtons.Contains(buttonName)) { - CurrentTasMovie.ChangeLog.BeginNewBatch(); + CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Bool"); ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName); _triggerAutoRestore = true; @@ -345,7 +345,7 @@ namespace BizHawk.Client.EmuHawk if (e.Clicks != 2) { - CurrentTasMovie.ChangeLog.BeginNewBatch(); + CurrentTasMovie.ChangeLog.BeginNewBatch("Paint Float"); _startFloatDrawColumn = buttonName; } else // Double-click enters float editing mode @@ -354,6 +354,7 @@ namespace BizHawk.Client.EmuHawk _floatEditRow = -1; else { + CurrentTasMovie.ChangeLog.BeginNewBatch("Float Edit: " + frame); _floatEditColumn = buttonName; _floatEditRow = frame; _floatTypedValue = ""; @@ -389,7 +390,7 @@ namespace BizHawk.Client.EmuHawk _rightClickLastFrame = -1; _supressContextMenu = true; // TODO: Turn off ChangeLog.IsRecording and handle the GeneralUndo here. - CurrentTasMovie.ChangeLog.BeginNewBatch(); + CurrentTasMovie.ChangeLog.BeginNewBatch("Right-Click Edit"); } } } @@ -416,7 +417,8 @@ namespace BizHawk.Client.EmuHawk _floatEditYPos = -1; _leftButtonHeld = false; - CurrentTasMovie.ChangeLog.EndBatch(); + if (_floatEditRow == -1) + CurrentTasMovie.ChangeLog.EndBatch(); } else if (e.Button == System.Windows.Forms.MouseButtons.Right) { @@ -734,6 +736,7 @@ namespace BizHawk.Client.EmuHawk SetFloatValue(_floatEditRow, _floatEditColumn, _floatPaintState); } _floatEditRow = -1; + CurrentTasMovie.ChangeLog.EndBatch(); } else { diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs index 209b8e1c79..55eba0fbfc 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.MenuItems.cs @@ -158,6 +158,13 @@ namespace BizHawk.Client.EmuHawk RedoMenuItem.Enabled = CurrentTasMovie.ChangeLog.CanRedo; } + private void showUndoHistoryToolStripMenuItem_Click(object sender, EventArgs e) + { + undoForm = new UndoHistoryForm(this); + undoForm.Show(); + undoForm.UpdateValues(); + } + private void EditSubMenu_DropDownOpened(object sender, EventArgs e) { DeselectMenuItem.Enabled = diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 2663834104..d2e3f2e6fa 100644 --- a/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -34,6 +34,8 @@ namespace BizHawk.Client.EmuHawk return (lg as Bk2LogEntryGenerator).Map(); } + private UndoHistoryForm undoForm; + private int? _autoRestoreFrame; // The frame auto-restore will restore to, if set [ConfigPersist] @@ -296,7 +298,9 @@ namespace BizHawk.Client.EmuHawk if (MarkerControl != null) MarkerControl.UpdateValues(); - + + if (undoForm != null) + undoForm.UpdateValues(); } private void RefreshTasView() @@ -603,10 +607,6 @@ namespace BizHawk.Client.EmuHawk } RefreshDialog(); - - /* adelikat: Hack to remove Undo History for now, it shouldn't be on the main window anyway, make it a modeless dialog */ - groupBox2.Visible = false; - groupBox1.Size = new System.Drawing.Size(groupBox1.Width, groupBox1.Height + 85); } private bool InitializeOnLoad() @@ -672,6 +672,9 @@ namespace BizHawk.Client.EmuHawk e.Cancel = true; _exiting = false; } + + if (undoForm != null) + undoForm.Close(); } /// @@ -746,18 +749,15 @@ namespace BizHawk.Client.EmuHawk { TasMovieMarker marker = new TasMovieMarker(markerFrame, message); CurrentTasMovie.Markers.Add(marker); - //CurrentTasMovie.ChangeLog.AddMarkerChange(marker); } public void RemoveMarker(TasMovieMarker marker) { CurrentTasMovie.Markers.Remove(marker); - //CurrentTasMovie.ChangeLog.AddMarkerChange(null, marker.Frame, marker.Message); } public void EditMarker(TasMovieMarker marker, string message) { string old = marker.Message; marker.Message = message; - //CurrentTasMovie.ChangeLog.AddMarkerChange(marker, marker.Frame, old); } } } diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs new file mode 100644 index 0000000000..2d89b9d493 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.Designer.cs @@ -0,0 +1,239 @@ +namespace BizHawk.Client.EmuHawk +{ + partial class UndoHistoryForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.ClearButton = new System.Windows.Forms.Button(); + this.UndoButton = new System.Windows.Forms.Button(); + this.RedoButton = new System.Windows.Forms.Button(); + this.RightClickMenu = new System.Windows.Forms.ContextMenuStrip(this.components); + this.undoHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.redoHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.sepToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator(); + this.clearHistoryToHereToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AutoScrollCheck = new System.Windows.Forms.CheckBox(); + this.MaxStepsNum = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.HistoryView = new BizHawk.Client.EmuHawk.VirtualListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.RightClickMenu.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.MaxStepsNum)).BeginInit(); + this.SuspendLayout(); + // + // ClearButton + // + this.ClearButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ClearButton.Location = new System.Drawing.Point(326, 228); + this.ClearButton.Name = "ClearButton"; + this.ClearButton.Size = new System.Drawing.Size(55, 22); + this.ClearButton.TabIndex = 4; + this.ClearButton.Text = "Clear"; + this.ClearButton.UseVisualStyleBackColor = true; + this.ClearButton.Click += new System.EventHandler(this.ClearButton_Click); + // + // UndoButton + // + this.UndoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.UndoButton.Location = new System.Drawing.Point(10, 228); + this.UndoButton.Name = "UndoButton"; + this.UndoButton.Size = new System.Drawing.Size(55, 22); + this.UndoButton.TabIndex = 3; + this.UndoButton.Text = "Undo"; + this.UndoButton.UseVisualStyleBackColor = true; + this.UndoButton.Click += new System.EventHandler(this.UndoButton_Click); + // + // RedoButton + // + this.RedoButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.RedoButton.Location = new System.Drawing.Point(71, 228); + this.RedoButton.Name = "RedoButton"; + this.RedoButton.Size = new System.Drawing.Size(55, 22); + this.RedoButton.TabIndex = 3; + this.RedoButton.Text = "Redo"; + this.RedoButton.UseVisualStyleBackColor = true; + this.RedoButton.Click += new System.EventHandler(this.RedoButton_Click); + // + // RightClickMenu + // + this.RightClickMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.undoHereToolStripMenuItem, + this.redoHereToolStripMenuItem, + this.sepToolStripMenuItem, + this.clearHistoryToHereToolStripMenuItem}); + this.RightClickMenu.Name = "RightClickMenu"; + this.RightClickMenu.Size = new System.Drawing.Size(211, 76); + // + // undoHereToolStripMenuItem + // + this.undoHereToolStripMenuItem.Name = "undoHereToolStripMenuItem"; + this.undoHereToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.undoHereToolStripMenuItem.Text = "Undo To Selection"; + this.undoHereToolStripMenuItem.Click += new System.EventHandler(this.undoHereToolStripMenuItem_Click); + // + // redoHereToolStripMenuItem + // + this.redoHereToolStripMenuItem.Name = "redoHereToolStripMenuItem"; + this.redoHereToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.redoHereToolStripMenuItem.Text = "Redo To Selection"; + this.redoHereToolStripMenuItem.Click += new System.EventHandler(this.redoHereToolStripMenuItem_Click); + // + // sepToolStripMenuItem + // + this.sepToolStripMenuItem.Name = "sepToolStripMenuItem"; + this.sepToolStripMenuItem.Size = new System.Drawing.Size(207, 6); + // + // clearHistoryToHereToolStripMenuItem + // + this.clearHistoryToHereToolStripMenuItem.Name = "clearHistoryToHereToolStripMenuItem"; + this.clearHistoryToHereToolStripMenuItem.Size = new System.Drawing.Size(210, 22); + this.clearHistoryToHereToolStripMenuItem.Text = "Clear History To Selection"; + this.clearHistoryToHereToolStripMenuItem.Click += new System.EventHandler(this.clearHistoryToHereToolStripMenuItem_Click); + // + // AutoScrollCheck + // + this.AutoScrollCheck.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.AutoScrollCheck.AutoSize = true; + this.AutoScrollCheck.Checked = true; + this.AutoScrollCheck.CheckState = System.Windows.Forms.CheckState.Checked; + this.AutoScrollCheck.Location = new System.Drawing.Point(132, 233); + this.AutoScrollCheck.Name = "AutoScrollCheck"; + this.AutoScrollCheck.Size = new System.Drawing.Size(77, 17); + this.AutoScrollCheck.TabIndex = 5; + this.AutoScrollCheck.Text = "Auto Scroll"; + this.AutoScrollCheck.UseVisualStyleBackColor = true; + // + // MaxStepsNum + // + this.MaxStepsNum.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.MaxStepsNum.Location = new System.Drawing.Point(268, 230); + this.MaxStepsNum.Maximum = new decimal(new int[] { + -1486618625, + 232830643, + 0, + 0}); + this.MaxStepsNum.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.MaxStepsNum.Name = "MaxStepsNum"; + this.MaxStepsNum.Size = new System.Drawing.Size(52, 20); + this.MaxStepsNum.TabIndex = 6; + this.MaxStepsNum.Value = new decimal(new int[] { + 100, + 0, + 0, + 0}); + this.MaxStepsNum.ValueChanged += new System.EventHandler(this.MaxStepsNum_ValueChanged); + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(236, 234); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(30, 13); + this.label1.TabIndex = 7; + this.label1.Text = "Max:"; + // + // HistoryView + // + this.HistoryView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.HistoryView.BlazingFast = false; + this.HistoryView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1, + this.columnHeader2}); + this.HistoryView.HideSelection = false; + this.HistoryView.ItemCount = 0; + this.HistoryView.Location = new System.Drawing.Point(10, 10); + this.HistoryView.MultiSelect = false; + this.HistoryView.Name = "HistoryView"; + this.HistoryView.SelectAllInProgress = false; + this.HistoryView.selectedItem = -1; + this.HistoryView.Size = new System.Drawing.Size(369, 213); + this.HistoryView.TabIndex = 2; + this.HistoryView.UseCompatibleStateImageBehavior = false; + this.HistoryView.UseCustomBackground = true; + this.HistoryView.View = System.Windows.Forms.View.Details; + this.HistoryView.DoubleClick += new System.EventHandler(this.HistoryView_DoubleClick); + this.HistoryView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.HistoryView_MouseDown); + this.HistoryView.MouseUp += new System.Windows.Forms.MouseEventHandler(this.HistoryView_MouseUp); + // + // columnHeader1 + // + this.columnHeader1.Text = "ID"; + this.columnHeader1.Width = 40; + // + // columnHeader2 + // + this.columnHeader2.Text = "Undo Step"; + this.columnHeader2.Width = 322; + // + // UndoHistoryForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(391, 258); + this.Controls.Add(this.label1); + this.Controls.Add(this.MaxStepsNum); + this.Controls.Add(this.AutoScrollCheck); + this.Controls.Add(this.ClearButton); + this.Controls.Add(this.RedoButton); + this.Controls.Add(this.UndoButton); + this.Controls.Add(this.HistoryView); + this.Name = "UndoHistoryForm"; + this.Text = "UndoHistoryForm"; + this.RightClickMenu.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.MaxStepsNum)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button ClearButton; + private System.Windows.Forms.Button UndoButton; + private VirtualListView HistoryView; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.ColumnHeader columnHeader2; + private System.Windows.Forms.Button RedoButton; + private System.Windows.Forms.ContextMenuStrip RightClickMenu; + private System.Windows.Forms.ToolStripMenuItem undoHereToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem redoHereToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator sepToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem clearHistoryToHereToolStripMenuItem; + private System.Windows.Forms.CheckBox AutoScrollCheck; + private System.Windows.Forms.NumericUpDown MaxStepsNum; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs new file mode 100644 index 0000000000..25c53a3887 --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace BizHawk.Client.EmuHawk +{ + public partial class UndoHistoryForm : Form + { + private TAStudio tastudio; + + public UndoHistoryForm(TAStudio owner) + { + InitializeComponent(); + tastudio = owner; + + HistoryView.QueryItemText += HistoryView_QueryItemText; + HistoryView.QueryItemBkColor += HistoryView_QueryItemBkColor; + + HistoryView.Columns[1].Width = 280; + + MaxStepsNum.Value = log.MaxSteps; + } + + private Common.TasMovieChangeLog log + { + get { return tastudio.CurrentTasMovie.ChangeLog; } + } + + private void HistoryView_QueryItemText(int row, int column, out string text) + { + if (column == 1) + text = log.Names[row]; + else + text = row.ToString(); + } + private void HistoryView_QueryItemBkColor(int row, int column, ref Color color) + { + if (column == 0) + return; + + if (row == log.UndoIndex) + color = Color.Green; + else if (row > log.UndoIndex) + color = Color.Red; + } + + private int _lastCount = -1; + public void UpdateValues() + { + HistoryView.ItemCount = log.Names.Count; + if (AutoScrollCheck.Checked && _lastCount != HistoryView.ItemCount) + HistoryView.ensureVisible(HistoryView.ItemCount - 1); + _lastCount = HistoryView.ItemCount; + + HistoryView.Refresh(); + } + + private void ClearButton_Click(object sender, EventArgs e) + { + log.ClearLog(); + UpdateValues(); + } + private void UndoButton_Click(object sender, EventArgs e) + { + log.Undo(); + tastudio.RefreshDialog(); + } + private void RedoButton_Click(object sender, EventArgs e) + { + log.Redo(); + tastudio.RefreshDialog(); + } + + + private void HistoryView_DoubleClick(object sender, EventArgs e) + { + if (log.UndoIndex <= HistoryView.selectedItem) + return; + + do + { + log.Undo(); + } while (log.UndoIndex > HistoryView.selectedItem); + UpdateValues(); + } + private void HistoryView_MouseUp(object sender, MouseEventArgs e) + { + if (e.Button == System.Windows.Forms.MouseButtons.Right) + RightClickMenu.Show(HistoryView, e.X, e.Y); + else if (e.Button == System.Windows.Forms.MouseButtons.Left) + { + if (HistoryView.selectedItem == -1) + HistoryView.SelectItem(_hackSelect, true); + } + } + // Hacky way to select a row by clicking the names row + int _hackSelect = -1; + private void HistoryView_MouseDown(object sender, MouseEventArgs e) + { + HistoryView.SelectItem(e.Y / HistoryView.LineHeight + HistoryView.VScrollPos - 1, true); + _hackSelect = HistoryView.selectedItem; + } + + private void undoHereToolStripMenuItem_Click(object sender, EventArgs e) + { + if (HistoryView.selectedItem == -1 || log.UndoIndex < HistoryView.selectedItem) + return; + + do + { + log.Undo(); + } while (log.UndoIndex >= HistoryView.selectedItem); + UpdateValues(); + } + private void redoHereToolStripMenuItem_Click(object sender, EventArgs e) + { + if (HistoryView.selectedItem == -1 || log.UndoIndex >= HistoryView.selectedItem) + return; + + do + { + log.Redo(); + } while (log.UndoIndex < HistoryView.selectedItem); + UpdateValues(); + } + private void clearHistoryToHereToolStripMenuItem_Click(object sender, EventArgs e) + { + if (HistoryView.selectedItem != -1) + log.ClearLog(HistoryView.selectedItem); + UpdateValues(); + } + + private void MaxStepsNum_ValueChanged(object sender, EventArgs e) + { + log.MaxSteps = (int)MaxStepsNum.Value; + } + + + + } +} diff --git a/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.resx b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.resx new file mode 100644 index 0000000000..e9962a344f --- /dev/null +++ b/BizHawk.Client.EmuHawk/tools/TAStudio/UndoHistoryForm.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file