From 56a39414ed06c0a481d6ed52b8c743c82cd26cce Mon Sep 17 00:00:00 2001 From: jays2kings Date: Mon, 28 Apr 2014 22:25:22 -0400 Subject: [PATCH] Clicking on the selected profile in the context menu now lets you edit it --- DS4Tool/ScpForm.cs | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/DS4Tool/ScpForm.cs b/DS4Tool/ScpForm.cs index b542106..a2077b7 100644 --- a/DS4Tool/ScpForm.cs +++ b/DS4Tool/ScpForm.cs @@ -427,19 +427,10 @@ namespace ScpServer { ToolStripMenuItem tS = (ToolStripMenuItem)sender; int tdevice = Int32.Parse(tS.Tag.ToString()); - if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) + if (e.ClickedItem != tS.DropDownItems[tS.DropDownItems.Count - 1]) + if (((ToolStripMenuItem)e.ClickedItem).Checked) { - for (int i = 0; i < tS.DropDownItems.Count; i++) - ((ToolStripMenuItem)tS.DropDownItems[i]).Checked = false; - ((ToolStripMenuItem)e.ClickedItem).Checked = true; - cbs[tdevice].SelectedIndex = tS.DropDownItems.IndexOf(e.ClickedItem); - Global.setAProfile(tdevice, e.ClickedItem.Text); - Global.Save(); - Global.LoadProfile(tdevice); - } - else if (e.ClickedItem.Text == "+New Profile") //if +New Profile selected - { - Options opt = OptionsDialog[tdevice] = new Options(rootHub, tdevice, "", this); + Options opt = OptionsDialog[tdevice] = new Options(rootHub, tdevice, e.ClickedItem.Text, this); opt.Text = "Options for Controller " + (tdevice + 1); opt.Icon = this.Icon; int i = tdevice; @@ -451,6 +442,30 @@ namespace ScpServer opt.Show(); Enable_Controls(i, false); } + else + { + for (int i = 0; i < tS.DropDownItems.Count; i++) + ((ToolStripMenuItem)tS.DropDownItems[i]).Checked = false; + ((ToolStripMenuItem)e.ClickedItem).Checked = true; + cbs[tdevice].SelectedIndex = tS.DropDownItems.IndexOf(e.ClickedItem); + Global.setAProfile(tdevice, e.ClickedItem.Text); + Global.Save(); + Global.LoadProfile(tdevice); + } + else if (e.ClickedItem.Text == "+New Profile") //if +New Profile selected + { + Options opt = OptionsDialog[tdevice] = new Options(rootHub, tdevice, "", this); + opt.Text = "Options for Controller " + (tdevice + 1); + opt.Icon = this.Icon; + int i = tdevice; + opt.FormClosed += delegate + { + OptionsDialog[i] = null; + Enable_Controls(i, true); + }; + opt.Show(); + Enable_Controls(i, false); + } } private void exitToolStripMenuItem_Click(object sender, EventArgs e)