New Cheat Dialog - implement Movie up/down, Remove, select all, disable all cheats
This commit is contained in:
parent
bfaebbf51d
commit
89ba4ffe8e
|
@ -85,6 +85,12 @@
|
|||
this.toolStripButtonLoadGameGenie = new System.Windows.Forms.ToolStripButton();
|
||||
this.TotalLabel = new System.Windows.Forms.Label();
|
||||
this.MessageLabel = new System.Windows.Forms.Label();
|
||||
this.nameToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.valueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.compareToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.onToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.domainToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CheatsMenu.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -276,12 +282,12 @@
|
|||
//
|
||||
// RemoveCheatMenuItem
|
||||
//
|
||||
this.RemoveCheatMenuItem.Enabled = false;
|
||||
this.RemoveCheatMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Delete;
|
||||
this.RemoveCheatMenuItem.Name = "RemoveCheatMenuItem";
|
||||
this.RemoveCheatMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R)));
|
||||
this.RemoveCheatMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.RemoveCheatMenuItem.Text = "&Remove Cheat";
|
||||
this.RemoveCheatMenuItem.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click);
|
||||
//
|
||||
// DuplicateMenuItem
|
||||
//
|
||||
|
@ -308,29 +314,29 @@
|
|||
//
|
||||
// MoveUpMenuItem
|
||||
//
|
||||
this.MoveUpMenuItem.Enabled = false;
|
||||
this.MoveUpMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.MoveUp;
|
||||
this.MoveUpMenuItem.Name = "MoveUpMenuItem";
|
||||
this.MoveUpMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
|
||||
this.MoveUpMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.MoveUpMenuItem.Text = "Move &Up";
|
||||
this.MoveUpMenuItem.Click += new System.EventHandler(this.MoveUpMenuItem_Click);
|
||||
//
|
||||
// MoveDownMenuItem
|
||||
//
|
||||
this.MoveDownMenuItem.Enabled = false;
|
||||
this.MoveDownMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.MoveDown;
|
||||
this.MoveDownMenuItem.Name = "MoveDownMenuItem";
|
||||
this.MoveDownMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
|
||||
this.MoveDownMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.MoveDownMenuItem.Text = "Move &Down";
|
||||
this.MoveDownMenuItem.Click += new System.EventHandler(this.MoveDownMenuItem_Click);
|
||||
//
|
||||
// SelectAllMenuItem
|
||||
//
|
||||
this.SelectAllMenuItem.Enabled = false;
|
||||
this.SelectAllMenuItem.Name = "SelectAllMenuItem";
|
||||
this.SelectAllMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
|
||||
this.SelectAllMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.SelectAllMenuItem.Text = "Select &All";
|
||||
this.SelectAllMenuItem.Click += new System.EventHandler(this.SelectAllMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
|
@ -339,11 +345,11 @@
|
|||
//
|
||||
// DisableAllCheatsMenuItem
|
||||
//
|
||||
this.DisableAllCheatsMenuItem.Enabled = false;
|
||||
this.DisableAllCheatsMenuItem.Image = global::BizHawk.MultiClient.Properties.Resources.Stop;
|
||||
this.DisableAllCheatsMenuItem.Name = "DisableAllCheatsMenuItem";
|
||||
this.DisableAllCheatsMenuItem.Size = new System.Drawing.Size(233, 22);
|
||||
this.DisableAllCheatsMenuItem.Text = "Disable all Cheats";
|
||||
this.DisableAllCheatsMenuItem.Click += new System.EventHandler(this.DisableAllCheatsMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator7
|
||||
//
|
||||
|
@ -437,6 +443,13 @@
|
|||
//
|
||||
// ColumnsSubMenu
|
||||
//
|
||||
this.ColumnsSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.nameToolStripMenuItem,
|
||||
this.addressToolStripMenuItem,
|
||||
this.valueToolStripMenuItem,
|
||||
this.compareToolStripMenuItem,
|
||||
this.onToolStripMenuItem,
|
||||
this.domainToolStripMenuItem});
|
||||
this.ColumnsSubMenu.Name = "ColumnsSubMenu";
|
||||
this.ColumnsSubMenu.Size = new System.Drawing.Size(67, 20);
|
||||
this.ColumnsSubMenu.Text = "&Columns";
|
||||
|
@ -501,12 +514,12 @@
|
|||
// cutToolStripButton
|
||||
//
|
||||
this.cutToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.cutToolStripButton.Enabled = false;
|
||||
this.cutToolStripButton.Image = global::BizHawk.MultiClient.Properties.Resources.Delete;
|
||||
this.cutToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.cutToolStripButton.Name = "cutToolStripButton";
|
||||
this.cutToolStripButton.Size = new System.Drawing.Size(23, 22);
|
||||
this.cutToolStripButton.Text = "&Remove";
|
||||
this.cutToolStripButton.Click += new System.EventHandler(this.RemoveCheatMenuItem_Click);
|
||||
//
|
||||
// copyToolStripButton
|
||||
//
|
||||
|
@ -536,22 +549,22 @@
|
|||
// toolStripButtonMoveUp
|
||||
//
|
||||
this.toolStripButtonMoveUp.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.toolStripButtonMoveUp.Enabled = false;
|
||||
this.toolStripButtonMoveUp.Image = global::BizHawk.MultiClient.Properties.Resources.MoveUp;
|
||||
this.toolStripButtonMoveUp.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonMoveUp.Name = "toolStripButtonMoveUp";
|
||||
this.toolStripButtonMoveUp.Size = new System.Drawing.Size(23, 22);
|
||||
this.toolStripButtonMoveUp.Text = "Move Up";
|
||||
this.toolStripButtonMoveUp.Click += new System.EventHandler(this.MoveUpMenuItem_Click);
|
||||
//
|
||||
// toolStripButtonMoveDown
|
||||
//
|
||||
this.toolStripButtonMoveDown.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.toolStripButtonMoveDown.Enabled = false;
|
||||
this.toolStripButtonMoveDown.Image = global::BizHawk.MultiClient.Properties.Resources.MoveDown;
|
||||
this.toolStripButtonMoveDown.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButtonMoveDown.Name = "toolStripButtonMoveDown";
|
||||
this.toolStripButtonMoveDown.Size = new System.Drawing.Size(23, 22);
|
||||
this.toolStripButtonMoveDown.Text = "Move Down";
|
||||
this.toolStripButtonMoveDown.Click += new System.EventHandler(this.MoveDownMenuItem_Click);
|
||||
//
|
||||
// toolStripButtonLoadGameGenie
|
||||
//
|
||||
|
@ -583,6 +596,48 @@
|
|||
this.MessageLabel.TabIndex = 7;
|
||||
this.MessageLabel.Text = " ";
|
||||
//
|
||||
// nameToolStripMenuItem
|
||||
//
|
||||
this.nameToolStripMenuItem.Enabled = false;
|
||||
this.nameToolStripMenuItem.Name = "nameToolStripMenuItem";
|
||||
this.nameToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.nameToolStripMenuItem.Text = "&Name";
|
||||
//
|
||||
// addressToolStripMenuItem
|
||||
//
|
||||
this.addressToolStripMenuItem.Enabled = false;
|
||||
this.addressToolStripMenuItem.Name = "addressToolStripMenuItem";
|
||||
this.addressToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.addressToolStripMenuItem.Text = "&Address";
|
||||
//
|
||||
// valueToolStripMenuItem
|
||||
//
|
||||
this.valueToolStripMenuItem.Enabled = false;
|
||||
this.valueToolStripMenuItem.Name = "valueToolStripMenuItem";
|
||||
this.valueToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.valueToolStripMenuItem.Text = "&Value";
|
||||
//
|
||||
// compareToolStripMenuItem
|
||||
//
|
||||
this.compareToolStripMenuItem.Enabled = false;
|
||||
this.compareToolStripMenuItem.Name = "compareToolStripMenuItem";
|
||||
this.compareToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.compareToolStripMenuItem.Text = "&Compare";
|
||||
//
|
||||
// onToolStripMenuItem
|
||||
//
|
||||
this.onToolStripMenuItem.Enabled = false;
|
||||
this.onToolStripMenuItem.Name = "onToolStripMenuItem";
|
||||
this.onToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.onToolStripMenuItem.Text = "&On";
|
||||
//
|
||||
// domainToolStripMenuItem
|
||||
//
|
||||
this.domainToolStripMenuItem.Enabled = false;
|
||||
this.domainToolStripMenuItem.Name = "domainToolStripMenuItem";
|
||||
this.domainToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.domainToolStripMenuItem.Text = "&Domain";
|
||||
//
|
||||
// NewCheatForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -665,5 +720,11 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem ColumnsSubMenu;
|
||||
private System.Windows.Forms.Label MessageLabel;
|
||||
private System.Windows.Forms.ToolStripMenuItem AlwaysOnTopMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem nameToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem addressToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem valueToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem compareToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem onToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem domainToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -75,22 +75,27 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
Global.Config.RecentWatches.Add(path);
|
||||
UpdateListView();
|
||||
ShowFileName(loaded: true);
|
||||
UpdateMessageLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowFileName(bool loaded)
|
||||
private void UpdateMessageLabel(bool saved = false)
|
||||
{
|
||||
MessageLabel.Text = Path.GetFileName(Global.CheatList2.CurrentFileName);
|
||||
if (loaded)
|
||||
string message = String.Empty;
|
||||
if (!String.IsNullOrWhiteSpace(Global.CheatList2.CurrentFileName))
|
||||
{
|
||||
MessageLabel.Text += " loaded";
|
||||
}
|
||||
else if (Global.CheatList2.Changes)
|
||||
{
|
||||
MessageLabel.Text += " *";
|
||||
if (saved)
|
||||
{
|
||||
message = Path.GetFileName(Global.CheatList2.CurrentFileName) + " saved.";
|
||||
}
|
||||
else
|
||||
{
|
||||
message = Path.GetFileName(Global.CheatList2.CurrentFileName) + (Global.CheatList2.Changes ? " *" : String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
MessageLabel.Text = message;
|
||||
}
|
||||
|
||||
public bool AskSave()
|
||||
|
@ -280,6 +285,88 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
private void MoveUp()
|
||||
{
|
||||
var indices = CheatListView.SelectedIndices;
|
||||
if (indices.Count == 0 || indices[0] == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (int index in indices)
|
||||
{
|
||||
var cheat = Global.CheatList2[index];
|
||||
Global.CheatList2.Remove(Global.CheatList2[index]);
|
||||
Global.CheatList2.Insert(index - 1, cheat);
|
||||
}
|
||||
|
||||
UpdateMessageLabel();
|
||||
|
||||
var newindices = new List<int>();
|
||||
for (int i = 0; i < indices.Count; i++)
|
||||
{
|
||||
newindices.Add(indices[i] - 1);
|
||||
}
|
||||
|
||||
CheatListView.SelectedIndices.Clear();
|
||||
foreach (int newi in newindices)
|
||||
{
|
||||
CheatListView.SelectItem(newi, true);
|
||||
}
|
||||
|
||||
UpdateListView();
|
||||
}
|
||||
|
||||
private void MoveDown()
|
||||
{
|
||||
var indices = CheatListView.SelectedIndices;
|
||||
if (indices.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (int index in indices)
|
||||
{
|
||||
var cheat = Global.CheatList2[index];
|
||||
|
||||
if (index < Global.CheatList2.Count - 1)
|
||||
{
|
||||
Global.CheatList2.Remove(Global.CheatList2[index]);
|
||||
Global.CheatList2.Insert(index + 1, cheat);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateMessageLabel();
|
||||
|
||||
var newindices = new List<int>();
|
||||
for (int i = 0; i < indices.Count; i++)
|
||||
{
|
||||
newindices.Add(indices[i] + 1);
|
||||
}
|
||||
|
||||
CheatListView.SelectedIndices.Clear();
|
||||
foreach (int newi in newindices)
|
||||
{
|
||||
CheatListView.SelectItem(newi, true);
|
||||
}
|
||||
|
||||
UpdateListView();
|
||||
}
|
||||
|
||||
private void Remove()
|
||||
{
|
||||
if (SelectedIndices.Any())
|
||||
{
|
||||
foreach (int index in SelectedIndices)
|
||||
{
|
||||
Global.CheatList2.Remove(Global.CheatList2[SelectedIndices[0]]); //SelectedIndices[0] used since each iteration will make this the correct list index
|
||||
}
|
||||
CheatListView.SelectedIndices.Clear();
|
||||
}
|
||||
|
||||
UpdateListView();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
#region File
|
||||
|
@ -312,7 +399,17 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void CheatsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
RemoveCheatMenuItem.Enabled =
|
||||
MoveUpMenuItem.Enabled =
|
||||
MoveDownMenuItem.Enabled =
|
||||
SelectedIndices.Any();
|
||||
|
||||
DisableAllCheatsMenuItem.Enabled = Global.CheatList2.ActiveCheatCount > 0;
|
||||
}
|
||||
|
||||
private void RemoveCheatMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Remove();
|
||||
}
|
||||
|
||||
private void InsertSeparatorMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -329,6 +426,29 @@ namespace BizHawk.MultiClient
|
|||
UpdateListView();
|
||||
}
|
||||
|
||||
private void MoveUpMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
|
||||
private void MoveDownMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
|
||||
private void SelectAllMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < Global.CheatList2.Count; i++)
|
||||
{
|
||||
CheatListView.SelectItem(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableAllCheatsMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Global.CheatList2.DisableAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Options
|
||||
|
|
|
@ -436,7 +436,8 @@ namespace BizHawk.MultiClient
|
|||
//but this avoids it being flagged falsely when the user did not select an index
|
||||
Changes();
|
||||
}
|
||||
List<int> indices = new List<int>();
|
||||
|
||||
var indices = new List<int>();
|
||||
for (int i = 0; i < indexes.Count; i++)
|
||||
{
|
||||
indices.Add(indexes[i] - 1);
|
||||
|
@ -453,7 +454,7 @@ namespace BizHawk.MultiClient
|
|||
|
||||
private void MoveDown()
|
||||
{
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
var indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -469,12 +470,12 @@ namespace BizHawk.MultiClient
|
|||
Watches.Insert(index + 1, watch);
|
||||
}
|
||||
|
||||
//Note: here it will get flagged many times redundantly potnetially,
|
||||
//Note: here it will get flagged many times redundantly potentially,
|
||||
//but this avoids it being flagged falsely when the user did not select an index
|
||||
Changes();
|
||||
}
|
||||
|
||||
List<int> indices = new List<int>();
|
||||
var indices = new List<int>();
|
||||
for (int i = 0; i < indexes.Count; i++)
|
||||
{
|
||||
indices.Add(indexes[i] + 1);
|
||||
|
|
Loading…
Reference in New Issue