Fixed the behavior related to closing LogWindow.

If you close LogWindow manually, Config.ShowLogWindow becomes false.
If you close the emulator window, Config.ShowLogWindow does not change.
This commit is contained in:
taotao54321 2012-03-09 21:20:02 +00:00
parent 88424ca2b7
commit 8cbe59cfa8
3 changed files with 26 additions and 3 deletions

View File

@ -274,13 +274,26 @@ namespace BizHawk.MultiClient
}
else
{
window.Close();
logStream.Close();
logStream = null;
Log.HACK_LOG_STREAM = null;
window.Close();
window = null;
}
}
public static void notifyLogWindowClosing()
{
Console.SetOut(TextWriter.Null);
ConsoleVisible = false;
if(logStream != null) logStream.Close();
Log.HACK_LOG_STREAM = null;
}
public static void SaveConfigSettings()
{
if (window != null && window.IsHandleCreated)
window.SaveConfigSettings();
}
}
}

View File

@ -19,7 +19,13 @@ namespace BizHawk.MultiClient
public LogWindow()
{
InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
Closing += (o, e) =>
{
Global.Config.ShowLogWindow = false;
Global.MainForm.notifyLogWindowClosing();
LogConsole.notifyLogWindowClosing();
SaveConfigSettings();
};
}
public void ShowReport(string title, string report)

View File

@ -2253,7 +2253,7 @@ namespace BizHawk.MultiClient
CloseForm(TI83KeyPad1);
CloseForm(TAStudio1);
CloseForm(LuaConsole1);
if (Global.Config.ShowLogWindow) LogConsole.HideConsole();
if (Global.Config.ShowLogWindow) LogConsole.SaveConfigSettings();
ConfigService.Save(PathManager.DefaultIniPath, Global.Config);
}
@ -2728,5 +2728,9 @@ namespace BizHawk.MultiClient
{
Global.Config.SkipLagFrame ^= true;
}
public void notifyLogWindowClosing()
{
displayLogWindowToolStripMenuItem.Checked = false;
}
}
}