LuaWriter. Added new option "Start With Empty Script", wich triggers the option of having while true do emu.frameadvance() end when creating a new script.

This commit is contained in:
rolanmen1 2012-08-03 02:59:36 +00:00
parent 70f07346b1
commit 8d0f87e5d9
3 changed files with 330 additions and 301 deletions

View File

@ -566,6 +566,7 @@ namespace BizHawk.MultiClient
public float LuaWriterFontSize = 11; public float LuaWriterFontSize = 11;
public string LuaWriterFont = "Courier New"; public string LuaWriterFont = "Courier New";
public float LuaWriterZoom = 1; public float LuaWriterZoom = 1;
public bool LuaWriterStartEmpty = false;
} }
public class SMSControllerTemplate public class SMSControllerTemplate

View File

@ -37,14 +37,6 @@
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.configToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.syntaxHighlightingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MessageLabel = new System.Windows.Forms.Label();
this.AutoCompleteView = new System.Windows.Forms.ListView();
this.PositionLabel = new System.Windows.Forms.Label();
this.ZoomLabel = new System.Windows.Forms.Label();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -58,7 +50,17 @@
this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.goToToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.goToToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.configToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.syntaxHighlightingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MessageLabel = new System.Windows.Forms.Label();
this.AutoCompleteView = new System.Windows.Forms.ListView();
this.PositionLabel = new System.Windows.Forms.Label();
this.ZoomLabel = new System.Windows.Forms.Label();
this.startWithEmptyScriptToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.LuaText = new BizHawk.MultiClient.LuaWriterBox(); this.LuaText = new BizHawk.MultiClient.LuaWriterBox();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -93,6 +95,7 @@
// //
// saveToolStripMenuItem // saveToolStripMenuItem
// //
this.saveToolStripMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.SaveAs;
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.saveToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.saveToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
@ -121,78 +124,6 @@
this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
// configToolStripMenuItem
//
this.configToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fontToolStripMenuItem,
this.syntaxHighlightingToolStripMenuItem,
this.restoreSettingsToolStripMenuItem});
this.configToolStripMenuItem.Name = "configToolStripMenuItem";
this.configToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.configToolStripMenuItem.Text = "&Config";
//
// fontToolStripMenuItem
//
this.fontToolStripMenuItem.Name = "fontToolStripMenuItem";
this.fontToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
this.fontToolStripMenuItem.Text = "&Font";
this.fontToolStripMenuItem.Click += new System.EventHandler(this.fontToolStripMenuItem_Click);
//
// syntaxHighlightingToolStripMenuItem
//
this.syntaxHighlightingToolStripMenuItem.Name = "syntaxHighlightingToolStripMenuItem";
this.syntaxHighlightingToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
this.syntaxHighlightingToolStripMenuItem.Text = "&Syntax Highlighting";
this.syntaxHighlightingToolStripMenuItem.Click += new System.EventHandler(this.syntaxHighlightingToolStripMenuItem_Click);
//
// restoreSettingsToolStripMenuItem
//
this.restoreSettingsToolStripMenuItem.Name = "restoreSettingsToolStripMenuItem";
this.restoreSettingsToolStripMenuItem.Size = new System.Drawing.Size(178, 22);
this.restoreSettingsToolStripMenuItem.Text = "Restore Settings";
this.restoreSettingsToolStripMenuItem.Click += new System.EventHandler(this.restoreSettingsToolStripMenuItem_Click);
//
// MessageLabel
//
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MessageLabel.AutoSize = true;
this.MessageLabel.Location = new System.Drawing.Point(15, 424);
this.MessageLabel.Name = "MessageLabel";
this.MessageLabel.Size = new System.Drawing.Size(91, 13);
this.MessageLabel.TabIndex = 2;
this.MessageLabel.Text = " ";
//
// AutoCompleteView
//
this.AutoCompleteView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AutoCompleteView.FullRowSelect = true;
this.AutoCompleteView.Location = new System.Drawing.Point(324, 322);
this.AutoCompleteView.Name = "AutoCompleteView";
this.AutoCompleteView.Size = new System.Drawing.Size(121, 97);
this.AutoCompleteView.TabIndex = 3;
this.AutoCompleteView.UseCompatibleStateImageBehavior = false;
this.AutoCompleteView.View = System.Windows.Forms.View.List;
this.AutoCompleteView.Visible = false;
this.AutoCompleteView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.AutoCompleteView_MouseDoubleClick);
//
// PositionLabel
//
this.PositionLabel.AutoSize = true;
this.PositionLabel.Location = new System.Drawing.Point(14, 30);
this.PositionLabel.Name = "PositionLabel";
this.PositionLabel.Size = new System.Drawing.Size(46, 13);
this.PositionLabel.TabIndex = 4;
this.PositionLabel.Text = " ";
//
// ZoomLabel
//
this.ZoomLabel.AutoSize = true;
this.ZoomLabel.Location = new System.Drawing.Point(393, 30);
this.ZoomLabel.Name = "ZoomLabel";
this.ZoomLabel.Size = new System.Drawing.Size(66, 13);
this.ZoomLabel.TabIndex = 5;
this.ZoomLabel.Text = "Zoom: 100%";
//
// editToolStripMenuItem // editToolStripMenuItem
// //
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -303,6 +234,87 @@
this.goToToolStripMenuItem.Text = "Go to..."; this.goToToolStripMenuItem.Text = "Go to...";
this.goToToolStripMenuItem.Click += new System.EventHandler(this.goToToolStripMenuItem_Click); this.goToToolStripMenuItem.Click += new System.EventHandler(this.goToToolStripMenuItem_Click);
// //
// configToolStripMenuItem
//
this.configToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fontToolStripMenuItem,
this.syntaxHighlightingToolStripMenuItem,
this.toolStripSeparator5,
this.startWithEmptyScriptToolStripMenuItem,
this.restoreSettingsToolStripMenuItem});
this.configToolStripMenuItem.Name = "configToolStripMenuItem";
this.configToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
this.configToolStripMenuItem.Text = "&Config";
//
// fontToolStripMenuItem
//
this.fontToolStripMenuItem.Name = "fontToolStripMenuItem";
this.fontToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.fontToolStripMenuItem.Text = "&Font";
this.fontToolStripMenuItem.Click += new System.EventHandler(this.fontToolStripMenuItem_Click);
//
// syntaxHighlightingToolStripMenuItem
//
this.syntaxHighlightingToolStripMenuItem.Name = "syntaxHighlightingToolStripMenuItem";
this.syntaxHighlightingToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.syntaxHighlightingToolStripMenuItem.Text = "&Syntax Highlighting";
this.syntaxHighlightingToolStripMenuItem.Click += new System.EventHandler(this.syntaxHighlightingToolStripMenuItem_Click);
//
// restoreSettingsToolStripMenuItem
//
this.restoreSettingsToolStripMenuItem.Name = "restoreSettingsToolStripMenuItem";
this.restoreSettingsToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.restoreSettingsToolStripMenuItem.Text = "Restore Settings";
this.restoreSettingsToolStripMenuItem.Click += new System.EventHandler(this.restoreSettingsToolStripMenuItem_Click);
//
// MessageLabel
//
this.MessageLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.MessageLabel.AutoSize = true;
this.MessageLabel.Location = new System.Drawing.Point(15, 424);
this.MessageLabel.Name = "MessageLabel";
this.MessageLabel.Size = new System.Drawing.Size(91, 13);
this.MessageLabel.TabIndex = 2;
this.MessageLabel.Text = " ";
//
// AutoCompleteView
//
this.AutoCompleteView.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.AutoCompleteView.FullRowSelect = true;
this.AutoCompleteView.Location = new System.Drawing.Point(324, 322);
this.AutoCompleteView.Name = "AutoCompleteView";
this.AutoCompleteView.Size = new System.Drawing.Size(121, 97);
this.AutoCompleteView.TabIndex = 3;
this.AutoCompleteView.UseCompatibleStateImageBehavior = false;
this.AutoCompleteView.View = System.Windows.Forms.View.List;
this.AutoCompleteView.Visible = false;
this.AutoCompleteView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.AutoCompleteView_MouseDoubleClick);
//
// PositionLabel
//
this.PositionLabel.AutoSize = true;
this.PositionLabel.Location = new System.Drawing.Point(14, 30);
this.PositionLabel.Name = "PositionLabel";
this.PositionLabel.Size = new System.Drawing.Size(46, 13);
this.PositionLabel.TabIndex = 4;
this.PositionLabel.Text = " ";
//
// ZoomLabel
//
this.ZoomLabel.AutoSize = true;
this.ZoomLabel.Location = new System.Drawing.Point(393, 30);
this.ZoomLabel.Name = "ZoomLabel";
this.ZoomLabel.Size = new System.Drawing.Size(66, 13);
this.ZoomLabel.TabIndex = 5;
this.ZoomLabel.Text = "Zoom: 100%";
//
// startWithEmptyScriptToolStripMenuItem
//
this.startWithEmptyScriptToolStripMenuItem.Name = "startWithEmptyScriptToolStripMenuItem";
this.startWithEmptyScriptToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
this.startWithEmptyScriptToolStripMenuItem.Text = "Start With Empty Script";
this.startWithEmptyScriptToolStripMenuItem.Click += new System.EventHandler(this.startWithEmptyScriptToolStripMenuItem_Click);
//
// LuaText // LuaText
// //
this.LuaText.AcceptsTab = true; this.LuaText.AcceptsTab = true;
@ -323,6 +335,11 @@
this.LuaText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyUp); this.LuaText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.LuaText_KeyUp);
this.LuaText.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.LuaText_PreviewKeyDown); this.LuaText.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.LuaText_PreviewKeyDown);
// //
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
this.toolStripSeparator5.Size = new System.Drawing.Size(193, 6);
//
// LuaWriter // LuaWriter
// //
this.AllowDrop = true; this.AllowDrop = true;
@ -381,5 +398,7 @@
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem goToToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem goToToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem startWithEmptyScriptToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
} }
} }

View File

@ -21,14 +21,11 @@ namespace BizHawk.MultiClient
//Save fontstyle to config //Save fontstyle to config
//Line numbers //Line numbers
//Option to toggle line numbers //Option to toggle line numbers
//Go to line number Ctrl+G
//Auto-complete drop down on functions in libraries //Auto-complete drop down on functions in libraries
//intellisense on library functions //intellisense on library functions
//Option to turn off basic lua script //Option to turn off basic lua script
//Tool strip //Tool strip
//function toolstrip button (inserts a function end block and puts cursor on blank line between them //function toolstrip button (inserts a function end block and puts cursor on blank line between them
//when pressing enter on function blah, it should put the end afterwards
//on if then + enter key, put end afterwards
//error checking logic on library functions (check parameters, etc) //error checking logic on library functions (check parameters, etc)
//fix so drag & drop text file on edit box works (not just the edges around it //fix so drag & drop text file on edit box works (not just the edges around it
//listview object with lua functions, double click inserts them into the script //listview object with lua functions, double click inserts them into the script
@ -310,11 +307,14 @@ namespace BizHawk.MultiClient
{ {
LoadCurrentFile(); LoadCurrentFile();
} }
else else if (!Global.Config.LuaWriterStartEmpty)
{ {
LuaText.Text = "while true do\n\t\n\temu.frameadvance()\nend"; LuaText.Text = "while true do\n\t\n\temu.frameadvance()\nend";
LuaText.SelectionStart = 15; LuaText.SelectionStart = 15;
} }
else
startWithEmptyScriptToolStripMenuItem.Checked = true;
UpdateLineNumber(); UpdateLineNumber();
ProcessText(); ProcessText();
NoChanges(); NoChanges();
@ -649,6 +649,7 @@ namespace BizHawk.MultiClient
private void LuaWriter_FormClosing(object sender, FormClosingEventArgs e) private void LuaWriter_FormClosing(object sender, FormClosingEventArgs e)
{ {
Global.Config.LuaWriterZoom = LuaText.ZoomFactor; Global.Config.LuaWriterZoom = LuaText.ZoomFactor;
Global.Config.LuaWriterStartEmpty = startWithEmptyScriptToolStripMenuItem.Checked;
} }
private void restoreSettingsToolStripMenuItem_Click(object sender, EventArgs e) private void restoreSettingsToolStripMenuItem_Click(object sender, EventArgs e)
@ -666,6 +667,9 @@ namespace BizHawk.MultiClient
Global.Config.LuaSymbolBold = false; Global.Config.LuaSymbolBold = false;
Global.Config.LuaLibraryBold = false; Global.Config.LuaLibraryBold = false;
Global.Config.LuaWriterStartEmpty = false;
startWithEmptyScriptToolStripMenuItem.Checked = false;
ProcessText(); ProcessText();
Global.Config.LuaWriterFontSize = 11; Global.Config.LuaWriterFontSize = 11;
@ -734,5 +738,10 @@ namespace BizHawk.MultiClient
{ {
LuaText.Redo(); LuaText.Redo();
} }
private void startWithEmptyScriptToolStripMenuItem_Click(object sender, EventArgs e)
{
startWithEmptyScriptToolStripMenuItem.Checked ^= true;
}
} }
} }