update some pce tools to use autoconfig/configpersist

This commit is contained in:
goyuken 2014-12-21 16:59:36 +00:00
parent ed6082cab3
commit 66b557ce93
7 changed files with 30 additions and 224 deletions

View File

@ -418,10 +418,6 @@ namespace BizHawk.Client.Common
public ToolDialogSettings SmsVdpSettings = new ToolDialogSettings();
public bool SmsVdpAutoLoad = false;
// PCE VDP Viewer Settings
public ToolDialogSettings PceVdpSettings = new ToolDialogSettings();
public bool PceVdpAutoLoad = false;
// SNES Graphics Debugger Dialog Settings
public bool AutoLoadSNESGraphicsDebugger = false;
public bool SNESGraphicsDebuggerSaveWindowPosition = true;
@ -431,11 +427,6 @@ namespace BizHawk.Client.Common
public bool SNESGraphicsUseUserBackdropColor = false;
public int SNESGraphicsUserBackdropColor = -1;
// PCE BG Viewer settings
public ToolDialogSettings PceBgViewerSettings = new ToolDialogSettings();
public bool PCEBGViewerAutoload = false;
public int PCEBGViewerRefreshRate = 16;
// PCE CDL settings
public ToolDialogSettings PceCdlSettings = new ToolDialogSettings();
public RecentFiles RecentPceCdlFiles = new RecentFiles(8);

View File

@ -402,16 +402,6 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.Load<SmsVDPViewer>();
}
if (Global.Config.PCEBGViewerAutoload)
{
GlobalWin.Tools.Load<PceBgViewer>();
}
if (Global.Config.PceVdpAutoLoad)
{
GlobalWin.Tools.Load<PCETileViewer>();
}
if (Global.Config.RecentPceCdlFiles.AutoLoad)
{
GlobalWin.Tools.Load<PCECDL>();

View File

@ -9,7 +9,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class NESNameTableViewer : Form, IToolForm
public partial class NESNameTableViewer : Form, IToolFormAutoConfig
{
// TODO:
// Show Scroll Lines + UI Toggle

View File

@ -35,11 +35,6 @@
this.VDC2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.AutoloadMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SaveWindowPositionMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.canvas = new BizHawk.Client.EmuHawk.PCEBGCanvas();
this.groupBox5 = new System.Windows.Forms.GroupBox();
@ -65,8 +60,7 @@
//
this.PceBgViewerMenu.ClickThrough = true;
this.PceBgViewerMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ViewerSubMenu,
this.OptionsSubMenu});
this.ViewerSubMenu});
this.PceBgViewerMenu.Location = new System.Drawing.Point(0, 0);
this.PceBgViewerMenu.Name = "PceBgViewerMenu";
this.PceBgViewerMenu.Size = new System.Drawing.Size(676, 24);
@ -81,77 +75,37 @@
this.toolStripSeparator1,
this.ExitMenuItem});
this.ViewerSubMenu.Name = "ViewerSubMenu";
this.ViewerSubMenu.Size = new System.Drawing.Size(54, 20);
this.ViewerSubMenu.Size = new System.Drawing.Size(51, 20);
this.ViewerSubMenu.Text = "&Viewer";
this.ViewerSubMenu.DropDownOpened += new System.EventHandler(this.FileSubMenu_DropDownOpened);
//
// VDC1MenuItem
//
this.VDC1MenuItem.Name = "VDC1MenuItem";
this.VDC1MenuItem.Size = new System.Drawing.Size(134, 22);
this.VDC1MenuItem.Size = new System.Drawing.Size(152, 22);
this.VDC1MenuItem.Text = "VDC&1";
this.VDC1MenuItem.Click += new System.EventHandler(this.VDC1MenuItem_Click);
//
// VDC2MenuItem
//
this.VDC2MenuItem.Name = "VDC2MenuItem";
this.VDC2MenuItem.Size = new System.Drawing.Size(134, 22);
this.VDC2MenuItem.Size = new System.Drawing.Size(152, 22);
this.VDC2MenuItem.Text = "VCD&2";
this.VDC2MenuItem.Click += new System.EventHandler(this.VDC2MenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(131, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
//
// ExitMenuItem
//
this.ExitMenuItem.Name = "ExitMenuItem";
this.ExitMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.ExitMenuItem.Size = new System.Drawing.Size(134, 22);
this.ExitMenuItem.Size = new System.Drawing.Size(152, 22);
this.ExitMenuItem.Text = "E&xit";
this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click);
//
// OptionsSubMenu
//
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.AutoloadMenuItem,
this.SaveWindowPositionMenuItem,
this.AlwaysOnTopMenuItem,
this.FloatingWindowMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.OptionsSubMenu.Text = "&Options";
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
//
// AutoloadMenuItem
//
this.AutoloadMenuItem.Name = "AutoloadMenuItem";
this.AutoloadMenuItem.Size = new System.Drawing.Size(191, 22);
this.AutoloadMenuItem.Text = "&Autoload";
this.AutoloadMenuItem.Click += new System.EventHandler(this.AutoloadMenuItem_Click);
//
// SaveWindowPositionMenuItem
//
this.SaveWindowPositionMenuItem.Name = "SaveWindowPositionMenuItem";
this.SaveWindowPositionMenuItem.Size = new System.Drawing.Size(191, 22);
this.SaveWindowPositionMenuItem.Text = "&Save Window position";
this.SaveWindowPositionMenuItem.Click += new System.EventHandler(this.SaveWindowPositionMenuItem_Click);
//
// AlwaysOnTopMenuItem
//
this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem";
this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(191, 22);
this.AlwaysOnTopMenuItem.Text = "Always On Top";
this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click);
//
// FloatingWindowMenuItem
//
this.FloatingWindowMenuItem.Name = "FloatingWindowMenuItem";
this.FloatingWindowMenuItem.Size = new System.Drawing.Size(191, 22);
this.FloatingWindowMenuItem.Text = "Floating Window";
this.FloatingWindowMenuItem.Click += new System.EventHandler(this.FloatingWindowMenuItem_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.canvas);
@ -208,7 +162,7 @@
this.RefreshRate.Minimum = 1;
this.RefreshRate.Name = "RefreshRate";
this.RefreshRate.Orientation = System.Windows.Forms.Orientation.Vertical;
this.RefreshRate.Size = new System.Drawing.Size(45, 136);
this.RefreshRate.Size = new System.Drawing.Size(42, 136);
this.RefreshRate.TabIndex = 0;
this.RefreshRate.TickFrequency = 4;
this.RefreshRate.Value = 16;
@ -324,10 +278,7 @@
private PCEBGCanvas canvas;
private MenuStripEx PceBgViewerMenu;
private System.Windows.Forms.ToolStripMenuItem ViewerSubMenu;
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
private System.Windows.Forms.ToolStripMenuItem AutoloadMenuItem;
private System.Windows.Forms.ToolStripMenuItem SaveWindowPositionMenuItem;
private System.Windows.Forms.ToolStripMenuItem ViewerSubMenu;
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
private System.Windows.Forms.ToolStripMenuItem VDC1MenuItem;
private System.Windows.Forms.ToolStripMenuItem VDC2MenuItem;
@ -345,7 +296,5 @@
private System.Windows.Forms.Label TileIDLabel;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem;
}
}

View File

@ -9,46 +9,38 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class PceBgViewer : Form, IToolForm
public partial class PceBgViewer : Form, IToolFormAutoConfig
{
[RequiredService]
private PCEngine _pce { get; set; }
[ConfigPersist]
private int RefreshRateConfig
{
get
{
return RefreshRate.Value;
}
set
{
RefreshRate.Value = Math.Max(Math.Min(value, RefreshRate.Maximum), RefreshRate.Minimum);
}
}
private int _vdcType;
public PceBgViewer()
{
InitializeComponent();
TopMost = Global.Config.PceBgViewerSettings.TopMost;
Activated += (o, e) => Generate();
Closing += (o, e) =>
{
Global.Config.PceBgViewerSettings.Wndx = Location.X;
Global.Config.PceBgViewerSettings.Wndy = Location.Y;
Global.Config.PCEBGViewerRefreshRate = RefreshRate.Value;
};
}
private void PceBgViewer_Load(object sender, EventArgs e)
{
if (Global.Config.PceBgViewerSettings.UseWindowPosition)
{
Location = Global.Config.PceBgViewerSettings.WindowPosition;
}
if (Global.Config.PCEBGViewerRefreshRate >= RefreshRate.Minimum && Global.Config.PCEBGViewerRefreshRate <= RefreshRate.Maximum)
{
RefreshRate.Value = Global.Config.PCEBGViewerRefreshRate;
}
else
{
RefreshRate.Value = RefreshRate.Maximum;
}
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.PceBgViewerSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
#region Public API
@ -146,36 +138,6 @@ namespace BizHawk.Client.EmuHawk
Close();
}
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
SaveWindowPositionMenuItem.Checked = Global.Config.PceBgViewerSettings.SaveWindowPosition;
AutoloadMenuItem.Checked = Global.Config.PCEBGViewerAutoload;
AlwaysOnTopMenuItem.Checked = Global.Config.PceBgViewerSettings.TopMost;
FloatingWindowMenuItem.Checked = Global.Config.PceBgViewerSettings.FloatingWindow;
}
private void AutoloadMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PCEBGViewerAutoload ^= true;
}
private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceBgViewerSettings.SaveWindowPosition ^= true;
}
private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceBgViewerSettings.TopMost ^= true;
TopMost = Global.Config.PceBgViewerSettings.TopMost;
}
private void FloatingWindowMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceBgViewerSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
#endregion
#region Dialog and Controls

View File

@ -43,11 +43,6 @@
this.saveSpriteScreenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.closeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.alwaysOnTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.floatingWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.menuStrip1.SuspendLayout();
@ -133,8 +128,7 @@
//
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.FileSubMenu,
this.OptionsSubMenu});
this.FileSubMenu});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(810, 24);
@ -149,76 +143,36 @@
this.toolStripSeparator1,
this.closeToolStripMenuItem});
this.FileSubMenu.Name = "FileSubMenu";
this.FileSubMenu.Size = new System.Drawing.Size(37, 20);
this.FileSubMenu.Size = new System.Drawing.Size(35, 20);
this.FileSubMenu.Text = "&File";
//
// saveBackgroundScreenshotToolStripMenuItem
//
this.saveBackgroundScreenshotToolStripMenuItem.Name = "saveBackgroundScreenshotToolStripMenuItem";
this.saveBackgroundScreenshotToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.saveBackgroundScreenshotToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.saveBackgroundScreenshotToolStripMenuItem.Text = "Save BG Screenshot...";
this.saveBackgroundScreenshotToolStripMenuItem.Click += new System.EventHandler(this.saveBackgroundScreenshotToolStripMenuItem_Click);
//
// saveSpriteScreenshotToolStripMenuItem
//
this.saveSpriteScreenshotToolStripMenuItem.Name = "saveSpriteScreenshotToolStripMenuItem";
this.saveSpriteScreenshotToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.saveSpriteScreenshotToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.saveSpriteScreenshotToolStripMenuItem.Text = "Save Sprite Screenshot...";
this.saveSpriteScreenshotToolStripMenuItem.Click += new System.EventHandler(this.saveSpriteScreenshotToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(198, 6);
this.toolStripSeparator1.Size = new System.Drawing.Size(195, 6);
//
// closeToolStripMenuItem
//
this.closeToolStripMenuItem.Name = "closeToolStripMenuItem";
this.closeToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.closeToolStripMenuItem.Size = new System.Drawing.Size(201, 22);
this.closeToolStripMenuItem.Size = new System.Drawing.Size(198, 22);
this.closeToolStripMenuItem.Text = "&Close";
this.closeToolStripMenuItem.Click += new System.EventHandler(this.closeToolStripMenuItem_Click);
//
// OptionsSubMenu
//
this.OptionsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.autoloadToolStripMenuItem,
this.saveWindowPositionToolStripMenuItem,
this.alwaysOnTopToolStripMenuItem,
this.floatingWindowToolStripMenuItem});
this.OptionsSubMenu.Name = "OptionsSubMenu";
this.OptionsSubMenu.Size = new System.Drawing.Size(61, 20);
this.OptionsSubMenu.Text = "&Options";
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
//
// autoloadToolStripMenuItem
//
this.autoloadToolStripMenuItem.Name = "autoloadToolStripMenuItem";
this.autoloadToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.autoloadToolStripMenuItem.Text = "&Autoload";
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);
//
// alwaysOnTopToolStripMenuItem
//
this.alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
this.alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.alwaysOnTopToolStripMenuItem.Text = "Always On Top";
this.alwaysOnTopToolStripMenuItem.Click += new System.EventHandler(this.alwaysOnTopToolStripMenuItem_Click);
//
// floatingWindowToolStripMenuItem
//
this.floatingWindowToolStripMenuItem.Name = "floatingWindowToolStripMenuItem";
this.floatingWindowToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.floatingWindowToolStripMenuItem.Text = "Floating Window";
this.floatingWindowToolStripMenuItem.Click += new System.EventHandler(this.floatingWindowToolStripMenuItem_Click);
//
// PCETileViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -261,10 +215,5 @@
private System.Windows.Forms.ToolStripMenuItem saveBackgroundScreenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveSpriteScreenshotToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu;
private System.Windows.Forms.ToolStripMenuItem autoloadToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem alwaysOnTopToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem floatingWindowToolStripMenuItem;
}
}

View File

@ -14,7 +14,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
public partial class PCETileViewer : Form, IToolForm
public partial class PCETileViewer : Form, IToolFormAutoConfig
{
[RequiredService]
public PCEngine emu { get; private set; }
@ -233,48 +233,13 @@ namespace BizHawk.Client.EmuHawk
bmpViewSP.SaveFile();
}
private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e)
{
autoloadToolStripMenuItem.Checked = Global.Config.PceVdpAutoLoad;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.PceVdpSettings.SaveWindowPosition;
alwaysOnTopToolStripMenuItem.Checked = Global.Config.PceVdpSettings.TopMost;
floatingWindowToolStripMenuItem.Checked = Global.Config.PceVdpSettings.FloatingWindow;
}
private void autoloadToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceVdpAutoLoad ^= true;
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceVdpSettings.SaveWindowPosition ^= true;
}
private void alwaysOnTopToolStripMenuItem_Click(object sender, EventArgs e)
{
TopMost = Global.Config.PceVdpSettings.TopMost ^= true;
}
private void floatingWindowToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.PceVdpSettings.FloatingWindow ^= true;
RefreshFloatingWindowControl();
}
private void PCETileViewer_Load(object sender, EventArgs e)
{
vce = emu.VCE;
TopMost = Global.Config.PceVdpSettings.TopMost;
if (Global.Config.PceVdpSettings.UseWindowPosition)
{
Location = Global.Config.PceVdpSettings.WindowPosition;
}
}
private void RefreshFloatingWindowControl()
{
Owner = Global.Config.PceVdpSettings.FloatingWindow ? null : GlobalWin.MainForm;
}
protected override void OnShown(EventArgs e)