TAStudio - move some settings from Config.cs to the dialog using [ConfigPersist]
This commit is contained in:
parent
6fb88a0105
commit
6ce93c0496
|
@ -341,14 +341,8 @@ namespace BizHawk.Client.Common
|
|||
|
||||
#endregion
|
||||
|
||||
// TAStudio Dialog
|
||||
public RecentFiles RecentTas = new RecentFiles(8);
|
||||
// TAStudio
|
||||
public TasStateManagerSettings DefaultTasProjSettings = new TasStateManagerSettings();
|
||||
public bool TAStudioDrawInput = true;
|
||||
public bool TAStudioAutoPause = true;
|
||||
public bool TAStudioAutoRestoreLastPosition = false;
|
||||
public bool TAStudioFollowCursor = true;
|
||||
public bool TAStudioEmptyMarkers = false;
|
||||
|
||||
// VirtualPad Dialog
|
||||
public ToolDialogSettings VirtualPadSettings = new ToolDialogSettings();
|
||||
|
|
|
@ -38,12 +38,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
get
|
||||
{
|
||||
return Global.Config.TAStudioAutoRestoreLastPosition;
|
||||
return Tastudio.Settings.AutoRestoreLastPosition;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
AutoRestoreCheckbox.Checked = Global.Config.TAStudioAutoRestoreLastPosition = value;
|
||||
AutoRestoreCheckbox.Checked = Tastudio.Settings.AutoRestoreLastPosition = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,12 +53,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
get
|
||||
{
|
||||
return Global.Config.TAStudioFollowCursor;
|
||||
return Tastudio.Settings.FollowCursor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
FollowCursorCheckbox.Checked = Global.Config.TAStudioFollowCursor = value;
|
||||
FollowCursorCheckbox.Checked = Tastudio.Settings.FollowCursor = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (Global.Config != null) // A check needed for the designer
|
||||
{
|
||||
TurboSeekCheckbox.Checked = Global.Config.TurboSeek;
|
||||
AutoRestoreCheckbox.Checked = Global.Config.TAStudioAutoRestoreLastPosition;
|
||||
FollowCursorCheckbox.Checked = Global.Config.TAStudioFollowCursor;
|
||||
AutoRestoreCheckbox.Checked = Tastudio.Settings.AutoRestoreLastPosition;
|
||||
FollowCursorCheckbox.Checked = Tastudio.Settings.FollowCursor;
|
||||
}
|
||||
_programmaticallyChangingValue = false;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!_programmaticallyChangingValue)
|
||||
{
|
||||
Global.Config.TAStudioAutoRestoreLastPosition ^= true;
|
||||
Tastudio.Settings.AutoRestoreLastPosition ^= true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,9 +120,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!_programmaticallyChangingValue)
|
||||
{
|
||||
Global.Config.TAStudioFollowCursor ^= true;
|
||||
Tastudio.Settings.FollowCursor ^= true;
|
||||
|
||||
if (Global.Config.TAStudioFollowCursor)
|
||||
if (Tastudio.Settings.FollowCursor)
|
||||
{
|
||||
Tastudio.SetVisibleIndex();
|
||||
Tastudio.RefreshDialog();
|
||||
|
|
|
@ -305,7 +305,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
TasView.CurrentCell.Column.Name == FrameColumnName &&
|
||||
e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (Global.Config.TAStudioEmptyMarkers)
|
||||
if (Settings.EmptyMarkers)
|
||||
{
|
||||
CurrentTasMovie.Markers.Add(TasView.CurrentCell.RowIndex.Value, string.Empty);
|
||||
RefreshDialog();
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
RecentSubMenu.DropDownItems.Clear();
|
||||
RecentSubMenu.DropDownItems.AddRange(
|
||||
Global.Config.RecentTas.RecentMenu(DummyLoadProject, true));
|
||||
Settings.RecentTas.RecentMenu(DummyLoadProject, true));
|
||||
}
|
||||
|
||||
private void NewTasMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
CurrentTasMovie.Save();
|
||||
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
||||
Global.Config.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
CurrentTasMovie.Filename = file.FullName;
|
||||
CurrentTasMovie.Save();
|
||||
Global.Config.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
||||
SetTextProperty();
|
||||
}
|
||||
|
@ -529,26 +529,24 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void ConfigSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
DrawInputByDraggingMenuItem.Checked = Global.Config.TAStudioDrawInput;
|
||||
AutopauseAtEndOfMovieMenuItem.Checked = Global.Config.TAStudioAutoPause;
|
||||
EmptyNewMarkerNotesMenuItem.Checked = Global.Config.TAStudioEmptyMarkers;
|
||||
|
||||
|
||||
DrawInputByDraggingMenuItem.Checked = Settings.DrawInput;
|
||||
AutopauseAtEndOfMovieMenuItem.Checked = Settings.AutoPause;
|
||||
EmptyNewMarkerNotesMenuItem.Checked = Settings.EmptyMarkers;
|
||||
}
|
||||
|
||||
private void DrawInputByDraggingMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
TasView.InputPaintingMode = Global.Config.TAStudioDrawInput ^= true;
|
||||
TasView.InputPaintingMode = Settings.DrawInput ^= true;
|
||||
}
|
||||
|
||||
private void EmptyNewMarkerNotesMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.TAStudioEmptyMarkers ^= true;
|
||||
Settings.EmptyMarkers ^= true;
|
||||
}
|
||||
|
||||
private void AutopauseAtEndMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.TAStudioAutoPause ^= true;
|
||||
Settings.AutoPause ^= true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
if (frame != Emulator.Frame) // If we aren't already at our destination, seek
|
||||
{
|
||||
GlobalWin.MainForm.UnpauseEmulator();
|
||||
if (Global.Config.TAStudioAutoPause && frame < CurrentTasMovie.InputLogLength)
|
||||
if (Settings.AutoPause && frame < CurrentTasMovie.InputLogLength)
|
||||
{
|
||||
GlobalWin.MainForm.PauseOnFrame = CurrentTasMovie.InputLogLength;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,27 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private int? _autoRestoreFrame; // The frame auto-restore will restore to, if set
|
||||
|
||||
[ConfigPersist]
|
||||
public TAStudioSettings Settings { get; set; }
|
||||
|
||||
public class TAStudioSettings
|
||||
{
|
||||
public TAStudioSettings()
|
||||
{
|
||||
RecentTas = new RecentFiles(8);
|
||||
DrawInput = true;
|
||||
AutoPause = true;
|
||||
FollowCursor = true;
|
||||
}
|
||||
|
||||
public RecentFiles RecentTas { get; set; }
|
||||
public bool DrawInput { get; set; }
|
||||
public bool AutoPause { get; set; }
|
||||
public bool AutoRestoreLastPosition { get; set; }
|
||||
public bool FollowCursor { get; set; }
|
||||
public bool EmptyMarkers { get; set; }
|
||||
}
|
||||
|
||||
public TasMovie CurrentTasMovie
|
||||
{
|
||||
get { return Global.MovieSession.Movie as TasMovie; }
|
||||
|
@ -49,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
TasView.QueryItemText += TasView_QueryItemText;
|
||||
TasView.QueryItemBkColor += TasView_QueryItemBkColor;
|
||||
TasView.QueryItemIcon += TasView_QueryItemIcon;
|
||||
TasView.InputPaintingMode = Global.Config.TAStudioDrawInput;
|
||||
TasView.InputPaintingMode = Settings.DrawInput;
|
||||
TasView.PointedCellChanged += TasView_PointedCellChanged;
|
||||
TasView.MultiSelect = true;
|
||||
TasView.MaxCharactersInHorizontal = 1;
|
||||
|
@ -62,13 +83,13 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.MainForm.SetMainformMovieInfo();
|
||||
}
|
||||
|
||||
private static void ConvertCurrentMovieToTasproj()
|
||||
private void ConvertCurrentMovieToTasproj()
|
||||
{
|
||||
Global.MovieSession.Movie.Save();
|
||||
Global.MovieSession.Movie = Global.MovieSession.Movie.ToTasMovie();
|
||||
Global.MovieSession.Movie.Save();
|
||||
Global.MovieSession.Movie.SwitchToRecord();
|
||||
Global.Config.RecentTas.Add(Global.MovieSession.Movie.Filename);
|
||||
Settings.RecentTas.Add(Global.MovieSession.Movie.Filename);
|
||||
}
|
||||
|
||||
private void EngageTastudio()
|
||||
|
@ -191,7 +212,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var file = new FileInfo(path);
|
||||
if (!file.Exists)
|
||||
{
|
||||
Global.Config.RecentTas.HandleLoadError(path);
|
||||
Settings.RecentTas.HandleLoadError(path);
|
||||
}
|
||||
|
||||
WantsToControlStopMovie = false;
|
||||
|
@ -207,7 +228,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
SetTasMovieCallbacks();
|
||||
|
||||
WantsToControlStopMovie = true;
|
||||
Global.Config.RecentTas.Add(path);
|
||||
Settings.RecentTas.Add(path);
|
||||
Text = "TAStudio - " + CurrentTasMovie.Name;
|
||||
|
||||
RefreshDialog();
|
||||
|
@ -235,7 +256,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void DoAutoRestore()
|
||||
{
|
||||
if (Global.Config.TAStudioAutoRestoreLastPosition && _autoRestoreFrame.HasValue)
|
||||
if (Settings.AutoRestoreLastPosition && _autoRestoreFrame.HasValue)
|
||||
{
|
||||
if (_autoRestoreFrame > Emulator.Frame) // Don't unpause if we are already on the desired frame, else runaway seek
|
||||
{
|
||||
|
@ -474,7 +495,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
MessageBoxButtons.OK);
|
||||
return;
|
||||
}
|
||||
Global.Config.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||
|
||||
if (CurrentTasMovie.InputLogLength > 0) // TODO: this is probably reoccuring logic, break off into a function
|
||||
{
|
||||
|
@ -537,9 +558,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
// Start Scenario 3: No movie, but user wants to autload their last project
|
||||
else if (Global.Config.RecentTas.AutoLoad && !string.IsNullOrEmpty(Global.Config.RecentTas.MostRecent))
|
||||
else if (Settings.RecentTas.AutoLoad && !string.IsNullOrEmpty(Settings.RecentTas.MostRecent))
|
||||
{
|
||||
var result = LoadProject(Global.Config.RecentTas.MostRecent);
|
||||
var result = LoadProject(Settings.RecentTas.MostRecent);
|
||||
if (!result)
|
||||
{
|
||||
TasView.AllColumns.Clear();
|
||||
|
|
Loading…
Reference in New Issue