private void config_constants_ItemCheck(object sender, ItemCheckEventArgs e) { System.Windows.Forms.CheckedListBox obj = sender as CheckedListBox; //Output.Text += "Clicked " + obj.Text; // +" newvalue " + e.NewValue + "\n"; IProject project = PluginBase.CurrentProject; if (project == null) { //Output.Text += "No project loaded"; return; } AS3Project as3_project = project as AS3Project; string[] constants = GetCompilerConstants(); for (int i = 0; i < constants.GetLength(0); i++) { //Output.Text += " " + constants[i]; if (IsConstantCONFIG(constants[i])) { string key; string value; string conf_namespace; ExtractCONFIGKeyValue(constants[i], out key, out value, out conf_namespace); if (key == obj.Text) // is this the clicked one { constants[i] = conf_namespace + "::" + key + "," + (e.NewValue == CheckState.Checked ? "true" : "false"); //Output.Text += "toggled " + constants[i] + "\n"; as3_project.Save(); return; } } } }
private void values_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.CancelEdit) { return; } /*if (e.Node.Parent == null) * Output.Text += "Parent is null / " + e.Node.Text + "\n"; * else * Output.Text += e.Node.Parent.Text + " / " + e.Node.Text + "\n"; * * return;*/ IProject project = PluginBase.CurrentProject; if (project == null) { //Output.Text += "No project loaded"; return; } AS3Project as3_project = project as AS3Project; string[] constants = GetCompilerConstants(); string old_key = ""; string new_key = ""; string new_value = null; if (e.Node.Parent == null) // edited the CONFIG::name part, so change the key { old_key = e.Node.Text; new_key = e.Label; //new_value shall be taken from if (old_key == new_key) { return; } } else // edited the value { old_key = e.Node.Parent.Text; new_key = old_key; new_value = e.Label; //Output.Text += e.Node.Parent.Text + " / " + e.Node.Text; } for (int i = 0; i < constants.GetLength(0); i++) { //Output.Text += " " + constants[i]; if (!IsConstantCONFIG(constants[i]) && IsConstantVALUE(constants[i])) { string key; string value; ExtractVALUEKeyValue(constants[i], out key, out value); if (key == new_key) // is this the clicked one { if (new_value == null) { new_value = value; } constants[i] = new_key + "," + new_value; Output.Text += "edited to " + constants[i] + "\n"; as3_project.Save(); return; } } } }