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
|
#endregion
|
||||||
|
|
||||||
// TAStudio Dialog
|
// TAStudio
|
||||||
public RecentFiles RecentTas = new RecentFiles(8);
|
|
||||||
public TasStateManagerSettings DefaultTasProjSettings = new TasStateManagerSettings();
|
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
|
// VirtualPad Dialog
|
||||||
public ToolDialogSettings VirtualPadSettings = new ToolDialogSettings();
|
public ToolDialogSettings VirtualPadSettings = new ToolDialogSettings();
|
||||||
|
|
|
@ -38,12 +38,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Global.Config.TAStudioAutoRestoreLastPosition;
|
return Tastudio.Settings.AutoRestoreLastPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
AutoRestoreCheckbox.Checked = Global.Config.TAStudioAutoRestoreLastPosition = value;
|
AutoRestoreCheckbox.Checked = Tastudio.Settings.AutoRestoreLastPosition = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,12 +53,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Global.Config.TAStudioFollowCursor;
|
return Tastudio.Settings.FollowCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
set
|
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
|
if (Global.Config != null) // A check needed for the designer
|
||||||
{
|
{
|
||||||
TurboSeekCheckbox.Checked = Global.Config.TurboSeek;
|
TurboSeekCheckbox.Checked = Global.Config.TurboSeek;
|
||||||
AutoRestoreCheckbox.Checked = Global.Config.TAStudioAutoRestoreLastPosition;
|
AutoRestoreCheckbox.Checked = Tastudio.Settings.AutoRestoreLastPosition;
|
||||||
FollowCursorCheckbox.Checked = Global.Config.TAStudioFollowCursor;
|
FollowCursorCheckbox.Checked = Tastudio.Settings.FollowCursor;
|
||||||
}
|
}
|
||||||
_programmaticallyChangingValue = false;
|
_programmaticallyChangingValue = false;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (!_programmaticallyChangingValue)
|
if (!_programmaticallyChangingValue)
|
||||||
{
|
{
|
||||||
Global.Config.TAStudioAutoRestoreLastPosition ^= true;
|
Tastudio.Settings.AutoRestoreLastPosition ^= true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (!_programmaticallyChangingValue)
|
if (!_programmaticallyChangingValue)
|
||||||
{
|
{
|
||||||
Global.Config.TAStudioFollowCursor ^= true;
|
Tastudio.Settings.FollowCursor ^= true;
|
||||||
|
|
||||||
if (Global.Config.TAStudioFollowCursor)
|
if (Tastudio.Settings.FollowCursor)
|
||||||
{
|
{
|
||||||
Tastudio.SetVisibleIndex();
|
Tastudio.SetVisibleIndex();
|
||||||
Tastudio.RefreshDialog();
|
Tastudio.RefreshDialog();
|
||||||
|
|
|
@ -305,7 +305,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
TasView.CurrentCell.Column.Name == FrameColumnName &&
|
TasView.CurrentCell.Column.Name == FrameColumnName &&
|
||||||
e.Button == MouseButtons.Left)
|
e.Button == MouseButtons.Left)
|
||||||
{
|
{
|
||||||
if (Global.Config.TAStudioEmptyMarkers)
|
if (Settings.EmptyMarkers)
|
||||||
{
|
{
|
||||||
CurrentTasMovie.Markers.Add(TasView.CurrentCell.RowIndex.Value, string.Empty);
|
CurrentTasMovie.Markers.Add(TasView.CurrentCell.RowIndex.Value, string.Empty);
|
||||||
RefreshDialog();
|
RefreshDialog();
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
RecentSubMenu.DropDownItems.Clear();
|
RecentSubMenu.DropDownItems.Clear();
|
||||||
RecentSubMenu.DropDownItems.AddRange(
|
RecentSubMenu.DropDownItems.AddRange(
|
||||||
Global.Config.RecentTas.RecentMenu(DummyLoadProject, true));
|
Settings.RecentTas.RecentMenu(DummyLoadProject, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NewTasMenuItem_Click(object sender, EventArgs e)
|
private void NewTasMenuItem_Click(object sender, EventArgs e)
|
||||||
|
@ -79,7 +79,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
CurrentTasMovie.Save();
|
CurrentTasMovie.Save();
|
||||||
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
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.Filename = file.FullName;
|
||||||
CurrentTasMovie.Save();
|
CurrentTasMovie.Save();
|
||||||
Global.Config.RecentTas.Add(CurrentTasMovie.Filename);
|
Settings.RecentTas.Add(CurrentTasMovie.Filename);
|
||||||
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
MessageStatusLabel.Text = Path.GetFileName(CurrentTasMovie.Filename) + " saved.";
|
||||||
SetTextProperty();
|
SetTextProperty();
|
||||||
}
|
}
|
||||||
|
@ -529,26 +529,24 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void ConfigSubMenu_DropDownOpened(object sender, EventArgs e)
|
private void ConfigSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
DrawInputByDraggingMenuItem.Checked = Global.Config.TAStudioDrawInput;
|
DrawInputByDraggingMenuItem.Checked = Settings.DrawInput;
|
||||||
AutopauseAtEndOfMovieMenuItem.Checked = Global.Config.TAStudioAutoPause;
|
AutopauseAtEndOfMovieMenuItem.Checked = Settings.AutoPause;
|
||||||
EmptyNewMarkerNotesMenuItem.Checked = Global.Config.TAStudioEmptyMarkers;
|
EmptyNewMarkerNotesMenuItem.Checked = Settings.EmptyMarkers;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawInputByDraggingMenuItem_Click(object sender, EventArgs e)
|
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)
|
private void EmptyNewMarkerNotesMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.Config.TAStudioEmptyMarkers ^= true;
|
Settings.EmptyMarkers ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AutopauseAtEndMenuItem_Click(object sender, EventArgs e)
|
private void AutopauseAtEndMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.Config.TAStudioAutoPause ^= true;
|
Settings.AutoPause ^= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -106,7 +106,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
if (frame != Emulator.Frame) // If we aren't already at our destination, seek
|
if (frame != Emulator.Frame) // If we aren't already at our destination, seek
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.UnpauseEmulator();
|
GlobalWin.MainForm.UnpauseEmulator();
|
||||||
if (Global.Config.TAStudioAutoPause && frame < CurrentTasMovie.InputLogLength)
|
if (Settings.AutoPause && frame < CurrentTasMovie.InputLogLength)
|
||||||
{
|
{
|
||||||
GlobalWin.MainForm.PauseOnFrame = 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
|
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
|
public TasMovie CurrentTasMovie
|
||||||
{
|
{
|
||||||
get { return Global.MovieSession.Movie as TasMovie; }
|
get { return Global.MovieSession.Movie as TasMovie; }
|
||||||
|
@ -49,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
TasView.QueryItemText += TasView_QueryItemText;
|
TasView.QueryItemText += TasView_QueryItemText;
|
||||||
TasView.QueryItemBkColor += TasView_QueryItemBkColor;
|
TasView.QueryItemBkColor += TasView_QueryItemBkColor;
|
||||||
TasView.QueryItemIcon += TasView_QueryItemIcon;
|
TasView.QueryItemIcon += TasView_QueryItemIcon;
|
||||||
TasView.InputPaintingMode = Global.Config.TAStudioDrawInput;
|
TasView.InputPaintingMode = Settings.DrawInput;
|
||||||
TasView.PointedCellChanged += TasView_PointedCellChanged;
|
TasView.PointedCellChanged += TasView_PointedCellChanged;
|
||||||
TasView.MultiSelect = true;
|
TasView.MultiSelect = true;
|
||||||
TasView.MaxCharactersInHorizontal = 1;
|
TasView.MaxCharactersInHorizontal = 1;
|
||||||
|
@ -62,13 +83,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
GlobalWin.MainForm.SetMainformMovieInfo();
|
GlobalWin.MainForm.SetMainformMovieInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConvertCurrentMovieToTasproj()
|
private void ConvertCurrentMovieToTasproj()
|
||||||
{
|
{
|
||||||
Global.MovieSession.Movie.Save();
|
Global.MovieSession.Movie.Save();
|
||||||
Global.MovieSession.Movie = Global.MovieSession.Movie.ToTasMovie();
|
Global.MovieSession.Movie = Global.MovieSession.Movie.ToTasMovie();
|
||||||
Global.MovieSession.Movie.Save();
|
Global.MovieSession.Movie.Save();
|
||||||
Global.MovieSession.Movie.SwitchToRecord();
|
Global.MovieSession.Movie.SwitchToRecord();
|
||||||
Global.Config.RecentTas.Add(Global.MovieSession.Movie.Filename);
|
Settings.RecentTas.Add(Global.MovieSession.Movie.Filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EngageTastudio()
|
private void EngageTastudio()
|
||||||
|
@ -191,7 +212,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var file = new FileInfo(path);
|
var file = new FileInfo(path);
|
||||||
if (!file.Exists)
|
if (!file.Exists)
|
||||||
{
|
{
|
||||||
Global.Config.RecentTas.HandleLoadError(path);
|
Settings.RecentTas.HandleLoadError(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
WantsToControlStopMovie = false;
|
WantsToControlStopMovie = false;
|
||||||
|
@ -207,7 +228,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
SetTasMovieCallbacks();
|
SetTasMovieCallbacks();
|
||||||
|
|
||||||
WantsToControlStopMovie = true;
|
WantsToControlStopMovie = true;
|
||||||
Global.Config.RecentTas.Add(path);
|
Settings.RecentTas.Add(path);
|
||||||
Text = "TAStudio - " + CurrentTasMovie.Name;
|
Text = "TAStudio - " + CurrentTasMovie.Name;
|
||||||
|
|
||||||
RefreshDialog();
|
RefreshDialog();
|
||||||
|
@ -235,7 +256,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void DoAutoRestore()
|
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
|
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);
|
MessageBoxButtons.OK);
|
||||||
return;
|
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
|
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
|
// 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)
|
if (!result)
|
||||||
{
|
{
|
||||||
TasView.AllColumns.Clear();
|
TasView.AllColumns.Clear();
|
||||||
|
|
Loading…
Reference in New Issue