private void itemsTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { #region Left Click if (e.Node.Nodes.Count == 0) { if (e.Node.Tag is Classes.IGuiPage) { if (!tabBar.isPageOpen(e.Node.Tag as Classes.IGuiPage)) { tabBar.AddTab(new TabItem(e.Node.Text, (e.Node.Tag as Classes.ICodeBlock).Type, (e.Node.Tag as Classes.IGuiPage))); } else tabBar.SelectTab(e.Node.Tag as Classes.IGuiPage); } else if (e.Node.Tag.ToString() == "ADD_ENUM") { using (Forms.enumEdit newEnum = new Forms.enumEdit(new Classes.Enumeration())) { if (newEnum.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { proj.Enumerations.Add(newEnum.returnVal); RefreshEnums(); } } } else if (e.Node.Parent == EnumsTN) { using (Forms.enumEdit newEnum = new Forms.enumEdit((Classes.Enumeration)e.Node.Tag)) { if (newEnum.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { proj.Enumerations.Remove((Classes.Enumeration)e.Node.Tag); proj.Enumerations.Add(newEnum.returnVal); RefreshEnums(); } } } else if (e.Node.Tag.ToString() == "ADD_STRUCT") { Classes.Struct newStruct = new Classes.Struct("NewStruct"); using (Forms.structConstruct strConstr = new Forms.structConstruct(newStruct, true, proj)) { if (strConstr.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { proj.Structs.Add(strConstr.returnVal); RefreshStructs(); } } } else if (e.Node.Parent == StructsTN) { using (Forms.structConstruct strConstr = new Forms.structConstruct((Classes.Struct)e.Node.Tag, false, proj)) { if (strConstr.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { proj.Structs.Remove((Classes.Struct)e.Node.Tag); proj.Structs.Add(strConstr.returnVal); RefreshStructs(); } } } } #endregion } else if (e.Button == System.Windows.Forms.MouseButtons.Right && e.Node.Tag != null && e.Node.Tag.ToString() != "ADD_STRUCT" && e.Node.Tag.ToString() != "ADD_ENUM" && e.Node.Tag.ToString() != "ADD_TASK" && e.Node.Tag.ToString() != "ADD_METHOD" ) { rightClickNode = e.Node; itemEditMenu.Show(itemsTreeView.PointToScreen(e.Location)); deleteToolStripMenuItem.Enabled = e.Node.Text != "main"; } }
private void editToolStripMenuItem1_Click(object sender, EventArgs e) { if (rightClickNode.Tag is Classes.IGuiPage) { if (!tabBar.isPageOpen(rightClickNode.Tag as Classes.IGuiPage)) { tabBar.AddTab(new TabItem(rightClickNode.Text, (rightClickNode.Tag as Classes.ICodeBlock).Type, (rightClickNode.Tag as Classes.IGuiPage) )); } else tabBar.SelectTab(rightClickNode.Tag as Classes.IGuiPage); } else if (rightClickNode.Parent == EnumsTN) { using (Forms.enumEdit newEnum = new Forms.enumEdit((Classes.Enumeration)rightClickNode.Tag)) { if (newEnum.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { proj.Enumerations.Remove((Classes.Enumeration)rightClickNode.Tag); proj.Enumerations.Add(newEnum.returnVal); RefreshEnums(); } } } else if (rightClickNode.Parent == StructsTN) { using (Forms.structConstruct strConstr = new Forms.structConstruct((Classes.Struct)rightClickNode.Tag, false, proj)) { if (strConstr.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { proj.Structs.Remove((Classes.Struct)rightClickNode.Tag); proj.Structs.Add(strConstr.returnVal); RefreshStructs(); } } } }