TAStudio - convert to IToolFormAutoConfig

This commit is contained in:
adelikat 2015-01-01 18:10:07 +00:00
parent dbdc92e7e2
commit 6fb88a0105
5 changed files with 874 additions and 1040 deletions

View File

@ -342,11 +342,8 @@ namespace BizHawk.Client.Common
#endregion
// TAStudio Dialog
public ToolDialogSettings TAStudioSettings = new ToolDialogSettings();
public RecentFiles RecentTas = new RecentFiles(8);
public TasStateManagerSettings DefaultTasProjSettings = new TasStateManagerSettings();
public bool AutoloadTAStudio = false;
public bool AutoloadTAStudioProject = false;
public bool TAStudioDrawInput = true;
public bool TAStudioAutoPause = true;
public bool TAStudioAutoRestoreLastPosition = false;

View File

@ -372,11 +372,6 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.LoadGameGenieEc();
}
if (Global.Config.AutoloadTAStudio)
{
GlobalWin.Tools.Load<TAStudio>();
}
if (Global.Config.AutoloadVirtualPad)
{
GlobalWin.Tools.Load<VirtualpadTool>();

View File

@ -86,8 +86,6 @@ namespace BizHawk.Client.EmuHawk
this.OsdInBranchScreenshotsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator14 = new System.Windows.Forms.ToolStripSeparator();
this.AutopauseAtEndOfMovieMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator20 = new System.Windows.Forms.ToolStripSeparator();
this.RotateMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MetaSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.HeaderMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GreenzoneSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -96,13 +94,7 @@ namespace BizHawk.Client.EmuHawk
this.toolStripSeparator21 = new System.Windows.Forms.ToolStripSeparator();
this.DefaultStateSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SettingsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AutoloadProjectMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator();
this.RestoreDefaultSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.RotateMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ColumnsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator19 = new System.Windows.Forms.ToolStripSeparator();
this.HelpSubMenu = new System.Windows.Forms.ToolStripMenuItem();
@ -492,9 +484,7 @@ namespace BizHawk.Client.EmuHawk
this.BranchesRestoreEntireMovieMenuItem,
this.OsdInBranchScreenshotsMenuItem,
this.toolStripSeparator14,
this.AutopauseAtEndOfMovieMenuItem,
this.toolStripSeparator20,
this.RotateMenuItem});
this.AutopauseAtEndOfMovieMenuItem});
this.ConfigSubMenu.Name = "ConfigSubMenu";
this.ConfigSubMenu.Size = new System.Drawing.Size(55, 20);
this.ConfigSubMenu.Text = "&Config";
@ -595,18 +585,6 @@ namespace BizHawk.Client.EmuHawk
this.AutopauseAtEndOfMovieMenuItem.Text = "Autopause at end of Movie";
this.AutopauseAtEndOfMovieMenuItem.Click += new System.EventHandler(this.AutopauseAtEndMenuItem_Click);
//
// toolStripSeparator20
//
this.toolStripSeparator20.Name = "toolStripSeparator20";
this.toolStripSeparator20.Size = new System.Drawing.Size(285, 6);
//
// RotateMenuItem
//
this.RotateMenuItem.Name = "RotateMenuItem";
this.RotateMenuItem.Size = new System.Drawing.Size(288, 22);
this.RotateMenuItem.Text = "Rotate";
this.RotateMenuItem.Click += new System.EventHandler(this.RotateMenuItem_Click);
//
// MetaSubMenu
//
this.MetaSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -663,64 +641,18 @@ namespace BizHawk.Client.EmuHawk
// SettingsSubMenu
//
this.SettingsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.AutoloadMenuItem,
this.AutoloadProjectMenuItem,
this.SaveWindowPositionMenuItem,
this.AlwaysOnTopMenuItem,
this.FloatingWindowMenuItem,
this.toolStripSeparator12,
this.RestoreDefaultSettingsMenuItem});
this.RotateMenuItem});
this.SettingsSubMenu.Name = "SettingsSubMenu";
this.SettingsSubMenu.Size = new System.Drawing.Size(61, 20);
this.SettingsSubMenu.Text = "&Settings";
this.SettingsSubMenu.DropDownOpened += new System.EventHandler(this.SettingsSubMenu_DropDownOpened);
//
// AutoloadMenuItem
// RotateMenuItem
//
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
this.AutoloadMenuItem.Size = new System.Drawing.Size(199, 22);
this.AutoloadMenuItem.Text = "Autoload";
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
//
// AutoloadProjectMenuItem
//
this.AutoloadProjectMenuItem.Name = "AutoloadProjectMenuItem";
this.AutoloadProjectMenuItem.Size = new System.Drawing.Size(199, 22);
this.AutoloadProjectMenuItem.Text = "Autload &Project";
this.AutoloadProjectMenuItem.Click += new System.EventHandler(this.AutoloadProjectMenuItem_Click);
//
// SaveWindowPositionMenuItem
//
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(199, 22);
this.SaveWindowPositionMenuItem.Text = "Save Window Position";
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
//
// AlwaysOnTopMenuItem
//
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(199, 22);
this.AlwaysOnTopMenuItem.Text = "Always On Top";
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
//
// FloatingWindowMenuItem
//
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(199, 22);
this.FloatingWindowMenuItem.Text = "Floating Window";
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
//
// toolStripSeparator12
//
this.toolStripSeparator12.Name = "toolStripSeparator12";
this.toolStripSeparator12.Size = new System.Drawing.Size(196, 6);
//
// RestoreDefaultSettingsMenuItem
//
this.RestoreDefaultSettingsMenuItem.Name = "RestoreDefaultSettingsMenuItem";
this.RestoreDefaultSettingsMenuItem.Size = new System.Drawing.Size(199, 22);
this.RestoreDefaultSettingsMenuItem.Text = "Restore Default Settings";
this.RestoreDefaultSettingsMenuItem.Click += new System.EventHandler(this.RestoreDefaultSettingsMenuItem_Click);
this.RotateMenuItem.Name = "RotateMenuItem";
this.RotateMenuItem.Size = new System.Drawing.Size(152, 22);
this.RotateMenuItem.Text = "Rotate";
this.RotateMenuItem.Click += new System.EventHandler(this.RotateMenuItem_Click);
//
// ColumnsSubMenu
//
@ -834,6 +766,7 @@ namespace BizHawk.Client.EmuHawk
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.MarkerControl.ContextMenuStrip = this.MarkerContextMenu;
this.MarkerControl.Emulator = null;
this.MarkerControl.Location = new System.Drawing.Point(2, 16);
this.MarkerControl.Name = "MarkerControl";
this.MarkerControl.Size = new System.Drawing.Size(198, 343);
@ -1125,17 +1058,10 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripSeparator toolStripSeparator14;
private System.Windows.Forms.ToolStripMenuItem AutopauseAtEndOfMovieMenuItem;
private System.Windows.Forms.ToolStripMenuItem SettingsSubMenu;
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;
private System.Windows.Forms.ToolStripMenuItem RestoreDefaultSettingsMenuItem;
private System.Windows.Forms.ToolStripMenuItem AutoloadProjectMenuItem;
private StatusStripEx TasStatusStrip;
private System.Windows.Forms.ToolStripStatusLabel MessageStatusLabel;
private PlaybackBox TasPlaybackBox;
private System.Windows.Forms.ToolStripStatusLabel SplicerStatusLabel;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
private System.Windows.Forms.ToolStripMenuItem MetaSubMenu;
private System.Windows.Forms.ToolStripMenuItem HeaderMenuItem;
private System.Windows.Forms.ToolStripMenuItem CommentsMenuItem;
@ -1163,8 +1089,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem GreenZoneIntegrityCheckMenuItem;
private System.Windows.Forms.ToolStripMenuItem ColumnsSubMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator19;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator20;
private System.Windows.Forms.ToolStripMenuItem RotateMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator21;
private System.Windows.Forms.ToolStripMenuItem DefaultStateSettingsMenuItem;
private System.Windows.Forms.GroupBox groupBox1;
@ -1175,5 +1099,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripMenuItem RemoveMarkerContextMenuItem;
private System.Windows.Forms.ToolStripSeparator StartFromNowSeparator;
private System.Windows.Forms.ToolStripMenuItem StartNewProjectFromNowMenuItem;
private System.Windows.Forms.ToolStripMenuItem RotateMenuItem;
}
}

View File

@ -35,7 +35,7 @@ namespace BizHawk.Client.EmuHawk
{
RecentSubMenu.DropDownItems.Clear();
RecentSubMenu.DropDownItems.AddRange(
Global.Config.RecentTas.RecentMenu(DummyLoadProject));
Global.Config.RecentTas.RecentMenu(DummyLoadProject, true));
}
private void NewTasMenuItem_Click(object sender, EventArgs e)
@ -533,7 +533,7 @@ namespace BizHawk.Client.EmuHawk
AutopauseAtEndOfMovieMenuItem.Checked = Global.Config.TAStudioAutoPause;
EmptyNewMarkerNotesMenuItem.Checked = Global.Config.TAStudioEmptyMarkers;
RotateMenuItem.ShortcutKeyDisplayString = TasView.RotateHotkeyStr;
}
private void DrawInputByDraggingMenuItem_Click(object sender, EventArgs e)
@ -551,12 +551,6 @@ namespace BizHawk.Client.EmuHawk
Global.Config.TAStudioAutoPause ^= true;
}
private void RotateMenuItem_Click(object sender, EventArgs e)
{
TasView.HorizontalOrientation ^= true;
CurrentTasMovie.FlagChanges();
}
#endregion
#region Metadata
@ -611,49 +605,13 @@ namespace BizHawk.Client.EmuHawk
private void SettingsSubMenu_DropDownOpened(object sender, EventArgs e)
{
SaveWindowPositionMenuItem.Checked = Global.Config.TAStudioSettings.SaveWindowPosition;
AutoloadMenuItem.Checked = Global.Config.AutoloadTAStudio;
AutoloadProjectMenuItem.Checked = Global.Config.AutoloadTAStudioProject;
AlwaysOnTopMenuItem.Checked = Global.Config.TAStudioSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.TAStudioSettings.FloatingWindow;
RotateMenuItem.ShortcutKeyDisplayString = TasView.RotateHotkeyStr;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
private void RotateMenuItem_Click(object sender, EventArgs e)
{
Global.Config.AutoloadTAStudio ^= true;
}
private void AutoloadProjectMenuItem_Click(object sender, EventArgs e)
{
Global.Config.AutoloadTAStudioProject ^= true;
}
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TAStudioSettings.SaveWindowPosition ^= true;
}
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TAStudioSettings.TopMost ^= true;
TopMost = Global.Config.TAStudioSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.TAStudioSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
private void RestoreDefaultSettingsMenuItem_Click(object sender, EventArgs e)
{
Size = new Size(_defaultWidth, _defaultHeight);
Global.Config.TAStudioSettings.SaveWindowPosition = true;
Global.Config.TAStudioSettings.TopMost = false;
Global.Config.TAStudioSettings.FloatingWindow = false;
RefreshFloatingWindowControl();
TasView.HorizontalOrientation ^= true;
CurrentTasMovie.FlagChanges();
}
#endregion

View File

@ -16,7 +16,7 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
namespace BizHawk.Client.EmuHawk
{
public partial class TAStudio : Form, IToolForm, IControlMainform
public partial class TAStudio : Form, IToolFormAutoConfig, IControlMainform
{
// TODO: UI flow that conveniently allows to start from savestate
private const string MarkerColumnName = "MarkerColumn";
@ -24,8 +24,6 @@ namespace BizHawk.Client.EmuHawk
private readonly List<TasClipboardEntry> _tasClipboard = new List<TasClipboardEntry>();
private int _defaultWidth;
private int _defaultHeight;
private MovieEndAction _originalEndAction; // The movie end behavior selected by the user (that is overridden by TAStudio)
private Dictionary<string, string> GenerateColumnNames()
{
@ -51,8 +49,6 @@ namespace BizHawk.Client.EmuHawk
TasView.QueryItemText += TasView_QueryItemText;
TasView.QueryItemBkColor += TasView_QueryItemBkColor;
TasView.QueryItemIcon += TasView_QueryItemIcon;
TopMost = Global.Config.TAStudioSettings.TopMost;
TasView.InputPaintingMode = Global.Config.TAStudioDrawInput;
TasView.PointedCellChanged += TasView_PointedCellChanged;
TasView.MultiSelect = true;
@ -278,30 +274,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void LoadConfigSettings()
{
_defaultWidth = Size.Width;
_defaultHeight = Size.Height;
if (Global.Config.TAStudioSettings.UseWindowPosition)
{
Location = Global.Config.TAStudioSettings.WindowPosition;
}
if (Global.Config.TAStudioSettings.UseWindowSize)
{
Size = Global.Config.TAStudioSettings.WindowSize;
}
}
private void SaveConfigSettings()
{
Global.Config.TAStudioSettings.Wndx = Location.X;
Global.Config.TAStudioSettings.Wndy = Location.Y;
Global.Config.TAStudioSettings.Width = Right - Left;
Global.Config.TAStudioSettings.Height = Bottom - Top;
}
private void StartAtNearestFrameAndEmulate(int frame)
{
CurrentTasMovie.SwitchToPlay();
@ -364,11 +336,6 @@ namespace BizHawk.Client.EmuHawk
SplicerStatusLabel.Text = message;
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.TAStudioSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
public void CallAddMarkerPopUp(int? frame = null)
{
var markerFrame = frame ?? TasView.LastSelectedIndex ?? Emulator.Frame;
@ -527,7 +494,6 @@ namespace BizHawk.Client.EmuHawk
private void Tastudio_Load(object sender, EventArgs e)
{
InitializeOnLoad();
LoadConfigSettings();
SetColumnsFromCurrentStickies();
if (VersionInfo.DeveloperBuild)
@ -571,7 +537,7 @@ namespace BizHawk.Client.EmuHawk
}
// Start Scenario 3: No movie, but user wants to autload their last project
else if (Global.Config.AutoloadTAStudioProject && !string.IsNullOrEmpty(Global.Config.RecentTas.MostRecent))
else if (Global.Config.RecentTas.AutoLoad && !string.IsNullOrEmpty(Global.Config.RecentTas.MostRecent))
{
var result = LoadProject(Global.Config.RecentTas.MostRecent);
if (!result)
@ -600,7 +566,6 @@ namespace BizHawk.Client.EmuHawk
if (AskSaveChanges())
{
WantsToControlStopMovie = false;
SaveConfigSettings();
GlobalWin.MainForm.StopMovie(saveChanges: false);
DisengageTastudio();
}
@ -610,12 +575,6 @@ namespace BizHawk.Client.EmuHawk
}
}
protected override void OnShown(EventArgs e)
{
RefreshFloatingWindowControl();
base.OnShown(e);
}
/// <summary>
/// This method is called everytime the Changes property is toggled on a TasMovie instance.
/// </summary>