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>
|
||||
public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter();
|
||||
public static MovieSession MovieSession = new MovieSession();
|
||||
public static bool ReadOnly = true; //Global Movie Read only setting
|
||||
|
||||
/// <summary>
|
||||
/// whether throttling is force-disabled by use of fast forward
|
||||
|
|
|
@ -230,7 +230,7 @@ namespace BizHawk.MultiClient
|
|||
= SaveMovieMenuItem.Enabled
|
||||
= Global.MovieSession.Movie.IsActive;
|
||||
|
||||
ReadonlyMenuItem.Checked = ReadOnly;
|
||||
ReadonlyMenuItem.Checked = Global.ReadOnly;
|
||||
BindSavestatesToMoviesMenuItem.Checked = Global.Config.BindSavestatesToMovies;
|
||||
AutomaticallyBackupMoviesMenuItem.Checked = Global.Config.EnableBackupMovies;
|
||||
FullMovieLoadstatesMenuItem.Checked = Global.Config.VBAStyleMovieLoadState;
|
||||
|
@ -1815,7 +1815,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1828,7 +1828,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
if (ReadOnly)
|
||||
if (Global.ReadOnly)
|
||||
{
|
||||
ViewSubtitlesContextMenuItem.Text = "View Subtitles";
|
||||
ViewCommentsContextMenuItem.Text = "View Comments";
|
||||
|
@ -1909,7 +1909,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
EditSubtitlesForm form = new EditSubtitlesForm { ReadOnly = ReadOnly };
|
||||
EditSubtitlesForm form = new EditSubtitlesForm { ReadOnly = Global.ReadOnly };
|
||||
form.GetMovie(Global.MovieSession.Movie);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
@ -1954,7 +1954,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
EditCommentsForm form = new EditCommentsForm { ReadOnly = ReadOnly };
|
||||
EditCommentsForm form = new EditCommentsForm();
|
||||
form.GetMovie(Global.MovieSession.Movie);
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
partial class MainForm
|
||||
{
|
||||
public bool ReadOnly = true; //Global Movie Read only setting
|
||||
|
||||
public void ClearFrame()
|
||||
{
|
||||
if (Global.MovieSession.Movie.IsPlaying)
|
||||
|
@ -48,7 +46,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
GlobalWinF.MainForm.ClearSaveRAM();
|
||||
Global.MovieSession.Movie.StartRecording();
|
||||
ReadOnly = false;
|
||||
Global.ReadOnly = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -124,7 +122,7 @@ namespace BizHawk.MultiClient
|
|||
Global.MovieSession.Movie.StartPlayback();
|
||||
SetMainformMovieInfo();
|
||||
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(message);
|
||||
GlobalWinF.MainForm.ReadOnly = true;
|
||||
Global.ReadOnly = true;
|
||||
SetMainformMovieInfo();
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +181,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
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);
|
||||
if (result == Movie.LoadStateResult.Pass)
|
||||
|
@ -276,9 +274,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
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)
|
||||
{
|
||||
//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);
|
||||
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)
|
||||
{
|
||||
return true;
|
||||
|
@ -318,7 +316,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
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)
|
||||
{
|
||||
Global.MovieSession.Movie.SwitchToRecord();
|
||||
|
@ -337,7 +335,7 @@ namespace BizHawk.MultiClient
|
|||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
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)
|
||||
{
|
||||
Global.MovieSession.Movie.SwitchToRecord();
|
||||
|
@ -368,9 +366,9 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
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.GuidMismatch)
|
||||
|
@ -380,7 +378,7 @@ namespace BizHawk.MultiClient
|
|||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
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)
|
||||
{
|
||||
Global.MovieSession.Movie.SwitchToPlay();
|
||||
|
@ -416,7 +414,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
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)
|
||||
{
|
||||
GlobalWinF.MainForm.ClearSaveRAM();
|
||||
|
@ -436,7 +434,7 @@ namespace BizHawk.MultiClient
|
|||
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
||||
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)
|
||||
{
|
||||
GlobalWinF.MainForm.ClearSaveRAM();
|
||||
|
|
|
@ -316,7 +316,7 @@ namespace BizHawk.MultiClient
|
|||
else
|
||||
{
|
||||
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 (autoDumpLength == 0)
|
||||
{
|
||||
|
@ -775,7 +775,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
else
|
||||
{
|
||||
ReadOnly = true;
|
||||
Global.ReadOnly = true;
|
||||
StartNewMovie(m, false);
|
||||
}
|
||||
}
|
||||
|
@ -3454,8 +3454,8 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
ReadOnly ^= true;
|
||||
if (ReadOnly)
|
||||
Global.ReadOnly ^= true;
|
||||
if (Global.ReadOnly)
|
||||
{
|
||||
GlobalWinF.OSD.AddMessage("Movie read-only mode");
|
||||
}
|
||||
|
@ -3473,8 +3473,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public void SetReadOnly(bool read_only)
|
||||
{
|
||||
ReadOnly = read_only;
|
||||
if (ReadOnly)
|
||||
Global.ReadOnly = read_only;
|
||||
if (Global.ReadOnly)
|
||||
{
|
||||
GlobalWinF.OSD.AddMessage("Movie read-only mode");
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
public partial class EditCommentsForm : Form
|
||||
{
|
||||
public bool ReadOnly;
|
||||
private Movie selectedMovie;
|
||||
|
||||
public EditCommentsForm()
|
||||
|
@ -17,7 +16,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void EditCommentsForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (ReadOnly)
|
||||
if (Global.ReadOnly)
|
||||
{
|
||||
CommentGrid.Columns[0].ReadOnly = true;
|
||||
Text = "View Comments";
|
||||
|
@ -40,7 +39,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!ReadOnly)
|
||||
if (!Global.ReadOnly)
|
||||
{
|
||||
selectedMovie.Header.Comments.Clear();
|
||||
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)
|
||||
{
|
||||
GlobalWinF.MainForm.ReadOnly = ReadOnlyCheckBox.Checked;
|
||||
Global.ReadOnly = ReadOnlyCheckBox.Checked;
|
||||
Run();
|
||||
Close();
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void MovieView_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
toolTip1.SetToolTip(DetailsView, "");
|
||||
toolTip1.SetToolTip(DetailsView, String.Empty);
|
||||
DetailsView.Items.Clear();
|
||||
if (MovieView.SelectedIndices.Count < 1)
|
||||
{
|
||||
|
@ -431,9 +431,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
ListView.SelectedIndexCollection indexes = MovieView.SelectedIndices;
|
||||
if (indexes.Count == 0) return;
|
||||
EditCommentsForm c = new EditCommentsForm {ReadOnly = true};
|
||||
c.GetMovie(MovieList[MovieView.SelectedIndices[0]]);
|
||||
c.Show();
|
||||
EditCommentsForm form = new EditCommentsForm();
|
||||
form.GetMovie(MovieList[MovieView.SelectedIndices[0]]);
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
|
@ -462,7 +462,9 @@ namespace BizHawk.MultiClient
|
|||
foreach (string path in filePaths)
|
||||
{
|
||||
if (Path.GetExtension(path) == "." + Global.Config.MovieExtension)
|
||||
{
|
||||
AddMovieToList(path, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public static bool movie_getreadonly()
|
||||
{
|
||||
return GlobalWinF.MainForm.ReadOnly;
|
||||
return Global.ReadOnly;
|
||||
}
|
||||
|
||||
public static bool movie_getrerecordcounting()
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace BizHawk.MultiClient
|
|||
if (Global.MovieSession.Movie.IsActive)
|
||||
{
|
||||
Global.MovieSession.Movie.StateCapturing = true;
|
||||
ReadOnlyCheckBox.Checked = GlobalWinF.MainForm.ReadOnly;
|
||||
ReadOnlyCheckBox.Checked = Global.ReadOnly;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue