move pce bg viewer to toolmanager

This commit is contained in:
adelikat 2013-11-02 22:39:23 +00:00
parent ddf0268657
commit b6d3ccf7b8
4 changed files with 31 additions and 40 deletions

View File

@ -1251,7 +1251,7 @@ namespace BizHawk.MultiClient
private void PCEBGViewerMenuItem_Click(object sender, EventArgs e) private void PCEBGViewerMenuItem_Click(object sender, EventArgs e)
{ {
LoadPCEBGViewer(); GlobalWinF.Tools.Load<PCEBGViewer>();
} }
private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e) private void PCEAlwaysPerformSpriteLimitMenuItem_Click(object sender, EventArgs e)

View File

@ -85,14 +85,12 @@ namespace BizHawk.MultiClient
private Point _windowed_location; private Point _windowed_location;
//tool dialogs //tool dialogs
private PCEBGViewer _pcebgviewer;
private ToolBox _toolbox; private ToolBox _toolbox;
private TI83KeyPad _ti83pad; private TI83KeyPad _ti83pad;
private TAStudio _tastudio; private TAStudio _tastudio;
private NESSoundConfig _nessound; private NESSoundConfig _nessound;
//TODO: this is a lazy way to refactor things, but works for now. The point is to not have these objects created until needed, without refactoring a lot of code //TODO: this is a lazy way to refactor things, but works for now. The point is to not have these objects created until needed, without refactoring a lot of code
public PCEBGViewer PCEBGViewer1 { get { if (_pcebgviewer == null) _pcebgviewer = new PCEBGViewer(); return _pcebgviewer; } set { _pcebgviewer = value; } }
public ToolBox ToolBox1 { get { if (_toolbox == null) _toolbox = new ToolBox(); return _toolbox; } set { _toolbox = value; } } public ToolBox ToolBox1 { get { if (_toolbox == null) _toolbox = new ToolBox(); return _toolbox; } set { _toolbox = value; } }
public TI83KeyPad TI83KeyPad1 { get { if (_ti83pad == null) _ti83pad = new TI83KeyPad(); return _ti83pad; } set { _ti83pad = value; } } public TI83KeyPad TI83KeyPad1 { get { if (_ti83pad == null) _ti83pad = new TI83KeyPad(); return _ti83pad; } set { _ti83pad = value; } }
public TAStudio TAStudio1 { get { if (_tastudio == null) _tastudio = new TAStudio(); return _tastudio; } set { _tastudio = value; } } public TAStudio TAStudio1 { get { if (_tastudio == null) _tastudio = new TAStudio(); return _tastudio; } set { _tastudio = value; } }
@ -371,7 +369,7 @@ namespace BizHawk.MultiClient
} }
if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine) if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine)
{ {
LoadPCEBGViewer(); GlobalWinF.Tools.Load<PCEBGViewer>();
} }
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore) if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
{ {
@ -1583,7 +1581,6 @@ namespace BizHawk.MultiClient
//} //}
GlobalWinF.Tools.Restart(); GlobalWinF.Tools.Restart();
if (_pcebgviewer != null) PCEBGViewer1.Restart();
if (_ti83pad != null) TI83KeyPad1.Restart(); if (_ti83pad != null) TI83KeyPad1.Restart();
if (_tastudio != null) TAStudio1.Restart(); if (_tastudio != null) TAStudio1.Restart();
Cheats_Restart(); Cheats_Restart();
@ -2310,10 +2307,7 @@ namespace BizHawk.MultiClient
LuaConsole1.LuaImp.CallFrameBeforeEvent(); LuaConsole1.LuaImp.CallFrameBeforeEvent();
} }
#endif #endif
GlobalWinF.Tools.UpdateBefore(); GlobalWinF.Tools.UpdateBefore();
if (_pcebgviewer != null) PCEBGViewer1.UpdateValues();
} }
public void UpdateToolsLoadstate() public void UpdateToolsLoadstate()
@ -2670,17 +2664,6 @@ namespace BizHawk.MultiClient
ToolBox1.Close(); ToolBox1.Close();
} }
public void LoadPCEBGViewer()
{
if (!PCEBGViewer1.IsHandleCreated || PCEBGViewer1.IsDisposed)
{
PCEBGViewer1 = new PCEBGViewer();
PCEBGViewer1.Show();
}
else
PCEBGViewer1.Focus();
}
public void LoadTI83KeyPad() public void LoadTI83KeyPad()
{ {
if (!TI83KeyPad1.IsHandleCreated || TI83KeyPad1.IsDisposed) if (!TI83KeyPad1.IsHandleCreated || TI83KeyPad1.IsDisposed)
@ -3027,7 +3010,6 @@ namespace BizHawk.MultiClient
RewireSound(); RewireSound();
ResetRewindBuffer(); ResetRewindBuffer();
PCEBGViewer1.Restart();
TI83KeyPad1.Restart(); TI83KeyPad1.Restart();
Cheats_Restart(); Cheats_Restart();
ToolBox1.Restart(); ToolBox1.Restart();
@ -3061,7 +3043,6 @@ namespace BizHawk.MultiClient
public void CloseTools() public void CloseTools()
{ {
CloseForm(PCEBGViewer1);
CloseForm(TI83KeyPad1); CloseForm(TI83KeyPad1);
CloseForm(TAStudio1); Global.MovieSession.EditorMode = false; CloseForm(TAStudio1); Global.MovieSession.EditorMode = false;
#if WINDOWS #if WINDOWS

View File

@ -38,6 +38,7 @@
this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.autoloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.canvas = new BizHawk.MultiClient.PCEBGCanvas();
this.groupBox5 = new System.Windows.Forms.GroupBox(); this.groupBox5 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
@ -50,7 +51,6 @@
this.TileIDLabel = new System.Windows.Forms.Label(); this.TileIDLabel = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.canvas = new BizHawk.MultiClient.PCEBGCanvas();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox5.SuspendLayout(); this.groupBox5.SuspendLayout();
@ -60,6 +60,7 @@
// //
// menuStrip1 // menuStrip1
// //
this.menuStrip1.ClickThrough = true;
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.optionsToolStripMenuItem}); this.optionsToolStripMenuItem});
@ -141,6 +142,15 @@
this.groupBox1.TabIndex = 3; this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
// canvas
//
this.canvas.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.canvas.Location = new System.Drawing.Point(8, 15);
this.canvas.Name = "canvas";
this.canvas.Size = new System.Drawing.Size(512, 513);
this.canvas.TabIndex = 0;
this.canvas.MouseMove += new System.Windows.Forms.MouseEventHandler(this.canvas_MouseMove);
//
// groupBox5 // groupBox5
// //
this.groupBox5.Controls.Add(this.label7); this.groupBox5.Controls.Add(this.label7);
@ -263,15 +273,6 @@
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
this.label1.Text = "Tile ID:"; this.label1.Text = "Tile ID:";
// //
// canvas
//
this.canvas.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.canvas.Location = new System.Drawing.Point(8, 15);
this.canvas.Name = "canvas";
this.canvas.Size = new System.Drawing.Size(512, 513);
this.canvas.TabIndex = 0;
this.canvas.MouseMove += new System.Windows.Forms.MouseEventHandler(this.canvas_MouseMove);
//
// PCEBGViewer // PCEBGViewer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -284,7 +285,7 @@
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "PCEBGViewer"; this.Name = "PCEBGViewer";
this.ShowIcon = false; this.ShowIcon = false;
this.Text = "PCE BG Viewer"; this.Text = "Background Viewer";
this.Load += new System.EventHandler(this.PCEBGViewer_Load); this.Load += new System.EventHandler(this.PCEBGViewer_Load);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();

View File

@ -8,11 +8,14 @@ using BizHawk.Emulation.Consoles.TurboGrafx;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
public partial class PCEBGViewer : Form public partial class PCEBGViewer : Form, IToolForm
{ {
private PCEngine pce; private PCEngine pce;
private int VDCtype; private int VDCtype;
public bool AskSave() { return true; }
public bool UpdateBefore { get { return true; } }
public PCEBGViewer() public PCEBGViewer()
{ {
InitializeComponent(); InitializeComponent();
@ -66,20 +69,26 @@ namespace BizHawk.MultiClient
public void Restart() public void Restart()
{ {
if (!IsHandleCreated || IsDisposed) return; if (Global.Emulator is PCEngine)
if (!(Global.Emulator is PCEngine)) {
pce = Global.Emulator as PCEngine;
}
else
{ {
Close(); Close();
return;
} }
pce = Global.Emulator as PCEngine;
} }
public void UpdateValues() public void UpdateValues()
{ {
if (!IsHandleCreated || IsDisposed) return; if (Global.Emulator is PCEngine)
if (!(Global.Emulator is PCEngine)) return; {
Generate(); Generate();
}
else
{
Close();
}
} }
private void SaveConfigSettings() private void SaveConfigSettings()