NESPPU - hook up windows position saving & autoload, and hook up UpdateValues to frame loop

This commit is contained in:
andres.delikat 2011-03-08 19:05:23 +00:00
parent b16b23d335
commit 791f2bcc2f
4 changed files with 49 additions and 6 deletions

View File

@ -84,6 +84,12 @@
public int HexEditorWidth = -1; public int HexEditorWidth = -1;
public int HexEditorHeight = -1; public int HexEditorHeight = -1;
// NESPPU Setings
public bool AutoLoadNESPPU = true;
public bool NESPPUSaveWindowPosition = true;
public int NESPPUWndx = -1;
public int NESPPUWndy = -1;
//Movie Settings //Movie Settings
public RecentFiles RecentMovies = new RecentFiles(8); public RecentFiles RecentMovies = new RecentFiles(8);

View File

@ -43,6 +43,7 @@ namespace BizHawk.MultiClient
public RamWatch RamWatch1 = new RamWatch(); public RamWatch RamWatch1 = new RamWatch();
public RamSearch RamSearch1 = new RamSearch(); public RamSearch RamSearch1 = new RamSearch();
public HexEditor HexEditor1 = new HexEditor(); public HexEditor HexEditor1 = new HexEditor();
public NESPPU NESPPU1 = new NESPPU();
public MainForm(string[] args) public MainForm(string[] args)
{ {
@ -133,6 +134,8 @@ namespace BizHawk.MultiClient
LoadRamSearch(); LoadRamSearch();
if (Global.Config.AutoLoadHexEditor) if (Global.Config.AutoLoadHexEditor)
LoadHexEditor(); LoadHexEditor();
if (Global.Config.AutoLoadNESPPU && Global.Emulator is NES)
LoadNESPPU();
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition) if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition)
this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy); this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy);
@ -706,6 +709,7 @@ namespace BizHawk.MultiClient
RamWatch1.UpdateValues(); RamWatch1.UpdateValues();
RamSearch1.UpdateValues(); RamSearch1.UpdateValues();
HexEditor1.UpdateValues(); HexEditor1.UpdateValues();
NESPPU1.UpdateValues();
if (InputLog.GetMovieMode() == MOVIEMODE.RECORD) if (InputLog.GetMovieMode() == MOVIEMODE.RECORD)
InputLog.GetMnemonic(); InputLog.GetMnemonic();
} }
@ -985,6 +989,17 @@ namespace BizHawk.MultiClient
HexEditor1.Focus(); HexEditor1.Focus();
} }
private void LoadNESPPU()
{
if (!NESPPU1.IsHandleCreated || NESPPU1.IsDisposed)
{
NESPPU1 = new NESPPU();
NESPPU1.Show();
}
else
NESPPU1.Focus();
}
private int lastWidth = -1; private int lastWidth = -1;
private int lastHeight = -1; private int lastHeight = -1;
@ -1186,8 +1201,7 @@ namespace BizHawk.MultiClient
private void pPUViewerToolStripMenuItem_Click(object sender, EventArgs e) private void pPUViewerToolStripMenuItem_Click(object sender, EventArgs e)
{ {
NESPPU n = new NESPPU(); LoadNESPPU();
n.Show();
} }
private void enableRewindToolStripMenuItem_Click(object sender, EventArgs e) private void enableRewindToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -30,7 +30,7 @@
{ {
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.PalettesGroup = new System.Windows.Forms.GroupBox(); this.PalettesGroup = new System.Windows.Forms.GroupBox();
this.PaletteView = new PaletteViewer(); this.PaletteView = new BizHawk.MultiClient.PaletteViewer();
this.PalettesGroup.SuspendLayout(); this.PalettesGroup.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -55,9 +55,10 @@
// //
// PaletteView // PaletteView
// //
this.PaletteView.BackColor = System.Drawing.Color.White;
this.PaletteView.Location = new System.Drawing.Point(69, 35); this.PaletteView.Location = new System.Drawing.Point(69, 35);
this.PaletteView.Size = new System.Drawing.Size(257, 34);
this.PaletteView.Name = "PaletteView"; this.PaletteView.Name = "PaletteView";
this.PaletteView.Size = new System.Drawing.Size(257, 34);
this.PaletteView.TabIndex = 0; this.PaletteView.TabIndex = 0;
// //
// NESPPU // NESPPU
@ -67,11 +68,11 @@
this.ClientSize = new System.Drawing.Size(443, 359); this.ClientSize = new System.Drawing.Size(443, 359);
this.Controls.Add(this.PalettesGroup); this.Controls.Add(this.PalettesGroup);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "NESPPU"; this.Name = "NESPPU";
this.Text = "PPU Viewer"; this.Text = "PPU Viewer";
this.Load += new System.EventHandler(this.NESPPU_Load); this.Load += new System.EventHandler(this.NESPPU_Load);
this.PalettesGroup.ResumeLayout(false); this.PalettesGroup.ResumeLayout(false);
this.PalettesGroup.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@ -12,19 +12,41 @@ namespace BizHawk.MultiClient
{ {
public partial class NESPPU : Form public partial class NESPPU : Form
{ {
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
public NESPPU() public NESPPU()
{ {
InitializeComponent(); InitializeComponent();
Closing += (o, e) => SaveConfigSettings();
}
private void SaveConfigSettings()
{
Global.Config.NESPPUWndx = this.Location.X;
Global.Config.NESPPUWndy = 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.NESPPUWndx >= 0 && Global.Config.NESPPUWndy >= 0)
Location = new Point(Global.Config.NESPPUWndx, Global.Config.NESPPUWndy);
} }
public void UpdateValues() public void UpdateValues()
{ {
if (!(Global.Emulator is NES)) return; if (!(Global.Emulator is NES)) return;
if (!this.IsHandleCreated || this.IsDisposed) return;
PaletteView.Refresh();
} }
private void NESPPU_Load(object sender, EventArgs e) private void NESPPU_Load(object sender, EventArgs e)
{ {
LoadConfigSettings();
} }
} }
} }