TAStudio:
-Undo History UI, some history bugfixes -Painting input past the movie no longer moves markers
This commit is contained in:
parent
e7fe6252c6
commit
189ecfeb2e
|
@ -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<string> 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<IController> inputStates)
|
||||
{
|
||||
// ChangeLog is done in the InsertInput call.
|
||||
|
@ -246,7 +248,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public void CopyOverInput(int frame, IEnumerable<IController> 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++)
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
List<List<IMovieAction>> History;
|
||||
public List<string> 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;
|
||||
/// <summary>
|
||||
/// This is not intended to turn off the ChangeLog, but to disable the normal recording process.
|
||||
|
@ -79,7 +81,7 @@ namespace BizHawk.Client.Common
|
|||
/// </summary>
|
||||
/// <param name="keepOldBatch">If set and a batch is in progress, a new batch will not be created.</param>
|
||||
/// <returns>Returns true if a new batch was started; otherwise false.</returns>
|
||||
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<IMovieAction>(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;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace BizHawk.Client.Common
|
|||
|
||||
public new void AddRange(IEnumerable<TasMovieMarker> 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<TasMovieMarker> 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<TasMovieMarker> 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)
|
||||
|
|
|
@ -924,12 +924,6 @@
|
|||
<Compile Include="tools\TAStudio\HeaderEditor.Designer.cs">
|
||||
<DependentUpon>HeaderEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\TAStudio\HistoryBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\TAStudio\HistoryBox.Designer.cs">
|
||||
<DependentUpon>HistoryBox.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\TAStudio\InputRoll.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -972,6 +966,12 @@
|
|||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\TAStudio\TAStudioClipboard.cs" />
|
||||
<Compile Include="tools\TAStudio\UndoHistoryForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="tools\TAStudio\UndoHistoryForm.Designer.cs">
|
||||
<DependentUpon>UndoHistoryForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\TI83\TI83KeyPad.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -1378,9 +1378,6 @@
|
|||
<EmbeddedResource Include="tools\TAStudio\HeaderEditor.resx">
|
||||
<DependentUpon>HeaderEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\TAStudio\HistoryBox.resx">
|
||||
<DependentUpon>HistoryBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\TAStudio\MarkerControl.resx">
|
||||
<DependentUpon>MarkerControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -1390,6 +1387,9 @@
|
|||
<EmbeddedResource Include="tools\TAStudio\TAStudio.resx">
|
||||
<DependentUpon>TAStudio.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\TAStudio\UndoHistoryForm.resx">
|
||||
<DependentUpon>UndoHistoryForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="tools\TI83\TI83KeyPad.resx">
|
||||
<DependentUpon>TI83KeyPad.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -623,7 +623,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public static extern int GetScrollPos(IntPtr hWnd, Orientation nBar);
|
||||
|
||||
/// <summary>
|
||||
/// Gets and Sets the Vertical Scroll position of the control.
|
||||
/// Gets the Vertical Scroll position of the control.
|
||||
/// </summary>
|
||||
public int VScrollPos
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,239 @@
|
|||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class UndoHistoryForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="RightClickMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
Loading…
Reference in New Issue