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 =
|
||||
CloneFramesMenuItem.Enabled =
|
||||
TruncateMenuItem.Enabled =
|
||||
InsertFrameMenuItem.Enabled =
|
||||
InsertNumFramesMenuItem.Enabled =
|
||||
TasView.AnyRowsSelected;
|
||||
|
||||
ReselectClipboardMenuItem.Enabled =
|
||||
|
@ -452,45 +454,48 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void PasteMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
// TODO: if highlighting 2 rows and pasting 3, only paste 2 of them
|
||||
// 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))
|
||||
if (TasView.AnyRowsSelected)
|
||||
{
|
||||
string input = (string)data.GetData(DataFormats.StringFormat);
|
||||
if (!string.IsNullOrWhiteSpace(input))
|
||||
// TODO: if highlighting 2 rows and pasting 3, only paste 2 of them
|
||||
// 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');
|
||||
if (lines.Length > 0)
|
||||
string input = (string)data.GetData(DataFormats.StringFormat);
|
||||
if (!string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
_tasClipboard.Clear();
|
||||
for (int i = 0; i < lines.Length - 1; i++)
|
||||
string[] lines = input.Split('\n');
|
||||
if (lines.Length > 0)
|
||||
{
|
||||
var line = TasClipboardEntry.SetFromMnemonicStr(lines[i]);
|
||||
if (line == null)
|
||||
_tasClipboard.Clear();
|
||||
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
|
||||
{
|
||||
_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)
|
||||
{
|
||||
var wasPaused = Mainform.EmulatorPaused;
|
||||
|
||||
// copypaste from PasteMenuItem_Click!
|
||||
IDataObject data = Clipboard.GetDataObject();
|
||||
if (data.GetDataPresent(DataFormats.StringFormat))
|
||||
if (TasView.AnyRowsSelected)
|
||||
{
|
||||
string input = (string)data.GetData(DataFormats.StringFormat);
|
||||
if (!string.IsNullOrWhiteSpace(input))
|
||||
var wasPaused = Mainform.EmulatorPaused;
|
||||
|
||||
// copypaste from PasteMenuItem_Click!
|
||||
IDataObject data = Clipboard.GetDataObject();
|
||||
if (data.GetDataPresent(DataFormats.StringFormat))
|
||||
{
|
||||
string[] lines = input.Split('\n');
|
||||
if (lines.Length > 0)
|
||||
string input = (string)data.GetData(DataFormats.StringFormat);
|
||||
if (!string.IsNullOrWhiteSpace(input))
|
||||
{
|
||||
_tasClipboard.Clear();
|
||||
for (int i = 0; i < lines.Length - 1; i++)
|
||||
string[] lines = input.Split('\n');
|
||||
if (lines.Length > 0)
|
||||
{
|
||||
var line = TasClipboardEntry.SetFromMnemonicStr(lines[i]);
|
||||
if (line == null)
|
||||
_tasClipboard.Clear();
|
||||
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
|
||||
{
|
||||
_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)
|
||||
{
|
||||
var wasPaused = Mainform.EmulatorPaused;
|
||||
var insertionFrame = TasView.AnyRowsSelected ? TasView.FirstSelectedIndex.Value : 0;
|
||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||
|
||||
CurrentTasMovie.InsertEmptyFrame(insertionFrame);
|
||||
|
||||
if (needsToRollback)
|
||||
if (TasView.AnyRowsSelected)
|
||||
{
|
||||
GoToLastEmulatedFrameIfNecessary(insertionFrame);
|
||||
DoAutoRestore();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDialog();
|
||||
var wasPaused = Mainform.EmulatorPaused;
|
||||
var insertionFrame = TasView.AnyRowsSelected ? TasView.FirstSelectedIndex.Value : 0;
|
||||
var needsToRollback = TasView.FirstSelectedIndex < Emulator.Frame;
|
||||
|
||||
CurrentTasMovie.InsertEmptyFrame(insertionFrame);
|
||||
|
||||
if (needsToRollback)
|
||||
{
|
||||
GoToLastEmulatedFrameIfNecessary(insertionFrame);
|
||||
DoAutoRestore();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InsertNumFramesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
int insertionFrame = TasView.AnyRowsSelected ? TasView.FirstSelectedIndex.Value : 0;
|
||||
|
||||
var framesPrompt = new FramesPrompt();
|
||||
DialogResult result = framesPrompt.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
if (TasView.AnyRowsSelected)
|
||||
{
|
||||
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