From ebcac8f9d06052c0fc9d26a989c7a4c82f00baa7 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 25 Sep 2013 23:09:39 +0000 Subject: [PATCH] Add Always on Top feature to Ram Watch, fix Ram Search Always On Top feature, remove some now unused variables from the config, fix a widths bug in cheat search dialog --- BizHawk.MultiClient/Config.cs | 38 ++++++++++--------- BizHawk.MultiClient/tools/Cheats.cs | 12 +++--- .../tools/Watch/NewRamSearch.cs | 3 ++ BizHawk.MultiClient/tools/Watch/RamSearch.cs | 4 +- .../tools/Watch/RamWatch.Designer.cs | 10 +++++ BizHawk.MultiClient/tools/Watch/RamWatch.cs | 9 +++++ 6 files changed, 51 insertions(+), 25 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 8e0a951765..5a831ac69f 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -174,6 +174,7 @@ namespace BizHawk.MultiClient // RamWatch Settings public RecentFiles RecentWatches = new RecentFiles(8); public bool RamWatchSaveWindowPosition = true; + public bool RamWatchAlwaysOnTop = false; public int RamWatchWndx = -1; //Negative numbers will be ignored even with save window position set public int RamWatchWndy = -1; public int RamWatchWidth = -1; @@ -183,14 +184,6 @@ namespace BizHawk.MultiClient public bool RamWatchShowDiffColumn = false; public bool RamWatchShowDomainColumn = true; - public int RamWatchAddressWidth = -1; - public int RamWatchValueWidth = -1; - public int RamWatchPrevWidth = -1; - public int RamWatchChangeWidth = -1; - public int RamWatchDiffWidth = -1; - public int RamWatchNotesWidth = -1; - public int RamWatchDomainWidth = -1; - public Dictionary RamWatchColumnWidths = new Dictionary() { { "AddressColumn", -1 }, @@ -213,18 +206,10 @@ namespace BizHawk.MultiClient { "NotesColumn", 6 }, }; - public int RamWatchAddressIndex = 0; - public int RamWatchValueIndex = 1; - public int RamWatchPrevIndex = 2; - public int RamWatchChangeIndex = 3; - public int RamWatchDiffIndex = 4; - public int RamWatchDomainIndex = 5; - public int RamWatchNotesIndex = 6; - - public int RamWatchPrev_Type = 1; public Watch.PreviousType RamWatchDefinePrevious = Watch.PreviousType.LastFrame; // RamSearch Settings + public int RamSearchPrev_Type = 1; public bool RamSearchSaveWindowPosition = true; public RecentFiles RecentSearches = new RecentFiles(8); public int RamSearchWndx = -1; //Negative numbers will be ignored even with save window position set @@ -245,6 +230,25 @@ namespace BizHawk.MultiClient public bool RamSearchFastMode = false; public bool RamSearchAlwaysOnTop = false; + public Dictionary RamSearchColumnWidths = new Dictionary() + { + { "AddressColumn", -1 }, + { "ValueColumn", -1 }, + { "PrevColumn", -1 }, + { "ChangesColumn", -1 }, + { "DiffColumn", -1 }, + }; + + public Dictionary RamSearchColumnIndexes = new Dictionary() + { + { "AddressColumn", 0 }, + { "ValueColumn", 1 }, + { "PrevColumn", 2 }, + { "ChangesColumn", 3 }, + { "DiffColumn", 4 }, + }; + + // HexEditor Settings public bool AutoLoadHexEditor = false; public bool HexEditorSaveWindowPosition = true; diff --git a/BizHawk.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index 55f3c4f75b..caf52be18a 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -1138,12 +1138,12 @@ namespace BizHawk.MultiClient List> columnSettings = new List> { - new KeyValuePair(Global.Config.RamWatchAddressIndex, "Name"), - new KeyValuePair(Global.Config.RamWatchAddressIndex, "Address"), - new KeyValuePair(Global.Config.RamWatchAddressIndex, "Value"), - new KeyValuePair(Global.Config.RamWatchAddressIndex, "Compare"), - new KeyValuePair(Global.Config.RamWatchAddressIndex, "Domain"), - new KeyValuePair(Global.Config.RamWatchAddressIndex, "On") + new KeyValuePair(Global.Config.CheatsNameIndex, "Name"), + new KeyValuePair(Global.Config.CheatsAddressIndex, "Address"), + new KeyValuePair(Global.Config.CheatsValueIndex, "Value"), + new KeyValuePair(Global.Config.CheatsCompareIndex, "Compare"), + new KeyValuePair(Global.Config.CheatsDomainIndex, "Domain"), + new KeyValuePair(Global.Config.CheatsOnIndex, "On") }; columnSettings = columnSettings.OrderBy(s => s.Key).ToList(); diff --git a/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs b/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs index 664106b704..41f67b8ceb 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs @@ -61,6 +61,8 @@ namespace BizHawk.MultiClient Settings = new RamSearchEngine.Settings(); Searches = new RamSearchEngine(Settings); + + TopMost = Global.Config.RamSearchAlwaysOnTop; } private void RamSearch_Load(object sender, EventArgs e) @@ -808,6 +810,7 @@ namespace BizHawk.MultiClient SaveWinPositionMenuItem.Checked = Global.Config.RamSearchSaveWindowPosition; ExcludeRamWatchMenuItem.Checked = Global.Config.RamSearchAlwaysExcludeRamWatch; PreviewModeMenuItem.Checked = Global.Config.RamSearchPreviewMode; + AlwaysOnTopMenuItem.Checked = Global.Config.RamSearchAlwaysOnTop; AutoSearchMenuItem.Checked = autoSearch; } diff --git a/BizHawk.MultiClient/tools/Watch/RamSearch.cs b/BizHawk.MultiClient/tools/Watch/RamSearch.cs index 6ba229dc10..837ddc5b8a 100644 --- a/BizHawk.MultiClient/tools/Watch/RamSearch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamSearch.cs @@ -2644,7 +2644,7 @@ namespace BizHawk.MultiClient case "value": return Searches[watch_index].ValueString; case "prev": - switch (Global.Config.RamWatchPrev_Type) + switch (Global.Config.RamSearchPrev_Type) { case 1: return Searches[watch_index].PrevString; @@ -2656,7 +2656,7 @@ namespace BizHawk.MultiClient case "changes": return Searches[watch_index].Changecount.ToString(); case "diff": - switch (Global.Config.RamWatchPrev_Type) + switch (Global.Config.RamSearchPrev_Type) { case 1: return Searches[watch_index].DiffPrevString; diff --git a/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs index 208437df7f..69e0d94c5c 100644 --- a/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs @@ -115,6 +115,7 @@ this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.DomainColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.NotesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -761,6 +762,7 @@ this.definePreviousValueAsToolStripMenuItem, this.displayWatchesOnScreenToolStripMenuItem, this.saveWindowPositionToolStripMenuItem, + this.AlwaysOnTopMenuItem, this.toolStripSeparator7, this.restoreWindowSizeToolStripMenuItem}); this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; @@ -903,6 +905,13 @@ this.NotesColumn.Text = "Notes"; this.NotesColumn.Width = 128; // + // AlwaysOnTopMenuItem + // + this.AlwaysOnTopMenuItem.Name = "AlwaysOnTopMenuItem"; + this.AlwaysOnTopMenuItem.Size = new System.Drawing.Size(217, 22); + this.AlwaysOnTopMenuItem.Text = "&Always On Top"; + this.AlwaysOnTopMenuItem.Click += new System.EventHandler(this.AlwaysOnTopMenuItem_Click); + // // RamWatch // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1019,5 +1028,6 @@ private System.Windows.Forms.ToolStripMenuItem ShowPreviousValueContextMenuItem; private System.Windows.Forms.ToolStripMenuItem ShowDiffContextMenuItem; private System.Windows.Forms.ToolStripMenuItem ShowDomainContextMenuItem; + private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/Watch/RamWatch.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.cs index 38d0418bfd..9bb1849707 100644 --- a/BizHawk.MultiClient/tools/Watch/RamWatch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatch.cs @@ -45,6 +45,8 @@ namespace BizHawk.MultiClient Closing += (o, e) => SaveConfigSettings(); _sortedColumn = ""; _sortReverse = false; + + TopMost = Global.Config.RamWatchAlwaysOnTop; } public void UpdateValues() @@ -986,6 +988,7 @@ namespace BizHawk.MultiClient { displayWatchesOnScreenToolStripMenuItem.Checked = Global.Config.DisplayRamWatch; saveWindowPositionToolStripMenuItem.Checked = Global.Config.RamWatchSaveWindowPosition; + AlwaysOnTopMenuItem.Checked = Global.Config.RamWatchAlwaysOnTop; } private void definePreviousValueAsToolStripMenuItem_DropDownOpened(object sender, EventArgs e) @@ -1043,6 +1046,12 @@ namespace BizHawk.MultiClient Global.Config.RamWatchSaveWindowPosition ^= true; } + private void AlwaysOnTopMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamWatchAlwaysOnTop ^= true; + TopMost = Global.Config.RamWatchAlwaysOnTop; + } + private void restoreWindowSizeToolStripMenuItem_Click(object sender, EventArgs e) { Size = new Size(defaultWidth, defaultHeight);