Ram Watch - save column width settings to config

This commit is contained in:
andres.delikat 2011-02-25 02:36:52 +00:00
parent cbdcea1341
commit 94ed90cc9d
4 changed files with 64 additions and 32 deletions

View File

@ -57,6 +57,11 @@
public bool RamWatchShowChangeColumn = true;
public bool RamWatchShowPrevColumn = false;
public bool RamWatchShowChangeFromPrev = true;
public int RamWatchAddressWidth = 59;
public int RamWatchValueWidth = 59;
public int RamWatchPrevWidth = 59;
public int RamWatchChangeWidth = 54;
public int RamWatchNotesWidth = 130;
// RamSearch Settings
public bool AutoLoadRamSearch = false;

View File

@ -86,6 +86,7 @@ namespace BizHawk.MultiClient
Global.Config.MainWndx = -1;
Global.Config.MainWndy = -1;
}
RamWatch1.SaveConfigSettings();
ConfigService.Save("config.ini", Global.Config);
};
@ -135,6 +136,8 @@ namespace BizHawk.MultiClient
if (Global.Config.StartPaused)
PauseEmulator();
}
void SetSpeedPercent(int value)
@ -1075,5 +1078,6 @@ namespace BizHawk.MultiClient
Global.RenderPanel.AddMessage("Saved loaded");
}
}
}

View File

@ -59,6 +59,7 @@
this.showChangeCountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showPreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.prevValueShowsChangeAmountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.WatchListView = new BizHawk.VirtualListView();
this.Address = new System.Windows.Forms.ColumnHeader();
this.Value = new System.Windows.Forms.ColumnHeader();
@ -91,7 +92,6 @@
this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton();
this.WatchCountLabel = new System.Windows.Forms.Label();
this.MessageLabel = new System.Windows.Forms.Label();
this.prevValueShowsChangeAmountToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
this.contextMenuStrip1.SuspendLayout();
this.toolStrip1.SuspendLayout();
@ -313,8 +313,8 @@
this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.showChangeCountsToolStripMenuItem,
this.showPreviousValueToolStripMenuItem,
this.restoreWindowSizeToolStripMenuItem,
this.prevValueShowsChangeAmountToolStripMenuItem});
this.prevValueShowsChangeAmountToolStripMenuItem,
this.restoreWindowSizeToolStripMenuItem});
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
this.optionsToolStripMenuItem.Text = "&Options";
@ -325,24 +325,31 @@
this.showChangeCountsToolStripMenuItem.Checked = true;
this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem";
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.showChangeCountsToolStripMenuItem.Text = "Show Change Counts";
this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.showChangeCountsToolStripMenuItem.Text = "Change Counts";
this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click);
//
// showPreviousValueToolStripMenuItem
//
this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem";
this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.showPreviousValueToolStripMenuItem.Text = "Show Previous Value";
this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.showPreviousValueToolStripMenuItem.Text = "Previous Value";
this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click);
//
// restoreWindowSizeToolStripMenuItem
//
this.restoreWindowSizeToolStripMenuItem.Name = "restoreWindowSizeToolStripMenuItem";
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.restoreWindowSizeToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.restoreWindowSizeToolStripMenuItem.Text = "Restore Window Size";
this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click);
//
// prevValueShowsChangeAmountToolStripMenuItem
//
this.prevValueShowsChangeAmountToolStripMenuItem.Name = "prevValueShowsChangeAmountToolStripMenuItem";
this.prevValueShowsChangeAmountToolStripMenuItem.Size = new System.Drawing.Size(191, 22);
this.prevValueShowsChangeAmountToolStripMenuItem.Text = "Prev Value as change";
this.prevValueShowsChangeAmountToolStripMenuItem.Click += new System.EventHandler(this.prevValueShowsChangeAmountToolStripMenuItem_Click);
//
// WatchListView
//
this.WatchListView.AllowColumnReorder = true;
@ -645,13 +652,6 @@
this.MessageLabel.TabIndex = 5;
this.MessageLabel.Text = " ";
//
// prevValueShowsChangeAmountToolStripMenuItem
//
this.prevValueShowsChangeAmountToolStripMenuItem.Name = "prevValueShowsChangeAmountToolStripMenuItem";
this.prevValueShowsChangeAmountToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
this.prevValueShowsChangeAmountToolStripMenuItem.Text = "Prev Value - Show change";
this.prevValueShowsChangeAmountToolStripMenuItem.Click += new System.EventHandler(this.prevValueShowsChangeAmountToolStripMenuItem_Click);
//
// RamWatch
//
this.AllowDrop = true;

View File

@ -62,12 +62,46 @@ namespace BizHawk.MultiClient
DisplayWatchList();
}
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.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0)
Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy);
if (Global.Config.RamWatchWidth >= 0 && Global.Config.RamWatchHeight >= 0)
{
Size = new System.Drawing.Size(Global.Config.RamWatchWidth, Global.Config.RamWatchHeight);
}
SetPrevColumn(Global.Config.RamWatchShowPrevColumn);
SetChangesColumn(Global.Config.RamWatchShowChangeColumn);
WatchListView.Columns[0].Width = Global.Config.RamWatchAddressWidth;
WatchListView.Columns[1].Width = Global.Config.RamWatchValueWidth;
WatchListView.Columns[2].Width = Global.Config.RamWatchPrevWidth;
WatchListView.Columns[3].Width = Global.Config.RamWatchChangeWidth;
WatchListView.Columns[4].Width = Global.Config.RamWatchNotesWidth;
}
public void SaveConfigSettings()
{
Global.Config.RamWatchAddressWidth = WatchListView.Columns[0].Width;
Global.Config.RamWatchValueWidth = WatchListView.Columns[1].Width;
Global.Config.RamWatchPrevWidth = WatchListView.Columns[2].Width;
Global.Config.RamWatchChangeWidth = WatchListView.Columns[3].Width;
Global.Config.RamWatchNotesWidth = WatchListView.Columns[4].Width;
}
public RamWatch()
{
InitializeComponent();
WatchListView.QueryItemText += new QueryItemTextHandler(WatchListView_QueryItemText);
WatchListView.QueryItemBkColor += new QueryItemBkColorHandler(WatchListView_QueryItemBkColor);
WatchListView.VirtualMode = true;
Closing += (o, e) => SaveConfigSettings();
}
protected override void OnClosing(CancelEventArgs e)
@ -610,18 +644,7 @@ namespace BizHawk.MultiClient
private void RamWatch_Load(object sender, EventArgs e)
{
defaultWidth = this.Size.Width; //Save these first so that the user can restore to its original size
defaultHeight = this.Size.Height;
if (Global.Config.RamWatchWndx >= 0 && Global.Config.RamWatchWndy >= 0)
this.Location = new Point(Global.Config.RamWatchWndx, Global.Config.RamWatchWndy);
if (Global.Config.RamWatchWidth >= 0 && Global.Config.RamWatchHeight >= 0)
{
this.Size = new System.Drawing.Size(Global.Config.RamWatchWidth, Global.Config.RamWatchHeight);
}
SetPrevColumn(Global.Config.RamWatchShowPrevColumn);
SetChangesColumn(Global.Config.RamWatchShowChangeColumn);
LoadConfigSettings();
}
private void filesToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
@ -718,17 +741,17 @@ namespace BizHawk.MultiClient
private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Size = new System.Drawing.Size(defaultWidth, defaultHeight);
WatchListView.Columns[0].Width = 59; //Address
WatchListView.Columns[1].Width = 59; //Value
WatchListView.Columns[0].Width = Global.Config.RamWatchAddressWidth;
WatchListView.Columns[1].Width = Global.Config.RamWatchValueWidth;
if (showPreviousValueToolStripMenuItem.Checked)
WatchListView.Columns[2].Width = 59; //Prev
WatchListView.Columns[2].Width = Global.Config.RamWatchPrevWidth;
else
WatchListView.Columns[2].Width = 0;
if (showChangeCountsToolStripMenuItem.Checked)
WatchListView.Columns[3].Width = 54; //Change counts
WatchListView.Columns[3].Width = Global.Config.RamWatchChangeWidth;
else
WatchListView.Columns[3].Width = 0;
WatchListView.Columns[4].Width = 150; //Notes
WatchListView.Columns[4].Width = Global.Config.RamWatchNotesWidth;
}
private void newToolStripButton_Click(object sender, EventArgs e)