From 632f063073c9c5cd9b3632bdace9c24964ed9f73 Mon Sep 17 00:00:00 2001
From: YoshiRulz <OSSYoshiRulz@gmail.com>
Date: Wed, 7 Dec 2022 06:59:24 +1000
Subject: [PATCH] Cleanup `RecordMovie` ctor

---
 .../movie/RecordMovie.cs                      | 185 +++++++-----------
 1 file changed, 75 insertions(+), 110 deletions(-)

diff --git a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs
index a70f0eb331..315e33ac70 100644
--- a/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs
+++ b/src/BizHawk.Client.EmuHawk/movie/RecordMovie.cs
@@ -54,110 +54,94 @@ namespace BizHawk.Client.EmuHawk
 			_movieSession = movieSession;
 			_firmwareManager = firmwareManager;
 
-			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;
+			Button Cancel = new()
+			{
+				Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
+				DialogResult = DialogResult.Cancel,
+				Location = new(391, 135),
+				Size = new(75, 23),
+				Text = "&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;
+			Button OK = new()
+			{
+				Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
+				Location = new(310, 135),
+				Size = new(75, 23),
+				Text = "&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;
+			Button BrowseBtn = new()
+			{
+				Anchor = AnchorStyles.Top | AnchorStyles.Right,
+				Image = Properties.Resources.OpenFile,
+				Location = new(423, 13),
+				Size = new(25, 23),
+				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 = new()
+			{
+				AllowDrop = true,
+				Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
+				Location = new(83, 13),
+				Size = new(334, 20),
+			};
 			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);
+			StartFromCombo = new()
+			{
+				DropDownStyle = ComboBoxStyle.DropDownList,
+				FormattingEnabled = true,
+				Items = { START_FROM_POWERON },
+				Location = new(83, 65),
+				MaxDropDownItems = 32,
+				Size = new(152, 21),
+			};
+			if (_emulator.HasSavestates()) StartFromCombo.Items.Add(START_FROM_SAVESTATE);
+			if (_emulator.HasSaveRam()) 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);
+			DefaultAuthorCheckBox = new()
+			{
+				Anchor = AnchorStyles.Right,
+				AutoSize = true,
+				Location = new(327, 64),
+				Size = new(121, 17),
+				Text = "Make default author",
+				UseVisualStyleBackColor = true,
+			};
+
+			AuthorBox = new()
+			{
+				AllowDrop = true,
+				Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
+				Location = new(83, 39),
+				Size = new(365, 20),
+			};
+
+			GroupBox groupBox1 = new()
+			{
+				Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
+				Location = new(12, 12),
+				Size = new(454, 112),
+			};
+			groupBox1.SuspendLayout();
+			groupBox1.Controls.Add(new LocLabelEx { Location = new(51, 16), Text = "File:" });
 			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:";
+			groupBox1.Controls.Add(BrowseBtn);
+			groupBox1.Controls.Add(new LocLabelEx { Location = new(36, 41), Text = "Author:" });
+			groupBox1.Controls.Add(AuthorBox);
+			groupBox1.Controls.Add(new LocLabelEx { Location = new(6, 68), Text = "Record From:" });
+			groupBox1.Controls.Add(StartFromCombo);
+			groupBox1.Controls.Add(DefaultAuthorCheckBox);
 
 			AcceptButton = OK;
 			AutoScaleDimensions = new(6.0f, 13.0f);
@@ -169,7 +153,6 @@ namespace BizHawk.Client.EmuHawk
 			MaximumSize = new(1440, 201);
 			MinimizeBox = false;
 			MinimumSize = new(425, 201);
-			Name = "RecordMovie";
 			StartPosition = FormStartPosition.CenterParent;
 			Text = "Record Movie";
 			Controls.Add(groupBox1);
@@ -189,24 +172,6 @@ namespace BizHawk.Client.EmuHawk
 			groupBox1.ResumeLayout(performLayout: false);
 			groupBox1.PerformLayout();
 			ResumeLayout(performLayout: false);
-
-			if (!_emulator.HasSavestates())
-			{
-				StartFromCombo.Items.Remove(
-					StartFromCombo.Items
-						.OfType<object>()
-						.First(i => i.ToString()
-							.ToLower() == "now"));
-			}
-
-			if (!_emulator.HasSaveRam())
-			{
-				StartFromCombo.Items.Remove(
-					StartFromCombo.Items
-						.OfType<object>()
-						.First(i => i.ToString()
-							.ToLower() == "saveram"));
-			}
 		}
 
 		private string MakePath()