From 7d510df2816ae8f8f6521166a1e8798cfd107d3e Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 16 Apr 2013 01:25:30 +0000 Subject: [PATCH] Lua Console - Lua Function List dialog - Ctrl+C copies the function to clipboard concatenated, ex: "emu.frameadvance()" --- .../tools/LuaFunctionList.Designer.cs | 3 ++ BizHawk.MultiClient/tools/LuaFunctionList.cs | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs b/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs index 41df9e60ed..f70f1f8f15 100644 --- a/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs +++ b/BizHawk.MultiClient/tools/LuaFunctionList.Designer.cs @@ -59,6 +59,7 @@ this.LibraryHead, this.LibraryName, this.LibraryParameters}); + this.FunctionView.FullRowSelect = true; this.FunctionView.GridLines = true; this.FunctionView.Location = new System.Drawing.Point(12, 12); this.FunctionView.Name = "FunctionView"; @@ -67,6 +68,8 @@ this.FunctionView.UseCompatibleStateImageBehavior = false; this.FunctionView.View = System.Windows.Forms.View.Details; this.FunctionView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.FunctionView_ColumnClick); + this.FunctionView.SelectedIndexChanged += new System.EventHandler(this.FunctionView_SelectedIndexChanged); + this.FunctionView.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FunctionView_KeyDown); // // LibraryReturn // diff --git a/BizHawk.MultiClient/tools/LuaFunctionList.cs b/BizHawk.MultiClient/tools/LuaFunctionList.cs index d7cb867ddd..0d5a7f65f8 100644 --- a/BizHawk.MultiClient/tools/LuaFunctionList.cs +++ b/BizHawk.MultiClient/tools/LuaFunctionList.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Windows.Forms; +using System.Text; using BizHawk.MultiClient.tools; namespace BizHawk.MultiClient @@ -113,5 +114,34 @@ namespace BizHawk.MultiClient } } } + + private void FunctionView_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void FunctionView_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.C && e.Control && !e.Alt && !e.Shift) //Copy + { + ListView.SelectedIndexCollection indexes = FunctionView.SelectedIndices; + + if (indexes.Count > 0) + { + StringBuilder sb = new StringBuilder(); + + foreach (int index in indexes) + { + var library_function = Global.MainForm.LuaConsole1.LuaImp.docs.FunctionList[index]; + sb.Append(library_function.library).Append('.').Append(library_function.name).Append("()\n"); + } + + if (sb.Length > 0) + { + Clipboard.SetDataObject((sb.ToString())); + } + } + } + } } }