From 6440c9c44b9966033e27936b6a2b88e5c6c1f67b Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 1 Jan 2015 00:47:22 +0000 Subject: [PATCH] Ram Watch - convert to ConfigPersist, and do column stuff the new way --- BizHawk.Client.Common/config/Config.cs | 31 +-- .../tools/Watch/RamWatch.Designer.cs | 117 +-------- .../tools/Watch/RamWatch.cs | 241 +++++------------- 3 files changed, 63 insertions(+), 326 deletions(-) diff --git a/BizHawk.Client.Common/config/Config.cs b/BizHawk.Client.Common/config/Config.cs index 4338d11856..058ba85fa2 100644 --- a/BizHawk.Client.Common/config/Config.cs +++ b/BizHawk.Client.Common/config/Config.cs @@ -240,37 +240,8 @@ namespace BizHawk.Client.Common public bool AutoLoadLuaConsole = false; public bool DisableLuaScriptsOnLoad = false; - // RamWatch Settings - public ToolDialogSettings RamWatchSettings = new ToolDialogSettings(); + // Watch Settings public RecentFiles RecentWatches = new RecentFiles(8); - public bool RamWatchShowAddressColumn = true; - public bool RamWatchShowChangeColumn = true; - public bool RamWatchShowPrevColumn = false; - public bool RamWatchShowDiffColumn = false; - public bool RamWatchShowDomainColumn = true; - - public Dictionary RamWatchColumnWidths = new Dictionary - { - { "AddressColumn", -1 }, - { "ValueColumn", -1 }, - { "PrevColumn", -1 }, - { "ChangesColumn", -1 }, - { "DiffColumn", -1 }, - { "DomainColumn", -1 }, - { "NotesColumn",-1 }, - }; - - public Dictionary RamWatchColumnIndexes = new Dictionary - { - { "AddressColumn", 0 }, - { "ValueColumn", 1 }, - { "PrevColumn", 2 }, - { "ChangesColumn", 3 }, - { "DiffColumn", 4 }, - { "DomainColumn", 5 }, - { "NotesColumn", 6 }, - }; - public Watch.PreviousType RamWatchDefinePrevious = Watch.PreviousType.LastFrame; // RamSearch Settings diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs index 1290fda11b..91bda36d88 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.Designer.cs @@ -44,11 +44,6 @@ this.InsertSeperatorContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MoveUpContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.MoveDownContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); - this.ShowPreviousValueContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowChangeCountsContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowDiffContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowDomainContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1 = new StatusStripEx(); this.ErrorIconButton = new System.Windows.Forms.ToolStripButton(); this.MessageLabel = new System.Windows.Forms.ToolStripStatusLabel(); @@ -110,12 +105,6 @@ this.FloatingWindowMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.RestoreWindowSizeMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ColumnsSubMenu = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowAddressMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowPreviousMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowChangesMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowDiffMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.ShowDomainMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.WatchListView = new BizHawk.Client.EmuHawk.VirtualListView(); this.AddressColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ValueColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -162,14 +151,9 @@ this.Separator6, this.InsertSeperatorContextMenuItem, this.MoveUpContextMenuItem, - this.MoveDownContextMenuItem, - this.toolStripSeparator4, - this.ShowPreviousValueContextMenuItem, - this.ShowChangeCountsContextMenuItem, - this.ShowDiffContextMenuItem, - this.ShowDomainContextMenuItem}); + this.MoveDownContextMenuItem}); this.ListViewContextMenu.Name = "contextMenuStrip1"; - this.ListViewContextMenu.Size = new System.Drawing.Size(204, 324); + this.ListViewContextMenu.Size = new System.Drawing.Size(204, 230); this.ListViewContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ListViewContextMenu_Opening); // // EditContextMenuItem @@ -264,39 +248,6 @@ this.MoveDownContextMenuItem.Text = "Move &Down"; this.MoveDownContextMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click); // - // toolStripSeparator4 - // - this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(200, 6); - // - // ShowPreviousValueContextMenuItem - // - this.ShowPreviousValueContextMenuItem.Name = "ShowPreviousValueContextMenuItem"; - this.ShowPreviousValueContextMenuItem.Size = new System.Drawing.Size(203, 22); - this.ShowPreviousValueContextMenuItem.Text = "Show Previous Value"; - this.ShowPreviousValueContextMenuItem.Click += new System.EventHandler(this.ShowPreviousMenuItem_Click); - // - // ShowChangeCountsContextMenuItem - // - this.ShowChangeCountsContextMenuItem.Name = "ShowChangeCountsContextMenuItem"; - this.ShowChangeCountsContextMenuItem.Size = new System.Drawing.Size(203, 22); - this.ShowChangeCountsContextMenuItem.Text = "Show Change Counts"; - this.ShowChangeCountsContextMenuItem.Click += new System.EventHandler(this.ShowChangesMenuItem_Click); - // - // ShowDiffContextMenuItem - // - this.ShowDiffContextMenuItem.Name = "ShowDiffContextMenuItem"; - this.ShowDiffContextMenuItem.Size = new System.Drawing.Size(203, 22); - this.ShowDiffContextMenuItem.Text = "Show Difference"; - this.ShowDiffContextMenuItem.Click += new System.EventHandler(this.ShowDiffMenuItem_Click); - // - // ShowDomainContextMenuItem - // - this.ShowDomainContextMenuItem.Name = "ShowDomainContextMenuItem"; - this.ShowDomainContextMenuItem.Size = new System.Drawing.Size(203, 22); - this.ShowDomainContextMenuItem.Text = "Show Domain"; - this.ShowDomainContextMenuItem.Click += new System.EventHandler(this.ShowDomainMenuItem_Click); - // // statusStrip1 // this.statusStrip1.ClickThrough = true; @@ -520,8 +471,7 @@ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.FileSubMenu, this.WatchesSubMenu, - this.OptionsSubMenu, - this.ColumnsSubMenu}); + this.OptionsSubMenu}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(364, 24); @@ -861,56 +811,6 @@ this.RestoreWindowSizeMenuItem.Text = "Restore Default Settings"; this.RestoreWindowSizeMenuItem.Click += new System.EventHandler(this.RestoreWindowSizeMenuItem_Click); // - // ColumnsSubMenu - // - this.ColumnsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.ShowAddressMenuItem, - this.ShowPreviousMenuItem, - this.ShowChangesMenuItem, - this.ShowDiffMenuItem, - this.ShowDomainMenuItem}); - this.ColumnsSubMenu.Name = "ColumnsSubMenu"; - this.ColumnsSubMenu.Size = new System.Drawing.Size(67, 20); - this.ColumnsSubMenu.Text = "&Columns"; - this.ColumnsSubMenu.DropDownOpened += new System.EventHandler(this.ColumnsSubMenu_DropDownOpened); - // - // ShowAddressMenuItem - // - this.ShowAddressMenuItem.Name = "ShowAddressMenuItem"; - this.ShowAddressMenuItem.Size = new System.Drawing.Size(156, 22); - this.ShowAddressMenuItem.Text = "Address"; - this.ShowAddressMenuItem.Click += new System.EventHandler(this.ShowAddressMenuItem_Click); - // - // ShowPreviousMenuItem - // - this.ShowPreviousMenuItem.Name = "ShowPreviousMenuItem"; - this.ShowPreviousMenuItem.Size = new System.Drawing.Size(156, 22); - this.ShowPreviousMenuItem.Text = "Previous Value"; - this.ShowPreviousMenuItem.Click += new System.EventHandler(this.ShowPreviousMenuItem_Click); - // - // ShowChangesMenuItem - // - this.ShowChangesMenuItem.Checked = true; - this.ShowChangesMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.ShowChangesMenuItem.Name = "ShowChangesMenuItem"; - this.ShowChangesMenuItem.Size = new System.Drawing.Size(156, 22); - this.ShowChangesMenuItem.Text = "Change Counts"; - this.ShowChangesMenuItem.Click += new System.EventHandler(this.ShowChangesMenuItem_Click); - // - // ShowDiffMenuItem - // - this.ShowDiffMenuItem.Name = "ShowDiffMenuItem"; - this.ShowDiffMenuItem.Size = new System.Drawing.Size(156, 22); - this.ShowDiffMenuItem.Text = "Difference"; - this.ShowDiffMenuItem.Click += new System.EventHandler(this.ShowDiffMenuItem_Click); - // - // ShowDomainMenuItem - // - this.ShowDomainMenuItem.Name = "ShowDomainMenuItem"; - this.ShowDomainMenuItem.Size = new System.Drawing.Size(156, 22); - this.ShowDomainMenuItem.Text = "Domain"; - this.ShowDomainMenuItem.Click += new System.EventHandler(this.ShowDomainMenuItem_Click); - // // WatchListView // this.WatchListView.AllowColumnReorder = true; @@ -1061,11 +961,6 @@ private System.Windows.Forms.ToolStripMenuItem MoveUpMenuItem; private System.Windows.Forms.ToolStripMenuItem MoveDownMenuItem; private System.Windows.Forms.ToolStripMenuItem SelectAllMenuItem; - private System.Windows.Forms.ToolStripMenuItem ColumnsSubMenu; - private System.Windows.Forms.ToolStripMenuItem ShowPreviousMenuItem; - private System.Windows.Forms.ToolStripMenuItem ShowChangesMenuItem; - private System.Windows.Forms.ToolStripMenuItem ShowDiffMenuItem; - private System.Windows.Forms.ToolStripMenuItem ShowDomainMenuItem; private System.Windows.Forms.ToolStripMenuItem OptionsSubMenu; private System.Windows.Forms.ToolStripMenuItem DefinePreviousValueSubMenu; private System.Windows.Forms.ToolStripMenuItem PreviousFrameMenuItem; @@ -1106,17 +1001,11 @@ private System.Windows.Forms.ToolStripMenuItem InsertSeperatorContextMenuItem; private System.Windows.Forms.ToolStripMenuItem MoveUpContextMenuItem; private System.Windows.Forms.ToolStripMenuItem MoveDownContextMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; - private System.Windows.Forms.ToolStripMenuItem ShowChangeCountsContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem ShowPreviousValueContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem ShowDiffContextMenuItem; - private System.Windows.Forms.ToolStripMenuItem ShowDomainContextMenuItem; private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem; private System.Windows.Forms.ToolStripMenuItem FloatingWindowMenuItem; private StatusStripEx statusStrip1; private System.Windows.Forms.ToolStripStatusLabel MessageLabel; private System.Windows.Forms.ToolStripButton ErrorIconButton; - private System.Windows.Forms.ToolStripMenuItem ShowAddressMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem PauseMenuItem; private System.Windows.Forms.ToolStripButton pauseToolStripButton; diff --git a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs index f9beeb0555..1c8b633ea5 100644 --- a/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs +++ b/BizHawk.Client.EmuHawk/tools/Watch/RamWatch.cs @@ -18,17 +18,6 @@ namespace BizHawk.Client.EmuHawk { public partial class RamWatch : Form, IToolForm { - private readonly Dictionary _defaultColumnWidths = new Dictionary - { - { WatchList.ADDRESS, 60 }, - { WatchList.VALUE, 59 }, - { WatchList.PREV, 59 }, - { WatchList.CHANGES, 55 }, - { WatchList.DIFF, 59 }, - { WatchList.DOMAIN, 55 }, - { WatchList.NOTES, 128 }, - }; - private WatchList _watches; private int _defaultWidth; @@ -39,12 +28,37 @@ namespace BizHawk.Client.EmuHawk [RequiredService] private IMemoryDomains _core { get; set; } + [RequiredService] private IEmulator _emu { get; set; } + [ConfigPersist] + public RamWatchSettings Settings { get; set; } + + public class RamWatchSettings : ToolDialogSettings + { + public RamWatchSettings() + { + Columns = new ColumnList + { + new Column { Name = WatchList.ADDRESS, Visible = true, Index = 0, Width = 60 }, + new Column { Name = WatchList.VALUE, Visible = true, Index = 1, Width = 59 }, + new Column { Name = WatchList.PREV, Visible = false, Index = 2, Width = 59 }, + new Column { Name = WatchList.CHANGES, Visible = true, Index = 3, Width = 55 }, + new Column { Name = WatchList.DIFF, Visible = false, Index = 4, Width = 59 }, + new Column { Name = WatchList.DOMAIN, Visible = true, Index = 5, Width = 55 }, + new Column { Name = WatchList.NOTES, Visible = true, Index = 6, Width = 128 }, + }; + } + + public ColumnList Columns { get; set; } + } + public RamWatch() { InitializeComponent(); + Settings = new RamWatchSettings(); + WatchListView.QueryItemText += WatchListView_QueryItemText; WatchListView.QueryItemBkColor += WatchListView_QueryItemBkColor; WatchListView.VirtualMode = true; @@ -62,8 +76,6 @@ namespace BizHawk.Client.EmuHawk _sortedColumn = string.Empty; _sortReverse = false; - - TopMost = Global.Config.RamWatchSettings.TopMost; } private IEnumerable SelectedIndices @@ -326,16 +338,16 @@ namespace BizHawk.Client.EmuHawk private void ColumnPositions() { - var columns = Global.Config.RamWatchColumnIndexes - .Where(x => WatchListView.Columns.ContainsKey(x.Key)) - .OrderBy(x => x.Value) - .ToList(); - - for (var i = 0; i < columns.Count; i++) + foreach (ColumnHeader column in WatchListView.Columns) { - if (WatchListView.Columns.ContainsKey(columns[i].Key)) + var index = Settings.Columns[column.Name].Index; + if (index < WatchListView.Columns.Count) { - WatchListView.Columns[columns[i].Key].DisplayIndex = i; + column.DisplayIndex = Settings.Columns[column.Name].Index; + } + else + { + column.DisplayIndex = WatchListView.Columns.Count - 1; } } } @@ -424,27 +436,14 @@ namespace BizHawk.Client.EmuHawk } } - private int GetColumnWidth(string columnName) - { - var width = Global.Config.RamWatchColumnWidths[columnName]; - if (width == -1) - { - width = _defaultColumnWidths[columnName]; - } - - return width; - } - private void LoadColumnInfo() { WatchListView.Columns.Clear(); - WatchListView.AddColumn(WatchList.ADDRESS, Global.Config.RamWatchShowAddressColumn, GetColumnWidth(WatchList.ADDRESS)); - WatchListView.AddColumn(WatchList.VALUE, true, GetColumnWidth(WatchList.VALUE)); - WatchListView.AddColumn(WatchList.PREV, Global.Config.RamWatchShowPrevColumn, GetColumnWidth(WatchList.PREV)); - WatchListView.AddColumn(WatchList.CHANGES, Global.Config.RamWatchShowChangeColumn, GetColumnWidth(WatchList.CHANGES)); - WatchListView.AddColumn(WatchList.DIFF, Global.Config.RamWatchShowDiffColumn, GetColumnWidth(WatchList.DIFF)); - WatchListView.AddColumn(WatchList.DOMAIN, Global.Config.RamWatchShowDomainColumn, GetColumnWidth(WatchList.DOMAIN)); - WatchListView.AddColumn(WatchList.NOTES, true, GetColumnWidth(WatchList.NOTES)); + + foreach (var column in Settings.Columns) + { + WatchListView.AddColumn(column); + } ColumnPositions(); } @@ -455,14 +454,14 @@ namespace BizHawk.Client.EmuHawk _defaultWidth = Size.Width; _defaultHeight = Size.Height; - if (Global.Config.RamWatchSettings.UseWindowPosition) + if (Settings.UseWindowPosition) { - Location = Global.Config.RamWatchSettings.WindowPosition; + Location = Settings.WindowPosition; } - if (Global.Config.RamWatchSettings.UseWindowSize) + if (Settings.UseWindowSize) { - Size = Global.Config.RamWatchSettings.WindowSize; + Size = Settings.WindowSize; } LoadColumnInfo(); @@ -514,56 +513,20 @@ namespace BizHawk.Client.EmuHawk private void SaveColumnInfo() { - if (WatchListView.Columns[WatchList.ADDRESS] != null) + foreach (ColumnHeader column in WatchListView.Columns) { - Global.Config.RamWatchColumnIndexes[WatchList.ADDRESS] = WatchListView.Columns[WatchList.ADDRESS].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.ADDRESS] = WatchListView.Columns[WatchList.ADDRESS].Width; - } - - if (WatchListView.Columns[WatchList.VALUE] != null) - { - Global.Config.RamWatchColumnIndexes[WatchList.VALUE] = WatchListView.Columns[WatchList.VALUE].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.VALUE] = WatchListView.Columns[WatchList.VALUE].Width; - } - - if (WatchListView.Columns[WatchList.PREV] != null) - { - Global.Config.RamWatchColumnIndexes[WatchList.PREV] = WatchListView.Columns[WatchList.PREV].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.PREV] = WatchListView.Columns[WatchList.PREV].Width; - } - - if (WatchListView.Columns[WatchList.CHANGES] != null) - { - Global.Config.RamWatchColumnIndexes[WatchList.CHANGES] = WatchListView.Columns[WatchList.CHANGES].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.CHANGES] = WatchListView.Columns[WatchList.CHANGES].Width; - } - - if (WatchListView.Columns[WatchList.DIFF] != null) - { - Global.Config.RamWatchColumnIndexes[WatchList.DIFF] = WatchListView.Columns[WatchList.DIFF].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.DIFF] = WatchListView.Columns[WatchList.DIFF].Width; - } - - if (WatchListView.Columns[WatchList.DOMAIN] != null) - { - Global.Config.RamWatchColumnIndexes[WatchList.DOMAIN] = WatchListView.Columns[WatchList.DOMAIN].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.DOMAIN] = WatchListView.Columns[WatchList.DOMAIN].Width; - } - - if (WatchListView.Columns[WatchList.NOTES] != null) - { - Global.Config.RamWatchColumnIndexes[WatchList.NOTES] = WatchListView.Columns[WatchList.NOTES].DisplayIndex; - Global.Config.RamWatchColumnWidths[WatchList.NOTES] = WatchListView.Columns[WatchList.NOTES].Width; + Settings.Columns[column.Name].Index = column.DisplayIndex; + Settings.Columns[column.Name].Width = column.Width; } } private void SaveConfigSettings() { SaveColumnInfo(); - Global.Config.RamWatchSettings.Wndx = Location.X; - Global.Config.RamWatchSettings.Wndy = Location.Y; - Global.Config.RamWatchSettings.Width = Right - Left; - Global.Config.RamWatchSettings.Height = Bottom - Top; + Settings.Wndx = Location.X; + Settings.Wndy = Location.Y; + Settings.Width = Right - Left; + Settings.Height = Bottom - Top; } private void SetMemoryDomain(string name) @@ -670,7 +633,7 @@ namespace BizHawk.Client.EmuHawk private void RefreshFloatingWindowControl() { - Owner = Global.Config.RamWatchSettings.FloatingWindow ? null : GlobalWin.MainForm; + Owner = Settings.FloatingWindow ? null : GlobalWin.MainForm; } #endregion @@ -923,9 +886,9 @@ namespace BizHawk.Client.EmuHawk private void OptionsSubMenu_DropDownOpened(object sender, EventArgs e) { WatchesOnScreenMenuItem.Checked = Global.Config.DisplayRamWatch; - SaveWindowPositionMenuItem.Checked = Global.Config.RamWatchSettings.SaveWindowPosition; - AlwaysOnTopMenuItem.Checked = Global.Config.RamWatchSettings.TopMost; - FloatingWindowMenuItem.Checked = Global.Config.RamWatchSettings.FloatingWindow; + SaveWindowPositionMenuItem.Checked = Settings.SaveWindowPosition; + AlwaysOnTopMenuItem.Checked = Settings.TopMost; + FloatingWindowMenuItem.Checked = Settings.FloatingWindow; } private void DefinePreviousValueSubMenu_DropDownOpened(object sender, EventArgs e) @@ -966,57 +929,26 @@ namespace BizHawk.Client.EmuHawk private void SaveWindowPositionMenuItem_Click(object sender, EventArgs e) { - Global.Config.RamWatchSettings.SaveWindowPosition ^= true; + Settings.SaveWindowPosition ^= true; } private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e) { - Global.Config.RamWatchSettings.TopMost ^= true; - TopMost = Global.Config.RamWatchSettings.TopMost; + TopMost = Settings.TopMost ^= true; } private void FloatingWindowMenuItem_Click(object sender, EventArgs e) { - Global.Config.RamWatchSettings.FloatingWindow ^= true; + Settings.FloatingWindow ^= true; RefreshFloatingWindowControl(); } private void RestoreWindowSizeMenuItem_Click(object sender, EventArgs e) { + Settings = new RamWatchSettings(); Size = new Size(_defaultWidth, _defaultHeight); - Global.Config.RamWatchColumnIndexes = new Dictionary - { - { "AddressColumn", 0 }, - { "ValueColumn", 1 }, - { "PrevColumn", 2 }, - { "ChangesColumn", 3 }, - { "DiffColumn", 4 }, - { "DomainColumn", 5 }, - { "NotesColumn", 6 }, - }; - - Global.Config.RamWatchColumnWidths = new Dictionary - { - { "AddressColumn", -1 }, - { "ValueColumn", -1 }, - { "PrevColumn", -1 }, - { "ChangesColumn", -1 }, - { "DiffColumn", -1 }, - { "DomainColumn", -1 }, - { "NotesColumn", -1 }, - }; - - Global.Config.RamWatchShowAddressColumn = true; - Global.Config.RamWatchShowChangeColumn = true; - Global.Config.RamWatchShowDomainColumn = true; - Global.Config.RamWatchShowPrevColumn = false; - Global.Config.RamWatchShowDiffColumn = false; - Global.Config.DisplayRamWatch = false; - Global.Config.RamWatchSettings.SaveWindowPosition = true; - Global.Config.RamWatchSettings.TopMost = TopMost = false; - Global.Config.RamWatchSettings.FloatingWindow = false; RefreshFloatingWindowControl(); ColumnPositions(); @@ -1025,63 +957,14 @@ namespace BizHawk.Client.EmuHawk #endregion - #region Columns - - private void ColumnsSubMenu_DropDownOpened(object sender, EventArgs e) - { - ShowAddressMenuItem.Checked = Global.Config.RamWatchShowAddressColumn; - ShowPreviousMenuItem.Checked = Global.Config.RamWatchShowPrevColumn; - ShowChangesMenuItem.Checked = Global.Config.RamWatchShowChangeColumn; - ShowDiffMenuItem.Checked = Global.Config.RamWatchShowDiffColumn; - ShowDomainMenuItem.Checked = Global.Config.RamWatchShowDomainColumn; - } - - private void ShowAddressMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowAddressColumn ^= true; - SaveColumnInfo(); - LoadColumnInfo(); - } - - private void ShowPreviousMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowPrevColumn ^= true; - SaveColumnInfo(); - LoadColumnInfo(); - } - - private void ShowChangesMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowChangeColumn ^= true; - - SaveColumnInfo(); - LoadColumnInfo(); - } - - private void ShowDiffMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowDiffColumn ^= true; - - SaveColumnInfo(); - LoadColumnInfo(); - } - - private void ShowDomainMenuItem_Click(object sender, EventArgs e) - { - Global.Config.RamWatchShowDomainColumn ^= true; - - SaveColumnInfo(); - LoadColumnInfo(); - } - - #endregion - #region Dialog, Context Menu, and ListView Events private void NewRamWatch_Load(object sender, EventArgs e) { + TopMost = Settings.TopMost; _watches = new WatchList(_core, _core.MemoryDomains.MainMemory, _emu.SystemId); LoadConfigSettings(); + menuStrip1.Items.Add(Settings.Columns.GenerateColumnsMenu()); UpdateStatusBar(); } @@ -1124,7 +1007,6 @@ namespace BizHawk.Client.EmuHawk MoveUpContextMenuItem.Visible = MoveDownContextMenuItem.Visible = Separator6.Visible = - toolStripSeparator4.Visible = indexes.Count > 0; var allCheats = _watches.All(x => Global.CheatList.IsActive(x.Domain, x.Address ?? 0)); @@ -1140,11 +1022,6 @@ namespace BizHawk.Client.EmuHawk FreezeContextMenuItem.Image = Properties.Resources.Freeze; } - ShowChangeCountsContextMenuItem.Text = Global.Config.RamWatchShowChangeColumn ? "Hide change counts" : "Show change counts"; - ShowPreviousValueContextMenuItem.Text = Global.Config.RamWatchShowPrevColumn ? "Hide previous value" : "Show previous value"; - ShowDiffContextMenuItem.Text = Global.Config.RamWatchShowDiffColumn ? "Hide difference value" : "Show difference value"; - ShowDomainContextMenuItem.Text = Global.Config.RamWatchShowDomainColumn ? "Hide domain" : "Show domain"; - UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0; ViewInHexEditorContextMenuItem.Visible = SelectedWatches.Count() == 1;