Lua Console - Lua Function List dialog - Ctrl+C copies the function to clipboard concatenated, ex: "emu.frameadvance()"

This commit is contained in:
adelikat 2013-04-16 01:25:30 +00:00
parent 462e861072
commit 7d510df281
2 changed files with 33 additions and 0 deletions

View File

@ -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
//

View File

@ -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()));
}
}
}
}
}
}