diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 4e13c0445f..16ff9de803 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -351,6 +351,12 @@ LuaWinform.cs + + Form + + + LuaWriter.cs + FFmpegWriterForm.cs @@ -405,6 +411,9 @@ LuaWinform.cs + + LuaWriter.cs + RamWatch.cs Designer diff --git a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs b/BizHawk.MultiClient/tools/LuaConsole.Designer.cs index 76914fb7e2..4950f4b345 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.Designer.cs @@ -77,6 +77,7 @@ this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.luaFunctionsListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.onlineDocumentationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.OutputBox = new System.Windows.Forms.RichTextBox(); this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); this.clearToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); @@ -93,10 +94,10 @@ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripButtonMoveUp = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonMoveDown = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); 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.onlineDocumentationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); @@ -496,10 +497,17 @@ // luaFunctionsListToolStripMenuItem // this.luaFunctionsListToolStripMenuItem.Name = "luaFunctionsListToolStripMenuItem"; - this.luaFunctionsListToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.luaFunctionsListToolStripMenuItem.Size = new System.Drawing.Size(202, 22); this.luaFunctionsListToolStripMenuItem.Text = "&Lua Functions List"; this.luaFunctionsListToolStripMenuItem.Click += new System.EventHandler(this.luaFunctionsListToolStripMenuItem_Click); // + // onlineDocumentationToolStripMenuItem + // + this.onlineDocumentationToolStripMenuItem.Name = "onlineDocumentationToolStripMenuItem"; + this.onlineDocumentationToolStripMenuItem.Size = new System.Drawing.Size(202, 22); + this.onlineDocumentationToolStripMenuItem.Text = "Documentation online..."; + this.onlineDocumentationToolStripMenuItem.Click += new System.EventHandler(this.onlineDocumentationToolStripMenuItem_Click); + // // OutputBox // this.OutputBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -570,7 +578,8 @@ this.toolStripButtonSeparator, this.toolStripSeparator2, this.toolStripButtonMoveUp, - this.toolStripButtonMoveDown}); + this.toolStripButtonMoveDown, + this.toolStripButton1}); this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(584, 25); @@ -662,6 +671,16 @@ this.toolStripButtonMoveDown.Text = "Move Down"; this.toolStripButtonMoveDown.Click += new System.EventHandler(this.toolStripButtonMoveDown_Click); // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::BizHawk.MultiClient.Properties.Resources.ToolBox; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "hacky button for lua script editor"; + this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click_2); + // // LuaListView // this.LuaListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -696,13 +715,6 @@ this.PathName.Text = "Path"; this.PathName.Width = 195; // - // onlineDocumentationToolStripMenuItem - // - this.onlineDocumentationToolStripMenuItem.Name = "onlineDocumentationToolStripMenuItem"; - this.onlineDocumentationToolStripMenuItem.Size = new System.Drawing.Size(202, 22); - this.onlineDocumentationToolStripMenuItem.Text = "Documentation online..."; - this.onlineDocumentationToolStripMenuItem.Click += new System.EventHandler(this.onlineDocumentationToolStripMenuItem_Click); - // // LuaConsole // this.AllowDrop = true; @@ -804,5 +816,6 @@ public System.Windows.Forms.RichTextBox OutputBox; private System.Windows.Forms.Label OutputMessages; private System.Windows.Forms.ToolStripMenuItem onlineDocumentationToolStripMenuItem; + private System.Windows.Forms.ToolStripButton toolStripButton1; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/LuaConsole.cs index f48dddf487..569e899987 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.cs @@ -1229,5 +1229,11 @@ namespace BizHawk.MultiClient { System.Diagnostics.Process.Start("http://tasvideos.org/BizHawk/LuaFunctions.html"); } + + private void toolStripButton1_Click_2(object sender, EventArgs e) + { + LuaWriter writer = new LuaWriter(); + writer.Show(); + } } } diff --git a/BizHawk.MultiClient/tools/LuaWriter.Designer.cs b/BizHawk.MultiClient/tools/LuaWriter.Designer.cs index 9612b1c1a3..a43130b8be 100644 --- a/BizHawk.MultiClient/tools/LuaWriter.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaWriter.Designer.cs @@ -1,4 +1,4 @@ -namespace BizHawk.MultiClient.tools +namespace BizHawk.MultiClient { partial class LuaWriter { @@ -28,34 +28,41 @@ /// private void InitializeComponent() { - this.LuaText = new System.Windows.Forms.RichTextBox(); - this.SuspendLayout(); - // - // LuaText - // - this.LuaText.DetectUrls = false; - this.LuaText.Location = new System.Drawing.Point(12, 12); - this.LuaText.Name = "LuaText"; - this.LuaText.Size = new System.Drawing.Size(819, 417); - this.LuaText.TabIndex = 0; - this.LuaText.Text = ""; - this.LuaText.ZoomFactor = 1.2F; - this.LuaText.TextChanged += new System.EventHandler(this.LuaText_TextChanged); - // - // LuaWriter - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(843, 441); - this.Controls.Add(this.LuaText); - this.Name = "LuaWriter"; - this.Text = "LuaWriter"; - this.ResumeLayout(false); + this.components = new System.ComponentModel.Container(); + this.LuaText = new System.Windows.Forms.RichTextBox(); + this.timer = new System.Windows.Forms.Timer(this.components); + this.SuspendLayout(); + // + // LuaText + // + this.LuaText.Location = new System.Drawing.Point(12, 12); + this.LuaText.Name = "LuaText"; + this.LuaText.Size = new System.Drawing.Size(819, 417); + this.LuaText.TabIndex = 0; + this.LuaText.Text = ""; + this.LuaText.ZoomFactor = 1.2F; + // + // timer + // + this.timer.Enabled = true; + this.timer.Interval = 1000; + this.timer.Tick += new System.EventHandler(this.timer_Tick); + // + // LuaWriter + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(843, 441); + this.Controls.Add(this.LuaText); + this.Name = "LuaWriter"; + this.Text = "LuaWriter"; + this.ResumeLayout(false); } #endregion private System.Windows.Forms.RichTextBox LuaText; + private System.Windows.Forms.Timer timer; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/LuaWriter.cs b/BizHawk.MultiClient/tools/LuaWriter.cs index 6f1b6d8a8e..591797f2f0 100644 --- a/BizHawk.MultiClient/tools/LuaWriter.cs +++ b/BizHawk.MultiClient/tools/LuaWriter.cs @@ -6,38 +6,30 @@ using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; +using System.Text.RegularExpressions; -namespace BizHawk.MultiClient.tools +namespace BizHawk.MultiClient { public partial class LuaWriter : Form { - string[] reserv = {"and", "break", "do", "else", "elseif", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"}; + public Regex keyWords = new Regex("and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while"); public LuaWriter() { InitializeComponent(); } - private void LuaText_TextChanged(object sender, EventArgs e) - { - int pos = LuaText.SelectionStart; - foreach (string str in reserv) + private void timer_Tick(object sender, EventArgs e) + { + int selPos = LuaText.SelectionStart; + foreach (Match keyWordMatch in keyWords.Matches(LuaText.Text)) { - int temppos = 0; - do - { - LuaText.Find(str, temppos, RichTextBoxFinds.WholeWord | RichTextBoxFinds.MatchCase); - if (LuaText.SelectedText.Count() > 0) - { - LuaText.SelectionColor = Color.Blue; - } - LuaText.Select(LuaText.SelectionStart + LuaText.SelectedText.Count() + 1, 0); - temppos = LuaText.SelectionStart; - - } while (temppos < LuaText.Text.Count()); + LuaText.Select(keyWordMatch.Index, keyWordMatch.Length); + LuaText.SelectionColor = Color.Blue; + LuaText.SelectionStart = selPos; + LuaText.SelectionColor = Color.Black; } - LuaText.Select(pos, 0); - LuaText.SelectionColor = Color.Black; - } + + } } } diff --git a/BizHawk.MultiClient/tools/LuaWriter.resx b/BizHawk.MultiClient/tools/LuaWriter.resx index 29dcb1b3a3..b351ef9fea 100644 --- a/BizHawk.MultiClient/tools/LuaWriter.resx +++ b/BizHawk.MultiClient/tools/LuaWriter.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file