Added Select All/None to RAM Search (squashed PR #3295)

* Added the ability to select all addresses / deselect all addresses in the RAM Search window.
* Fixed logic error. This now makes more intuitive sense, in that, if a portion of the rows were selected, and you do Select All, it should select the unselected rows along with the selected rows.
* Simplify condition

Co-authored-by: YoshiRulz <OSSYoshiRulz@gmail.com>
This commit is contained in:
Thompson Lee 2022-06-29 09:16:46 -04:00 committed by GitHub
parent a86591c595
commit e88fa81358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -143,6 +143,7 @@ namespace BizHawk.Client.EmuHawk
this.label1 = new BizHawk.WinForms.Controls.LocLabelEx();
this.label2 = new BizHawk.WinForms.Controls.LocLabelEx();
this.DisplayTypeDropdown = new System.Windows.Forms.ComboBox();
this.SelectAllMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.SearchMenuItem = new BizHawk.WinForms.Controls.ToolStripMenuItemEx();
this.ListViewContextMenu.SuspendLayout();
this.RamSearchMenu.SuspendLayout();
@ -204,7 +205,7 @@ namespace BizHawk.Client.EmuHawk
this.ContextMenuSeparator3,
this.ClearPreviewContextMenuItem});
this.ListViewContextMenu.Name = "contextMenuStrip1";
this.ListViewContextMenu.Size = new System.Drawing.Size(218, 220);
this.ListViewContextMenu.Size = new System.Drawing.Size(222, 220);
this.ListViewContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ListViewContextMenu_Opening);
//
// DoSearchContextMenuItem
@ -439,6 +440,7 @@ namespace BizHawk.Client.EmuHawk
this.AddToRamWatchMenuItem,
this.PokeAddressMenuItem,
this.FreezeAddressMenuItem,
this.SelectAllMenuItem,
this.toolStripSeparator13,
this.ClearUndoMenuItem});
this.searchToolStripMenuItem.Text = "&Search";
@ -544,6 +546,13 @@ namespace BizHawk.Client.EmuHawk
this.UseUndoHistoryMenuItem.Text = "&Use Undo History";
this.UseUndoHistoryMenuItem.Click += new System.EventHandler(this.UseUndoHistoryMenuItem_Click);
//
// SelectAllMenuItem
//
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys) ((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.SelectAllMenuItem.ShortcutKeyDisplayString = "Ctrl+A";
this.SelectAllMenuItem.Text = "Select All";
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
//
// MemDomainLabel
//
this.MemDomainLabel.Location = new System.Drawing.Point(135, 49);
@ -1174,5 +1183,6 @@ namespace BizHawk.Client.EmuHawk
private System.Windows.Forms.ToolStripButton ErrorIconButton;
private BizHawk.WinForms.Controls.ToolStripMenuItemEx Previous_LastChangeMenuItem;
private BizHawk.WinForms.Controls.ToolStripMenuItemEx AutoSearchAccountForLagMenuItem;
private ToolStripMenuItemEx SelectAllMenuItem;
}
}

View File

@ -944,6 +944,12 @@ namespace BizHawk.Client.EmuHawk
}
}
private void SelectAllAddresses()
{
if (SelectedIndices.Count() == WatchListView.RowCount) WatchListView.DeselectAll();
else WatchListView.SelectAll();
}
public class RamSearchSettings
{
public RamSearchSettings()
@ -1292,6 +1298,11 @@ namespace BizHawk.Client.EmuHawk
UpdateUndoToolBarButtons();
}
private void SelectAllMenuItem_Click(object sender, EventArgs e)
{
SelectAllAddresses();
}
private void SettingsSubMenu_DropDownOpened(object sender, EventArgs e)
{
ExcludeRamWatchMenuItem.Checked = Settings.AlwaysExcludeRamWatch;