PCE BG Viewer - implemented auto-load and save window position options
This commit is contained in:
parent
f53088c7be
commit
e0e95ee8ea
|
@ -304,6 +304,12 @@ namespace BizHawk.MultiClient
|
|||
public bool PCEDispBG2 = true;
|
||||
public bool PCEDispOBJ2= true;
|
||||
|
||||
// PCE BG Viewer settings
|
||||
public bool PCEBGViewerSaveWIndowPosition = true;
|
||||
public bool PCEBGViewerAutoload = false;
|
||||
public int PCEBGViewerWndx = -1;
|
||||
public int PCEBGViewerWndy = -1;
|
||||
|
||||
// SMS Graphics settings
|
||||
public bool SMSDispBG = true;
|
||||
public bool SMSDispOBJ = true;
|
||||
|
|
|
@ -234,6 +234,8 @@ namespace BizHawk.MultiClient
|
|||
LoadTAStudio();
|
||||
if (Global.Config.AutoLoadLuaConsole)
|
||||
OpenLuaConsole();
|
||||
if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine)
|
||||
LoadPCEBGViewer();
|
||||
|
||||
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition)
|
||||
this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy);
|
||||
|
|
|
@ -28,99 +28,102 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.vdcComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.canvas = new BizHawk.MultiClient.PCEBGCanvas();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = 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.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
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);
|
||||
//
|
||||
// canvas
|
||||
//
|
||||
this.canvas.Location = new System.Drawing.Point(12, 65);
|
||||
this.canvas.Name = "canvas";
|
||||
this.canvas.Size = new System.Drawing.Size(1024, 543);
|
||||
this.canvas.TabIndex = 0;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
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.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[] {
|
||||
this.fileToolStripMenuItem,
|
||||
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.TabIndex = 2;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1056, 24);
|
||||
this.menuStrip1.TabIndex = 2;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||
this.fileToolStripMenuItem.Text = "&Viewer";
|
||||
//
|
||||
// optionsToolStripMenuItem
|
||||
//
|
||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
|
||||
this.fileToolStripMenuItem.Text = "&Viewer";
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// optionsToolStripMenuItem
|
||||
//
|
||||
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.autoloadToolStripMenuItem,
|
||||
this.saveWindowPositionToolStripMenuItem});
|
||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
this.optionsToolStripMenuItem.Text = "&Options";
|
||||
//
|
||||
// autoloadToolStripMenuItem
|
||||
//
|
||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.autoloadToolStripMenuItem.Text = "&Auto-load";
|
||||
//
|
||||
// saveWindowPositionToolStripMenuItem
|
||||
//
|
||||
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
|
||||
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window position";
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// 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.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.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.PCEBGViewer_FormClosed);
|
||||
this.Load += new System.EventHandler(this.PCEBGViewer_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
this.optionsToolStripMenuItem.Text = "&Options";
|
||||
this.optionsToolStripMenuItem.DropDownOpened += new System.EventHandler(this.optionsToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
// autoloadToolStripMenuItem
|
||||
//
|
||||
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
|
||||
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.autoloadToolStripMenuItem.Text = "&Auto-load";
|
||||
this.autoloadToolStripMenuItem.Click += new System.EventHandler(this.autoloadToolStripMenuItem_Click);
|
||||
//
|
||||
// saveWindowPositionToolStripMenuItem
|
||||
//
|
||||
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
|
||||
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
|
||||
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window position";
|
||||
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
|
||||
//
|
||||
// canvas
|
||||
//
|
||||
this.canvas.Location = new System.Drawing.Point(12, 65);
|
||||
this.canvas.Name = "canvas";
|
||||
this.canvas.Size = new System.Drawing.Size(1024, 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.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.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.PCEBGViewer_FormClosed);
|
||||
this.Load += new System.EventHandler(this.PCEBGViewer_Load);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
PCEngine pce;
|
||||
|
||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||
int defaultHeight;
|
||||
|
||||
public PCEBGViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -23,6 +26,7 @@ namespace BizHawk.MultiClient
|
|||
vdcComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
vdcComboBox.SelectedIndex = 0;
|
||||
Activated += (o, e) => Generate();
|
||||
Closing += (o, e) => SaveConfigSettings();
|
||||
}
|
||||
|
||||
public unsafe void Generate()
|
||||
|
@ -94,11 +98,27 @@ namespace BizHawk.MultiClient
|
|||
|
||||
}
|
||||
|
||||
private void SaveConfigSettings()
|
||||
{
|
||||
Global.Config.PCEBGViewerWndx = this.Location.X;
|
||||
Global.Config.PCEBGViewerWndy = this.Location.Y;
|
||||
}
|
||||
|
||||
private void LoadConfigSettings()
|
||||
{
|
||||
defaultWidth = Size.Width; //Save these first so that the user can restore to its original size
|
||||
defaultHeight = Size.Height;
|
||||
|
||||
if (Global.Config.PCEBGViewerSaveWIndowPosition && Global.Config.PCEBGViewerWndx >= 0 && Global.Config.PCEBGViewerWndy >= 0)
|
||||
Location = new Point(Global.Config.PCEBGViewerWndx, Global.Config.PCEBGViewerWndy);
|
||||
}
|
||||
|
||||
private void PCEBGViewer_Load(object sender, EventArgs e)
|
||||
{
|
||||
pce = Global.Emulator as PCEngine;
|
||||
vdcComboBox.SelectedIndex = 0;
|
||||
vdcComboBox.Enabled = pce.SystemId == "SGX";
|
||||
LoadConfigSettings();
|
||||
}
|
||||
|
||||
private void PCEBGViewer_FormClosed(object sender, FormClosedEventArgs e)
|
||||
|
@ -115,5 +135,21 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.PCEBGViewerSaveWIndowPosition ^= true;
|
||||
}
|
||||
|
||||
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.PCEBGViewerAutoload ^= true;
|
||||
}
|
||||
|
||||
private void optionsToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
saveWindowPositionToolStripMenuItem.Checked = Global.Config.PCEBGViewerSaveWIndowPosition;
|
||||
autoloadToolStripMenuItem.Checked = Global.Config.PCEBGViewerAutoload;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue