tastudio: a whole bunch of actions shouldn't be possible with no selection
This commit is contained in:
parent
c839bffc33
commit
61bf9b67a8
|
@ -300,6 +300,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
DeleteFramesMenuItem.Enabled =
|
DeleteFramesMenuItem.Enabled =
|
||||||
CloneFramesMenuItem.Enabled =
|
CloneFramesMenuItem.Enabled =
|
||||||
TruncateMenuItem.Enabled =
|
TruncateMenuItem.Enabled =
|
||||||
|
InsertFrameMenuItem.Enabled =
|
||||||
|
InsertNumFramesMenuItem.Enabled =
|
||||||
TasView.AnyRowsSelected;
|
TasView.AnyRowsSelected;
|
||||||
|
|
||||||
ReselectClipboardMenuItem.Enabled =
|
ReselectClipboardMenuItem.Enabled =
|
||||||
|
@ -452,45 +454,48 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void PasteMenuItem_Click(object sender, EventArgs e)
|
private void PasteMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// TODO: if highlighting 2 rows and pasting 3, only paste 2 of them
|
if (TasView.AnyRowsSelected)
|
||||||
// FCEUX Taseditor does't do this, but I think it is the expected behavior in editor programs
|
|
||||||
var wasPaused = Mainform.EmulatorPaused;
|
|
||||||
|
|
||||||
// copypaste from PasteInsertMenuItem_Click!
|
|
||||||
IDataObject data = Clipboard.GetDataObject();
|
|
||||||
if (data.GetDataPresent(DataFormats.StringFormat))
|
|
||||||
{
|
{
|
||||||
string input = (string)data.GetData(DataFormats.StringFormat);
|
// TODO: if highlighting 2 rows and pasting 3, only paste 2 of them
|
||||||
if (!string.IsNullOrWhiteSpace(input))
|
// FCEUX Taseditor does't do this, but I think it is the expected behavior in editor programs
|
||||||
|
var wasPaused = Mainform.EmulatorPaused;
|
||||||
|
|
||||||
|
// copypaste from PasteInsertMenuItem_Click!
|
||||||
|
IDataObject data = Clipboard.GetDataObject();
|
||||||
|
if (data.GetDataPresent(DataFormats.StringFormat))
|
||||||
{
|
{
|
||||||
string[] lines = input.Split('\n');
|
string input = (string)data.GetData(DataFormats.StringFormat);
|
||||||
if (lines.Length > 0)
|
if (!string.IsNullOrWhiteSpace(input))
|
||||||
{
|
{
|
||||||
_tasClipboard.Clear();
|
string[] lines = input.Split('\n');
|
||||||
for (int i = 0; i < lines.Length - 1; i++)
|
if (lines.Length > 0)
|
||||||
{
|
{
|
||||||
var line = TasClipboardEntry.SetFromMnemonicStr(lines[i]);
|
_tasClipboard.Clear();
|
||||||
if (line == null)
|
for (int i = 0; i < lines.Length - 1; i++)
|
||||||
{
|
{
|
||||||
return;
|
var line = TasClipboardEntry.SetFromMnemonicStr(lines[i]);
|
||||||
|
if (line == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_tasClipboard.Add(new TasClipboardEntry(i, line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||||
|
CurrentTasMovie.CopyOverInput(TasView.FirstSelectedIndex.Value, _tasClipboard.Select(x => x.ControllerState));
|
||||||
|
if (needsToRollback)
|
||||||
|
{
|
||||||
|
GoToLastEmulatedFrameIfNecessary(TasView.FirstSelectedIndex.Value);
|
||||||
|
DoAutoRestore();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_tasClipboard.Add(new TasClipboardEntry(i, line));
|
RefreshDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
|
||||||
CurrentTasMovie.CopyOverInput(TasView.FirstSelectedIndex.Value, _tasClipboard.Select(x => x.ControllerState));
|
|
||||||
if (needsToRollback)
|
|
||||||
{
|
|
||||||
GoToLastEmulatedFrameIfNecessary(TasView.FirstSelectedIndex.Value);
|
|
||||||
DoAutoRestore();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RefreshDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,43 +503,46 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void PasteInsertMenuItem_Click(object sender, EventArgs e)
|
private void PasteInsertMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var wasPaused = Mainform.EmulatorPaused;
|
if (TasView.AnyRowsSelected)
|
||||||
|
|
||||||
// copypaste from PasteMenuItem_Click!
|
|
||||||
IDataObject data = Clipboard.GetDataObject();
|
|
||||||
if (data.GetDataPresent(DataFormats.StringFormat))
|
|
||||||
{
|
{
|
||||||
string input = (string)data.GetData(DataFormats.StringFormat);
|
var wasPaused = Mainform.EmulatorPaused;
|
||||||
if (!string.IsNullOrWhiteSpace(input))
|
|
||||||
|
// copypaste from PasteMenuItem_Click!
|
||||||
|
IDataObject data = Clipboard.GetDataObject();
|
||||||
|
if (data.GetDataPresent(DataFormats.StringFormat))
|
||||||
{
|
{
|
||||||
string[] lines = input.Split('\n');
|
string input = (string)data.GetData(DataFormats.StringFormat);
|
||||||
if (lines.Length > 0)
|
if (!string.IsNullOrWhiteSpace(input))
|
||||||
{
|
{
|
||||||
_tasClipboard.Clear();
|
string[] lines = input.Split('\n');
|
||||||
for (int i = 0; i < lines.Length - 1; i++)
|
if (lines.Length > 0)
|
||||||
{
|
{
|
||||||
var line = TasClipboardEntry.SetFromMnemonicStr(lines[i]);
|
_tasClipboard.Clear();
|
||||||
if (line == null)
|
for (int i = 0; i < lines.Length - 1; i++)
|
||||||
{
|
{
|
||||||
return;
|
var line = TasClipboardEntry.SetFromMnemonicStr(lines[i]);
|
||||||
|
if (line == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_tasClipboard.Add(new TasClipboardEntry(i, line));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||||
|
CurrentTasMovie.InsertInput(TasView.FirstSelectedIndex.Value, _tasClipboard.Select(x => x.ControllerState));
|
||||||
|
if (needsToRollback)
|
||||||
|
{
|
||||||
|
GoToLastEmulatedFrameIfNecessary(TasView.FirstSelectedIndex.Value);
|
||||||
|
DoAutoRestore();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_tasClipboard.Add(new TasClipboardEntry(i, line));
|
RefreshDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
|
||||||
CurrentTasMovie.InsertInput(TasView.FirstSelectedIndex.Value, _tasClipboard.Select(x => x.ControllerState));
|
|
||||||
if (needsToRollback)
|
|
||||||
{
|
|
||||||
GoToLastEmulatedFrameIfNecessary(TasView.FirstSelectedIndex.Value);
|
|
||||||
DoAutoRestore();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RefreshDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -668,32 +676,37 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void InsertFrameMenuItem_Click(object sender, EventArgs e)
|
private void InsertFrameMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var wasPaused = Mainform.EmulatorPaused;
|
if (TasView.AnyRowsSelected)
|
||||||
var insertionFrame = TasView.AnyRowsSelected ? TasView.FirstSelectedIndex.Value : 0;
|
|
||||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
|
||||||
|
|
||||||
CurrentTasMovie.InsertEmptyFrame(insertionFrame);
|
|
||||||
|
|
||||||
if (needsToRollback)
|
|
||||||
{
|
{
|
||||||
GoToLastEmulatedFrameIfNecessary(insertionFrame);
|
var wasPaused = Mainform.EmulatorPaused;
|
||||||
DoAutoRestore();
|
var insertionFrame = TasView.AnyRowsSelected ? TasView.FirstSelectedIndex.Value : 0;
|
||||||
}
|
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||||
else
|
|
||||||
{
|
CurrentTasMovie.InsertEmptyFrame(insertionFrame);
|
||||||
RefreshDialog();
|
|
||||||
|
if (needsToRollback)
|
||||||
|
{
|
||||||
|
GoToLastEmulatedFrameIfNecessary(insertionFrame);
|
||||||
|
DoAutoRestore();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RefreshDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InsertNumFramesMenuItem_Click(object sender, EventArgs e)
|
private void InsertNumFramesMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
int insertionFrame = TasView.AnyRowsSelected ? TasView.FirstSelectedIndex.Value : 0;
|
if (TasView.AnyRowsSelected)
|
||||||
|
|
||||||
var framesPrompt = new FramesPrompt();
|
|
||||||
DialogResult result = framesPrompt.ShowDialog();
|
|
||||||
if (result == DialogResult.OK)
|
|
||||||
{
|
{
|
||||||
InsertNumFrames(insertionFrame, framesPrompt.Frames);
|
int insertionFrame = TasView.FirstSelectedIndex.Value;
|
||||||
|
var framesPrompt = new FramesPrompt();
|
||||||
|
DialogResult result = framesPrompt.ShowDialog();
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
InsertNumFrames(insertionFrame, framesPrompt.Frames);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue