Fix crash on saving config if ram watch is closed. Refactor some config saving stuff
This commit is contained in:
parent
94ed90cc9d
commit
04bee5f950
|
@ -75,19 +75,8 @@ namespace BizHawk.MultiClient
|
|||
|
||||
Closing += (o, e) =>
|
||||
{
|
||||
CloseGame();
|
||||
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;
|
||||
}
|
||||
RamWatch1.SaveConfigSettings();
|
||||
ConfigService.Save("config.ini", Global.Config);
|
||||
CloseGame();
|
||||
SaveConfig();
|
||||
};
|
||||
|
||||
ResizeBegin += (o, e) =>
|
||||
|
@ -1068,7 +1057,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void saveConfigToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
ConfigService.Save("config.ini", Global.Config);
|
||||
SaveConfig();
|
||||
Global.RenderPanel.AddMessage("Saved settings");
|
||||
}
|
||||
|
||||
|
@ -1078,6 +1067,21 @@ namespace BizHawk.MultiClient
|
|||
Global.RenderPanel.AddMessage("Saved loaded");
|
||||
}
|
||||
|
||||
|
||||
private void SaveConfig()
|
||||
{
|
||||
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;
|
||||
}
|
||||
if (!RamWatch1.IsDisposed)
|
||||
RamWatch1.SaveConfigSettings();
|
||||
ConfigService.Save("config.ini", Global.Config);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -671,8 +671,6 @@
|
|||
this.Load += new System.EventHandler(this.RamWatch_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.RamWatch_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.RamWatch_DragEnter);
|
||||
this.Resize += new System.EventHandler(this.RamWatch_Resize);
|
||||
this.LocationChanged += new System.EventHandler(this.RamWatch_LocationChanged);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
|
|
|
@ -91,7 +91,10 @@ namespace BizHawk.MultiClient
|
|||
Global.Config.RamWatchChangeWidth = WatchListView.Columns[3].Width;
|
||||
Global.Config.RamWatchNotesWidth = WatchListView.Columns[4].Width;
|
||||
|
||||
|
||||
Global.Config.RamWatchWndx = this.Location.X;
|
||||
Global.Config.RamWatchWndy = this.Location.Y;
|
||||
Global.Config.RamWatchWidth = this.Right - this.Left;
|
||||
Global.Config.RamWatchHeight = this.Bottom - this.Top;
|
||||
}
|
||||
|
||||
public RamWatch()
|
||||
|
@ -726,32 +729,20 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void RamWatch_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.RamWatchWndx = this.Location.X;
|
||||
Global.Config.RamWatchWndy = this.Location.Y;
|
||||
}
|
||||
|
||||
private void RamWatch_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.RamWatchWidth = this.Right - this.Left;
|
||||
Global.Config.RamWatchHeight = this.Bottom - this.Top;
|
||||
}
|
||||
|
||||
private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Size = new System.Drawing.Size(defaultWidth, defaultHeight);
|
||||
WatchListView.Columns[0].Width = Global.Config.RamWatchAddressWidth;
|
||||
WatchListView.Columns[1].Width = Global.Config.RamWatchValueWidth;
|
||||
WatchListView.Columns[0].Width = 59; //Address
|
||||
WatchListView.Columns[1].Width = 59; //Value
|
||||
if (showPreviousValueToolStripMenuItem.Checked)
|
||||
WatchListView.Columns[2].Width = Global.Config.RamWatchPrevWidth;
|
||||
WatchListView.Columns[2].Width = 59; //Prev
|
||||
else
|
||||
WatchListView.Columns[2].Width = 0;
|
||||
if (showChangeCountsToolStripMenuItem.Checked)
|
||||
WatchListView.Columns[3].Width = Global.Config.RamWatchChangeWidth;
|
||||
WatchListView.Columns[3].Width = 54; //Change counts
|
||||
else
|
||||
WatchListView.Columns[3].Width = 0;
|
||||
WatchListView.Columns[4].Width = Global.Config.RamWatchNotesWidth;
|
||||
WatchListView.Columns[4].Width = 130; //Notes
|
||||
}
|
||||
|
||||
private void newToolStripButton_Click(object sender, EventArgs e)
|
||||
|
|
Loading…
Reference in New Issue