Cheats - remove duplicate button and menu item, since duplicates aren't allowed. And some minor code cleanup while I'm at it
This commit is contained in:
parent
57f62d13f1
commit
a7bf93a85c
BizHawk.Client.EmuHawk/tools/Cheats
|
@ -37,10 +37,11 @@
|
|||
this.Compare = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.On = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.Domain = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.CheatsContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.ToggleContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RemoveContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DisableAllContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ViewInHexEditorContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CheatsMenu = new MenuStripEx();
|
||||
this.FileSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.NewMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -54,7 +55,6 @@
|
|||
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CheatsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RemoveCheatMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.DuplicateMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.InsertSeparatorMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.MoveUpMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -91,7 +91,6 @@
|
|||
this.SaveToolBarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.RemoveToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.DuplicateToolBarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.SeparatorToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.MoveUpToolbarItem = new System.Windows.Forms.ToolStripButton();
|
||||
|
@ -102,8 +101,7 @@
|
|||
this.MessageLabel = new System.Windows.Forms.Label();
|
||||
this.CheatGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.CheatEditor = new BizHawk.Client.EmuHawk.CheatEdit();
|
||||
this.ViewInHexEditorContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.CheatsContextMenu.SuspendLayout();
|
||||
this.CheatsMenu.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.CheatGroupBox.SuspendLayout();
|
||||
|
@ -125,7 +123,7 @@
|
|||
this.Compare,
|
||||
this.On,
|
||||
this.Domain});
|
||||
this.CheatListView.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.CheatListView.ContextMenuStrip = this.CheatsContextMenu;
|
||||
this.CheatListView.FullRowSelect = true;
|
||||
this.CheatListView.GridLines = true;
|
||||
this.CheatListView.HideSelection = false;
|
||||
|
@ -176,16 +174,16 @@
|
|||
this.Domain.Text = "Domain";
|
||||
this.Domain.Width = 75;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
// CheatsContextMenu
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.CheatsContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ToggleContextMenuItem,
|
||||
this.RemoveContextMenuItem,
|
||||
this.DisableAllContextMenuItem,
|
||||
this.ViewInHexEditorContextMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(170, 114);
|
||||
this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);
|
||||
this.CheatsContextMenu.Name = "contextMenuStrip1";
|
||||
this.CheatsContextMenu.Size = new System.Drawing.Size(170, 92);
|
||||
this.CheatsContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.CheatsContextMenu_Opening);
|
||||
//
|
||||
// ToggleContextMenuItem
|
||||
//
|
||||
|
@ -213,6 +211,13 @@
|
|||
this.DisableAllContextMenuItem.Text = "&Disable All";
|
||||
this.DisableAllContextMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click);
|
||||
//
|
||||
// ViewInHexEditorContextMenuItem
|
||||
//
|
||||
this.ViewInHexEditorContextMenuItem.Name = "ViewInHexEditorContextMenuItem";
|
||||
this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(169, 22);
|
||||
this.ViewInHexEditorContextMenuItem.Text = "View in Hex Editor";
|
||||
this.ViewInHexEditorContextMenuItem.Click += new System.EventHandler(this.ViewInHexEditorContextMenuItem_Click);
|
||||
//
|
||||
// CheatsMenu
|
||||
//
|
||||
this.CheatsMenu.ClickThrough = true;
|
||||
|
@ -317,7 +322,6 @@
|
|||
//
|
||||
this.CheatsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.RemoveCheatMenuItem,
|
||||
this.DuplicateMenuItem,
|
||||
this.InsertSeparatorMenuItem,
|
||||
this.toolStripSeparator3,
|
||||
this.MoveUpMenuItem,
|
||||
|
@ -342,15 +346,6 @@
|
|||
this.RemoveCheatMenuItem.Text = "&Remove Cheat";
|
||||
this.RemoveCheatMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click);
|
||||
//
|
||||
// DuplicateMenuItem
|
||||
//
|
||||
this.DuplicateMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.Duplicate;
|
||||
this.DuplicateMenuItem.Name = "DuplicateMenuItem";
|
||||
this.DuplicateMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
|
||||
this.DuplicateMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.DuplicateMenuItem.Text = "&Duplicate";
|
||||
this.DuplicateMenuItem.Click += new System.EventHandler(this.DuplicateMenuItem_Click);
|
||||
//
|
||||
// InsertSeparatorMenuItem
|
||||
//
|
||||
this.InsertSeparatorMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.InsertSeparator;
|
||||
|
@ -590,7 +585,6 @@
|
|||
this.SaveToolBarItem,
|
||||
this.toolStripSeparator,
|
||||
this.RemoveToolbarItem,
|
||||
this.DuplicateToolBarItem,
|
||||
this.SeparatorToolbarItem,
|
||||
this.toolStripSeparator2,
|
||||
this.MoveUpToolbarItem,
|
||||
|
@ -648,16 +642,6 @@
|
|||
this.RemoveToolbarItem.Text = "&Remove";
|
||||
this.RemoveToolbarItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click);
|
||||
//
|
||||
// DuplicateToolBarItem
|
||||
//
|
||||
this.DuplicateToolBarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.DuplicateToolBarItem.Image = ((System.Drawing.Image)(resources.GetObject("DuplicateToolBarItem.Image")));
|
||||
this.DuplicateToolBarItem.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.DuplicateToolBarItem.Name = "DuplicateToolBarItem";
|
||||
this.DuplicateToolBarItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.DuplicateToolBarItem.Text = "&Duplicate";
|
||||
this.DuplicateToolBarItem.Click += new System.EventHandler(this.DuplicateMenuItem_Click);
|
||||
//
|
||||
// SeparatorToolbarItem
|
||||
//
|
||||
this.SeparatorToolbarItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -750,13 +734,6 @@
|
|||
this.CheatEditor.Size = new System.Drawing.Size(190, 264);
|
||||
this.CheatEditor.TabIndex = 0;
|
||||
//
|
||||
// ViewInHexEditorContextMenuItem
|
||||
//
|
||||
this.ViewInHexEditorContextMenuItem.Name = "ViewInHexEditorContextMenuItem";
|
||||
this.ViewInHexEditorContextMenuItem.Size = new System.Drawing.Size(169, 22);
|
||||
this.ViewInHexEditorContextMenuItem.Text = "View in Hex Editor";
|
||||
this.ViewInHexEditorContextMenuItem.Click += new System.EventHandler(this.ViewInHexEditorContextMenuItem_Click);
|
||||
//
|
||||
// Cheats
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -775,7 +752,7 @@
|
|||
this.Load += new System.EventHandler(this.NewCheatForm_Load);
|
||||
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.NewCheatForm_DragDrop);
|
||||
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.NewCheatForm_DragEnter);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.CheatsContextMenu.ResumeLayout(false);
|
||||
this.CheatsMenu.ResumeLayout(false);
|
||||
this.CheatsMenu.PerformLayout();
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
|
@ -808,7 +785,6 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem ExitMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem CheatsSubMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem RemoveCheatMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem DuplicateMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem InsertSeparatorMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.ToolStripMenuItem MoveUpMenuItem;
|
||||
|
@ -832,7 +808,6 @@
|
|||
private System.Windows.Forms.ToolStripButton SaveToolBarItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator;
|
||||
private System.Windows.Forms.ToolStripButton RemoveToolbarItem;
|
||||
private System.Windows.Forms.ToolStripButton DuplicateToolBarItem;
|
||||
private System.Windows.Forms.ToolStripButton SeparatorToolbarItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
private System.Windows.Forms.ToolStripButton MoveUpToolbarItem;
|
||||
|
@ -853,7 +828,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem ShowSizeMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ShowEndianMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem ShowDisplayTypeMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ContextMenuStrip CheatsContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem ToggleContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem RemoveContextMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem DisableAllContextMenuItem;
|
||||
|
|
|
@ -199,11 +199,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GameGenieToolbarSeparator.Visible =
|
||||
LoadGameGenieToolbarItem.Visible =
|
||||
((Global.Emulator is NES)
|
||||
(Global.Emulator is NES)
|
||||
|| (Global.Emulator.SystemId == "GEN" && VersionInfo.INTERIM)
|
||||
|| (Global.Emulator.SystemId == "GB")
|
||||
|| (Global.Game.System == "GG")
|
||||
|| (Global.Emulator is LibsnesCore));
|
||||
|| (Global.Emulator is LibsnesCore);
|
||||
}
|
||||
|
||||
private void AddCheat()
|
||||
|
@ -592,7 +592,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void CheatsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
RemoveCheatMenuItem.Enabled =
|
||||
DuplicateMenuItem.Enabled =
|
||||
MoveUpMenuItem.Enabled =
|
||||
MoveDownMenuItem.Enabled =
|
||||
ToggleMenuItem.Enabled =
|
||||
|
@ -602,11 +601,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
GameGenieSeparator.Visible =
|
||||
OpenGameGenieEncoderDecoderMenuItem.Visible =
|
||||
((Global.Emulator is NES)
|
||||
(Global.Emulator is NES)
|
||||
|| (Global.Emulator is Genesis)
|
||||
|| (Global.Emulator.SystemId == "GB")
|
||||
|| (Global.Game.System == "GG")
|
||||
|| (Global.Emulator is LibsnesCore));
|
||||
|| (Global.Emulator is LibsnesCore);
|
||||
}
|
||||
|
||||
private void RemoveCheatMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -614,20 +613,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
Remove();
|
||||
}
|
||||
|
||||
private void DuplicateMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CheatListView.SelectedIndices.Count > 0)
|
||||
{
|
||||
foreach (int index in CheatListView.SelectedIndices)
|
||||
{
|
||||
Global.CheatList.Add(new Cheat(Global.CheatList[index]));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateDialog();
|
||||
UpdateMessageLabel();
|
||||
}
|
||||
|
||||
private void InsertSeparatorMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (SelectedIndices.Any())
|
||||
|
@ -655,10 +640,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void SelectAllMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (var i = 0; i < Global.CheatList.Count; i++)
|
||||
{
|
||||
CheatListView.SelectItem(i, true);
|
||||
}
|
||||
Enumerable
|
||||
.Range(0, Global.CheatList.Count)
|
||||
.ToList()
|
||||
.ForEach(i => CheatListView.SelectItem(i, true));
|
||||
}
|
||||
|
||||
private void ToggleMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -704,6 +689,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Global.Config.DisableCheatsOnLoad ^= true;
|
||||
}
|
||||
|
||||
private void AutoloadMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.Config.RecentCheats.AutoLoad ^= true;
|
||||
|
@ -843,7 +829,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
private void CheatListView_ColumnReordered(object sender, ColumnReorderedEventArgs e)
|
||||
{
|
||||
|
||||
Global.Config.CheatsColumnIndices[NAME] = CheatListView.Columns[NAME].DisplayIndex;
|
||||
Global.Config.CheatsColumnIndices[ADDRESS] = CheatListView.Columns[ADDRESS].DisplayIndex;
|
||||
Global.Config.CheatsColumnIndices[VALUE] = CheatListView.Columns[VALUE].DisplayIndex;
|
||||
|
@ -866,7 +851,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
Remove();
|
||||
}
|
||||
else if (e.KeyCode == Keys.A && e.Control && !e.Alt && !e.Shift) //Select All
|
||||
else if (e.KeyCode == Keys.A && e.Control && !e.Alt && !e.Shift)
|
||||
{
|
||||
SelectAllMenuItem_Click(null, null);
|
||||
}
|
||||
|
@ -895,7 +880,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private void NewCheatForm_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
if (Path.GetExtension(filePaths[0]) == (".cht"))
|
||||
if (Path.GetExtension(filePaths[0]) == ".cht")
|
||||
{
|
||||
LoadFile(new FileInfo(filePaths[0]), append: false);
|
||||
UpdateDialog();
|
||||
|
@ -908,7 +893,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
e.Effect = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
|
||||
}
|
||||
|
||||
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
|
||||
private void CheatsContextMenu_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
ToggleContextMenuItem.Enabled =
|
||||
RemoveContextMenuItem.Enabled =
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="CheatsContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>339, 17</value>
|
||||
</metadata>
|
||||
<metadata name="CheatsMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
@ -168,20 +168,6 @@
|
|||
r00Cgk/n38S7wBwC04u4UGxHrMHF4CbEJtyDLj5fCDIzhljfSxzeavRgyw4Zj9t64GvvQ0d3P3pfD2Kv
|
||||
2QqNvgFxDN6urYdWmyMElJMnevh60obRktA701PRtGlg1DOdSkXwzrisaMG/RZLWAE60OMW5fNhvAAAA
|
||||
AElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="DuplicateToolBarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHkSURBVDhPvZHfS1NhHIf3p5QypLr2D4goMwoMCi/qIugH
|
||||
Xe1Cr7qKDIMkZixwNhfWLGWbnuki0kXKzLU023KubBNPJrbRdOzocm6e2dPOO21mMS+CHvjcvOf9PF++
|
||||
79H9M+7RT2iRRsIi9sEAXe43yAvf2LpSHq28G9uAnytNT4jMLewtcQ2Ht2pF8ps/aOt+gccX5lxD694S
|
||||
+1BQFD1RkN5DSFa4Z3uONKbgHE3h8KZ4OJTC1J8UiSzmfhd2uf1CoJHbyKOsZokl0kKwm+aeJaov+wjO
|
||||
rpQkVqdXfOz0bWAcVLghfaXxkUz3y2VxvpMGSwL3uMKh+gHezSSLEnNhX23vtYzKUirDfGyFj/Iy1mdx
|
||||
UWqR8iKhwtQLxjgH659y4EwvVXWPiwJt3/Ws+muywRrlqvkDdx3zQrCN8l1ldnEd3/QqFmkS/akHJYGS
|
||||
zjLzOUEwEsMf+sLI2zmaOou/93pPGoM5zvk7UU7fnBKxSBPoT7SXBNW1F/9Io2lKCNTCeomUyrS8xnBA
|
||||
wfUqyf1eP5U1ptJD/o1LzeNCsHPydtqdr6k4aiwvOHvNSya3ibU/QIdrEkvfhJislc32MfYfuV1eUGPw
|
||||
FF7bIVJVZ0N/soPK421UHGstlFvYd/hWecF/Qqf7CR0A5wwgSQA2AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="LoadGameGenieToolbarItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
|
|
Loading…
Reference in New Issue