From bb62fa569ec61c66bb4ea1b7482a582d6f96ee00 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 26 Sep 2013 00:51:08 +0000 Subject: [PATCH] New Ram Search - Columns - show/hide, save/load column enabled status, width, and column orders --- BizHawk.MultiClient/Config.cs | 3 + .../tools/Watch/NewRamSearch.Designer.cs | 141 +++++++++++------ .../tools/Watch/NewRamSearch.cs | 143 ++++++++++++++++-- .../tools/Watch/RamWatch.Designer.cs | 122 +++++++-------- BizHawk.MultiClient/tools/Watch/RamWatch.cs | 17 +-- 5 files changed, 295 insertions(+), 131 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 5a831ac69f..5ef96ba30f 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -248,6 +248,9 @@ namespace BizHawk.MultiClient { "DiffColumn", 4 }, }; + public bool RamSearchShowPrevColumn = true; + public bool RamSearchShowChangeColumn = true; + public bool RamSearchShowDiffColumn = false; // HexEditor Settings public bool AutoLoadHexEditor = false; diff --git a/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs b/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs index 62f8909bd1..09231ef260 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamSearch.Designer.cs @@ -37,6 +37,7 @@ this.ValueColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.PreviousColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ChangesColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.DoSearchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.NewSearchContextMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -127,11 +128,14 @@ this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); this.CopyValueToPrevToolBarItem = new System.Windows.Forms.ToolStripButton(); this.ClearChangeCountsToolBarItem = new System.Windows.Forms.ToolStripButton(); - this.RemoveToolBarItem = new System.Windows.Forms.ToolStripButton(); this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator(); + this.RemoveToolBarItem = new System.Windows.Forms.ToolStripButton(); this.AddToRamWatchToolBarItem = new System.Windows.Forms.ToolStripButton(); this.PokeAddressToolBarItem = new System.Windows.Forms.ToolStripButton(); this.FreezeAddressToolBarItem = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); + this.UndoToolBarButton = new System.Windows.Forms.ToolStripButton(); + this.RedoToolBarItem = new System.Windows.Forms.ToolStripButton(); this.ComparisonBox = new System.Windows.Forms.GroupBox(); this.DifferentByBox = new BizHawk.UnsignedIntegerBox(); this.DifferentByRadio = new System.Windows.Forms.RadioButton(); @@ -141,10 +145,10 @@ this.LessThanOrEqualToRadio = new System.Windows.Forms.RadioButton(); this.GreaterThanRadio = new System.Windows.Forms.RadioButton(); this.LessThanRadio = new System.Windows.Forms.RadioButton(); - this.DiffColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.toolStripSeparator12 = new System.Windows.Forms.ToolStripSeparator(); - this.UndoToolBarButton = new System.Windows.Forms.ToolStripButton(); - this.RedoToolBarItem = new System.Windows.Forms.ToolStripButton(); + this.ColumnsMenuItem = 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.SpecificValueBox = new BizHawk.MultiClient.WatchValueBox(); SearchMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); @@ -192,7 +196,7 @@ this.WatchListView.Location = new System.Drawing.Point(9, 65); this.WatchListView.Name = "WatchListView"; this.WatchListView.selectedItem = -1; - this.WatchListView.Size = new System.Drawing.Size(232, 366); + this.WatchListView.Size = new System.Drawing.Size(216, 366); this.WatchListView.TabIndex = 1; this.WatchListView.UseCompatibleStateImageBehavior = false; this.WatchListView.View = System.Windows.Forms.View.Details; @@ -220,6 +224,10 @@ this.ChangesColumn.Text = "Changes"; this.ChangesColumn.Width = 55; // + // DiffColumn + // + this.DiffColumn.Text = "Diff"; + // // contextMenuStrip1 // this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -335,10 +343,11 @@ this.fileToolStripMenuItem, this.settingsToolStripMenuItem, this.searchToolStripMenuItem, - this.optionsToolStripMenuItem}); + this.optionsToolStripMenuItem, + this.ColumnsMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(470, 24); + this.menuStrip1.Size = new System.Drawing.Size(438, 24); this.menuStrip1.TabIndex = 4; this.menuStrip1.Text = "menuStrip1"; // @@ -820,7 +829,7 @@ // // CompareToBox // - this.CompareToBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.CompareToBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.CompareToBox.Controls.Add(this.DifferenceBox); this.CompareToBox.Controls.Add(this.DifferenceRadio); this.CompareToBox.Controls.Add(this.label1); @@ -831,9 +840,9 @@ this.CompareToBox.Controls.Add(this.SpecificAddressRadio); this.CompareToBox.Controls.Add(this.SpecificValueRadio); this.CompareToBox.Controls.Add(this.PreviousValueRadio); - this.CompareToBox.Location = new System.Drawing.Point(247, 65); + this.CompareToBox.Location = new System.Drawing.Point(230, 65); this.CompareToBox.Name = "CompareToBox"; - this.CompareToBox.Size = new System.Drawing.Size(211, 125); + this.CompareToBox.Size = new System.Drawing.Size(197, 125); this.CompareToBox.TabIndex = 10; this.CompareToBox.TabStop = false; this.CompareToBox.Text = "Compare To / By"; @@ -842,7 +851,7 @@ // this.DifferenceBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.DifferenceBox.Enabled = false; - this.DifferenceBox.Location = new System.Drawing.Point(135, 98); + this.DifferenceBox.Location = new System.Drawing.Point(126, 98); this.DifferenceBox.MaxLength = 8; this.DifferenceBox.Name = "DifferenceBox"; this.DifferenceBox.Size = new System.Drawing.Size(65, 20); @@ -863,7 +872,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(116, 62); + this.label1.Location = new System.Drawing.Point(108, 62); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(18, 13); this.label1.TabIndex = 10; @@ -873,7 +882,7 @@ // this.NumberOfChangesBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.NumberOfChangesBox.Enabled = false; - this.NumberOfChangesBox.Location = new System.Drawing.Point(135, 78); + this.NumberOfChangesBox.Location = new System.Drawing.Point(126, 78); this.NumberOfChangesBox.MaxLength = 8; this.NumberOfChangesBox.Name = "NumberOfChangesBox"; this.NumberOfChangesBox.Size = new System.Drawing.Size(65, 20); @@ -884,7 +893,7 @@ // this.SpecificAddressBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.SpecificAddressBox.Enabled = false; - this.SpecificAddressBox.Location = new System.Drawing.Point(135, 58); + this.SpecificAddressBox.Location = new System.Drawing.Point(126, 58); this.SpecificAddressBox.MaxLength = 8; this.SpecificAddressBox.Name = "SpecificAddressBox"; this.SpecificAddressBox.Size = new System.Drawing.Size(65, 20); @@ -957,7 +966,7 @@ this.RedoToolBarItem}); this.toolStrip1.Location = new System.Drawing.Point(0, 24); this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(470, 25); + this.toolStrip1.Size = new System.Drawing.Size(438, 25); this.toolStrip1.TabIndex = 11; this.toolStrip1.Text = "toolStrip1"; // @@ -1012,6 +1021,11 @@ this.ClearChangeCountsToolBarItem.ToolTipText = "Clear Change Counts"; this.ClearChangeCountsToolBarItem.Click += new System.EventHandler(this.ClearChangeCountsMenuItem_Click); // + // toolStripSeparator16 + // + this.toolStripSeparator16.Name = "toolStripSeparator16"; + this.toolStripSeparator16.Size = new System.Drawing.Size(6, 25); + // // RemoveToolBarItem // this.RemoveToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -1024,11 +1038,6 @@ this.RemoveToolBarItem.ToolTipText = "Eliminate Selected Items"; this.RemoveToolBarItem.Click += new System.EventHandler(this.RemoveMenuItem_Click); // - // toolStripSeparator16 - // - this.toolStripSeparator16.Name = "toolStripSeparator16"; - this.toolStripSeparator16.Size = new System.Drawing.Size(6, 25); - // // AddToRamWatchToolBarItem // this.AddToRamWatchToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -1062,9 +1071,36 @@ this.FreezeAddressToolBarItem.Text = "Freeze"; this.FreezeAddressToolBarItem.Click += new System.EventHandler(this.FreezeAddressMenuItem_Click); // + // toolStripSeparator12 + // + this.toolStripSeparator12.Name = "toolStripSeparator12"; + this.toolStripSeparator12.Size = new System.Drawing.Size(6, 25); + // + // UndoToolBarButton + // + this.UndoToolBarButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.UndoToolBarButton.Enabled = false; + this.UndoToolBarButton.Image = global::BizHawk.MultiClient.Properties.Resources.undo; + this.UndoToolBarButton.ImageTransparentColor = System.Drawing.Color.Magenta; + this.UndoToolBarButton.Name = "UndoToolBarButton"; + this.UndoToolBarButton.Size = new System.Drawing.Size(23, 22); + this.UndoToolBarButton.Text = "Undo Search"; + this.UndoToolBarButton.Click += new System.EventHandler(this.UndoMenuItem_Click); + // + // RedoToolBarItem + // + this.RedoToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.RedoToolBarItem.Enabled = false; + this.RedoToolBarItem.Image = global::BizHawk.MultiClient.Properties.Resources.redo; + this.RedoToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; + this.RedoToolBarItem.Name = "RedoToolBarItem"; + this.RedoToolBarItem.Size = new System.Drawing.Size(23, 22); + this.RedoToolBarItem.Text = "Redo"; + this.RedoToolBarItem.Click += new System.EventHandler(this.RedoMenuItem_Click); + // // ComparisonBox // - this.ComparisonBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.ComparisonBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.ComparisonBox.Controls.Add(this.DifferentByBox); this.ComparisonBox.Controls.Add(this.DifferentByRadio); this.ComparisonBox.Controls.Add(this.NotEqualToRadio); @@ -1073,9 +1109,9 @@ this.ComparisonBox.Controls.Add(this.LessThanOrEqualToRadio); this.ComparisonBox.Controls.Add(this.GreaterThanRadio); this.ComparisonBox.Controls.Add(this.LessThanRadio); - this.ComparisonBox.Location = new System.Drawing.Point(247, 196); + this.ComparisonBox.Location = new System.Drawing.Point(230, 196); this.ComparisonBox.Name = "ComparisonBox"; - this.ComparisonBox.Size = new System.Drawing.Size(211, 159); + this.ComparisonBox.Size = new System.Drawing.Size(197, 159); this.ComparisonBox.TabIndex = 12; this.ComparisonBox.TabStop = false; this.ComparisonBox.Text = "Comparison Operator"; @@ -1170,43 +1206,44 @@ this.LessThanRadio.UseVisualStyleBackColor = true; this.LessThanRadio.Click += new System.EventHandler(this.LessThanRadio_Click); // - // DiffColumn + // ColumnsMenuItem // - this.DiffColumn.Text = "Diff"; + this.ColumnsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ShowPreviousMenuItem, + this.ShowChangesMenuItem, + this.ShowDiffMenuItem}); + this.ColumnsMenuItem.Name = "ColumnsMenuItem"; + this.ColumnsMenuItem.Size = new System.Drawing.Size(67, 20); + this.ColumnsMenuItem.Text = "&Columns"; + this.ColumnsMenuItem.DropDownOpened += new System.EventHandler(this.ColumnsMenuItem_DropDownOpened); // - // toolStripSeparator12 + // ShowPreviousMenuItem // - this.toolStripSeparator12.Name = "toolStripSeparator12"; - this.toolStripSeparator12.Size = new System.Drawing.Size(6, 25); + 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); // - // UndoToolBarButton + // ShowChangesMenuItem // - this.UndoToolBarButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.UndoToolBarButton.Enabled = false; - this.UndoToolBarButton.Image = global::BizHawk.MultiClient.Properties.Resources.undo; - this.UndoToolBarButton.ImageTransparentColor = System.Drawing.Color.Magenta; - this.UndoToolBarButton.Name = "UndoToolBarButton"; - this.UndoToolBarButton.Size = new System.Drawing.Size(23, 22); - this.UndoToolBarButton.Text = "Undo Search"; - this.UndoToolBarButton.Click += new System.EventHandler(this.UndoMenuItem_Click); + 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); // - // RedoToolBarItem + // ShowDiffMenuItem // - this.RedoToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.RedoToolBarItem.Enabled = false; - this.RedoToolBarItem.Image = global::BizHawk.MultiClient.Properties.Resources.redo; - this.RedoToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta; - this.RedoToolBarItem.Name = "RedoToolBarItem"; - this.RedoToolBarItem.Size = new System.Drawing.Size(23, 22); - this.RedoToolBarItem.Text = "Redo"; - this.RedoToolBarItem.Click += new System.EventHandler(this.RedoMenuItem_Click); + 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); // // SpecificValueBox // this.SpecificValueBox.ByteSize = BizHawk.MultiClient.Watch.WatchSize.Byte; this.SpecificValueBox.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.SpecificValueBox.Enabled = false; - this.SpecificValueBox.Location = new System.Drawing.Point(135, 38); + this.SpecificValueBox.Location = new System.Drawing.Point(126, 38); this.SpecificValueBox.MaxLength = 2; this.SpecificValueBox.Name = "SpecificValueBox"; this.SpecificValueBox.Size = new System.Drawing.Size(65, 20); @@ -1219,7 +1256,7 @@ this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(470, 459); + this.ClientSize = new System.Drawing.Size(438, 459); this.Controls.Add(this.ComparisonBox); this.Controls.Add(this.toolStrip1); this.Controls.Add(this.CompareToBox); @@ -1230,7 +1267,7 @@ this.Controls.Add(this.menuStrip1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; - this.MinimumSize = new System.Drawing.Size(291, 463); + this.MinimumSize = new System.Drawing.Size(291, 400); this.Name = "NewRamSearch"; this.Text = "Brand New Experimental Ram Search"; this.Load += new System.EventHandler(this.RamSearch_Load); @@ -1365,5 +1402,9 @@ private System.Windows.Forms.ToolStripSeparator toolStripSeparator12; private System.Windows.Forms.ToolStripButton UndoToolBarButton; private System.Windows.Forms.ToolStripButton RedoToolBarItem; + private System.Windows.Forms.ToolStripMenuItem ColumnsMenuItem; + private System.Windows.Forms.ToolStripMenuItem ShowPreviousMenuItem; + private System.Windows.Forms.ToolStripMenuItem ShowChangesMenuItem; + private System.Windows.Forms.ToolStripMenuItem ShowDiffMenuItem; } } \ No newline at end of file diff --git a/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs b/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs index 41f67b8ceb..a33e5634a1 100644 --- a/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs +++ b/BizHawk.MultiClient/tools/Watch/NewRamSearch.cs @@ -187,7 +187,7 @@ namespace BizHawk.MultiClient public void SaveConfigSettings() { - //TODO: columns + SaveColumnInfo(); Global.Config.RamSearchWndx = Location.X; Global.Config.RamSearchWndy = Location.Y; @@ -289,13 +289,73 @@ namespace BizHawk.MultiClient private void LoadColumnInfo() { WatchListView.Columns.Clear(); - AddColumn(ADDRESS, true); //TODO: make things configurable + AddColumn(ADDRESS, true); AddColumn(VALUE, true); - AddColumn(PREV, true); - AddColumn(CHANGES, true); - AddColumn(DIFF, true); + AddColumn(PREV, Global.Config.RamSearchShowPrevColumn); + AddColumn(CHANGES, Global.Config.RamSearchShowChangeColumn); + AddColumn(DIFF, Global.Config.RamSearchShowDiffColumn); - //ColumnPositions(); //TODO + ColumnPositions(); + } + + private void ColumnPositions() + { + List> Columns = + Global.Config.RamSearchColumnIndexes + .Where(x => WatchListView.Columns.ContainsKey(x.Key)) + .OrderBy(x => x.Value).ToList(); + + for (int i = 0; i < Columns.Count; i++) + { + if (WatchListView.Columns.ContainsKey(Columns[i].Key)) + { + WatchListView.Columns[Columns[i].Key].DisplayIndex = i; + } + } + } + + private void SaveColumnInfo() + { + if (WatchListView.Columns[ADDRESS] != null) + { + Global.Config.RamSearchColumnIndexes[ADDRESS] = WatchListView.Columns[ADDRESS].DisplayIndex; + Global.Config.RamSearchColumnWidths[ADDRESS] = WatchListView.Columns[ADDRESS].Width; + } + + if (WatchListView.Columns[VALUE] != null) + { + Global.Config.RamSearchColumnIndexes[VALUE] = WatchListView.Columns[VALUE].DisplayIndex; + Global.Config.RamSearchColumnWidths[VALUE] = WatchListView.Columns[VALUE].Width; + } + + if (WatchListView.Columns[PREV] != null) + { + Global.Config.RamSearchColumnIndexes[PREV] = WatchListView.Columns[PREV].DisplayIndex; + Global.Config.RamSearchColumnWidths[PREV] = WatchListView.Columns[PREV].Width; + } + + if (WatchListView.Columns[CHANGES] != null) + { + Global.Config.RamSearchColumnIndexes[CHANGES] = WatchListView.Columns[CHANGES].DisplayIndex; + Global.Config.RamSearchColumnWidths[CHANGES] = WatchListView.Columns[CHANGES].Width; + } + + if (WatchListView.Columns[DIFF] != null) + { + Global.Config.RamSearchColumnIndexes[DIFF] = WatchListView.Columns[DIFF].DisplayIndex; + Global.Config.RamSearchColumnWidths[DIFF] = WatchListView.Columns[DIFF].Width; + } + } + + private int GetColumnWidth(string columnName) + { + var width = Global.Config.RamSearchColumnWidths[columnName]; + if (width == -1) + { + width = DefaultColumnWidths[columnName]; + } + + return width; } private void AddColumn(string columnName, bool enabled) @@ -308,7 +368,7 @@ namespace BizHawk.MultiClient { Name = columnName, Text = columnName.Replace("Column", ""), - Width = 50, //TODO: GetColumnWidth(columnName), + Width = GetColumnWidth(columnName), }; WatchListView.Columns.Add(column); @@ -356,6 +416,7 @@ namespace BizHawk.MultiClient DifferenceRadio.Enabled = true; DifferentByBox.Enabled = true; ClearChangeCountsToolBarItem.Enabled = true; + WatchListView.Columns[CHANGES].Width = Global.Config.RamSearchColumnWidths[CHANGES]; } private void SetToFastMode() @@ -376,6 +437,9 @@ namespace BizHawk.MultiClient { PreviousValueRadio.Checked = true; } + + Global.Config.RamSearchColumnWidths[CHANGES] = WatchListView.Columns[CHANGES].Width; + WatchListView.Columns[CHANGES].Width = 0; } private void RemoveAddresses() @@ -851,10 +915,67 @@ namespace BizHawk.MultiClient private void RestoreDefaultsMenuItem_Click(object sender, EventArgs e) { - //TODO: finish - - Global.Config.RamSearchAlwaysOnTop = TopMost = false; Size = new Size(defaultWidth, defaultHeight); + + Global.Config.RamSearchColumnIndexes = new Dictionary + { + { "AddressColumn", 0 }, + { "ValueColumn", 1 }, + { "PrevColumn", 2 }, + { "ChangesColumn", 3 }, + { "DiffColumn", 4 }, + { "DomainColumn", 5 }, + { "NotesColumn", 6 }, + }; + + ColumnPositions(); + + Global.Config.RamSearchShowChangeColumn = true; + Global.Config.RamSearchShowPrevColumn = true; + Global.Config.RamSearchShowDiffColumn = false; + + WatchListView.Columns[ADDRESS].Width = DefaultColumnWidths[ADDRESS]; + WatchListView.Columns[VALUE].Width = DefaultColumnWidths[VALUE]; + //WatchListView.Columns[PREV].Width = DefaultColumnWidths[PREV]; + WatchListView.Columns[CHANGES].Width = DefaultColumnWidths[CHANGES]; + //WatchListView.Columns[DIFF].Width = DefaultColumnWidths[DIFF]; + + Global.Config.RamSearchSaveWindowPosition = true; + Global.Config.RamSearchAlwaysOnTop = TopMost = false; + + LoadColumnInfo(); + } + + #endregion + + #region Columns + + private void ColumnsMenuItem_DropDownOpened(object sender, EventArgs e) + { + ShowPreviousMenuItem.Checked = Global.Config.RamSearchShowPrevColumn; + ShowChangesMenuItem.Checked = Global.Config.RamSearchShowChangeColumn; + ShowDiffMenuItem.Checked = Global.Config.RamSearchShowDiffColumn; + } + + private void ShowPreviousMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamSearchShowPrevColumn ^= true; + SaveColumnInfo(); + LoadColumnInfo(); + } + + private void ShowChangesMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamSearchShowChangeColumn ^= true; + SaveColumnInfo(); + LoadColumnInfo(); + } + + private void ShowDiffMenuItem_Click(object sender, EventArgs e) + { + Global.Config.RamSearchShowDiffColumn ^= true; + SaveColumnInfo(); + LoadColumnInfo(); } #endregion @@ -1067,5 +1188,7 @@ namespace BizHawk.MultiClient #endregion #endregion + + } } diff --git a/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs index 69e0d94c5c..ee73d3f38e 100644 --- a/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatch.Designer.cs @@ -93,11 +93,6 @@ this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.showPreviousValueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.showChangeCountsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.diffToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.domainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.definePreviousValueAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.previousFrameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -105,8 +100,14 @@ this.originalToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.displayWatchesOnScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.saveWindowPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AlwaysOnTopMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator(); this.restoreWindowSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.viewToolStripMenuItem = 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.VirtualListView(); this.AddressColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.ValueColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -115,7 +116,6 @@ 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(); @@ -475,8 +475,8 @@ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.filesToolStripMenuItem, this.watchesToolStripMenuItem, - this.viewToolStripMenuItem, - this.optionsToolStripMenuItem}); + this.optionsToolStripMenuItem, + this.viewToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(359, 24); @@ -714,48 +714,6 @@ this.selectAllToolStripMenuItem.Text = "Select &All"; this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click); // - // viewToolStripMenuItem - // - this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.showPreviousValueToolStripMenuItem, - this.showChangeCountsToolStripMenuItem, - this.diffToolStripMenuItem, - this.domainToolStripMenuItem}); - this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; - this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.viewToolStripMenuItem.Text = "&View"; - this.viewToolStripMenuItem.DropDownOpened += new System.EventHandler(this.viewToolStripMenuItem_DropDownOpened); - // - // showPreviousValueToolStripMenuItem - // - this.showPreviousValueToolStripMenuItem.Name = "showPreviousValueToolStripMenuItem"; - this.showPreviousValueToolStripMenuItem.Size = new System.Drawing.Size(156, 22); - this.showPreviousValueToolStripMenuItem.Text = "Previous Value"; - this.showPreviousValueToolStripMenuItem.Click += new System.EventHandler(this.showPreviousValueToolStripMenuItem_Click); - // - // showChangeCountsToolStripMenuItem - // - this.showChangeCountsToolStripMenuItem.Checked = true; - this.showChangeCountsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.showChangeCountsToolStripMenuItem.Name = "showChangeCountsToolStripMenuItem"; - this.showChangeCountsToolStripMenuItem.Size = new System.Drawing.Size(156, 22); - this.showChangeCountsToolStripMenuItem.Text = "Change Counts"; - this.showChangeCountsToolStripMenuItem.Click += new System.EventHandler(this.showChangeCountsToolStripMenuItem_Click); - // - // diffToolStripMenuItem - // - this.diffToolStripMenuItem.Name = "diffToolStripMenuItem"; - this.diffToolStripMenuItem.Size = new System.Drawing.Size(156, 22); - this.diffToolStripMenuItem.Text = "Difference"; - this.diffToolStripMenuItem.Click += new System.EventHandler(this.diffToolStripMenuItem_Click); - // - // domainToolStripMenuItem - // - this.domainToolStripMenuItem.Name = "domainToolStripMenuItem"; - this.domainToolStripMenuItem.Size = new System.Drawing.Size(156, 22); - this.domainToolStripMenuItem.Text = "Domain"; - this.domainToolStripMenuItem.Click += new System.EventHandler(this.domainToolStripMenuItem_Click); - // // optionsToolStripMenuItem // this.optionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -816,6 +774,13 @@ this.saveWindowPositionToolStripMenuItem.Text = "Save Window Position"; this.saveWindowPositionToolStripMenuItem.Click += new System.EventHandler(this.saveWindowPositionToolStripMenuItem_Click); // + // 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); + // // toolStripSeparator7 // this.toolStripSeparator7.Name = "toolStripSeparator7"; @@ -828,6 +793,48 @@ this.restoreWindowSizeToolStripMenuItem.Text = "Restore Default Settings"; this.restoreWindowSizeToolStripMenuItem.Click += new System.EventHandler(this.restoreWindowSizeToolStripMenuItem_Click); // + // viewToolStripMenuItem + // + this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ShowPreviousMenuItem, + this.ShowChangesMenuItem, + this.ShowDiffMenuItem, + this.ShowDomainMenuItem}); + this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; + this.viewToolStripMenuItem.Size = new System.Drawing.Size(67, 20); + this.viewToolStripMenuItem.Text = "&Columns"; + this.viewToolStripMenuItem.DropDownOpened += new System.EventHandler(this.ColumnsSubMenu_DropDownOpened); + // + // 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.showPreviousValueToolStripMenuItem_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.showChangeCountsToolStripMenuItem_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.diffToolStripMenuItem_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.domainToolStripMenuItem_Click); + // // WatchListView // this.WatchListView.AllowColumnReorder = true; @@ -905,13 +912,6 @@ 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); @@ -978,10 +978,10 @@ private System.Windows.Forms.ToolStripMenuItem moveDownToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem showPreviousValueToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem showChangeCountsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem diffToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem domainToolStripMenuItem; + 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 optionsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem definePreviousValueAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem previousFrameToolStripMenuItem; diff --git a/BizHawk.MultiClient/tools/Watch/RamWatch.cs b/BizHawk.MultiClient/tools/Watch/RamWatch.cs index 9bb1849707..0b4f86f866 100644 --- a/BizHawk.MultiClient/tools/Watch/RamWatch.cs +++ b/BizHawk.MultiClient/tools/Watch/RamWatch.cs @@ -939,20 +939,19 @@ namespace BizHawk.MultiClient SelectAll(); } - /*************View***********************/ - private void viewToolStripMenuItem_DropDownOpened(object sender, EventArgs e) + /*************Columns***********************/ + private void ColumnsSubMenu_DropDownOpened(object sender, EventArgs e) { - showPreviousValueToolStripMenuItem.Checked = Global.Config.RamWatchShowPrevColumn; - showChangeCountsToolStripMenuItem.Checked = Global.Config.RamWatchShowChangeColumn; - diffToolStripMenuItem.Checked = Global.Config.RamWatchShowDiffColumn; - domainToolStripMenuItem.Checked = Global.Config.RamWatchShowDomainColumn; + ShowPreviousMenuItem.Checked = Global.Config.RamWatchShowPrevColumn; + ShowChangesMenuItem.Checked = Global.Config.RamWatchShowChangeColumn; + ShowDiffMenuItem.Checked = Global.Config.RamWatchShowDiffColumn; + ShowDomainMenuItem.Checked = Global.Config.RamWatchShowDomainColumn; } private void showPreviousValueToolStripMenuItem_Click(object sender, EventArgs e) { Global.Config.RamWatchShowPrevColumn ^= true; SaveColumnInfo(); - //AddRemoveColumn(PREV, Global.Config.RamWatchShowPrevColumn); LoadColumnInfo(); } @@ -961,7 +960,6 @@ namespace BizHawk.MultiClient Global.Config.RamWatchShowChangeColumn ^= true; SaveColumnInfo(); - //AddRemoveColumn(CHANGES, Global.Config.RamWatchShowChangeColumn); LoadColumnInfo(); } @@ -970,7 +968,6 @@ namespace BizHawk.MultiClient Global.Config.RamWatchShowDiffColumn ^= true; SaveColumnInfo(); - //(DIFF, Global.Config.RamWatchShowDiffColumn); LoadColumnInfo(); } @@ -979,7 +976,6 @@ namespace BizHawk.MultiClient Global.Config.RamWatchShowDomainColumn ^= true; SaveColumnInfo(); - //AddRemoveColumn(DOMAIN, Global.Config.RamWatchShowDomainColumn); LoadColumnInfo(); } @@ -1084,6 +1080,7 @@ namespace BizHawk.MultiClient Global.Config.DisplayRamWatch = false; Global.Config.RamWatchSaveWindowPosition = true; + Global.Config.RamWatchAlwaysOnTop = TopMost = false; LoadColumnInfo(); }