diff --git a/BizHawk.MultiClient/BizHawk.MultiClient.csproj b/BizHawk.MultiClient/BizHawk.MultiClient.csproj index 8abe9ebfef..5a675136cc 100644 --- a/BizHawk.MultiClient/BizHawk.MultiClient.csproj +++ b/BizHawk.MultiClient/BizHawk.MultiClient.csproj @@ -278,6 +278,7 @@ LuaConsole.cs + Form diff --git a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs b/BizHawk.MultiClient/tools/LuaConsole.Designer.cs index d76b079fb0..d384c2b904 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.Designer.cs @@ -35,6 +35,7 @@ this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -44,13 +45,15 @@ this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toggleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.richTextBox1 = new System.Windows.Forms.RichTextBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + 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.groupBox1 = new System.Windows.Forms.GroupBox(); this.menuStrip1.SuspendLayout(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); @@ -85,7 +88,8 @@ this.toolStripMenuItem1, this.fileToolStripMenuItem, this.scriptToolStripMenuItem, - this.viewToolStripMenuItem}); + this.viewToolStripMenuItem, + this.optionsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(598, 24); @@ -110,6 +114,13 @@ this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); this.fileToolStripMenuItem.Text = "&File"; // + // newToolStripMenuItem + // + this.newToolStripMenuItem.Name = "newToolStripMenuItem"; + this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItem.Size = new System.Drawing.Size(204, 22); + this.newToolStripMenuItem.Text = "&New"; + // // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; @@ -156,13 +167,13 @@ // editToolStripMenuItem // this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.editToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.editToolStripMenuItem.Text = "Edit"; // // toggleToolStripMenuItem // this.toggleToolStripMenuItem.Name = "toggleToolStripMenuItem"; - this.toggleToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.toggleToolStripMenuItem.Size = new System.Drawing.Size(117, 22); this.toggleToolStripMenuItem.Text = "Toggle"; // // viewToolStripMenuItem @@ -176,18 +187,51 @@ this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); this.viewToolStripMenuItem.Text = "&View"; // + // removeToolStripMenuItem + // + this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; + this.removeToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.removeToolStripMenuItem.Text = "Remove"; + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); + // // moveUpToolStripMenuItem // this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem"; - this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(141, 22); this.moveUpToolStripMenuItem.Text = "Move Up"; // // moveDownToolStripMenuItem // this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem"; - this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(141, 22); this.moveDownToolStripMenuItem.Text = "Move Down"; // + // optionsToolStripMenuItem + // + this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.saveWindowPositionToolStripMenuItem, + this.restoreWindowSizeToolStripMenuItem}); + this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; + this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20); + this.optionsToolStripMenuItem.Text = "&Options"; + // + // saveWindowPositionToolStripMenuItem + // + this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem"; + this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; + // + // restoreWindowSizeToolStripMenuItem + // + this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem"; + this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(190, 22); + this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size"; + this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); + // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(6, 19); @@ -207,24 +251,6 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "Output"; // - // newToolStripMenuItem - // - this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); - this.newToolStripMenuItem.Size = new System.Drawing.Size(204, 22); - this.newToolStripMenuItem.Text = "&New"; - // - // removeToolStripMenuItem - // - this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.removeToolStripMenuItem.Text = "Remove"; - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); - // // LuaConsole // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -270,5 +296,8 @@ private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem restoreWindowSizeToolStripMenuItem; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/LuaConsole.cs b/BizHawk.MultiClient/tools/LuaConsole.cs index 1f93618862..40d54e65c6 100644 --- a/BizHawk.MultiClient/tools/LuaConsole.cs +++ b/BizHawk.MultiClient/tools/LuaConsole.cs @@ -11,13 +11,61 @@ namespace BizHawk.MultiClient { public partial class LuaConsole : Form { + int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired + int defaultHeight; + int defaultNameWidth; + int defaultAddressWidth; + + List luaList = new List(); + string lastLuaFile = ""; + + private List GetLuaFileList() + { + List l = new List(); + for (int x = 0; x < luaList.Count; x++) + l.Add(new LuaFiles(luaList[x])); + + return l; + } + public LuaConsole() { InitializeComponent(); + Closing += (o, e) => SaveConfigSettings(); } private void LuaConsole_Load(object sender, EventArgs e) { + LoadConfigSettings(); + } + + public void Restart() + { + //Stop all Lua scripts + for (int x = 0; x < luaList.Count; x++) + luaList[x].Enabled = false; + } + + private void SaveConfigSettings() + { + Global.Config.LuaConsoleWndx = this.Location.X; + Global.Config.LuaConsoleWndy = this.Location.Y; + Global.Config.LuaConsoleWidth = this.Right - this.Left; + Global.Config.LuaConsoleHeight = this.Bottom - this.Top; + } + + private void LoadConfigSettings() + { + defaultWidth = Size.Width; //Save these first so that the user can restore to its original size + defaultHeight = Size.Height; + + if (Global.Config.LuaConsoleSaveWindowPosition && Global.Config.LuaConsoleWndx >= 0 && Global.Config.LuaConsoleWndy >= 0) + Location = new Point(Global.Config.LuaConsoleWndx, Global.Config.LuaConsoleWndy); + + if (Global.Config.LuaConsoleWidth >= 0 && Global.Config.LuaConsoleHeight >= 0) + { + Size = new System.Drawing.Size(Global.Config.LuaConsoleWidth, Global.Config.LuaConsoleHeight); + } } @@ -25,5 +73,10 @@ namespace BizHawk.MultiClient { this.Close(); } + + private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) + { + this.Size = new System.Drawing.Size(defaultWidth, defaultHeight); + } } } diff --git a/BizHawk.MultiClient/tools/LuaFiles.cs b/BizHawk.MultiClient/tools/LuaFiles.cs new file mode 100644 index 0000000000..35c116d8ca --- /dev/null +++ b/BizHawk.MultiClient/tools/LuaFiles.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace BizHawk.MultiClient +{ + class LuaFiles + { + public string Name; + public string Path; + public bool Enabled; + + public LuaFiles(string path) + { + Name = ""; + Path = path; + Enabled = true; + } + + public LuaFiles(string name, string path, bool enabled) + { + Name = name; + Path = path; + Enabled = enabled; + } + + public LuaFiles(LuaFiles l) + { + Name = l.Name; + Path = l.Path; + Enabled = l.Enabled; + } + + public void Toggle() + { + Enabled ^= true; + } + } +}