Hook up LuaWriter to a new & hacky toolstrip icon for now

This commit is contained in:
adelikat 2012-07-19 04:19:24 +00:00
parent 876007c502
commit 7cb69f4826
6 changed files with 85 additions and 55 deletions

View File

@ -351,6 +351,12 @@
<Compile Include="tools\LuaWinform.Designer.cs">
<DependentUpon>LuaWinform.cs</DependentUpon>
</Compile>
<Compile Include="tools\LuaWriter.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="tools\LuaWriter.designer.cs">
<DependentUpon>LuaWriter.cs</DependentUpon>
</Compile>
<Compile Include="tools\WatchCommon.cs" />
<EmbeddedResource Include="AVOut\FFmpegWriterForm.resx">
<DependentUpon>FFmpegWriterForm.cs</DependentUpon>
@ -405,6 +411,9 @@
<EmbeddedResource Include="tools\LuaWinform.resx">
<DependentUpon>LuaWinform.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\LuaWriter.resx">
<DependentUpon>LuaWriter.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="tools\RamWatch.resx">
<DependentUpon>RamWatch.cs</DependentUpon>
<SubType>Designer</SubType>

View File

@ -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;
}
}

View File

@ -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();
}
}
}

View File

@ -1,4 +1,4 @@
namespace BizHawk.MultiClient.tools
namespace BizHawk.MultiClient
{
partial class LuaWriter
{
@ -28,34 +28,41 @@
/// </summary>
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;
}
}

View File

@ -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;
}
}
}
}

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>