Skip to content

Commit 0dc08f7

Browse files
committed
Inline some fields and event handlers in DiscoHawk
1 parent b3fc9ce commit 0dc08f7

File tree

3 files changed

+39
-107
lines changed

3 files changed

+39
-107
lines changed

src/BizHawk.Client.DiscoHawk/About.cs

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,11 @@ namespace BizHawk.Client.DiscoHawk
77
{
88
public class About : Form
99
{
10-
private readonly Button button1;
11-
12-
private readonly Label lblVersion;
13-
14-
private readonly RichTextBox richTextBox1;
15-
1610
public About()
1711
{
18-
richTextBox1 = new();
19-
button1 = new();
20-
lblVersion = new();
2112
SuspendLayout();
2213

14+
RichTextBox richTextBox1 = new();
2315
richTextBox1.Location = new(12, 12);
2416
richTextBox1.Name = "richTextBox1";
2517
richTextBox1.ReadOnly = true;
@@ -31,17 +23,19 @@ public About()
3123
+ "\n\nTo use, drag a disc (.cue, .iso, .ccd, .cdi, .mds, .nrg) into the top area. DiscoHawk will dump a newly cleaned up CCD file set to the same directory as the original disc image, and call it _hawked."
3224
+ "\n\nThis is beta software. You are invited to report problems to our bug tracker or IRC. Problems consist of: crusty disc images that crash DiscoHawk or that cause DiscoHawk to produce a _hawked.ccd which fails to serve your particular purposes (which we will need to be informed of, in case we are outputting wrongly.)")
3325
.Replace("\n", Environment.NewLine);
34-
richTextBox1.LinkClicked += richTextBox1_LinkClicked;
26+
richTextBox1.LinkClicked += (_, clickedArgs) => Util.OpenUrlExternal(clickedArgs.LinkText);
3527

28+
Button button1 = new();
3629
button1.DialogResult = DialogResult.Cancel;
3730
button1.Location = new(436, 254);
3831
button1.Name = "button1";
3932
button1.Size = new(75, 23);
4033
button1.TabIndex = 2;
4134
button1.Text = "OK";
4235
button1.UseVisualStyleBackColor = true;
43-
button1.Click += button1_Click;
36+
button1.Click += (_, _) => Close();
4437

38+
Label lblVersion = new();
4539
lblVersion.AutoSize = true;
4640
lblVersion.Location = new(12, 259);
4741
lblVersion.Name = "lblVersion";
@@ -65,15 +59,5 @@ public About()
6559
ResumeLayout(performLayout: false);
6660
PerformLayout();
6761
}
68-
69-
private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
70-
{
71-
Util.OpenUrlExternal(e.LinkText);
72-
}
73-
74-
private void button1_Click(object sender, EventArgs e)
75-
{
76-
Close();
77-
}
7862
}
7963
}

src/BizHawk.Client.DiscoHawk/ComparisonResults.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,13 @@ namespace BizHawk.Client.DiscoHawk
55
{
66
public class ComparisonResults : Form
77
{
8-
private readonly TabControl tabControl1;
9-
10-
private readonly TabPage tabPage1;
11-
12-
private readonly TabPage tabPage2;
13-
14-
private readonly TabPage tabPage3;
15-
168
public readonly RichTextBox textBox1;
179

1810
public ComparisonResults()
1911
{
20-
textBox1 = new();
21-
tabControl1 = new();
22-
tabPage1 = new();
23-
tabPage2 = new();
24-
tabPage3 = new();
25-
tabControl1.SuspendLayout();
26-
tabPage1.SuspendLayout();
2712
SuspendLayout();
2813

14+
textBox1 = new();
2915
textBox1.Dock = DockStyle.Fill;
3016
textBox1.Font = new("Courier New", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0);
3117
textBox1.Location = new(3, 3);
@@ -35,6 +21,11 @@ public ComparisonResults()
3521
textBox1.TabIndex = 1;
3622
textBox1.Text = "";
3723

24+
TabControl tabControl1 = new();
25+
tabControl1.SuspendLayout();
26+
TabPage tabPage1 = new();
27+
TabPage tabPage2 = new();
28+
TabPage tabPage3 = new();
3829
tabControl1.Controls.Add(tabPage1);
3930
tabControl1.Controls.Add(tabPage2);
4031
tabControl1.Controls.Add(tabPage3);
@@ -45,6 +36,7 @@ public ComparisonResults()
4536
tabControl1.Size = new(771, 426);
4637
tabControl1.TabIndex = 2;
4738

39+
tabPage1.SuspendLayout();
4840
tabPage1.Controls.Add(textBox1);
4941
tabPage1.Location = new(4, 22);
5042
tabPage1.Name = "tabPage1";

src/BizHawk.Client.DiscoHawk/MainDiscoForm.cs

Lines changed: 27 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -11,83 +11,37 @@ namespace BizHawk.Client.DiscoHawk
1111
{
1212
public class MainDiscoForm : Form
1313
{
14-
private readonly Button btnAbout;
15-
1614
private readonly RadioButton ccdOutputButton;
1715

1816
private readonly RadioButton chdOutputButton;
1917

20-
private readonly ColumnHeader columnHeader1;
21-
22-
private readonly Button ExitButton;
23-
24-
private readonly GroupBox groupBox1;
25-
26-
private readonly GroupBox groupBox2;
27-
28-
private readonly Label label1;
29-
30-
private readonly Label label2;
31-
32-
private readonly Label label3;
33-
34-
private readonly Label label4;
35-
36-
private readonly Label label6;
37-
38-
private readonly Label label7;
39-
4018
private readonly Panel lblMagicDragArea;
4119

4220
private readonly Panel lblMp3ExtractMagicArea;
4321

4422
private readonly ListView lvCompareTargets;
4523

46-
private readonly RadioButton radioButton1;
47-
48-
private readonly RadioButton radioButton2;
49-
5024
// Release TODO:
5125
// An input (queue) list
5226
// An outputted list showing new file name
5327
// Progress bar should show file being converted
5428
// Add disc button, which puts it on the progress cue (converts it)
5529
public MainDiscoForm()
5630
{
57-
ListViewItem listViewItem1 = new("BizHawk");
58-
ListViewItem listViewItem2 = new("Mednafen");
59-
ExitButton = new();
60-
lblMagicDragArea = new();
61-
label1 = new();
62-
lblMp3ExtractMagicArea = new();
63-
label2 = new();
64-
btnAbout = new();
65-
radioButton1 = new();
66-
groupBox1 = new();
67-
label4 = new();
68-
label3 = new();
69-
radioButton2 = new();
70-
groupBox2 = new();
71-
ccdOutputButton = new();
72-
chdOutputButton = new();
73-
label6 = new();
74-
label7 = new();
75-
lvCompareTargets = new();
76-
columnHeader1 = new();
77-
lblMagicDragArea.SuspendLayout();
78-
lblMp3ExtractMagicArea.SuspendLayout();
79-
groupBox1.SuspendLayout();
80-
groupBox2.SuspendLayout();
8131
SuspendLayout();
8232

33+
Button ExitButton = new();
8334
ExitButton.Location = new(434, 414);
8435
ExitButton.Name = "ExitButton";
8536
ExitButton.Size = new(75, 23);
8637
ExitButton.TabIndex = 0;
8738
ExitButton.Text = "E&xit";
8839
ExitButton.UseVisualStyleBackColor = true;
89-
ExitButton.Click += ExitButton_Click;
40+
ExitButton.Click += (_, _) => Close();
9041

42+
lblMagicDragArea = new();
43+
lblMagicDragArea.SuspendLayout();
44+
Label label1 = new();
9145
lblMagicDragArea.AllowDrop = true;
9246
lblMagicDragArea.BorderStyle = BorderStyle.Fixed3D;
9347
lblMagicDragArea.Controls.Add(label1);
@@ -104,6 +58,9 @@ public MainDiscoForm()
10458
label1.TabIndex = 0;
10559
label1.Text = "Drag here to HAWK your disc - dump it out as a clean CCD/CHD";
10660

61+
lblMp3ExtractMagicArea = new();
62+
lblMp3ExtractMagicArea.SuspendLayout();
63+
Label label2 = new();
10764
lblMp3ExtractMagicArea.AllowDrop = true;
10865
lblMp3ExtractMagicArea.BorderStyle = BorderStyle.Fixed3D;
10966
lblMp3ExtractMagicArea.Controls.Add(label2);
@@ -120,14 +77,16 @@ public MainDiscoForm()
12077
label2.TabIndex = 0;
12178
label2.Text = "Drag a disc here to extract the audio tracks to MP3";
12279

80+
Button btnAbout = new();
12381
btnAbout.Location = new(353, 414);
12482
btnAbout.Name = "btnAbout";
12583
btnAbout.Size = new(75, 23);
12684
btnAbout.TabIndex = 3;
12785
btnAbout.Text = "&About";
12886
btnAbout.UseVisualStyleBackColor = true;
129-
btnAbout.Click += BtnAbout_Click;
87+
btnAbout.Click += (_, _) => new About().ShowDialog();
13088

89+
RadioButton radioButton1 = new();
13190
radioButton1.AutoSize = true;
13291
radioButton1.Checked = true;
13392
radioButton1.Location = new(6, 19);
@@ -138,6 +97,11 @@ public MainDiscoForm()
13897
radioButton1.Text = "BizHawk";
13998
radioButton1.UseVisualStyleBackColor = true;
14099

100+
GroupBox groupBox1 = new();
101+
groupBox1.SuspendLayout();
102+
Label label4 = new();
103+
Label label3 = new();
104+
RadioButton radioButton2 = new();
141105
groupBox1.Controls.Add(label4);
142106
groupBox1.Controls.Add(label3);
143107
groupBox1.Controls.Add(radioButton2);
@@ -171,6 +135,10 @@ public MainDiscoForm()
171135
radioButton2.Text = "Mednafen";
172136
radioButton2.UseVisualStyleBackColor = true;
173137

138+
GroupBox groupBox2 = new();
139+
groupBox2.SuspendLayout();
140+
ccdOutputButton = new();
141+
chdOutputButton = new();
174142
groupBox2.Controls.Add(ccdOutputButton);
175143
groupBox2.Controls.Add(chdOutputButton);
176144
groupBox2.Enabled = true;
@@ -201,6 +169,7 @@ public MainDiscoForm()
201169
chdOutputButton.Text = "CHD";
202170
chdOutputButton.UseVisualStyleBackColor = true;
203171

172+
Label label6 = new();
204173
label6.AutoSize = true;
205174
label6.Enabled = false;
206175
label6.Location = new(9, 324);
@@ -209,21 +178,23 @@ public MainDiscoForm()
209178
label6.TabIndex = 2;
210179
label6.Text = "Compare Reading To:";
211180

181+
Label label7 = new();
212182
label7.AutoSize = true;
213183
label7.Location = new(358, 12);
214184
label7.Name = "label7";
215185
label7.Size = new(70, 13);
216186
label7.TabIndex = 10;
217187
label7.Text = "- Operations -";
218188

219-
lvCompareTargets.Columns.Add(columnHeader1);
189+
lvCompareTargets = new();
190+
lvCompareTargets.Columns.Add(new ColumnHeader());
220191
lvCompareTargets.Enabled = false;
221192
lvCompareTargets.FullRowSelect = true;
222193
lvCompareTargets.GridLines = true;
223194
lvCompareTargets.HeaderStyle = ColumnHeaderStyle.None;
224195
lvCompareTargets.HideSelection = false;
225-
lvCompareTargets.Items.Add(listViewItem1);
226-
lvCompareTargets.Items.Add(listViewItem2);
196+
lvCompareTargets.Items.Add("BizHawk");
197+
lvCompareTargets.Items.Add("Mednafen");
227198
lvCompareTargets.Location = new(9, 340);
228199
lvCompareTargets.Name = "lvCompareTargets";
229200
lvCompareTargets.Size = new(121, 97);
@@ -251,7 +222,7 @@ public MainDiscoForm()
251222
MinimizeBox = false;
252223
Name = "MainDiscoForm";
253224
Text = "DiscoHawk";
254-
Load += MainDiscoForm_Load;
225+
Load += (_, _) => lvCompareTargets.Columns[0].Width = lvCompareTargets.ClientSize.Width;
255226
lblMagicDragArea.ResumeLayout(performLayout: false);
256227
lblMp3ExtractMagicArea.ResumeLayout(performLayout: false);
257228
groupBox1.ResumeLayout(performLayout: false);
@@ -262,16 +233,6 @@ public MainDiscoForm()
262233
PerformLayout();
263234
}
264235

265-
private void MainDiscoForm_Load(object sender, EventArgs e)
266-
{
267-
lvCompareTargets.Columns[0].Width = lvCompareTargets.ClientSize.Width;
268-
}
269-
270-
private void ExitButton_Click(object sender, EventArgs e)
271-
{
272-
Close();
273-
}
274-
275236
private void lblMagicDragArea_DragDrop(object sender, DragEventArgs e)
276237
{
277238
lblMagicDragArea.AllowDrop = false;
@@ -406,10 +367,5 @@ private void LblMp3ExtractMagicArea_DragDrop(object sender, DragEventArgs e)
406367
Cursor = Cursors.Default;
407368
}
408369
}
409-
410-
private void BtnAbout_Click(object sender, EventArgs e)
411-
{
412-
new About().ShowDialog();
413-
}
414370
}
415371
}

0 commit comments

Comments
 (0)