Lua console - remember splitter position

This commit is contained in:
adelikat 2020-03-29 17:22:22 -05:00
parent 58bcb38315
commit 948f58bfae
2 changed files with 24 additions and 0 deletions

View File

@ -853,6 +853,7 @@
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 49);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.BranchesMarkersSplit_SplitterMoved);
//
// splitContainer1.Panel1
//

View File

@ -28,6 +28,8 @@ namespace BizHawk.Client.EmuHawk
private readonly LuaAutocompleteInstaller _luaAutoInstaller = new LuaAutocompleteInstaller();
private readonly List<FileSystemWatcher> _watches = new List<FileSystemWatcher>();
private readonly int _defaultSplitDistance;
[RequiredService]
private IEmulator Emulator { get; set; }
@ -55,6 +57,8 @@ namespace BizHawk.Client.EmuHawk
public bool ReloadOnScriptFileChange { get; set; }
public bool ToggleAllIfNoneSelected { get; set; } = true;
public int SplitDistance { get; set; }
}
[ConfigPersist]
@ -104,6 +108,7 @@ namespace BizHawk.Client.EmuHawk
// this is bad, in case we ever have more than one gui part running lua.. not sure how much other badness there is like that
LuaSandbox.DefaultLogger = WriteToOutputWindow;
_defaultSplitDistance = splitContainer1.SplitterDistance;
}
public PlatformEmuLuaLibrary LuaImp { get; private set; }
@ -163,6 +168,23 @@ namespace BizHawk.Client.EmuHawk
LuaListView.AllColumns.Clear();
SetColumns();
if (Settings.SplitDistance > 0)
{
try
{
splitContainer1.SplitterDistance = Settings.SplitDistance;
}
catch (Exception)
{
splitContainer1.SplitterDistance = _defaultSplitDistance;
}
}
}
private void BranchesMarkersSplit_SplitterMoved(object sender, SplitterEventArgs e)
{
Settings.SplitDistance = splitContainer1.SplitterDistance;
}
public void Restart()
@ -1505,6 +1527,7 @@ namespace BizHawk.Client.EmuHawk
Settings = new LuaConsoleSettings();
LuaListView.AllColumns.Clear();
SetColumns();
splitContainer1.SplitterDistance = _defaultSplitDistance;
UpdateDialog();
}
}