Disabled LuaWindow in favor of LuaConsole

This commit is contained in:
andres.delikat 2011-05-07 01:06:01 +00:00
parent 3bca271d0e
commit db98f67772
4 changed files with 37 additions and 16 deletions

View File

@ -11,11 +11,12 @@ namespace BizHawk.MultiClient
class LuaImplementation
{
Lua lua = new Lua();
LuaWindow Caller;
LuaConsole Caller;
public static string[] MemoryFunctions = new string[] {
"readbyte",
"writebyte"};
public LuaImplementation(LuaWindow passed)
public LuaImplementation(LuaConsole passed)
{
Caller = passed.get();
lua.RegisterFunction("print",this, this.GetType().GetMethod("print"));
@ -24,8 +25,8 @@ namespace BizHawk.MultiClient
{
lua.RegisterFunction("memory." + MemoryFunctions[i], this, this.GetType().GetMethod(MemoryFunctions[i]));
}
}
public void DoLuaFile(string File)
{
lua.DoFile(File);

View File

@ -53,7 +53,7 @@
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.OutputBox = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.NumberOfScripts = new System.Windows.Forms.Label();
this.insertSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -250,18 +250,18 @@
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
//
// richTextBox1
// OutputBox
//
this.richTextBox1.Location = new System.Drawing.Point(6, 19);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(246, 253);
this.richTextBox1.TabIndex = 2;
this.richTextBox1.Text = "";
this.OutputBox.Location = new System.Drawing.Point(6, 19);
this.OutputBox.Name = "OutputBox";
this.OutputBox.ReadOnly = true;
this.OutputBox.Size = new System.Drawing.Size(246, 253);
this.OutputBox.TabIndex = 2;
this.OutputBox.Text = "";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.richTextBox1);
this.groupBox1.Controls.Add(this.OutputBox);
this.groupBox1.Location = new System.Drawing.Point(311, 51);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(258, 278);
@ -363,7 +363,7 @@
private System.Windows.Forms.ToolStripMenuItem moveUpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem moveDownToolStripMenuItem;
public System.Windows.Forms.ColumnHeader Script;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox OutputBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using LuaInterface;
namespace BizHawk.MultiClient
{
@ -18,6 +19,7 @@ namespace BizHawk.MultiClient
int defaultHeight;
List<LuaFiles> luaList = new List<LuaFiles>();
LuaImplementation LuaImp;
string lastLuaFile = "";
private List<LuaFiles> GetLuaFileList()
@ -29,9 +31,20 @@ namespace BizHawk.MultiClient
return l;
}
public LuaConsole get()
{
return this;
}
public void AddText(string s)
{
OutputBox.Text += s;
}
public LuaConsole()
{
InitializeComponent();
LuaImp = new LuaImplementation(this);
Closing += (o, e) => SaveConfigSettings();
LuaListView.QueryItemText += new QueryItemTextHandler(LuaListView_QueryItemText);
LuaListView.QueryItemBkColor += new QueryItemBkColorHandler(LuaListView_QueryItemBkColor);
@ -114,13 +127,20 @@ namespace BizHawk.MultiClient
return file;
}
private void LoadLuaFile(string path)
{
LuaFiles l = new LuaFiles("", path, true);
luaList.Add(l);
LuaImp.DoLuaFile(path);
}
private void OpenLuaFile()
{
var file = GetFileFromUser();
if (file != null)
{
//LoadLuaFile(file.FullName, false);
LoadLuaFile(file.FullName);
//DisplayLuaList();
}
}

View File

@ -17,12 +17,12 @@ namespace BizHawk.MultiClient.tools
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
LuaImplementation LuaImp;
//LuaImplementation LuaImp;
public LuaWindow()
{
InitializeComponent();
LuaImp = new LuaImplementation(this);
//LuaImp = new LuaImplementation(this);
Closing += (o, e) => SaveConfigSettings();
}
public LuaWindow get()