refactor - move readonly flag from MainForm.cs to Global.cs
This commit is contained in:
parent
2d643f78b1
commit
fe9d8ed881
|
@ -18,6 +18,7 @@ namespace BizHawk.Client.Common
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter();
|
public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter();
|
||||||
public static MovieSession MovieSession = new MovieSession();
|
public static MovieSession MovieSession = new MovieSession();
|
||||||
|
public static bool ReadOnly = true; //Global Movie Read only setting
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// whether throttling is force-disabled by use of fast forward
|
/// whether throttling is force-disabled by use of fast forward
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace BizHawk.MultiClient
|
||||||
= SaveMovieMenuItem.Enabled
|
= SaveMovieMenuItem.Enabled
|
||||||
= Global.MovieSession.Movie.IsActive;
|
= Global.MovieSession.Movie.IsActive;
|
||||||
|
|
||||||
ReadonlyMenuItem.Checked = ReadOnly;
|
ReadonlyMenuItem.Checked = Global.ReadOnly;
|
||||||
BindSavestatesToMoviesMenuItem.Checked = Global.Config.BindSavestatesToMovies;
|
BindSavestatesToMoviesMenuItem.Checked = Global.Config.BindSavestatesToMovies;
|
||||||
AutomaticallyBackupMoviesMenuItem.Checked = Global.Config.EnableBackupMovies;
|
AutomaticallyBackupMoviesMenuItem.Checked = Global.Config.EnableBackupMovies;
|
||||||
FullMovieLoadstatesMenuItem.Checked = Global.Config.VBAStyleMovieLoadState;
|
FullMovieLoadstatesMenuItem.Checked = Global.Config.VBAStyleMovieLoadState;
|
||||||
|
@ -1815,7 +1815,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
StopNoSaveContextMenuItem.Visible = Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.HasChanges;
|
StopNoSaveContextMenuItem.Visible = Global.MovieSession.Movie.IsActive && Global.MovieSession.Movie.HasChanges;
|
||||||
|
|
||||||
AddSubtitleContextMenuItem.Visible = !IsNullEmulator() && Global.MovieSession.Movie.IsActive && ReadOnly;
|
AddSubtitleContextMenuItem.Visible = !IsNullEmulator() && Global.MovieSession.Movie.IsActive && Global.ReadOnly;
|
||||||
|
|
||||||
ConfigContextMenuItem.Visible = InFullscreen;
|
ConfigContextMenuItem.Visible = InFullscreen;
|
||||||
|
|
||||||
|
@ -1828,7 +1828,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
ViewSubtitlesContextMenuItem.Text = "View Subtitles";
|
ViewSubtitlesContextMenuItem.Text = "View Subtitles";
|
||||||
ViewCommentsContextMenuItem.Text = "View Comments";
|
ViewCommentsContextMenuItem.Text = "View Comments";
|
||||||
|
@ -1909,7 +1909,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
EditSubtitlesForm form = new EditSubtitlesForm { ReadOnly = ReadOnly };
|
EditSubtitlesForm form = new EditSubtitlesForm { ReadOnly = Global.ReadOnly };
|
||||||
form.GetMovie(Global.MovieSession.Movie);
|
form.GetMovie(Global.MovieSession.Movie);
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
@ -1954,7 +1954,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
EditCommentsForm form = new EditCommentsForm { ReadOnly = ReadOnly };
|
EditCommentsForm form = new EditCommentsForm();
|
||||||
form.GetMovie(Global.MovieSession.Movie);
|
form.GetMovie(Global.MovieSession.Movie);
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
partial class MainForm
|
partial class MainForm
|
||||||
{
|
{
|
||||||
public bool ReadOnly = true; //Global Movie Read only setting
|
|
||||||
|
|
||||||
public void ClearFrame()
|
public void ClearFrame()
|
||||||
{
|
{
|
||||||
if (Global.MovieSession.Movie.IsPlaying)
|
if (Global.MovieSession.Movie.IsPlaying)
|
||||||
|
@ -48,7 +46,7 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
GlobalWinF.MainForm.ClearSaveRAM();
|
GlobalWinF.MainForm.ClearSaveRAM();
|
||||||
Global.MovieSession.Movie.StartRecording();
|
Global.MovieSession.Movie.StartRecording();
|
||||||
ReadOnly = false;
|
Global.ReadOnly = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -124,7 +122,7 @@ namespace BizHawk.MultiClient
|
||||||
Global.MovieSession.Movie.StartPlayback();
|
Global.MovieSession.Movie.StartPlayback();
|
||||||
SetMainformMovieInfo();
|
SetMainformMovieInfo();
|
||||||
GlobalWinF.OSD.AddMessage("Replaying movie file in read-only mode");
|
GlobalWinF.OSD.AddMessage("Replaying movie file in read-only mode");
|
||||||
GlobalWinF.MainForm.ReadOnly = true;
|
Global.ReadOnly = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +148,7 @@ namespace BizHawk.MultiClient
|
||||||
GlobalWinF.OSD.AddMessage(Path.GetFileName(Global.MovieSession.Movie.Filename) + " written to disk.");
|
GlobalWinF.OSD.AddMessage(Path.GetFileName(Global.MovieSession.Movie.Filename) + " written to disk.");
|
||||||
}
|
}
|
||||||
GlobalWinF.OSD.AddMessage(message);
|
GlobalWinF.OSD.AddMessage(message);
|
||||||
GlobalWinF.MainForm.ReadOnly = true;
|
Global.ReadOnly = true;
|
||||||
SetMainformMovieInfo();
|
SetMainformMovieInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,7 +181,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
else if (Global.MovieSession.Movie.IsRecording)
|
else if (Global.MovieSession.Movie.IsRecording)
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: false, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: false, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
||||||
if (result == Movie.LoadStateResult.Pass)
|
if (result == Movie.LoadStateResult.Pass)
|
||||||
|
@ -276,9 +274,9 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
else if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
else if (Global.MovieSession.Movie.IsPlaying && !Global.MovieSession.Movie.IsFinished)
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
||||||
if (result == Movie.LoadStateResult.Pass)
|
if (result == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
//Frame loop automatically handles the rewinding effect based on Global.Emulator.Frame so nothing else is needed here
|
//Frame loop automatically handles the rewinding effect based on Global.Emulator.Frame so nothing else is needed here
|
||||||
|
@ -293,7 +291,7 @@ namespace BizHawk.MultiClient
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
if (dresult == DialogResult.Yes)
|
if (dresult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
||||||
if (newresult == Movie.LoadStateResult.Pass)
|
if (newresult == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -318,7 +316,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
||||||
if (result == Movie.LoadStateResult.Pass)
|
if (result == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.SwitchToRecord();
|
Global.MovieSession.Movie.SwitchToRecord();
|
||||||
|
@ -337,7 +335,7 @@ namespace BizHawk.MultiClient
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
if (dresult == DialogResult.Yes)
|
if (dresult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
||||||
if (newresult == Movie.LoadStateResult.Pass)
|
if (newresult == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.SwitchToRecord();
|
Global.MovieSession.Movie.SwitchToRecord();
|
||||||
|
@ -368,9 +366,9 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else if (Global.MovieSession.Movie.IsFinished)
|
else if (Global.MovieSession.Movie.IsFinished)
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
||||||
if (result != Movie.LoadStateResult.Pass)
|
if (result != Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
if (result == Movie.LoadStateResult.GuidMismatch)
|
if (result == Movie.LoadStateResult.GuidMismatch)
|
||||||
|
@ -380,7 +378,7 @@ namespace BizHawk.MultiClient
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
if (dresult == DialogResult.Yes)
|
if (dresult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
||||||
if (newresult == Movie.LoadStateResult.Pass)
|
if (newresult == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.SwitchToPlay();
|
Global.MovieSession.Movie.SwitchToPlay();
|
||||||
|
@ -416,7 +414,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
var result = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: false, ErrorMessage: out ErrorMSG);
|
||||||
if (result == Movie.LoadStateResult.Pass)
|
if (result == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
GlobalWinF.MainForm.ClearSaveRAM();
|
GlobalWinF.MainForm.ClearSaveRAM();
|
||||||
|
@ -436,7 +434,7 @@ namespace BizHawk.MultiClient
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||||
if (dresult == DialogResult.Yes)
|
if (dresult == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
var newresult = Global.MovieSession.Movie.CheckTimeLines(reader, OnlyGUID: !Global.ReadOnly, IgnoreGuidMismatch: true, ErrorMessage: out ErrorMSG);
|
||||||
if (newresult == Movie.LoadStateResult.Pass)
|
if (newresult == Movie.LoadStateResult.Pass)
|
||||||
{
|
{
|
||||||
GlobalWinF.MainForm.ClearSaveRAM();
|
GlobalWinF.MainForm.ClearSaveRAM();
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace BizHawk.MultiClient
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Movie m = new Movie(cmdMovie, GlobalWinF.MainForm.GetEmuVersion());
|
Movie m = new Movie(cmdMovie, GlobalWinF.MainForm.GetEmuVersion());
|
||||||
ReadOnly = true;
|
Global.ReadOnly = true;
|
||||||
// if user is dumping and didnt supply dump length, make it as long as the loaded movie
|
// if user is dumping and didnt supply dump length, make it as long as the loaded movie
|
||||||
if (autoDumpLength == 0)
|
if (autoDumpLength == 0)
|
||||||
{
|
{
|
||||||
|
@ -775,7 +775,7 @@ namespace BizHawk.MultiClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ReadOnly = true;
|
Global.ReadOnly = true;
|
||||||
StartNewMovie(m, false);
|
StartNewMovie(m, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3454,8 +3454,8 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
ReadOnly ^= true;
|
Global.ReadOnly ^= true;
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
GlobalWinF.OSD.AddMessage("Movie read-only mode");
|
GlobalWinF.OSD.AddMessage("Movie read-only mode");
|
||||||
}
|
}
|
||||||
|
@ -3473,8 +3473,8 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public void SetReadOnly(bool read_only)
|
public void SetReadOnly(bool read_only)
|
||||||
{
|
{
|
||||||
ReadOnly = read_only;
|
Global.ReadOnly = read_only;
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
GlobalWinF.OSD.AddMessage("Movie read-only mode");
|
GlobalWinF.OSD.AddMessage("Movie read-only mode");
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
public partial class EditCommentsForm : Form
|
public partial class EditCommentsForm : Form
|
||||||
{
|
{
|
||||||
public bool ReadOnly;
|
|
||||||
private Movie selectedMovie;
|
private Movie selectedMovie;
|
||||||
|
|
||||||
public EditCommentsForm()
|
public EditCommentsForm()
|
||||||
|
@ -17,7 +16,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void EditCommentsForm_Load(object sender, EventArgs e)
|
private void EditCommentsForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (ReadOnly)
|
if (Global.ReadOnly)
|
||||||
{
|
{
|
||||||
CommentGrid.Columns[0].ReadOnly = true;
|
CommentGrid.Columns[0].ReadOnly = true;
|
||||||
Text = "View Comments";
|
Text = "View Comments";
|
||||||
|
@ -40,7 +39,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void OK_Click(object sender, EventArgs e)
|
private void OK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (!ReadOnly)
|
if (!Global.ReadOnly)
|
||||||
{
|
{
|
||||||
selectedMovie.Header.Comments.Clear();
|
selectedMovie.Header.Comments.Clear();
|
||||||
for (int x = 0; x < CommentGrid.Rows.Count - 1; x++)
|
for (int x = 0; x < CommentGrid.Rows.Count - 1; x++)
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void OK_Click(object sender, EventArgs e)
|
private void OK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GlobalWinF.MainForm.ReadOnly = ReadOnlyCheckBox.Checked;
|
Global.ReadOnly = ReadOnlyCheckBox.Checked;
|
||||||
Run();
|
Run();
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
private void MovieView_SelectedIndexChanged(object sender, EventArgs e)
|
private void MovieView_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
toolTip1.SetToolTip(DetailsView, "");
|
toolTip1.SetToolTip(DetailsView, String.Empty);
|
||||||
DetailsView.Items.Clear();
|
DetailsView.Items.Clear();
|
||||||
if (MovieView.SelectedIndices.Count < 1)
|
if (MovieView.SelectedIndices.Count < 1)
|
||||||
{
|
{
|
||||||
|
@ -431,9 +431,9 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
ListView.SelectedIndexCollection indexes = MovieView.SelectedIndices;
|
ListView.SelectedIndexCollection indexes = MovieView.SelectedIndices;
|
||||||
if (indexes.Count == 0) return;
|
if (indexes.Count == 0) return;
|
||||||
EditCommentsForm c = new EditCommentsForm {ReadOnly = true};
|
EditCommentsForm form = new EditCommentsForm();
|
||||||
c.GetMovie(MovieList[MovieView.SelectedIndices[0]]);
|
form.GetMovie(MovieList[MovieView.SelectedIndices[0]]);
|
||||||
c.Show();
|
form.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
private void button2_Click(object sender, EventArgs e)
|
||||||
|
@ -462,7 +462,9 @@ namespace BizHawk.MultiClient
|
||||||
foreach (string path in filePaths)
|
foreach (string path in filePaths)
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(path) == "." + Global.Config.MovieExtension)
|
if (Path.GetExtension(path) == "." + Global.Config.MovieExtension)
|
||||||
|
{
|
||||||
AddMovieToList(path, true);
|
AddMovieToList(path, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public static bool movie_getreadonly()
|
public static bool movie_getreadonly()
|
||||||
{
|
{
|
||||||
return GlobalWinF.MainForm.ReadOnly;
|
return Global.ReadOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool movie_getrerecordcounting()
|
public static bool movie_getrerecordcounting()
|
||||||
|
|
|
@ -171,7 +171,7 @@ namespace BizHawk.MultiClient
|
||||||
if (Global.MovieSession.Movie.IsActive)
|
if (Global.MovieSession.Movie.IsActive)
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.StateCapturing = true;
|
Global.MovieSession.Movie.StateCapturing = true;
|
||||||
ReadOnlyCheckBox.Checked = GlobalWinF.MainForm.ReadOnly;
|
ReadOnlyCheckBox.Checked = Global.ReadOnly;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue