From 17f17a02fd845214ab7054c41d7f9b2381069765 Mon Sep 17 00:00:00 2001 From: mvl1986 Date: Wed, 12 Feb 2014 13:28:48 +0000 Subject: [PATCH] Added the display of tooltips for all the methods that are in the lualibraries -MightyMar --- BizHawk.Client.Common/lua/LuaDocumentation.cs | 5 ++--- .../tools/Lua/LuaWriter.Designer.cs | 1 + BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/BizHawk.Client.Common/lua/LuaDocumentation.cs b/BizHawk.Client.Common/lua/LuaDocumentation.cs index 25ace41be0..98900f1eff 100644 --- a/BizHawk.Client.Common/lua/LuaDocumentation.cs +++ b/BizHawk.Client.Common/lua/LuaDocumentation.cs @@ -40,11 +40,10 @@ namespace BizHawk.Client.Common return FunctionList.Select(x => x.Library); } - public IEnumerable GetFunctionsByLibrary(string library) + public IEnumerable GetFunctionsByLibrary(string library) { return FunctionList - .Where(func => func.Library == library) - .Select(func => func.Name); + .Where(func => func.Library == library); } public class LibraryFunction diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs index 58bfccc0a1..8e380a9cb5 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.Designer.cs @@ -381,6 +381,7 @@ this.AutoCompleteView.MultiSelect = false; this.AutoCompleteView.Name = "AutoCompleteView"; this.AutoCompleteView.Scrollable = false; + this.AutoCompleteView.ShowItemToolTips = true; this.AutoCompleteView.Size = new System.Drawing.Size(150, 182); this.AutoCompleteView.TabIndex = 3; this.AutoCompleteView.UseCompatibleStateImageBehavior = false; diff --git a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs index aaea030c02..2d5a12a3f0 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/LuaWriter.cs @@ -15,7 +15,6 @@ namespace BizHawk.Client.EmuHawk public partial class LuaWriter : Form { //TODO: - //Loads of exceptions when closing the writer, primarily in System.Windows.Forms.dll and mscorlib.dll //make functions is string part of string or comment since the actual way of validating it isn't correct //Option to turn off basic lua script //Tool strip @@ -725,8 +724,7 @@ namespace BizHawk.Client.EmuHawk string currentword = CurrentWord(); if (IsLibraryWord(currentword)) { - List libfunctions = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetFunctionsByLibrary(currentword).ToList(); - + List libfunctions = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetFunctionsByLibrary(currentword).ToList(); // Position autocomplete box near the cursor's current position int x = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).X + LuaText.Location.X + 5; int y = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).Y + LuaText.Location.Y + (int)LuaText.Font.GetHeight() + 5; // One row down @@ -734,9 +732,10 @@ namespace BizHawk.Client.EmuHawk // Populate list with available options AutoCompleteView.Items.Clear(); - foreach (string function in libfunctions) + foreach (LuaDocumentation.LibraryFunction function in libfunctions) { - ListViewItem item = new ListViewItem(function); + ListViewItem item = new ListViewItem(function.Name); + item.ToolTipText = function.Description; AutoCompleteView.Items.Add(item); } // Show window after it has been positioned and set up @@ -817,6 +816,7 @@ namespace BizHawk.Client.EmuHawk currentWord += e.KeyCode; currentWord = currentWord.ToLower(); List libList = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetLibraryList().Distinct().ToList(); + // List libListToolTip = GlobalWin.Tools.LuaConsole.LuaImp.Docs. int x = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).X + LuaText.Location.X + 5; int y = LuaText.GetPositionFromCharIndex(LuaText.SelectionStart).Y + LuaText.Location.Y + (int)LuaText.Font.GetHeight() + 5; // One row down AutoCompleteView.Location = new Point(x, y); @@ -840,12 +840,13 @@ namespace BizHawk.Client.EmuHawk String fileName = words[0]; if (IsLibraryWord(fileName)) { - List libfunctions = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetFunctionsByLibrary(fileName).ToList(); - foreach (String libfunction in libfunctions) + List libfunctions = GlobalWin.Tools.LuaConsole.LuaImp.Docs.GetFunctionsByLibrary(words[1]).ToList(); + foreach (LuaDocumentation.LibraryFunction libfunction in libfunctions) { - if (libfunction.StartsWith(words[1])) + if (libfunction.Name.StartsWith(words[1])) { - ListViewItem item = new ListViewItem(libfunction); + ListViewItem item = new ListViewItem(libfunction.Name); + item.ToolTipText = libfunction.Description; AutoCompleteView.Items.Add(item); } }