TAStudio - implement the Insert menu item
This commit is contained in:
parent
3ebad0cf49
commit
e8f821117b
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -57,8 +58,26 @@ namespace BizHawk.Client.Common
|
||||||
_log.RemoveAt(frame);
|
_log.RemoveAt(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Changes = true;
|
||||||
InvalidateAfter(invalidateAfter);
|
InvalidateAfter(invalidateAfter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InsertInput(int frame, IEnumerable<string> inputLog)
|
||||||
|
{
|
||||||
|
_log.InsertRange(frame, inputLog);
|
||||||
|
Changes = true;
|
||||||
|
InvalidateAfter(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InsertEmptyFrame(int frame)
|
||||||
|
{
|
||||||
|
var lg = LogGeneratorInstance();
|
||||||
|
lg.SetSource(Global.MovieSession.MovieControllerInstance());
|
||||||
|
_log.Insert(frame, lg.EmptyEntry);
|
||||||
|
|
||||||
|
Changes = true;
|
||||||
|
InvalidateAfter(frame - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -377,20 +377,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
//
|
//
|
||||||
// CloneMenuItem
|
// CloneMenuItem
|
||||||
//
|
//
|
||||||
this.CloneMenuItem.Enabled = false;
|
|
||||||
this.CloneMenuItem.Name = "CloneMenuItem";
|
this.CloneMenuItem.Name = "CloneMenuItem";
|
||||||
this.CloneMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert)));
|
this.CloneMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert)));
|
||||||
this.CloneMenuItem.Size = new System.Drawing.Size(240, 22);
|
this.CloneMenuItem.Size = new System.Drawing.Size(240, 22);
|
||||||
this.CloneMenuItem.Text = "&Clone";
|
this.CloneMenuItem.Text = "&Clone";
|
||||||
|
this.CloneMenuItem.Click += new System.EventHandler(this.CloneMenuItem_Click);
|
||||||
//
|
//
|
||||||
// InsertFrameMenuItem
|
// InsertFrameMenuItem
|
||||||
//
|
//
|
||||||
this.InsertFrameMenuItem.Enabled = false;
|
|
||||||
this.InsertFrameMenuItem.Name = "InsertFrameMenuItem";
|
this.InsertFrameMenuItem.Name = "InsertFrameMenuItem";
|
||||||
this.InsertFrameMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
this.InsertFrameMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
|
||||||
| System.Windows.Forms.Keys.Insert)));
|
| System.Windows.Forms.Keys.Insert)));
|
||||||
this.InsertFrameMenuItem.Size = new System.Drawing.Size(240, 22);
|
this.InsertFrameMenuItem.Size = new System.Drawing.Size(240, 22);
|
||||||
this.InsertFrameMenuItem.Text = "&Insert";
|
this.InsertFrameMenuItem.Text = "&Insert";
|
||||||
|
this.InsertFrameMenuItem.Click += new System.EventHandler(this.InsertFrameMenuItem_Click);
|
||||||
//
|
//
|
||||||
// InsertNumFramesMenuItem
|
// InsertNumFramesMenuItem
|
||||||
//
|
//
|
||||||
|
|
|
@ -452,6 +452,37 @@ namespace BizHawk.Client.EmuHawk
|
||||||
RefreshDialog();
|
RefreshDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CloneMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var framesToInsert = TasView.SelectedIndices
|
||||||
|
.OfType<int>()
|
||||||
|
.OrderBy(frame => frame)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var insertionFrame = framesToInsert.Last() + 1;
|
||||||
|
|
||||||
|
var inputLog = new List<string>();
|
||||||
|
foreach (var frame in framesToInsert)
|
||||||
|
{
|
||||||
|
inputLog.Add(_tas.GetInput(frame));
|
||||||
|
}
|
||||||
|
|
||||||
|
_tas.InsertInput(insertionFrame, inputLog);
|
||||||
|
|
||||||
|
RefreshDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InsertFrameMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var insertionFrame = TasView.SelectedIndices
|
||||||
|
.OfType<int>()
|
||||||
|
.Last() + 1;
|
||||||
|
|
||||||
|
_tas.InsertEmptyFrame(insertionFrame);
|
||||||
|
|
||||||
|
RefreshDialog();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Config
|
#region Config
|
||||||
|
|
Loading…
Reference in New Issue