UI: Save/restore window position

This commit is contained in:
Souryo 2017-05-01 23:17:51 -04:00
parent 91b93a9cf3
commit 682b6d1d36
2 changed files with 12 additions and 0 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
@ -29,6 +30,7 @@ namespace Mesen.GUI.Config
public PlayerProfile Profile;
public DebugInfo DebugInfo;
public AviRecordInfo AviRecordInfo;
public Point? WindowLocation;
public Configuration()
{

View File

@ -48,6 +48,11 @@ namespace Mesen.GUI.Forms
{
InitializeComponent();
if(ConfigManager.Config.WindowLocation.HasValue) {
this.StartPosition = FormStartPosition.Manual;
this.Location = ConfigManager.Config.WindowLocation.Value;
}
_commandLineArgs = args;
Application.AddMessageFilter(this);
@ -175,6 +180,11 @@ namespace Mesen.GUI.Forms
ConfigManager.Config.EmulationInfo.EmulationSpeed = InteropEmu.GetEmulationSpeed();
ConfigManager.Config.VideoInfo.VideoScale = _regularScale;
if(this.WindowState == FormWindowState.Normal) {
ConfigManager.Config.WindowLocation = this.Location;
} else {
ConfigManager.Config.WindowLocation = this.RestoreBounds.Location;
}
ConfigManager.ApplyChanges();
StopEmu();