PCE BG Viewer - GUI overhaul

This commit is contained in:
andres.delikat 2012-03-16 15:29:05 +00:00
parent c55e863b15
commit 871e6df12f
2 changed files with 67 additions and 29 deletions

View File

@ -28,26 +28,19 @@
/// </summary>
private void InitializeComponent()
{
this.vdcComboBox = new System.Windows.Forms.ComboBox();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.vDC1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.vCD2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.canvas = new BizHawk.MultiClient.PCEBGCanvas();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// vdcComboBox
//
this.vdcComboBox.FormattingEnabled = true;
this.vdcComboBox.Location = new System.Drawing.Point(12, 27);
this.vdcComboBox.Name = "vdcComboBox";
this.vdcComboBox.Size = new System.Drawing.Size(121, 21);
this.vdcComboBox.TabIndex = 1;
this.vdcComboBox.SelectedIndexChanged += new System.EventHandler(this.vdcComboBox_SelectedIndexChanged);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -55,17 +48,21 @@
this.optionsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1056, 24);
this.menuStrip1.Size = new System.Drawing.Size(536, 24);
this.menuStrip1.TabIndex = 2;
this.menuStrip1.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.vDC1ToolStripMenuItem,
this.vCD2ToolStripMenuItem,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
this.fileToolStripMenuItem.Text = "&Viewer";
this.fileToolStripMenuItem.DropDownOpened += new System.EventHandler(this.fileToolStripMenuItem_DropDownOpened);
//
// exitToolStripMenuItem
//
@ -99,25 +96,43 @@
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window position";
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
//
// vDC1ToolStripMenuItem
//
this.vDC1ToolStripMenuItem.Name = "vDC1ToolStripMenuItem";
this.vDC1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.vDC1ToolStripMenuItem.Text = "VDC&1";
this.vDC1ToolStripMenuItem.Click += new System.EventHandler(this.vDC1ToolStripMenuItem_Click);
//
// vCD2ToolStripMenuItem
//
this.vCD2ToolStripMenuItem.Name = "vCD2ToolStripMenuItem";
this.vCD2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.vCD2ToolStripMenuItem.Text = "VCD&2";
this.vCD2ToolStripMenuItem.Click += new System.EventHandler(this.vCD2ToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
//
// canvas
//
this.canvas.Location = new System.Drawing.Point(12, 65);
this.canvas.Location = new System.Drawing.Point(12, 27);
this.canvas.Name = "canvas";
this.canvas.Size = new System.Drawing.Size(1024, 543);
this.canvas.Size = new System.Drawing.Size(512, 543);
this.canvas.TabIndex = 0;
//
// PCEBGViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1056, 649);
this.Controls.Add(this.vdcComboBox);
this.ClientSize = new System.Drawing.Size(536, 582);
this.Controls.Add(this.canvas);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "PCEBGViewer";
this.ShowIcon = false;
this.Text = "PCE BG Viewer (interim)";
this.Text = "PCE BG Viewer";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.PCEBGViewer_FormClosed);
this.Load += new System.EventHandler(this.PCEBGViewer_Load);
this.menuStrip1.ResumeLayout(false);
@ -130,12 +145,14 @@
#endregion
private PCEBGCanvas canvas;
private System.Windows.Forms.ComboBox vdcComboBox;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem vDC1ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem vCD2ToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
}
}

View File

@ -14,17 +14,13 @@ namespace BizHawk.MultiClient
public partial class PCEBGViewer : Form
{
PCEngine pce;
int VDCtype = 0;
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
public PCEBGViewer()
{
InitializeComponent();
vdcComboBox.Items.Add("VDC1");
vdcComboBox.Items.Add("VDC2");
vdcComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
vdcComboBox.SelectedIndex = 0;
Activated += (o, e) => Generate();
Closing += (o, e) => SaveConfigSettings();
}
@ -36,7 +32,7 @@ namespace BizHawk.MultiClient
if (Global.Emulator.Frame % 20 != 0) return; // TODO: just a makeshift. hard-coded 3fps
VDC vdc = vdcComboBox.SelectedIndex == 0 ? pce.VDC1 : pce.VDC2;
VDC vdc = VDCtype == 0 ? pce.VDC1 : pce.VDC2;
int width = 8 * vdc.BatWidth;
int height = 8 * vdc.BatHeight;
@ -86,16 +82,12 @@ namespace BizHawk.MultiClient
return;
}
pce = Global.Emulator as PCEngine;
vdcComboBox.SelectedIndex = 0;
vdcComboBox.Enabled = pce.SystemId == "SGX";
}
public void UpdateValues()
{
if (!this.IsHandleCreated || this.IsDisposed) return;
if (!(Global.Emulator is PCEngine)) return;
}
private void SaveConfigSettings()
@ -116,8 +108,6 @@ namespace BizHawk.MultiClient
private void PCEBGViewer_Load(object sender, EventArgs e)
{
pce = Global.Emulator as PCEngine;
vdcComboBox.SelectedIndex = 0;
vdcComboBox.Enabled = pce.SystemId == "SGX";
LoadConfigSettings();
}
@ -151,5 +141,36 @@ namespace BizHawk.MultiClient
saveWindowPositionToolStripMenuItem.Checked = Global.Config.PCEBGViewerSaveWIndowPosition;
autoloadToolStripMenuItem.Checked = Global.Config.PCEBGViewerAutoload;
}
private void vDC1ToolStripMenuItem_Click(object sender, EventArgs e)
{
VDCtype = 0;
}
private void vCD2ToolStripMenuItem_Click(object sender, EventArgs e)
{
VDCtype = 1;
}
private void fileToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
if (pce.SystemId == "SGX")
vCD2ToolStripMenuItem.Enabled = true;
else
vCD2ToolStripMenuItem.Enabled = false;
switch (VDCtype)
{
default:
case 0:
vDC1ToolStripMenuItem.Checked = true;
vCD2ToolStripMenuItem.Checked = false;
break;
case 1:
vDC1ToolStripMenuItem.Checked = false;
vCD2ToolStripMenuItem.Checked = true;
break;
}
}
}
}