Lua Console - fix behavior of Save Changes nag, fix deleting of items

This commit is contained in:
adelikat 2013-11-25 23:38:10 +00:00
parent 5bbed4a58f
commit 3d48a0b39e
3 changed files with 17 additions and 5 deletions

View File

@ -11,7 +11,7 @@ namespace BizHawk.Client.Common
public LuaFileList() : base() { }
private string _filename = String.Empty;
private bool _changes = false;
private bool _changes;
public Action ChangedCallback;
public Action LoadCallback;

View File

@ -132,7 +132,7 @@ namespace BizHawk.Client.EmuHawk
public bool AskSave()
{
if (Global.Config.SupressAskSave) //User has elected to not be nagged
if (Global.Config.SupressAskSave)
{
return true;
}

View File

@ -47,7 +47,17 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent();
LuaImp = new EmuLuaLibrary(this);
Closing += (o, e) => SaveConfigSettings();
Closing += (o, e) =>
{
if (AskSave())
{
SaveConfigSettings();
}
else
{
e.Cancel = true;
}
};
LuaListView.QueryItemText += LuaListView_QueryItemText;
LuaListView.QueryItemBkColor += LuaListView_QueryItemBkColor;
LuaListView.VirtualMode = true;
@ -492,6 +502,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (result == DialogResult.No)
{
_luaList.Changes = false;
return true;
}
else if (result == DialogResult.Cancel)
@ -692,9 +703,10 @@ namespace BizHawk.Client.EmuHawk
private void RemoveScriptMenuItem_Click(object sender, EventArgs e)
{
if (SelectedItems.Any())
var items = SelectedItems.ToList();
if (items.Any())
{
foreach (var item in SelectedItems)
foreach (var item in items)
{
_luaList.Remove(item);
}