Virtual Pad tool - save window position, Ram Watch - restore defaults should set Save Window Position to true, not false

This commit is contained in:
adelikat 2012-12-08 18:35:12 +00:00
parent 3f35c9505a
commit 8b08946c41
4 changed files with 59 additions and 9 deletions

View File

@ -544,6 +544,8 @@ namespace BizHawk.MultiClient
public bool VirtualPadSticky = true;
public int VPadWndx = -1;
public int VPadWndy = -1;
public int VPadWidth = -1;
public int VPadHeight = -1;
// NES Game Genie Encoder/Decoder
public bool NESGGAutoload = false;

View File

@ -813,7 +813,7 @@ namespace BizHawk.MultiClient
WatchListView.Columns[5].Width = 55;
WatchListView.Columns[6].Width = 128;
Global.Config.DisplayRamWatch = false;
Global.Config.RamWatchSaveWindowPosition = false;
Global.Config.RamWatchSaveWindowPosition = true;
}
private void newToolStripButton_Click(object sender, EventArgs e)

View File

@ -40,6 +40,8 @@
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.StickyBox = new System.Windows.Forms.CheckBox();
this.restoreDefaultSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.contextMenuStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@ -87,6 +89,8 @@
this.autolaodToolStripMenuItem,
this.saveWindowPositionToolStripMenuItem,
this.toolStripSeparator2,
this.restoreDefaultSettingsToolStripMenuItem,
this.toolStripSeparator1,
this.exitToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
@ -96,27 +100,27 @@
// autolaodToolStripMenuItem
//
this.autolaodToolStripMenuItem.Name = "autolaodToolStripMenuItem";
this.autolaodToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.autolaodToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.autolaodToolStripMenuItem.Text = "&Autoload";
this.autolaodToolStripMenuItem.Click += new System.EventHandler(this.autolaodToolStripMenuItem_Click);
//
// saveWindowPositionToolStripMenuItem
//
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.saveWindowPositionToolStripMenuItem.Text = "&Save Window Position";
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(188, 6);
this.toolStripSeparator2.Size = new System.Drawing.Size(196, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@ -132,6 +136,18 @@
this.StickyBox.UseVisualStyleBackColor = true;
this.StickyBox.CheckedChanged += new System.EventHandler(this.StickyBox_CheckedChanged);
//
// restoreDefaultSettingsToolStripMenuItem
//
this.restoreDefaultSettingsToolStripMenuItem.Name = "restoreDefaultSettingsToolStripMenuItem";
this.restoreDefaultSettingsToolStripMenuItem.Size = new System.Drawing.Size(199, 22);
this.restoreDefaultSettingsToolStripMenuItem.Text = "Restore Default Settings";
this.restoreDefaultSettingsToolStripMenuItem.Click += new System.EventHandler(this.restoreDefaultSettingsToolStripMenuItem_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(196, 6);
//
// VirtualPadForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -166,5 +182,7 @@
private System.Windows.Forms.CheckBox StickyBox;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem restoreDefaultSettingsToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
}
}

View File

@ -11,9 +11,9 @@ namespace BizHawk.MultiClient
{
public partial class VirtualPadForm : Form
{
//TODO: clicky vs sticky
//Remember window size
//Restore defaults
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
int defaultHeight;
List<IVirtualPad> Pads = new List<IVirtualPad>();
@ -25,6 +25,15 @@ namespace BizHawk.MultiClient
private void VirtualPadForm_Load(object sender, EventArgs e)
{
LoadConfigSettings();
LoadPads();
}
private void LoadConfigSettings()
{
defaultWidth = Size.Width; //Save these first so that the user can restore to its original size
defaultHeight = Size.Height;
StickyBox.Checked = Global.Config.VirtualPadSticky;
if (Global.Config.VirtualPadSaveWindowPosition && Global.Config.VPadWndx >= 0 && Global.Config.VPadWndy >= 0)
@ -32,13 +41,20 @@ namespace BizHawk.MultiClient
this.Location = new Point(Global.Config.VPadWndx, Global.Config.VPadWndy);
}
LoadPads();
if (Global.Config.VirtualPadSaveWindowPosition && Global.Config.VPadWidth >= 0 && Global.Config.VPadHeight >= 0)
{
Size = new System.Drawing.Size(Global.Config.VPadWidth, Global.Config.VPadHeight);
}
}
private void SaveConfigSettings()
{
Global.Config.VPadWndx = this.Location.X;
Global.Config.VPadWndy = this.Location.Y;
Global.Config.VPadWidth = this.Right - this.Left;
Global.Config.VPadHeight = this.Bottom - this.Top;
Pads.Clear();
}
@ -338,6 +354,20 @@ namespace BizHawk.MultiClient
{
ClearVirtualPadHolds();
}
private void restoreDefaultSettingsToolStripMenuItem_Click(object sender, EventArgs e)
{
RestoreDefaultSettings();
}
private void RestoreDefaultSettings()
{
this.Size = new System.Drawing.Size(defaultWidth, defaultHeight);
Global.Config.VirtualPadSaveWindowPosition = true;
Global.Config.VPadHeight = -1;
Global.Config.VPadWidth = -1;
}
}
}