From 89958f4c62e2d3f81bee6f2eec85af1a3a778a9f Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Thu, 17 Mar 2011 03:41:14 +0000 Subject: [PATCH] Cheat Window - some more stuff implemented --- BizHawk.MultiClient/tools/Cheats.Designer.cs | 2 ++ BizHawk.MultiClient/tools/Cheats.cs | 31 ++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/BizHawk.MultiClient/tools/Cheats.Designer.cs b/BizHawk.MultiClient/tools/Cheats.Designer.cs index 46b0e0b756..2af482b15e 100644 --- a/BizHawk.MultiClient/tools/Cheats.Designer.cs +++ b/BizHawk.MultiClient/tools/Cheats.Designer.cs @@ -252,6 +252,7 @@ this.duplicateToolStripMenuItem.Name = "duplicateToolStripMenuItem"; this.duplicateToolStripMenuItem.Size = new System.Drawing.Size(165, 22); this.duplicateToolStripMenuItem.Text = "&Duplicate"; + this.duplicateToolStripMenuItem.Click += new System.EventHandler(this.duplicateToolStripMenuItem_Click); // // insertSeparatorToolStripMenuItem // @@ -381,6 +382,7 @@ this.copyToolStripButton.Name = "copyToolStripButton"; this.copyToolStripButton.Size = new System.Drawing.Size(23, 22); this.copyToolStripButton.Text = "&Duplicate"; + this.copyToolStripButton.Click += new System.EventHandler(this.copyToolStripButton_Click); // // toolStripButtonSeparator // diff --git a/BizHawk.MultiClient/tools/Cheats.cs b/BizHawk.MultiClient/tools/Cheats.cs index 4fd56cec7f..3c1e52db3e 100644 --- a/BizHawk.MultiClient/tools/Cheats.cs +++ b/BizHawk.MultiClient/tools/Cheats.cs @@ -17,10 +17,10 @@ namespace BizHawk.MultiClient //Input validation on address & value boxes //Remove compare column? make it conditional? Think about this //Set address box text load based on memory domain size - //Recent files //Memory domains //File format - saving & loading //Shortcuts for Cheat menu items + //Edit button enabled conditionally on highlighted listview item int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired int defaultHeight; @@ -103,7 +103,6 @@ namespace BizHawk.MultiClient public void AddCheat(Cheat c) { cheatList.Add(c); - UpdateNumberOfCheats(); DisplayCheatsList(); CheatListView.Refresh(); } @@ -196,6 +195,7 @@ namespace BizHawk.MultiClient private void DisplayCheatsList() { + UpdateNumberOfCheats(); CheatListView.ItemCount = cheatList.Count; } @@ -562,5 +562,32 @@ namespace BizHawk.MultiClient { saveWindowPositionToolStripMenuItem.Checked = Global.Config.CheatsSaveWindowPosition; } + + private void DuplicateCheat() + { + ListView.SelectedIndexCollection indexes = CheatListView.SelectedIndices; + if (indexes.Count > 0) + { + Cheat c = new Cheat(); + int x = indexes[0]; + c.name = cheatList[x].name; + c.address = cheatList[x].address; + c.value = cheatList[x].value; + c.compare = cheatList[x].compare; + Changes(); + cheatList.Add(c); + DisplayCheatsList(); + } + } + + private void copyToolStripButton_Click(object sender, EventArgs e) + { + DuplicateCheat(); + } + + private void duplicateToolStripMenuItem_Click(object sender, EventArgs e) + { + DuplicateCheat(); + } } }