TAStudio - implement Insert # Frames, and Select All, hide context menu items based on read-only status
This commit is contained in:
parent
d7e05ceb32
commit
862caafd05
|
@ -1844,7 +1844,7 @@ namespace BizHawk.MultiClient
|
|||
InputPrompt prompt = new InputPrompt();
|
||||
prompt.SetMessage("Enter a set of hex values to search for");
|
||||
prompt.SetCasing(CharacterCasing.Upper);
|
||||
prompt.HexOnly = true;
|
||||
prompt.TextInputType = InputPrompt.InputType.HEX;
|
||||
if (addressHighlighted > 0)
|
||||
{
|
||||
string values = ValueString(GetHighlightedAddress());
|
||||
|
|
|
@ -14,9 +14,18 @@ namespace BizHawk.MultiClient
|
|||
/// </summary>
|
||||
public partial class InputPrompt : Form
|
||||
{
|
||||
public enum InputType { HEX, UNSIGNED, SIGNED, TEXT };
|
||||
public bool UserOK; //Will be true if the user selects Ok
|
||||
public string UserText = ""; //What the user selected
|
||||
public bool HexOnly = false;
|
||||
|
||||
private InputType itype = InputType.TEXT;
|
||||
|
||||
public InputType TextInputType
|
||||
{
|
||||
get { return itype; }
|
||||
set { itype = value; }
|
||||
}
|
||||
|
||||
public InputPrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -37,6 +46,11 @@ namespace BizHawk.MultiClient
|
|||
PromptBox.Text = value;
|
||||
}
|
||||
|
||||
public void SetTitle(string value)
|
||||
{
|
||||
Text = value;
|
||||
}
|
||||
|
||||
private void InputPrompt_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
@ -51,22 +65,47 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
UserOK = false;
|
||||
UserOK = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void PromptBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (HexOnly)
|
||||
switch (itype)
|
||||
{
|
||||
if (e.KeyChar == '\b')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!InputValidate.IsValidHexNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
default:
|
||||
case InputType.TEXT:
|
||||
break;
|
||||
case InputType.HEX:
|
||||
if (e.KeyChar == '\b')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!InputValidate.IsValidHexNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
case InputType.SIGNED:
|
||||
if (e.KeyChar == '\b')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!InputValidate.IsValidUnsignedNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
case InputType.UNSIGNED:
|
||||
if (e.KeyChar == '\b')
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (!InputValidate.IsValidSignedNumber(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,10 +68,13 @@
|
|||
this.ReadOnlyCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.ContextMenu_Insert = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cloneToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.clearToolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ContextMenu_Delete = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SelectAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cloneToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ContextMenu_Insert = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.insertFramesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripItem_SelectAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ControllerBox = new System.Windows.Forms.GroupBox();
|
||||
this.ControllersContext = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.clearToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -88,8 +91,8 @@
|
|||
this.TASView = new BizHawk.VirtualListView();
|
||||
this.Frame = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.Log = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.clearToolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.ControllersContext.SuspendLayout();
|
||||
|
@ -215,6 +218,8 @@
|
|||
this.insertFrameToolStripMenuItem,
|
||||
this.insertNumFramesToolStripMenuItem,
|
||||
this.toolStripSeparator7,
|
||||
this.selectAllToolStripMenuItem,
|
||||
this.toolStripSeparator8,
|
||||
this.clearVirtualPadsToolStripMenuItem});
|
||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||
|
@ -258,6 +263,7 @@
|
|||
this.insertNumFramesToolStripMenuItem.Name = "insertNumFramesToolStripMenuItem";
|
||||
this.insertNumFramesToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
||||
this.insertNumFramesToolStripMenuItem.Text = "Insert # of Frames";
|
||||
this.insertNumFramesToolStripMenuItem.Click += new System.EventHandler(this.insertNumFramesToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator7
|
||||
//
|
||||
|
@ -339,42 +345,61 @@
|
|||
this.ContextMenu_Delete,
|
||||
this.cloneToolStripMenuItem1,
|
||||
this.ContextMenu_Insert,
|
||||
this.insertFramesToolStripMenuItem,
|
||||
this.toolStripSeparator5,
|
||||
this.SelectAll});
|
||||
this.toolStripItem_SelectAll});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(232, 120);
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(185, 164);
|
||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||
//
|
||||
// ContextMenu_Insert
|
||||
// clearToolStripMenuItem3
|
||||
//
|
||||
this.ContextMenu_Insert.Name = "ContextMenu_Insert";
|
||||
this.ContextMenu_Insert.ShortcutKeyDisplayString = "Ctrl+Shift+Ins";
|
||||
this.ContextMenu_Insert.Size = new System.Drawing.Size(231, 22);
|
||||
this.ContextMenu_Insert.Text = "Insert frame(s)";
|
||||
this.ContextMenu_Insert.Click += new System.EventHandler(this.Insert_Click);
|
||||
//
|
||||
// cloneToolStripMenuItem1
|
||||
//
|
||||
this.cloneToolStripMenuItem1.Name = "cloneToolStripMenuItem1";
|
||||
this.cloneToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+Ins";
|
||||
this.cloneToolStripMenuItem1.Size = new System.Drawing.Size(231, 22);
|
||||
this.cloneToolStripMenuItem1.Text = "Clone";
|
||||
this.cloneToolStripMenuItem1.Click += new System.EventHandler(this.cloneToolStripMenuItem1_Click);
|
||||
this.clearToolStripMenuItem3.Name = "clearToolStripMenuItem3";
|
||||
this.clearToolStripMenuItem3.Size = new System.Drawing.Size(184, 22);
|
||||
this.clearToolStripMenuItem3.Text = "Clear";
|
||||
//
|
||||
// ContextMenu_Delete
|
||||
//
|
||||
this.ContextMenu_Delete.Name = "ContextMenu_Delete";
|
||||
this.ContextMenu_Delete.ShortcutKeyDisplayString = "Ctrl+Del";
|
||||
this.ContextMenu_Delete.Size = new System.Drawing.Size(231, 22);
|
||||
this.ContextMenu_Delete.Text = "Delete frame(s)";
|
||||
this.ContextMenu_Delete.Size = new System.Drawing.Size(184, 22);
|
||||
this.ContextMenu_Delete.Text = "Delete";
|
||||
this.ContextMenu_Delete.Click += new System.EventHandler(this.Delete_Click);
|
||||
//
|
||||
// cloneToolStripMenuItem1
|
||||
//
|
||||
this.cloneToolStripMenuItem1.Name = "cloneToolStripMenuItem1";
|
||||
this.cloneToolStripMenuItem1.ShortcutKeyDisplayString = "Ctrl+Ins";
|
||||
this.cloneToolStripMenuItem1.Size = new System.Drawing.Size(184, 22);
|
||||
this.cloneToolStripMenuItem1.Text = "Clone";
|
||||
this.cloneToolStripMenuItem1.Click += new System.EventHandler(this.cloneToolStripMenuItem1_Click);
|
||||
//
|
||||
// ContextMenu_Insert
|
||||
//
|
||||
this.ContextMenu_Insert.Name = "ContextMenu_Insert";
|
||||
this.ContextMenu_Insert.ShortcutKeyDisplayString = "Ctrl+Shift+Ins";
|
||||
this.ContextMenu_Insert.Size = new System.Drawing.Size(184, 22);
|
||||
this.ContextMenu_Insert.Text = "Insert";
|
||||
this.ContextMenu_Insert.Click += new System.EventHandler(this.Insert_Click);
|
||||
//
|
||||
// insertFramesToolStripMenuItem
|
||||
//
|
||||
this.insertFramesToolStripMenuItem.Name = "insertFramesToolStripMenuItem";
|
||||
this.insertFramesToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
|
||||
this.insertFramesToolStripMenuItem.Text = "Insert # Frames";
|
||||
this.insertFramesToolStripMenuItem.Click += new System.EventHandler(this.insertFramesToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(181, 6);
|
||||
//
|
||||
// SelectAll
|
||||
//
|
||||
this.SelectAll.Enabled = false;
|
||||
this.SelectAll.Name = "SelectAll";
|
||||
this.SelectAll.Size = new System.Drawing.Size(231, 22);
|
||||
this.SelectAll.Text = "Select All";
|
||||
this.toolStripItem_SelectAll.Name = "SelectAll";
|
||||
this.toolStripItem_SelectAll.Size = new System.Drawing.Size(184, 22);
|
||||
this.toolStripItem_SelectAll.Text = "Select All";
|
||||
this.toolStripItem_SelectAll.Click += new System.EventHandler(this.SelectAll_Click);
|
||||
//
|
||||
// ControllerBox
|
||||
//
|
||||
|
@ -545,16 +570,18 @@
|
|||
this.Log.Text = "Log";
|
||||
this.Log.Width = 201;
|
||||
//
|
||||
// clearToolStripMenuItem3
|
||||
// toolStripSeparator8
|
||||
//
|
||||
this.clearToolStripMenuItem3.Name = "clearToolStripMenuItem3";
|
||||
this.clearToolStripMenuItem3.Size = new System.Drawing.Size(231, 22);
|
||||
this.clearToolStripMenuItem3.Text = "Clear";
|
||||
this.toolStripSeparator8.Name = "toolStripSeparator8";
|
||||
this.toolStripSeparator8.Size = new System.Drawing.Size(184, 6);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
// selectAllToolStripMenuItem
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(228, 6);
|
||||
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
|
||||
this.selectAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
|
||||
this.selectAllToolStripMenuItem.Text = "Select &All";
|
||||
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click);
|
||||
//
|
||||
// TAStudio
|
||||
//
|
||||
|
@ -618,7 +645,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem insertFrameToolStripMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem ContextMenu_Insert;
|
||||
private System.Windows.Forms.ToolStripMenuItem SelectAll;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripItem_SelectAll;
|
||||
private System.Windows.Forms.GroupBox ControllerBox;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
|
||||
private System.Windows.Forms.ToolStripButton StopButton;
|
||||
|
@ -638,5 +665,8 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem insertNumFramesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem3;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
private System.Windows.Forms.ToolStripMenuItem insertFramesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
|
||||
}
|
||||
}
|
|
@ -414,8 +414,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (ReadOnlyCheckBox.Checked)
|
||||
{
|
||||
|
||||
clearToolStripMenuItem.Enabled = false;
|
||||
|
||||
clearToolStripMenuItem2.Enabled = false;
|
||||
deleteFramesToolStripMenuItem.Enabled = false;
|
||||
cloneToolStripMenuItem.Enabled = false;
|
||||
insertFrameToolStripMenuItem.Enabled = false;
|
||||
|
@ -424,7 +424,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
clearToolStripMenuItem.Enabled = true;
|
||||
clearToolStripMenuItem2.Enabled = true;
|
||||
deleteFramesToolStripMenuItem.Enabled = true;
|
||||
cloneToolStripMenuItem.Enabled = true;
|
||||
insertFrameToolStripMenuItem.Enabled = true;
|
||||
|
@ -576,13 +576,21 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (ReadOnlyCheckBox.Checked)
|
||||
{
|
||||
ContextMenu_Insert.Enabled = false; //TODO: just hide them, but right now only read-only depenent items are in this menu and I need something to show!
|
||||
ContextMenu_Delete.Enabled = false;
|
||||
clearToolStripMenuItem3.Visible = false;
|
||||
ContextMenu_Delete.Visible = false;
|
||||
cloneToolStripMenuItem1.Visible = false;
|
||||
ContextMenu_Insert.Visible = false;
|
||||
insertFramesToolStripMenuItem.Visible = false;
|
||||
toolStripSeparator5.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextMenu_Insert.Enabled = true;
|
||||
ContextMenu_Delete.Enabled = true;
|
||||
clearToolStripMenuItem3.Visible = true;
|
||||
ContextMenu_Delete.Visible = true;
|
||||
cloneToolStripMenuItem1.Visible = true;
|
||||
ContextMenu_Insert.Visible = true;
|
||||
insertFramesToolStripMenuItem.Visible = true;
|
||||
toolStripSeparator5.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,9 +653,60 @@ namespace BizHawk.MultiClient
|
|||
UpdateValues();
|
||||
}
|
||||
|
||||
private void InsertNumFrames()
|
||||
{
|
||||
ListView.SelectedIndexCollection list = TASView.SelectedIndices;
|
||||
if (list.Count > 0)
|
||||
{
|
||||
InputPrompt prompt = new InputPrompt();
|
||||
prompt.TextInputType = InputPrompt.InputType.UNSIGNED;
|
||||
prompt.SetMessage("How many frames?");
|
||||
prompt.SetInitialValue("1");
|
||||
prompt.SetTitle("Insert new frames");
|
||||
prompt.ShowDialog();
|
||||
if (prompt.UserOK)
|
||||
{
|
||||
int frames = int.Parse(prompt.UserText);
|
||||
for (int i = 0; i < frames; i++)
|
||||
{
|
||||
Global.MovieSession.Movie.InsertBlankFrame(list[0] + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateValues();
|
||||
}
|
||||
|
||||
private void SelectAll()
|
||||
{
|
||||
for (int i = 0; i < TASView.ItemCount; i++)
|
||||
{
|
||||
TASView.SelectItem(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearToolStripMenuItem2_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearFrames();
|
||||
}
|
||||
|
||||
private void insertNumFramesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
InsertNumFrames();
|
||||
}
|
||||
|
||||
private void insertFramesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
InsertNumFrames();
|
||||
}
|
||||
|
||||
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectAll();
|
||||
}
|
||||
|
||||
private void SelectAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue