Lua Console - remember column widths
This commit is contained in:
parent
fdae465089
commit
1e57a0a221
|
@ -28,8 +28,28 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public bool IsRebootingCore;
|
public bool IsRebootingCore;
|
||||||
|
|
||||||
|
public ToolDialogSettings.ColumnList Columns { get; set; }
|
||||||
|
|
||||||
|
public class LuaConsoleSettings
|
||||||
|
{
|
||||||
|
public LuaConsoleSettings()
|
||||||
|
{
|
||||||
|
Columns = new ToolDialogSettings.ColumnList
|
||||||
|
{
|
||||||
|
new ToolDialogSettings.Column { Name = "Script", Visible = true, Index = 0, Width = 92 },
|
||||||
|
new ToolDialogSettings.Column { Name = "PathName", Visible = true, Index = 0, Width = 195 }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public ToolDialogSettings.ColumnList Columns { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[ConfigPersist]
|
||||||
|
public LuaConsoleSettings Settings { get; set; }
|
||||||
|
|
||||||
public LuaConsole()
|
public LuaConsole()
|
||||||
{
|
{
|
||||||
|
Settings = new LuaConsoleSettings();
|
||||||
_sortReverse = false;
|
_sortReverse = false;
|
||||||
_lastColumnSorted = string.Empty;
|
_lastColumnSorted = string.Empty;
|
||||||
_luaList = new LuaFileList
|
_luaList = new LuaFileList
|
||||||
|
@ -44,6 +64,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (AskSaveChanges())
|
if (AskSaveChanges())
|
||||||
{
|
{
|
||||||
|
SaveColumnInfo();
|
||||||
CloseLua();
|
CloseLua();
|
||||||
GlobalWin.DisplayManager.ClearLuaSurfaces();
|
GlobalWin.DisplayManager.ClearLuaSurfaces();
|
||||||
}
|
}
|
||||||
|
@ -100,15 +121,40 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (Global.Config.RecentLuaSession.AutoLoad && !Global.Config.RecentLuaSession.Empty)
|
if (Global.Config.RecentLuaSession.AutoLoad && !Global.Config.RecentLuaSession.Empty)
|
||||||
{
|
{
|
||||||
LoadSessionFromRecent(Global.Config.RecentLuaSession[0]);
|
LoadSessionFromRecent(Global.Config.RecentLuaSession.MostRecent);
|
||||||
}
|
}
|
||||||
else if (Global.Config.RecentLua.AutoLoad)
|
else if (Global.Config.RecentLua.AutoLoad)
|
||||||
{
|
{
|
||||||
if (!Global.Config.RecentLua.Empty)
|
if (!Global.Config.RecentLua.Empty)
|
||||||
{
|
{
|
||||||
LoadLuaFromRecent(Global.Config.RecentLua[0]);
|
LoadLuaFromRecent(Global.Config.RecentLua.MostRecent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadColumnInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadColumnInfo()
|
||||||
|
{
|
||||||
|
LuaListView.Columns.Clear();
|
||||||
|
|
||||||
|
var columns = Settings.Columns
|
||||||
|
.Where(c => c.Visible)
|
||||||
|
.OrderBy(c => c.Index);
|
||||||
|
|
||||||
|
foreach (var column in columns)
|
||||||
|
{
|
||||||
|
LuaListView.AddColumn(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveColumnInfo()
|
||||||
|
{
|
||||||
|
foreach (ColumnHeader column in LuaListView.Columns)
|
||||||
|
{
|
||||||
|
Settings.Columns[column.Name].Index = column.DisplayIndex;
|
||||||
|
Settings.Columns[column.Name].Width = column.Width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Restart()
|
public void Restart()
|
||||||
|
|
Loading…
Reference in New Issue