convert Lua Console to IToolFormAutoConfig
This commit is contained in:
parent
a2bee4f88a
commit
b8d667812b
|
@ -232,11 +232,9 @@ namespace BizHawk.Client.Common
|
|||
public int LogWindowWidth = -1;
|
||||
public int LogWindowHeight = -1;
|
||||
|
||||
// Lua Console
|
||||
public ToolDialogSettings LuaSettings = new ToolDialogSettings();
|
||||
// Lua
|
||||
public RecentFiles RecentLua = new RecentFiles(8);
|
||||
public RecentFiles RecentLuaSession = new RecentFiles(8);
|
||||
public bool AutoLoadLuaConsole = false;
|
||||
public bool DisableLuaScriptsOnLoad = false;
|
||||
|
||||
// Watch Settings
|
||||
|
|
|
@ -382,11 +382,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.Tools.Load<VirtualpadTool>();
|
||||
}
|
||||
|
||||
if (Global.Config.AutoLoadLuaConsole)
|
||||
{
|
||||
OpenLuaConsole();
|
||||
}
|
||||
|
||||
if (Global.Config.DisplayStatusBar == false)
|
||||
{
|
||||
MainStatusBar.Visible = false;
|
||||
|
|
|
@ -68,15 +68,8 @@
|
|||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.StopAllScriptsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RegisteredFunctionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AutoloadConsoleMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.SettingsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DisableScriptsOnLoadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.RestoreDefaultSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.HelpSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.FunctionsListMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.OnlineDocsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -185,7 +178,7 @@
|
|||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.FileSubMenu,
|
||||
this.ScriptSubMenu,
|
||||
this.OptionsSubMenu,
|
||||
this.SettingsSubMenu,
|
||||
this.HelpSubMenu});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
|
@ -449,74 +442,22 @@
|
|||
this.RegisteredFunctionsMenuItem.Text = "&Registered Functions...";
|
||||
this.RegisteredFunctionsMenuItem.Click += new System.EventHandler(this.RegisteredFunctionsMenuItem_Click);
|
||||
//
|
||||
// OptionsSubMenu
|
||||
// SettingsSubMenu
|
||||
//
|
||||
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.AutoloadConsoleMenuItem,
|
||||
this.DisableScriptsOnLoadMenuItem,
|
||||
this.toolStripSeparator4,
|
||||
this.SaveWindowPositionMenuItem,
|
||||
this.AlwaysOnTopMenuItem,
|
||||
this.FloatingWindowMenuItem,
|
||||
this.toolStripSeparator5,
|
||||
this.RestoreDefaultSettingsMenuItem});
|
||||
this.OptionsSubMenu.Name = "OptionsSubMenu";
|
||||
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||
this.OptionsSubMenu.Text = "&Options";
|
||||
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||
//
|
||||
// AutoloadConsoleMenuItem
|
||||
//
|
||||
this.AutoloadConsoleMenuItem.Name = "AutoloadConsoleMenuItem";
|
||||
this.AutoloadConsoleMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.AutoloadConsoleMenuItem.Text = "Autoload Console";
|
||||
this.AutoloadConsoleMenuItem.Click += new System.EventHandler(this.AutoloadConsoleMenuItem_Click);
|
||||
this.SettingsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.DisableScriptsOnLoadMenuItem});
|
||||
this.SettingsSubMenu.Name = "SettingsSubMenu";
|
||||
this.SettingsSubMenu.Size = new System.Drawing.Size(61, 20);
|
||||
this.SettingsSubMenu.Text = "&Settings";
|
||||
this.SettingsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||
//
|
||||
// DisableScriptsOnLoadMenuItem
|
||||
//
|
||||
this.DisableScriptsOnLoadMenuItem.Name = "DisableScriptsOnLoadMenuItem";
|
||||
this.DisableScriptsOnLoadMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.DisableScriptsOnLoadMenuItem.Size = new System.Drawing.Size(196, 22);
|
||||
this.DisableScriptsOnLoadMenuItem.Text = "Disable Scripts on Load";
|
||||
this.DisableScriptsOnLoadMenuItem.Click += new System.EventHandler(this.DisableScriptsOnLoadMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator4
|
||||
//
|
||||
this.toolStripSeparator4.Name = "toolStripSeparator4";
|
||||
this.toolStripSeparator4.Size = new System.Drawing.Size(196, 6);
|
||||
//
|
||||
// SaveWindowPositionMenuItem
|
||||
//
|
||||
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
|
||||
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.SaveWindowPositionMenuItem.Text = "Save Window Position";
|
||||
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
|
||||
//
|
||||
// AlwaysOnTopMenuItem
|
||||
//
|
||||
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
|
||||
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.AlwaysOnTopMenuItem.Text = "Always On Top";
|
||||
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
|
||||
//
|
||||
// FloatingWindowMenuItem
|
||||
//
|
||||
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
|
||||
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.FloatingWindowMenuItem.Text = "Floating Window";
|
||||
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
this.toolStripSeparator5.Size = new System.Drawing.Size(196, 6);
|
||||
//
|
||||
// RestoreDefaultSettingsMenuItem
|
||||
//
|
||||
this.RestoreDefaultSettingsMenuItem.Name = "RestoreDefaultSettingsMenuItem";
|
||||
this.RestoreDefaultSettingsMenuItem.Size = new System.Drawing.Size(199, 22);
|
||||
this.RestoreDefaultSettingsMenuItem.Text = "Restore Default Settings";
|
||||
this.RestoreDefaultSettingsMenuItem.Click += new System.EventHandler(this.RestoreDefaultSettingsMenuItem_Click);
|
||||
//
|
||||
// HelpSubMenu
|
||||
//
|
||||
this.HelpSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -851,9 +792,7 @@
|
|||
public System.Windows.Forms.ColumnHeader Script;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.ToolStripMenuItem NewSessionMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RestoreDefaultSettingsMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem SettingsSubMenu;
|
||||
private System.Windows.Forms.Label NumberOfScripts;
|
||||
private System.Windows.Forms.ToolStripMenuItem InsertSeparatorMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem StopAllScriptsMenuItem;
|
||||
|
@ -861,11 +800,9 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem RecentScriptsSubMenu;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.ToolStripMenuItem StopAllScriptsContextItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem AutoloadConsoleMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RemoveScriptContextItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem InsertSeperatorContextItem;
|
||||
private System.Windows.Forms.ToolStripSeparator ScriptContextSeparator;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
|
||||
private System.Windows.Forms.ToolStripMenuItem EditScriptContextItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ToggleScriptContextItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RemoveScriptMenuItem;
|
||||
|
@ -903,9 +840,6 @@
|
|||
private System.Windows.Forms.ToolStripButton NewScriptToolbarItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RegisteredFunctionsMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RegisteredFunctionsContextItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
|
||||
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
|
||||
private System.Windows.Forms.ToolStripButton RefreshScriptToolbarItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RefreshScriptMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
|
||||
|
|
|
@ -17,11 +17,9 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
|
|||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public partial class LuaConsole : Form, IToolForm
|
||||
public partial class LuaConsole : Form, IToolFormAutoConfig
|
||||
{
|
||||
private readonly LuaFileList _luaList;
|
||||
private int _defaultWidth;
|
||||
private int _defaultHeight;
|
||||
private bool _sortReverse;
|
||||
private string _lastColumnSorted;
|
||||
|
||||
|
@ -53,8 +51,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
LuaListView.QueryItemText += LuaListView_QueryItemText;
|
||||
LuaListView.QueryItemBkColor += LuaListView_QueryItemBkColor;
|
||||
LuaListView.VirtualMode = true;
|
||||
|
||||
TopMost = Global.Config.LuaSettings.TopMost;
|
||||
}
|
||||
|
||||
public EmuLuaLibrary LuaImp { get; set; }
|
||||
|
@ -71,11 +67,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
get { return SelectedItems.Where(x => !x.IsSeparator); }
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
{
|
||||
Owner = Global.Config.LuaSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
public void UpdateValues()
|
||||
{
|
||||
// Do nothing
|
||||
|
@ -98,7 +89,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void LuaConsole_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadConfigSettings();
|
||||
if (Global.Config.RecentLuaSession.AutoLoad)
|
||||
{
|
||||
if (!Global.Config.RecentLuaSession.Empty)
|
||||
|
@ -255,29 +245,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
return path;
|
||||
}
|
||||
|
||||
// TODO: Rename me
|
||||
private void SaveConfigSettings()
|
||||
{
|
||||
LuaImp.Close();
|
||||
Global.Config.LuaSettings.Wndx = Location.X;
|
||||
Global.Config.LuaSettings.Wndy = Location.Y;
|
||||
Global.Config.LuaSettings.Width = Right - Left;
|
||||
Global.Config.LuaSettings.Height = Bottom - Top;
|
||||
}
|
||||
|
||||
private void LoadConfigSettings()
|
||||
{
|
||||
_defaultWidth = Size.Width;
|
||||
_defaultHeight = Size.Height;
|
||||
|
||||
if (Global.Config.LuaSettings.UseWindowPosition)
|
||||
{
|
||||
Location = Global.Config.LuaSettings.WindowPosition;
|
||||
}
|
||||
|
||||
if (Global.Config.LuaSettings.UseWindowSize)
|
||||
{
|
||||
Size = Global.Config.LuaSettings.WindowSize;
|
||||
}
|
||||
}
|
||||
|
||||
private static FileInfo GetFileFromUser(string filter)
|
||||
|
@ -913,16 +884,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
SaveWindowPositionMenuItem.Checked = Global.Config.LuaSettings.SaveWindowPosition;
|
||||
AutoloadConsoleMenuItem.Checked = Global.Config.AutoLoadLuaConsole;
|
||||
DisableScriptsOnLoadMenuItem.Checked = Global.Config.DisableLuaScriptsOnLoad;
|
||||
AlwaysOnTopMenuItem.Checked = Global.Config.LuaSettings.TopMost;
|
||||
FloatingWindowMenuItem.Checked = Global.Config.LuaSettings.FloatingWindow;
|
||||
}
|
||||
|
||||
private void AutoloadConsoleMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.AutoLoadLuaConsole ^= true;
|
||||
}
|
||||
|
||||
private void DisableScriptsOnLoadMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -930,32 +892,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Config.DisableLuaScriptsOnLoad ^= true;
|
||||
}
|
||||
|
||||
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.LuaSettings.SaveWindowPosition ^= true;
|
||||
}
|
||||
|
||||
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.LuaSettings.TopMost ^= true;
|
||||
TopMost = Global.Config.LuaSettings.TopMost;
|
||||
}
|
||||
|
||||
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.LuaSettings.FloatingWindow ^= true;
|
||||
RefreshFloatingWindowControl();
|
||||
}
|
||||
|
||||
private void RestoreDefaultSettingsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Size = new Size(_defaultWidth, _defaultHeight);
|
||||
|
||||
Global.Config.LuaSettings.SaveWindowPosition = true;
|
||||
Global.Config.LuaSettings.TopMost = TopMost = false;
|
||||
Global.Config.LuaSettings.FloatingWindow = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Help
|
||||
|
@ -1000,12 +936,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region Dialog, Listview, OutputBox
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
RefreshFloatingWindowControl();
|
||||
base.OnShown(e);
|
||||
}
|
||||
|
||||
private void LuaConsole_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
@ -1149,7 +1079,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.DisplayManager.ClearLuaSurfaces();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue