Make saving main window position dependent on a Save Window Position flag that toggles from a menu item

This commit is contained in:
andres.delikat 2011-02-18 05:12:23 +00:00
parent b2e7319275
commit 8759bc5b31
3 changed files with 35 additions and 10 deletions

View File

@ -8,6 +8,7 @@
public bool AutoLoadMostRecentRom = false; //TODO: eventually make a class or struct for all the auto-loads, which will include recent roms, movies, etc, as well as autoloading any modeless dialog
public RecentFiles RecentRoms = new RecentFiles(8);
public bool PauseWhenMenuActivated = true;
public bool SaveWindowPosition = true;
public int MainWndx = -1; //Negative numbers will be ignored
public int MainWndy = -1;

View File

@ -131,6 +131,7 @@
this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.rAMPokeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
@ -840,7 +841,7 @@
// controllersToolStripMenuItem
//
this.controllersToolStripMenuItem.Name = "controllersToolStripMenuItem";
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.controllersToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.controllersToolStripMenuItem.Text = "&Controllers";
this.controllersToolStripMenuItem.Click += new System.EventHandler(this.controllersToolStripMenuItem_Click);
//
@ -848,28 +849,29 @@
//
this.hotkeysToolStripMenuItem.Enabled = false;
this.hotkeysToolStripMenuItem.Name = "hotkeysToolStripMenuItem";
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.hotkeysToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.hotkeysToolStripMenuItem.Text = "&Hotkeys";
this.hotkeysToolStripMenuItem.Click += new System.EventHandler(this.hotkeysToolStripMenuItem_Click);
//
// toolStripSeparator9
//
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new System.Drawing.Size(134, 6);
this.toolStripSeparator9.Size = new System.Drawing.Size(149, 6);
//
// soundToolStripMenuItem
//
this.soundToolStripMenuItem.Name = "soundToolStripMenuItem";
this.soundToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.soundToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.soundToolStripMenuItem.Text = "&Sound";
this.soundToolStripMenuItem.Click += new System.EventHandler(this.soundToolStripMenuItem_Click);
//
// gUIToolStripMenuItem
//
this.gUIToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.pauseWhenMenuActivatedToolStripMenuItem});
this.pauseWhenMenuActivatedToolStripMenuItem,
this.saveWindowPositionToolStripMenuItem});
this.gUIToolStripMenuItem.Name = "gUIToolStripMenuItem";
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(137, 22);
this.gUIToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.gUIToolStripMenuItem.Text = "GUI";
this.gUIToolStripMenuItem.DropDownOpened += new System.EventHandler(this.gUIToolStripMenuItem_DropDownOpened);
//
@ -960,6 +962,13 @@
this.rAMPokeToolStripMenuItem.Text = "RAM &Poke";
this.rAMPokeToolStripMenuItem.Click += new System.EventHandler(this.rAMPokeToolStripMenuItem_Click);
//
// saveWindowPositionToolStripMenuItem
//
this.saveWindowPositionToolStripMenuItem.Name = "saveWindowPositionToolStripMenuItem";
this.saveWindowPositionToolStripMenuItem.Size = new System.Drawing.Size(220, 22);
this.saveWindowPositionToolStripMenuItem.Text = "Save window position";
this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1084,6 +1093,7 @@
private System.Windows.Forms.ToolStripMenuItem pauseWhenMenuActivatedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem soundToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem rAMPokeToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveWindowPositionToolStripMenuItem;
}
}

View File

@ -17,7 +17,7 @@ namespace BizHawk.MultiClient
private Control renderTarget;
private RetainedViewportPanel retainedPanel;
private string CurrentlyOpenRom;
private int SaveSlot = 0; //Saveslot sytem
private int SaveSlot = 0; //Saveslot sytem
private bool wasPaused = false; //For handling automatic pausing when entering the menu
private int FrameAdvanceDelay = 0;
private bool EmulatorPaused = false;
@ -60,8 +60,16 @@ namespace BizHawk.MultiClient
Closing += (o, e) =>
{
CloseGame();
Global.Config.MainWndx = this.Location.X;
Global.Config.MainWndy = this.Location.Y;
if (Global.Config.SaveWindowPosition)
{
Global.Config.MainWndx = this.Location.X;
Global.Config.MainWndy = this.Location.Y;
}
else
{
Global.Config.MainWndx = -1;
Global.Config.MainWndy = -1;
}
ConfigService.Save("config.ini", Global.Config);
};
@ -108,7 +116,7 @@ namespace BizHawk.MultiClient
if (Global.Config.AutoLoadRamSearch)
LoadRamSearch();
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0)
if (Global.Config.MainWndx >= 0 && Global.Config.MainWndy >= 0 && Global.Config.SaveWindowPosition)
this.Location = new Point(Global.Config.MainWndx, Global.Config.MainWndy);
}
@ -1200,6 +1208,7 @@ namespace BizHawk.MultiClient
private void gUIToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
pauseWhenMenuActivatedToolStripMenuItem.Checked = Global.Config.PauseWhenMenuActivated;
saveWindowPositionToolStripMenuItem.Checked = Global.Config.SaveWindowPosition;
}
private void pauseWhenMenuActivatedToolStripMenuItem_Click(object sender, EventArgs e)
@ -1223,5 +1232,10 @@ namespace BizHawk.MultiClient
RamPoke r = new RamPoke();
r.Show();
}
private void saveWindowPositionToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.SaveWindowPosition ^= true;
}
}
}