diff --git a/BizHawk.MultiClient/LuaImplementation.cs b/BizHawk.MultiClient/LuaImplementation.cs index 29422ee0f3..f83f284f50 100644 --- a/BizHawk.MultiClient/LuaImplementation.cs +++ b/BizHawk.MultiClient/LuaImplementation.cs @@ -80,77 +80,77 @@ namespace BizHawk.MultiClient for (int i = 0; i < ConsoleFunctions.Length; i++) { lua.RegisterFunction("console." + ConsoleFunctions[i], this, this.GetType().GetMethod("console_" + ConsoleFunctions[i])); - docs.Add("console", "console." + ConsoleFunctions[i], this.GetType().GetMethod("console_" + ConsoleFunctions[i])); + docs.Add("console", ConsoleFunctions[i], this.GetType().GetMethod("console_" + ConsoleFunctions[i])); } lua.NewTable("gui"); for (int i = 0; i < GuiFunctions.Length; i++) { lua.RegisterFunction("gui." + GuiFunctions[i], this, this.GetType().GetMethod("gui_" + GuiFunctions[i])); - docs.Add("gui", "gui." + GuiFunctions[i], this.GetType().GetMethod("gui_" + GuiFunctions[i])); + docs.Add("gui", GuiFunctions[i], this.GetType().GetMethod("gui_" + GuiFunctions[i])); } lua.NewTable("emu"); for (int i = 0; i < EmuFunctions.Length; i++) { lua.RegisterFunction("emu." + EmuFunctions[i], this, this.GetType().GetMethod("emu_" + EmuFunctions[i])); - docs.Add("emu", "emu." + EmuFunctions[i], this.GetType().GetMethod("emu_" + EmuFunctions[i])); + docs.Add("emu", EmuFunctions[i], this.GetType().GetMethod("emu_" + EmuFunctions[i])); } lua.NewTable("memory"); for (int i = 0; i < MemoryFunctions.Length; i++) { lua.RegisterFunction("memory." + MemoryFunctions[i], this, this.GetType().GetMethod("memory_" + MemoryFunctions[i])); - docs.Add("memory", "memory." + MemoryFunctions[i], this.GetType().GetMethod("memory_" + MemoryFunctions[i])); + docs.Add("memory", MemoryFunctions[i], this.GetType().GetMethod("memory_" + MemoryFunctions[i])); } lua.NewTable("mainmemory"); for (int i = 0; i < MainMemoryFunctions.Length; i++) { lua.RegisterFunction("mainmemory." + MainMemoryFunctions[i], this, this.GetType().GetMethod("mainmemory_" + MainMemoryFunctions[i])); - docs.Add("mainmemory", "mainmemory." + MainMemoryFunctions[i], this.GetType().GetMethod("mainmemory_" + MainMemoryFunctions[i])); + docs.Add("mainmemory", MainMemoryFunctions[i], this.GetType().GetMethod("mainmemory_" + MainMemoryFunctions[i])); } lua.NewTable("savestate"); for (int i = 0; i < SaveStateFunctions.Length; i++) { lua.RegisterFunction("savestate." + SaveStateFunctions[i], this, this.GetType().GetMethod("savestate_" + SaveStateFunctions[i])); - docs.Add("savestate", "savestate." + SaveStateFunctions[i], this.GetType().GetMethod("savestate_" + SaveStateFunctions[i])); + docs.Add("savestate", SaveStateFunctions[i], this.GetType().GetMethod("savestate_" + SaveStateFunctions[i])); } lua.NewTable("movie"); for (int i = 0; i < MovieFunctions.Length; i++) { lua.RegisterFunction("movie." + MovieFunctions[i], this, this.GetType().GetMethod("movie_" + MovieFunctions[i])); - docs.Add("movie", "movie." + MovieFunctions[i], this.GetType().GetMethod("movie_" + MovieFunctions[i])); + docs.Add("movie", MovieFunctions[i], this.GetType().GetMethod("movie_" + MovieFunctions[i])); } lua.NewTable("input"); for (int i = 0; i < InputFunctions.Length; i++) { lua.RegisterFunction("input." + InputFunctions[i], this, this.GetType().GetMethod("input_" + InputFunctions[i])); - docs.Add("input", "input." + InputFunctions[i], this.GetType().GetMethod("input_" + InputFunctions[i])); + docs.Add("input", InputFunctions[i], this.GetType().GetMethod("input_" + InputFunctions[i])); } lua.NewTable("joypad"); for (int i = 0; i < JoypadFunctions.Length; i++) { lua.RegisterFunction("joypad." + JoypadFunctions[i], this, this.GetType().GetMethod("joypad_" + JoypadFunctions[i])); - docs.Add("joypad", "joypad." + JoypadFunctions[i], this.GetType().GetMethod("joypad_" + JoypadFunctions[i])); + docs.Add("joypad", JoypadFunctions[i], this.GetType().GetMethod("joypad_" + JoypadFunctions[i])); } lua.NewTable("client"); for (int i = 0; i < MultiClientFunctions.Length; i++) { lua.RegisterFunction("client." + MultiClientFunctions[i], this, this.GetType().GetMethod("client_" + MultiClientFunctions[i])); - docs.Add("client", "client." + MultiClientFunctions[i], this.GetType().GetMethod("client_" + MultiClientFunctions[i])); + docs.Add("client", MultiClientFunctions[i], this.GetType().GetMethod("client_" + MultiClientFunctions[i])); } lua.NewTable("forms"); for (int i = 0; i < FormsFunctions.Length; i++) { lua.RegisterFunction("forms." + FormsFunctions[i], this, this.GetType().GetMethod("forms_" + FormsFunctions[i])); - docs.Add("forms", "forms." + FormsFunctions[i], this.GetType().GetMethod("forms_" + FormsFunctions[i])); + docs.Add("forms", FormsFunctions[i], this.GetType().GetMethod("forms_" + FormsFunctions[i])); } docs.Sort(); diff --git a/BizHawk.MultiClient/tools/LuaDocumentation.cs b/BizHawk.MultiClient/tools/LuaDocumentation.cs index d287c4f58d..abc4051931 100644 --- a/BizHawk.MultiClient/tools/LuaDocumentation.cs +++ b/BizHawk.MultiClient/tools/LuaDocumentation.cs @@ -22,7 +22,7 @@ namespace BizHawk.MultiClient.tools public void Sort() { - FunctionList = FunctionList.OrderBy(x => x.name).ToList(); + FunctionList = FunctionList.OrderBy(x => x.library).ThenBy(x => x.name).ToList(); } public class LibraryFunction @@ -43,6 +43,36 @@ namespace BizHawk.MultiClient.tools public string name = ""; public List parameters = new List(); public string return_type = ""; + + public string ParameterList + { + get + { + StringBuilder list = new StringBuilder(); + list.Append('('); + for (int i = 0; i < parameters.Count; i++) + { + string param = parameters[i].Replace("System", "").Replace("Object", "").Replace(" ", "").Replace(".", "").Replace("LuaInterface", ""); + list.Append(param); + if (i < parameters.Count - 1) + { + list.Append(','); + } + } + list.Append(')'); + return list.ToString(); + } + } + + public string ReturnType + { + get + { + string r = ""; + r = return_type.Replace("System.", "").Replace("LuaInterface.", "").ToLower().Trim(); + return r; + } + } } } } diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs b/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs index d9ed536e37..8ef2b4f782 100644 --- a/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs @@ -31,13 +31,17 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LuaFunctionList)); this.OK = new System.Windows.Forms.Button(); this.directoryEntry1 = new System.DirectoryServices.DirectoryEntry(); - this.FunctionBox = new System.Windows.Forms.RichTextBox(); + this.FunctionView = new System.Windows.Forms.ListView(); + this.LibraryHead = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.LibraryReturn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.LibraryName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.LibraryParameters = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.SuspendLayout(); // // OK // this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(174, 287); + this.OK.Location = new System.Drawing.Point(423, 287); this.OK.Name = "OK"; this.OK.Size = new System.Drawing.Size(75, 23); this.OK.TabIndex = 0; @@ -45,25 +49,51 @@ this.OK.UseVisualStyleBackColor = true; this.OK.Click += new System.EventHandler(this.OK_Click); // - // FunctionBox + // FunctionView // - this.FunctionBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.FunctionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.FunctionBox.Location = new System.Drawing.Point(12, 12); - this.FunctionBox.Name = "FunctionBox"; - this.FunctionBox.ReadOnly = true; - this.FunctionBox.Size = new System.Drawing.Size(237, 269); - this.FunctionBox.TabIndex = 1; - this.FunctionBox.Text = ""; + this.FunctionView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.LibraryReturn, + this.LibraryHead, + this.LibraryName, + this.LibraryParameters}); + this.FunctionView.GridLines = true; + this.FunctionView.Location = new System.Drawing.Point(12, 12); + this.FunctionView.Name = "FunctionView"; + this.FunctionView.Size = new System.Drawing.Size(486, 253); + this.FunctionView.TabIndex = 1; + this.FunctionView.UseCompatibleStateImageBehavior = false; + this.FunctionView.View = System.Windows.Forms.View.Details; + // + // LibraryHead + // + this.LibraryHead.Text = "Library"; + this.LibraryHead.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + this.LibraryHead.Width = 75; + // + // LibraryReturn + // + this.LibraryReturn.Text = "Return"; + // + // LibraryName + // + this.LibraryName.Text = "Name"; + this.LibraryName.Width = 135; + // + // LibraryParameters + // + this.LibraryParameters.Text = "Parameters"; + this.LibraryParameters.Width = 210; // // LuaFunctionList // this.AcceptButton = this.OK; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(261, 322); - this.Controls.Add(this.FunctionBox); + this.ClientSize = new System.Drawing.Size(510, 322); + this.Controls.Add(this.FunctionView); this.Controls.Add(this.OK); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "LuaFunctionList"; @@ -77,6 +107,10 @@ private System.Windows.Forms.Button OK; private System.DirectoryServices.DirectoryEntry directoryEntry1; - private System.Windows.Forms.RichTextBox FunctionBox; + private System.Windows.Forms.ListView FunctionView; + private System.Windows.Forms.ColumnHeader LibraryHead; + private System.Windows.Forms.ColumnHeader LibraryReturn; + private System.Windows.Forms.ColumnHeader LibraryName; + private System.Windows.Forms.ColumnHeader LibraryParameters; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.cs b/BizHawk.MultiClient/tools/LuaFunctionList.cs index da6a27bd8f..f9844794aa 100644 --- a/BizHawk.MultiClient/tools/LuaFunctionList.cs +++ b/BizHawk.MultiClient/tools/LuaFunctionList.cs @@ -19,11 +19,15 @@ namespace BizHawk.MultiClient private void LuaFunctionList_Load(object sender, EventArgs e) { - FunctionBox.Text = ""; - + FunctionView.Items.Clear(); foreach (LuaDocumentation.LibraryFunction l in Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList) { - FunctionBox.Text += l.name + "\n"; + ListViewItem item = new ListViewItem(); + item.Text = l.ReturnType; + item.SubItems.Add(l.library + "."); + item.SubItems.Add(l.name); + item.SubItems.Add(l.ParameterList); + FunctionView.Items.Add(item); } }