Lua Console - option to disable scripts on load

This commit is contained in:
andres.delikat 2012-03-19 16:19:31 +00:00
parent adda412369
commit 33383b533b
3 changed files with 47 additions and 22 deletions

View File

@ -220,6 +220,7 @@ namespace BizHawk.MultiClient
public int LuaConsoleWndy = -1;
public int LuaConsoleWidth = -1;
public int LuaConsoleHeight = -1;
public bool DisableLuaScriptsOnLoad = false;
// RamWatch Settings
public bool AutoLoadRamWatch = false;

View File

@ -74,10 +74,10 @@
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.luaFunctionsListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OutputBox = new System.Windows.Forms.RichTextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.NumberOfScripts = new System.Windows.Forms.Label();
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.clearToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.NumberOfScripts = new System.Windows.Forms.Label();
this.toolStrip1 = new ToolStripEx();
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
this.copyToolStripButton = new System.Windows.Forms.ToolStripButton();
@ -90,10 +90,11 @@
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.disableScriptsOnLoadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -410,6 +411,7 @@
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveWindowPositionToolStripMenuItem,
this.autoloadConsoleToolStripMenuItem,
this.disableScriptsOnLoadToolStripMenuItem,
this.toolStripSeparator5,
this.restoreWindowSizeToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
@ -468,6 +470,20 @@
this.OutputBox.TabIndex = 2;
this.OutputBox.Text = "";
//
// contextMenuStrip2
//
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clearToolStripMenuItem2});
this.contextMenuStrip2.Name = "contextMenuStrip2";
this.contextMenuStrip2.Size = new System.Drawing.Size(102, 26);
//
// clearToolStripMenuItem2
//
this.clearToolStripMenuItem2.Name = "clearToolStripMenuItem2";
this.clearToolStripMenuItem2.Size = new System.Drawing.Size(101, 22);
this.clearToolStripMenuItem2.Text = "&Clear";
this.clearToolStripMenuItem2.Click += new System.EventHandler(this.clearToolStripMenuItem2_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -488,20 +504,6 @@
this.NumberOfScripts.TabIndex = 4;
this.NumberOfScripts.Text = " 0 Scripts ";
//
// contextMenuStrip2
//
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.clearToolStripMenuItem2});
this.contextMenuStrip2.Name = "contextMenuStrip2";
this.contextMenuStrip2.Size = new System.Drawing.Size(102, 26);
//
// clearToolStripMenuItem2
//
this.clearToolStripMenuItem2.Name = "clearToolStripMenuItem2";
this.clearToolStripMenuItem2.Size = new System.Drawing.Size(101, 22);
this.clearToolStripMenuItem2.Text = "&Clear";
this.clearToolStripMenuItem2.Click += new System.EventHandler(this.clearToolStripMenuItem2_Click);
//
// toolStrip1
//
this.toolStrip1.ClickThrough = true;
@ -628,6 +630,13 @@
this.PathName.Text = "Path";
this.PathName.Width = 195;
//
// disableScriptsOnLoadToolStripMenuItem
//
this.disableScriptsOnLoadToolStripMenuItem.Name = "disableScriptsOnLoadToolStripMenuItem";
this.disableScriptsOnLoadToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.disableScriptsOnLoadToolStripMenuItem.Text = "Disable Scripts on Load";
this.disableScriptsOnLoadToolStripMenuItem.Click += new System.EventHandler(this.disableScriptsOnLoadToolStripMenuItem_Click);
//
// LuaConsole
//
this.AllowDrop = true;
@ -650,8 +659,8 @@
this.contextMenuStrip1.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.contextMenuStrip2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
@ -721,5 +730,6 @@
private System.Windows.Forms.ToolStripMenuItem luaFunctionsListToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem disableScriptsOnLoadToolStripMenuItem;
}
}

View File

@ -14,7 +14,6 @@ namespace BizHawk.MultiClient
public partial class LuaConsole : Form
{
//options - autoload session
//options - disable scripts on load
//TODO: remember column widths
//TODO: restore column width on restore default settings
@ -161,11 +160,16 @@ namespace BizHawk.MultiClient
private void LoadLuaFile(string path)
{
LuaFiles l = new LuaFiles("", path, true);
bool enabled = true;
if (Global.Config.DisableLuaScriptsOnLoad)
enabled = false;
LuaFiles l = new LuaFiles("", path, enabled);
luaList.Add(l);
LuaListView.ItemCount = luaList.Count;
LuaListView.Refresh();
Global.Config.RecentLua.Add(path);
if (!Global.Config.DisableLuaScriptsOnLoad)
LuaImp.DoLuaFile(path);
changes = true;
}
@ -195,6 +199,7 @@ namespace BizHawk.MultiClient
{
saveWindowPositionToolStripMenuItem.Checked = Global.Config.LuaConsoleSaveWindowPosition;
autoloadConsoleToolStripMenuItem.Checked = Global.Config.AutoLoadLuaConsole;
disableScriptsOnLoadToolStripMenuItem.Checked = Global.Config.DisableLuaScriptsOnLoad;
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
@ -658,7 +663,11 @@ namespace BizHawk.MultiClient
s = s.Substring(2, s.Length - 2); //Get path
LuaFiles l = new LuaFiles(s);
if (!Global.Config.DisableLuaScriptsOnLoad)
l.Enabled = enabled;
else
l.Enabled = false;
luaList.Add(l);
}
}
@ -991,5 +1000,10 @@ namespace BizHawk.MultiClient
contextMenuStrip1.Items[5].Visible = false;
}
}
private void disableScriptsOnLoadToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.DisableLuaScriptsOnLoad ^= true;
}
}
}