Progress on lua console window
This commit is contained in:
parent
4914fa64d2
commit
b95a5dfc17
|
@ -278,6 +278,7 @@
|
|||
<Compile Include="tools\LuaConsole.Designer.cs">
|
||||
<DependentUpon>LuaConsole.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="tools\LuaFiles.cs" />
|
||||
<Compile Include="tools\LuaWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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<LuaFiles> luaList = new List<LuaFiles>();
|
||||
string lastLuaFile = "";
|
||||
|
||||
private List<LuaFiles> GetLuaFileList()
|
||||
{
|
||||
List<LuaFiles> l = new List<LuaFiles>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue