Ram Watch - make Edit/Remove/Duplicate menu items enabled only if a listview item is selected
This commit is contained in:
parent
2f3f0e01cf
commit
79a95ba061
|
@ -51,6 +51,7 @@
|
|||
this.removeWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.duplicateWatchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.insertSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -67,14 +68,13 @@
|
|||
this.EditWatchToolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.cutToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.DuplicateWatchToolStripButton = new System.Windows.Forms.ToolStripButton();
|
||||
this.PoketoolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.MoveUpStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.MoveDownStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.WatchCountLabel = new System.Windows.Forms.Label();
|
||||
this.MessageLabel = new System.Windows.Forms.Label();
|
||||
this.PoketoolStripButton2 = new System.Windows.Forms.ToolStripButton();
|
||||
this.pokeAddressToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
@ -223,6 +223,7 @@
|
|||
this.watchesToolStripMenuItem.Name = "watchesToolStripMenuItem";
|
||||
this.watchesToolStripMenuItem.Size = new System.Drawing.Size(61, 20);
|
||||
this.watchesToolStripMenuItem.Text = "&Watches";
|
||||
this.watchesToolStripMenuItem.DropDownOpened += new System.EventHandler(this.watchesToolStripMenuItem_DropDownOpened);
|
||||
//
|
||||
// newWatchToolStripMenuItem
|
||||
//
|
||||
|
@ -264,6 +265,14 @@
|
|||
this.insertSeparatorToolStripMenuItem.Text = "Insert Separator";
|
||||
this.insertSeparatorToolStripMenuItem.Click += new System.EventHandler(this.insertSeparatorToolStripMenuItem_Click);
|
||||
//
|
||||
// pokeAddressToolStripMenuItem
|
||||
//
|
||||
this.pokeAddressToolStripMenuItem.Name = "pokeAddressToolStripMenuItem";
|
||||
this.pokeAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
|
||||
this.pokeAddressToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.pokeAddressToolStripMenuItem.Text = "Poke Address";
|
||||
this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
|
@ -419,6 +428,17 @@
|
|||
this.DuplicateWatchToolStripButton.Text = "Duplicate Watch";
|
||||
this.DuplicateWatchToolStripButton.Click += new System.EventHandler(this.DuplicateWatchToolStripButton_Click);
|
||||
//
|
||||
// PoketoolStripButton2
|
||||
//
|
||||
this.PoketoolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.PoketoolStripButton2.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
|
||||
this.PoketoolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.PoketoolStripButton2.Name = "PoketoolStripButton2";
|
||||
this.PoketoolStripButton2.Size = new System.Drawing.Size(23, 22);
|
||||
this.PoketoolStripButton2.Text = "toolStripButton2";
|
||||
this.PoketoolStripButton2.ToolTipText = "Poke address";
|
||||
this.PoketoolStripButton2.Click += new System.EventHandler(this.PoketoolStripButton2_Click);
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
|
@ -474,25 +494,6 @@
|
|||
this.MessageLabel.TabIndex = 5;
|
||||
this.MessageLabel.Text = " ";
|
||||
//
|
||||
// PoketoolStripButton2
|
||||
//
|
||||
this.PoketoolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.PoketoolStripButton2.Image = global::BizHawk.MultiClient.Properties.Resources.poke;
|
||||
this.PoketoolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.PoketoolStripButton2.Name = "PoketoolStripButton2";
|
||||
this.PoketoolStripButton2.Size = new System.Drawing.Size(23, 22);
|
||||
this.PoketoolStripButton2.Text = "toolStripButton2";
|
||||
this.PoketoolStripButton2.ToolTipText = "Poke address";
|
||||
this.PoketoolStripButton2.Click += new System.EventHandler(this.PoketoolStripButton2_Click);
|
||||
//
|
||||
// pokeAddressToolStripMenuItem
|
||||
//
|
||||
this.pokeAddressToolStripMenuItem.Name = "pokeAddressToolStripMenuItem";
|
||||
this.pokeAddressToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
|
||||
this.pokeAddressToolStripMenuItem.Size = new System.Drawing.Size(202, 22);
|
||||
this.pokeAddressToolStripMenuItem.Text = "Poke Address";
|
||||
this.pokeAddressToolStripMenuItem.Click += new System.EventHandler(this.pokeAddressToolStripMenuItem_Click);
|
||||
//
|
||||
// RamWatch
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
|
@ -20,7 +20,6 @@ namespace BizHawk.MultiClient
|
|||
//Make a context menu for add/remove/Dup/etc, make the context menu & edit watch windows appear in relation to where they right clicked
|
||||
//TODO: Call AskSave in main client X function
|
||||
//Multiselect is enabled but only one row can be highlighted by the user
|
||||
//When using ListView index, validate the user has selected one!
|
||||
//DWORD display
|
||||
|
||||
int defaultWidth; //For saving the default size of the dialog, so the user can restore if desired
|
||||
|
@ -294,34 +293,41 @@ namespace BizHawk.MultiClient
|
|||
void EditWatch()
|
||||
{
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
EditWatchObject(indexes[0]);
|
||||
if (indexes.Count > 0)
|
||||
EditWatchObject(indexes[0]);
|
||||
}
|
||||
|
||||
void RemoveWatch()
|
||||
{
|
||||
Changes();
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
foreach (int index in indexes)
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
watchList.Remove(watchList[index]);
|
||||
foreach (int index in indexes)
|
||||
{
|
||||
watchList.Remove(watchList[index]);
|
||||
}
|
||||
DisplayWatchList();
|
||||
}
|
||||
DisplayWatchList();
|
||||
}
|
||||
|
||||
void DuplicateWatch()
|
||||
{
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
RamWatchNewWatch r = new RamWatchNewWatch();
|
||||
r.location = GetPromptPoint();
|
||||
int x = indexes[0];
|
||||
r.SetToEditWatch(watchList[x], "Duplicate Watch");
|
||||
r.ShowDialog();
|
||||
|
||||
if (r.userSelected == true)
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
Changes();
|
||||
watchList.Add(watchList[x]); //TODO: Fail, add the userselected watchlist
|
||||
DisplayWatchList();
|
||||
RamWatchNewWatch r = new RamWatchNewWatch();
|
||||
r.location = GetPromptPoint();
|
||||
int x = indexes[0];
|
||||
r.SetToEditWatch(watchList[x], "Duplicate Watch");
|
||||
r.ShowDialog();
|
||||
|
||||
if (r.userSelected == true)
|
||||
{
|
||||
Changes();
|
||||
watchList.Add(watchList[x]); //TODO: Fail, add the userselected watchlist
|
||||
DisplayWatchList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -751,7 +757,9 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
RamPoke p = new RamPoke();
|
||||
p.SetWatchObject(watchList[indexes[0]]);
|
||||
|
||||
if (indexes.Count > 0)
|
||||
p.SetWatchObject(watchList[indexes[0]]);
|
||||
p.location = GetPromptPoint();
|
||||
p.ShowDialog();
|
||||
}
|
||||
|
@ -760,5 +768,22 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
PokeAddress();
|
||||
}
|
||||
|
||||
private void watchesToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
ListView.SelectedIndexCollection indexes = WatchListView.SelectedIndices;
|
||||
if (indexes.Count > 0)
|
||||
{
|
||||
editWatchToolStripMenuItem.Enabled = true;
|
||||
duplicateWatchToolStripMenuItem.Enabled = true;
|
||||
removeWatchToolStripMenuItem.Enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
editWatchToolStripMenuItem.Enabled = false;
|
||||
duplicateWatchToolStripMenuItem.Enabled = false;
|
||||
removeWatchToolStripMenuItem.Enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue