Skip to content

Commit 2806af6

Browse files
committed
reapply intervening changes to LuaConsole.cs
1 parent 081f485 commit 2806af6

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ public override void Restart()
225225
return;
226226
}
227227

228-
runningScripts = LuaImp.ScriptList.Where(lf => lf.Enabled).ToList();
228+
runningScripts = _openedFiles.Where(lf => lf.Enabled).ToList();
229229

230230
// we don't use runningScripts here as the other scripts need to be stopped too
231-
foreach (var file in LuaImp.ScriptList)
231+
foreach (var file in _openedFiles)
232232
{
233233
file.Stop();
234234
}
@@ -263,7 +263,7 @@ public override void Restart()
263263

264264
_nonFile = new LuaFile(Config.PathEntries.LuaAbsolutePath(), UpdateRegisteredFunctionsDialog);
265265
_nonFile.Start(LuaImp.SpawnBlankCoroutineAndSandbox(null));
266-
LuaImp.ScriptList.Insert(0, _nonFile);
266+
_openedFiles.Insert(0, _nonFile);
267267

268268
UpdateDialog();
269269
}
@@ -360,7 +360,7 @@ public void LoadLuaFile(string path)
360360
{
361361
var luaFile = new LuaFile(absolutePath, UpdateRegisteredFunctionsDialog);
362362

363-
LuaImp.ScriptList.Add(luaFile);
363+
_openedFiles.Add(luaFile);
364364
_openedFiles.Add(luaFile);
365365
LuaListView.RowCount = _openedFiles.Count;
366366
Config.RecentLua.Add(absolutePath);
@@ -403,7 +403,7 @@ private void RemoveLuaFile(LuaFile item)
403403
item.Stop();
404404
RemoveFileWatcher(item);
405405
}
406-
LuaImp.ScriptList.Remove(item);
406+
_openedFiles.Remove(item);
407407
_openedFiles.Remove(item);
408408
}
409409

@@ -549,9 +549,9 @@ public void ClearOutputWindow()
549549

550550
private void SyncScriptList()
551551
{
552-
LuaImp.ScriptList.Clear();
553-
LuaImp.ScriptList.Add(_nonFile);
554-
LuaImp.ScriptList.AddRange(_openedFiles.Where(static lf => !lf.IsSeparator));
552+
_openedFiles.Clear();
553+
_openedFiles.Add(_nonFile);
554+
_openedFiles.AddRange(_openedFiles.Where(static lf => !lf.IsSeparator));
555555
}
556556

557557
public bool LoadLuaSession(string path)
@@ -690,7 +690,7 @@ private void SaveSessionAs()
690690
var file = GetSaveFileFromUser();
691691
if (file != null)
692692
{
693-
LuaImp.ScriptList.Save(file.FullName);
693+
_openedFiles.Save(file.FullName);
694694
Config.RecentLuaSession.Add(file.FullName);
695695
OutputMessages.Text = $"{file.Name} saved.";
696696
}
@@ -715,14 +715,14 @@ private void LoadSessionFromRecent(string path)
715715

716716
public override bool AskSaveChanges()
717717
{
718-
if (!LuaImp.ScriptList.Changes || string.IsNullOrEmpty(LuaImp.ScriptList.Filename)) return true;
718+
if (!_openedFiles.Changes || string.IsNullOrEmpty(_openedFiles.Filename)) return true;
719719
var result = DialogController.DoWithTempMute(() => this.ModalMessageBox3(
720720
caption: "Closing with Unsaved Changes",
721721
icon: EMsgBoxIcon.Question,
722722
text: $"Save {WindowTitleStatic} session?"));
723723
if (result is null) return false;
724724
if (result.Value) SaveOrSaveAs();
725-
else LuaImp.ScriptList.Changes = false;
725+
else _openedFiles.Changes = false;
726726
return true;
727727
}
728728

@@ -732,16 +732,16 @@ private void UpdateRegisteredFunctionsDialog()
732732

733733
foreach (var form in Application.OpenForms.OfType<LuaRegisteredFunctionsList>().ToList())
734734
{
735-
form.UpdateValues(LuaImp.ScriptList);
735+
form.UpdateValues(_openedFiles);
736736
}
737737
}
738738

739739
private void SaveOrSaveAs()
740740
{
741-
if (!string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename))
741+
if (!string.IsNullOrWhiteSpace(_openedFiles.Filename))
742742
{
743-
LuaImp.ScriptList.Save(LuaImp.ScriptList.Filename);
744-
Config.RecentLuaSession.Add(LuaImp.ScriptList.Filename);
743+
_openedFiles.Save(_openedFiles.Filename);
744+
Config.RecentLuaSession.Add(_openedFiles.Filename);
745745
}
746746
else
747747
{
@@ -786,10 +786,10 @@ private void OpenSessionMenuItem_Click(object sender, EventArgs e)
786786

787787
private void SaveSessionMenuItem_Click(object sender, EventArgs e)
788788
{
789-
if (LuaImp.ScriptList.Changes)
789+
if (_openedFiles.Changes)
790790
{
791791
SaveOrSaveAs();
792-
OutputMessages.Text = $"{Path.GetFileName(LuaImp.ScriptList.Filename)} saved.";
792+
OutputMessages.Text = $"{Path.GetFileName(_openedFiles.Filename)} saved.";
793793
}
794794
}
795795

@@ -1086,7 +1086,7 @@ private void RegisteredFunctionsMenuItem_Click(object sender, EventArgs e)
10861086

10871087
if (!alreadyOpen)
10881088
{
1089-
new LuaRegisteredFunctionsList(LuaImp.ScriptList)
1089+
new LuaRegisteredFunctionsList(_openedFiles)
10901090
{
10911091
StartLocation = this.ChildPointToScreen(LuaListView),
10921092
}.Show();
@@ -1199,15 +1199,15 @@ private void ScriptListContextMenu_Opening(object sender, CancelEventArgs e)
11991199

12001200
StopAllScriptsContextItem.Visible =
12011201
ScriptContextSeparator.Visible =
1202-
LuaImp.ScriptList.Exists(file => file.Enabled);
1202+
_openedFiles.Exists(file => file.Enabled);
12031203

1204-
ClearRegisteredFunctionsContextItem.Enabled = LuaImp.ScriptList.Exists(lf => lf.Functions.Count != 0);
1204+
ClearRegisteredFunctionsContextItem.Enabled = _openedFiles.Exists(lf => lf.Functions.Count != 0);
12051205
}
12061206

12071207
private void ConsoleContextMenu_Opening(object sender, CancelEventArgs e)
12081208
{
12091209
RegisteredFunctionsContextItem.Enabled = ClearRegisteredFunctionsLogContextItem.Enabled
1210-
= LuaImp.ScriptList.Exists(lf => lf.Functions.Count != 0);
1210+
= _openedFiles.Exists(lf => lf.Functions.Count != 0);
12111211
CopyContextItem.Enabled = OutputBox.SelectedText.Length is not 0;
12121212
ClearConsoleContextItem.Enabled = SelectAllContextItem.Enabled = OutputBox.Text.Length is not 0;
12131213
}
@@ -1241,7 +1241,7 @@ private void CopyContextItem_Click(object sender, EventArgs e)
12411241

12421242
private void ClearRegisteredFunctionsContextMenuItem_Click(object sender, EventArgs e)
12431243
{
1244-
foreach (LuaFile lf in LuaImp.ScriptList)
1244+
foreach (LuaFile lf in _openedFiles)
12451245
lf.Functions.Clear();
12461246
}
12471247

0 commit comments

Comments
 (0)