text: LuaConsole. Added a New Script menu item and toolstrip button. It calls the LuaWriter with a null path.

LuaWriter. If it is loaded with a null value, it will start the Text with while true do emu.frameadvance() end.
This commit is contained in:
andres.delikat 2012-07-25 17:36:26 +00:00
parent 8214a649c3
commit a5ed71269d
4 changed files with 66 additions and 15 deletions

View File

@ -97,6 +97,8 @@
this.LuaListView = new BizHawk.VirtualListView();
this.Script = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.PathName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.newScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.newStripButton1 = new System.Windows.Forms.ToolStripButton();
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout();
@ -205,7 +207,8 @@
//
this.newToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.NewFile;
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.N)));
this.newToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
this.newToolStripMenuItem.Text = "&New Session";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
@ -316,6 +319,7 @@
// scriptToolStripMenuItem
//
this.scriptToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newScriptToolStripMenuItem,
this.openToolStripMenuItem,
this.toggleToolStripMenuItem,
this.pauseResumeToolStripMenuItem,
@ -569,6 +573,7 @@
//
this.toolStrip1.ClickThrough = true;
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newStripButton1,
this.openToolStripButton,
this.copyToolStripButton,
this.resumePauseButton1,
@ -703,6 +708,25 @@
this.PathName.Text = "Path";
this.PathName.Width = 195;
//
// newScriptToolStripMenuItem
//
this.newScriptToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.NewFile;
this.newScriptToolStripMenuItem.Name = "newScriptToolStripMenuItem";
this.newScriptToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.newScriptToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.newScriptToolStripMenuItem.Text = "New Script";
this.newScriptToolStripMenuItem.Click += new System.EventHandler(this.newScriptToolStripMenuItem_Click);
//
// newStripButton1
//
this.newStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.newStripButton1.Image = global::BizHawk.MultiClient.Properties.Resources.NewFile;
this.newStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.newStripButton1.Name = "newStripButton1";
this.newStripButton1.Size = new System.Drawing.Size(23, 22);
this.newStripButton1.Text = "toolStripButton1";
this.newStripButton1.Click += new System.EventHandler(this.newStripButton1_Click);
//
// LuaConsole
//
this.AllowDrop = true;
@ -804,5 +828,7 @@
public System.Windows.Forms.RichTextBox OutputBox;
private System.Windows.Forms.Label OutputMessages;
private System.Windows.Forms.ToolStripMenuItem onlineDocumentationToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem newScriptToolStripMenuItem;
private System.Windows.Forms.ToolStripButton newStripButton1;
}
}

View File

@ -1275,5 +1275,20 @@ namespace BizHawk.MultiClient
writer.CurrentFile = path;
writer.Show();
}
private void newScriptToolStripMenuItem_Click(object sender, EventArgs e)
{
NewScript();
}
private void NewScript()
{
OpenLuaWriter(null);
}
private void newStripButton1_Click(object sender, EventArgs e)
{
NewScript();
}
}
}

View File

@ -133,17 +133,18 @@
<data name="openToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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fxoU9Pp5ubUlS5rU9f8rCyjsA+pUCRC
TR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2n+Mij+XLRLLYULdF2pxlEVIDcw0p
AsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpavwatjPebqCzOprPt8YKQgzFagqL0
BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4VWm5WM/rVPNN5SjDTLQebZEHNA1wr
UvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkGtcyZptSYzvC7XByx3zQoqCnTMvlG
CX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6iuSO8CIfmECYa/bE/8ON1iRipJNh5
F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHozymgfYRy5E1CgTWKgXcZ1i5qWp0KS
rjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01GfzA1LFvQkQ6sQ9/khxhoCGHnox1Dt
NvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp
59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRnraf7Xz/xf/rJ/kvxb84I3U1y+9/W
AAAAAElFTkSuQmCC
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@ -23,7 +23,6 @@ namespace BizHawk.MultiClient
//Auto-complete drop down on functions in libraries
//intellisense on library functions
//New lua script menu item on console
//Open up a basic while true do emu.frameadvance() end code block on new lua script
//Option to turn off basic lua script
//Color config menu item
//Load/Save font
@ -301,9 +300,14 @@ namespace BizHawk.MultiClient
if (!String.IsNullOrWhiteSpace(CurrentFile))
{
LoadCurrentFile();
ProcessText();
NoChanges();
}
else
{
LuaText.Text = "while true do\n\temu.frameadvance()\nend";
}
UpdateLineNumber();
ProcessText();
NoChanges();
}
private void NoChanges()
@ -541,6 +545,11 @@ namespace BizHawk.MultiClient
}
private void LuaText_SelectionChanged(object sender, EventArgs e)
{
UpdateLineNumber();
}
private void UpdateLineNumber()
{
if (!hasChanged)
{