pass in LuaImp to LuaWinform, now the global usage is in the lua library, but baby steps
This commit is contained in:
parent
b9c0d11c16
commit
2403f38bcc
|
@ -360,7 +360,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
"newform", "creates a new default dialog, if both width and height are specified it will create a dialog of the specified size. If title is specified it will be the caption of the dialog, else the dialog caption will be 'Lua Dialog'. The function will return an int representing the handle of the dialog created.")]
|
||||
public int NewForm(int? width = null, int? height = null, string title = null, LuaFunction onClose = null)
|
||||
{
|
||||
var form = new LuaWinform(CurrentFile);
|
||||
var form = new LuaWinform(CurrentFile, GlobalWin.Tools.LuaConsole.LuaImp);
|
||||
_luaForms.Add(form);
|
||||
if (width.HasValue && height.HasValue)
|
||||
{
|
||||
|
|
|
@ -39,9 +39,7 @@
|
|||
this.Name = "LuaWinform";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Lua Dialog";
|
||||
this.Load += new System.EventHandler(this.LuaWinform_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using NLua;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
@ -12,24 +10,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public List<LuaEvent> ControlEvents { get; } = new List<LuaEvent>();
|
||||
|
||||
private readonly PlatformEmuLuaLibrary _luaImp;
|
||||
private readonly string _currentDirectory = Environment.CurrentDirectory;
|
||||
private readonly LuaFile _ownerFile;
|
||||
|
||||
public LuaWinform(LuaFile ownerFile)
|
||||
public LuaWinform(LuaFile ownerFile, PlatformEmuLuaLibrary luaImp)
|
||||
{
|
||||
InitializeComponent();
|
||||
_ownerFile = ownerFile;
|
||||
_luaImp = luaImp;
|
||||
InitializeComponent();
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Closing += (o, e) => CloseThis();
|
||||
}
|
||||
|
||||
private void LuaWinform_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void CloseThis()
|
||||
{
|
||||
GlobalWin.Tools.LuaConsole.LuaImp.WindowClosed(Handle);
|
||||
_luaImp.WindowClosed(Handle);
|
||||
}
|
||||
|
||||
public void DoLuaEvent(IntPtr handle)
|
||||
|
|
Loading…
Reference in New Issue