Fix the "Null" window text bug. Part of the problem was scattered logic that sets the text, so I refactored to have a single function that does window text setting logic
This commit is contained in:
parent
b4e1cc00da
commit
6bad2d9427
|
@ -117,25 +117,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsPlaying)
|
||||
{
|
||||
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename);
|
||||
PlayRecordStatusButton.Image = Properties.Resources.Play;
|
||||
PlayRecordStatusButton.ToolTipText = "Movie is in playback mode";
|
||||
PlayRecordStatusButton.Visible = true;
|
||||
}
|
||||
else if (Global.MovieSession.Movie.IsRecording)
|
||||
{
|
||||
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename);
|
||||
PlayRecordStatusButton.Image = Properties.Resources.RecordHS;
|
||||
PlayRecordStatusButton.ToolTipText = "Movie is in record mode";
|
||||
PlayRecordStatusButton.Visible = true;
|
||||
}
|
||||
else if (!Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Text = DisplayNameForSystem(Global.Game.System) + " - " + Global.Game.Name;
|
||||
PlayRecordStatusButton.Image = Properties.Resources.Blank;
|
||||
PlayRecordStatusButton.ToolTipText = "No movie is active";
|
||||
PlayRecordStatusButton.Visible = false;
|
||||
}
|
||||
|
||||
SetWindowText();
|
||||
}
|
||||
|
||||
public void RestartMovie()
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : string.Empty);
|
||||
SetWindowText();
|
||||
|
||||
Global.CheatList.Changed += ToolHelpers.UpdateCheatRelatedTools;
|
||||
|
||||
|
@ -1177,6 +1177,49 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
#region Private methods
|
||||
|
||||
private static string DisplayNameForSystem(string system)
|
||||
{
|
||||
if (system == "NULL")
|
||||
{
|
||||
//Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : string.Empty);
|
||||
//return;
|
||||
}
|
||||
|
||||
var str = Global.SystemInfo.DisplayName;
|
||||
|
||||
if (VersionInfo.DeveloperBuild)
|
||||
{
|
||||
str += " (interim)";
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
private void SetWindowText()
|
||||
{
|
||||
if (Global.Emulator is NullEmulator)
|
||||
{
|
||||
Text = "BizHawk" + (VersionInfo.DeveloperBuild ? " (interim) " : string.Empty);
|
||||
return;
|
||||
}
|
||||
|
||||
var str = Global.SystemInfo.DisplayName;
|
||||
|
||||
if (VersionInfo.DeveloperBuild)
|
||||
{
|
||||
str += " (interim)";
|
||||
}
|
||||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Text = str + " - " + Global.Game.Name + " - " + Path.GetFileName(Global.MovieSession.Movie.Filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
Text = str + " - " + Global.Game.Name;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearAutohold()
|
||||
{
|
||||
ClearHolds();
|
||||
|
@ -1451,18 +1494,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private static string DisplayNameForSystem(string system)
|
||||
{
|
||||
var str = Global.SystemInfo.DisplayName;
|
||||
|
||||
if (VersionInfo.DeveloperBuild)
|
||||
{
|
||||
str += " (interim)";
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
private static void InitControls()
|
||||
{
|
||||
var controls = new Controller(
|
||||
|
@ -3098,7 +3129,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
Global.Game.Status = nes.RomStatus;
|
||||
}
|
||||
|
||||
Text = DisplayNameForSystem(loader.Game.System) + " - " + Global.Game.Name;
|
||||
SetWindowText();
|
||||
|
||||
Global.Rewinder.ResetRewindBuffer();
|
||||
|
||||
|
|
Loading…
Reference in New Issue