From 400b1b589b004f1b3bf2d59be63405ac027dc84c Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 7 Dec 2022 06:20:28 +1000 Subject: [PATCH] Inline `RecordMovie.InitializeComponent` (Designer file) --- .../movie/RecordMovie.Designer.cs | 199 ------------------ .../movie/RecordMovie.cs | 149 ++++++++++++- .../movie/RecordMovie.resx | 120 ----------- 3 files changed, 144 insertions(+), 324 deletions(-) delete mode 100644 src/BizHawk.Client.EmuHawk/movie/RecordMovie.Designer.cs delete mode 100644 src/BizHawk.Client.EmuHawk/movie/RecordMovie.resx diff --git a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.Designer.cs b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.Designer.cs deleted file mode 100644 index a42597c9cc..0000000000 --- a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.Designer.cs +++ /dev/null @@ -1,199 +0,0 @@ -namespace BizHawk.Client.EmuHawk -{ - partial class RecordMovie - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.Cancel = new System.Windows.Forms.Button(); - this.OK = new System.Windows.Forms.Button(); - this.BrowseBtn = new System.Windows.Forms.Button(); - this.RecordBox = new System.Windows.Forms.TextBox(); - this.StartFromCombo = new System.Windows.Forms.ComboBox(); - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.DefaultAuthorCheckBox = new System.Windows.Forms.CheckBox(); - this.AuthorBox = new System.Windows.Forms.TextBox(); - this.label3 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.label2 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.label1 = new BizHawk.WinForms.Controls.LocLabelEx(); - this.groupBox1.SuspendLayout(); - this.SuspendLayout(); - // - // Cancel - // - this.Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.Cancel.Location = new System.Drawing.Point(391, 135); - this.Cancel.Name = "Cancel"; - this.Cancel.Size = new System.Drawing.Size(75, 23); - this.Cancel.TabIndex = 1; - this.Cancel.Text = "&Cancel"; - this.Cancel.UseVisualStyleBackColor = true; - this.Cancel.Click += new System.EventHandler(this.Cancel_Click); - // - // OK - // - this.OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.OK.Location = new System.Drawing.Point(310, 135); - this.OK.Name = "OK"; - this.OK.Size = new System.Drawing.Size(75, 23); - this.OK.TabIndex = 0; - this.OK.Text = "&OK"; - this.OK.UseVisualStyleBackColor = true; - this.OK.Click += new System.EventHandler(this.Ok_Click); - // - // BrowseBtn - // - this.BrowseBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.BrowseBtn.Location = new System.Drawing.Point(423, 13); - this.BrowseBtn.Name = "BrowseBtn"; - this.BrowseBtn.Size = new System.Drawing.Size(25, 23); - this.BrowseBtn.TabIndex = 1; - this.BrowseBtn.UseVisualStyleBackColor = true; - this.BrowseBtn.Click += new System.EventHandler(this.BrowseBtn_Click); - // - // RecordBox - // - this.RecordBox.AllowDrop = true; - this.RecordBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.RecordBox.Location = new System.Drawing.Point(83, 13); - this.RecordBox.Name = "RecordBox"; - this.RecordBox.Size = new System.Drawing.Size(334, 20); - this.RecordBox.TabIndex = 0; - this.RecordBox.DragDrop += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragDrop); - this.RecordBox.DragEnter += new System.Windows.Forms.DragEventHandler(this.RecordBox_DragEnter); - // - // StartFromCombo - // - this.StartFromCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.StartFromCombo.FormattingEnabled = true; - this.StartFromCombo.Items.AddRange(new object[] { - "Power-On", - "Now", - "SaveRam"}); - this.StartFromCombo.Location = new System.Drawing.Point(83, 65); - this.StartFromCombo.MaxDropDownItems = 32; - this.StartFromCombo.Name = "StartFromCombo"; - this.StartFromCombo.Size = new System.Drawing.Size(152, 21); - this.StartFromCombo.TabIndex = 3; - // - // groupBox1 - // - this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBox1.Controls.Add(this.DefaultAuthorCheckBox); - this.groupBox1.Controls.Add(this.AuthorBox); - this.groupBox1.Controls.Add(this.StartFromCombo); - this.groupBox1.Controls.Add(this.BrowseBtn); - this.groupBox1.Controls.Add(this.label3); - this.groupBox1.Controls.Add(this.label2); - this.groupBox1.Controls.Add(this.label1); - this.groupBox1.Controls.Add(this.RecordBox); - this.groupBox1.Location = new System.Drawing.Point(12, 12); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(454, 112); - this.groupBox1.TabIndex = 0; - this.groupBox1.TabStop = false; - // - // DefaultAuthorCheckBox - // - this.DefaultAuthorCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.DefaultAuthorCheckBox.AutoSize = true; - this.DefaultAuthorCheckBox.Location = new System.Drawing.Point(327, 64); - this.DefaultAuthorCheckBox.Name = "DefaultAuthorCheckBox"; - this.DefaultAuthorCheckBox.Size = new System.Drawing.Size(121, 17); - this.DefaultAuthorCheckBox.TabIndex = 6; - this.DefaultAuthorCheckBox.Text = "Make default author"; - this.DefaultAuthorCheckBox.UseVisualStyleBackColor = true; - // - // AuthorBox - // - this.AuthorBox.AllowDrop = true; - this.AuthorBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.AuthorBox.Location = new System.Drawing.Point(83, 39); - this.AuthorBox.Name = "AuthorBox"; - this.AuthorBox.Size = new System.Drawing.Size(365, 20); - this.AuthorBox.TabIndex = 2; - // - // label3 - // - this.label3.Location = new System.Drawing.Point(36, 41); - this.label3.Name = "label3"; - this.label3.Text = "Author:"; - // - // label2 - // - this.label2.Location = new System.Drawing.Point(6, 68); - this.label2.Name = "label2"; - this.label2.Text = "Record From:"; - // - // label1 - // - this.label1.Location = new System.Drawing.Point(51, 16); - this.label1.Name = "label1"; - this.label1.Text = "File:"; - // - // RecordMovie - // - this.AcceptButton = this.OK; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.Cancel; - this.ClientSize = new System.Drawing.Size(478, 163); - this.Controls.Add(this.groupBox1); - this.Controls.Add(this.OK); - this.Controls.Add(this.Cancel); - this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(1440, 201); - this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(425, 201); - this.Name = "RecordMovie"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Record Movie"; - this.Load += new System.EventHandler(this.RecordMovie_Load); - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button Cancel; - private System.Windows.Forms.Button OK; - private System.Windows.Forms.Button BrowseBtn; - private System.Windows.Forms.TextBox RecordBox; - private System.Windows.Forms.ComboBox StartFromCombo; - private System.Windows.Forms.GroupBox groupBox1; - private BizHawk.WinForms.Controls.LocLabelEx label3; - private BizHawk.WinForms.Controls.LocLabelEx label2; - private BizHawk.WinForms.Controls.LocLabelEx label1; - private System.Windows.Forms.TextBox AuthorBox; - private System.Windows.Forms.CheckBox DefaultAuthorCheckBox; - } -} \ No newline at end of file diff --git a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index 2c9f09b3a6..a70f0eb331 100644 --- a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -7,12 +7,19 @@ using System.Linq; using BizHawk.Emulation.Common; using BizHawk.Client.Common; using BizHawk.Common; +using BizHawk.WinForms.Controls; namespace BizHawk.Client.EmuHawk { // TODO - Allow relative paths in record TextBox - public partial class RecordMovie : Form, IDialogParent + public sealed class RecordMovie : Form, IDialogParent { + private const string START_FROM_POWERON = "Power-On"; + + private const string START_FROM_SAVERAM = "SaveRam"; + + private const string START_FROM_SAVESTATE = "Now"; + private readonly IMainFormForTools _mainForm; private readonly Config _config; private readonly GameInfo _game; @@ -20,6 +27,14 @@ namespace BizHawk.Client.EmuHawk private readonly IMovieSession _movieSession; private readonly FirmwareManager _firmwareManager; + private readonly TextBox AuthorBox; + + private readonly CheckBox DefaultAuthorCheckBox; + + private readonly TextBox RecordBox; + + private readonly ComboBox StartFromCombo; + public IDialogController DialogController => _mainForm; public RecordMovie( @@ -38,9 +53,129 @@ namespace BizHawk.Client.EmuHawk _emulator = core; _movieSession = movieSession; _firmwareManager = firmwareManager; - InitializeComponent(); - Icon = Properties.Resources.TAStudioIcon; + + Button Cancel = new(); + Button OK = new(); + Button BrowseBtn = new(); + RecordBox = new(); + StartFromCombo = new(); + GroupBox groupBox1 = new(); + DefaultAuthorCheckBox = new(); + AuthorBox = new(); + LocLabelEx label3 = new(); + LocLabelEx label2 = new(); + LocLabelEx label1 = new(); + groupBox1.SuspendLayout(); + SuspendLayout(); + + Cancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + Cancel.DialogResult = DialogResult.Cancel; + Cancel.Location = new(391, 135); + Cancel.Name = "Cancel"; + Cancel.Size = new(75, 23); + Cancel.TabIndex = 1; + Cancel.Text = "&Cancel"; + Cancel.UseVisualStyleBackColor = true; + Cancel.Click += Cancel_Click; + + OK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + OK.Location = new(310, 135); + OK.Name = "OK"; + OK.Size = new(75, 23); + OK.TabIndex = 0; + OK.Text = "&OK"; + OK.UseVisualStyleBackColor = true; + OK.Click += Ok_Click; + + BrowseBtn.Anchor = AnchorStyles.Top | AnchorStyles.Right; BrowseBtn.Image = Properties.Resources.OpenFile; + BrowseBtn.Location = new(423, 13); + BrowseBtn.Name = "BrowseBtn"; + BrowseBtn.Size = new(25, 23); + BrowseBtn.TabIndex = 1; + BrowseBtn.UseVisualStyleBackColor = true; + BrowseBtn.Click += BrowseBtn_Click; + + RecordBox.AllowDrop = true; + RecordBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + RecordBox.Location = new(83, 13); + RecordBox.Name = "RecordBox"; + RecordBox.Size = new(334, 20); + RecordBox.TabIndex = 0; + RecordBox.DragDrop += RecordBox_DragDrop; + RecordBox.DragEnter += RecordBox_DragEnter; + + StartFromCombo.DropDownStyle = ComboBoxStyle.DropDownList; + StartFromCombo.FormattingEnabled = true; + StartFromCombo.Location = new(83, 65); + StartFromCombo.MaxDropDownItems = 32; + StartFromCombo.Name = "StartFromCombo"; + StartFromCombo.Size = new(152, 21); + StartFromCombo.TabIndex = 3; + StartFromCombo.Items.Add(START_FROM_POWERON); + StartFromCombo.Items.Add(START_FROM_SAVESTATE); + StartFromCombo.Items.Add(START_FROM_SAVERAM); + + groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + groupBox1.Location = new(12, 12); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new(454, 112); + groupBox1.TabIndex = 0; + groupBox1.TabStop = false; + groupBox1.Controls.Add(DefaultAuthorCheckBox); + groupBox1.Controls.Add(AuthorBox); + groupBox1.Controls.Add(StartFromCombo); + groupBox1.Controls.Add(BrowseBtn); + groupBox1.Controls.Add(label3); + groupBox1.Controls.Add(label2); + groupBox1.Controls.Add(label1); + groupBox1.Controls.Add(RecordBox); + + DefaultAuthorCheckBox.Anchor = AnchorStyles.Right; + DefaultAuthorCheckBox.AutoSize = true; + DefaultAuthorCheckBox.Location = new(327, 64); + DefaultAuthorCheckBox.Name = "DefaultAuthorCheckBox"; + DefaultAuthorCheckBox.Size = new(121, 17); + DefaultAuthorCheckBox.TabIndex = 6; + DefaultAuthorCheckBox.Text = "Make default author"; + DefaultAuthorCheckBox.UseVisualStyleBackColor = true; + + AuthorBox.AllowDrop = true; + AuthorBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; + AuthorBox.Location = new(83, 39); + AuthorBox.Name = "AuthorBox"; + AuthorBox.Size = new(365, 20); + AuthorBox.TabIndex = 2; + + label3.Location = new(36, 41); + label3.Name = "label3"; + label3.Text = "Author:"; + + label2.Location = new(6, 68); + label2.Name = "label2"; + label2.Text = "Record From:"; + + label1.Location = new(51, 16); + label1.Name = "label1"; + label1.Text = "File:"; + + AcceptButton = OK; + AutoScaleDimensions = new(6.0f, 13.0f); + AutoScaleMode = AutoScaleMode.Font; + CancelButton = Cancel; + ClientSize = new(478, 163); + Icon = Properties.Resources.TAStudioIcon; + MaximizeBox = false; + MaximumSize = new(1440, 201); + MinimizeBox = false; + MinimumSize = new(425, 201); + Name = "RecordMovie"; + StartPosition = FormStartPosition.CenterParent; + Text = "Record Movie"; + Controls.Add(groupBox1); + Controls.Add(OK); + Controls.Add(Cancel); + Load += RecordMovie_Load; if (OSTailoredCode.IsUnixHost) Load += (_, _) => { //HACK to make this usable on Linux. No clue why this Form in particular is so much worse, maybe the GroupBox? --yoshi @@ -51,6 +186,10 @@ namespace BizHawk.Client.EmuHawk Cancel.Location += s; }; + groupBox1.ResumeLayout(performLayout: false); + groupBox1.PerformLayout(); + ResumeLayout(performLayout: false); + if (!_emulator.HasSavestates()) { StartFromCombo.Items.Remove( @@ -119,7 +258,7 @@ namespace BizHawk.Client.EmuHawk Directory.CreateDirectory(fileInfo.DirectoryName); } - if (StartFromCombo.SelectedItem.ToString() == "Now" && _emulator.HasSavestates()) + if (StartFromCombo.SelectedItem.ToString() is START_FROM_SAVESTATE && _emulator.HasSavestates()) { var core = _emulator.AsStatable(); @@ -143,7 +282,7 @@ namespace BizHawk.Client.EmuHawk movieToRecord.SavestateFramebuffer = (int[])_emulator.AsVideoProvider().GetVideoBuffer().Clone(); } } - else if (StartFromCombo.SelectedItem.ToString() == "SaveRam" && _emulator.HasSaveRam()) + else if (StartFromCombo.SelectedItem.ToString() is START_FROM_SAVERAM && _emulator.HasSaveRam()) { var core = _emulator.AsSaveRam(); movieToRecord.StartsFromSaveRam = true; diff --git a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.resx b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.resx deleted file mode 100644 index c7e0d4bdf1..0000000000 --- a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file