public KrystalFamilyTreeView(List<Dependency> dependencyList) { this.Dock = System.Windows.Forms.DockStyle.Fill; this.Location = new System.Drawing.Point(0, 0); this.BeginUpdate(); this.Nodes.Clear(); TreeNode constantRoot = new TreeNode("Constants"); TreeNode lineRoot = new TreeNode("Lines"); TreeNode expansionRoot = new TreeNode("Expansions"); TreeNode shapedExpansionRoot = new TreeNode("Shaped Expansions"); TreeNode modulationRoot = new TreeNode("Modulations"); TreeNode permutationRoot = new TreeNode("Permutations"); this.Nodes.Add(constantRoot); this.Nodes.Add(lineRoot); this.Nodes.Add(expansionRoot); this.Nodes.Add(shapedExpansionRoot); this.Nodes.Add(modulationRoot); this.Nodes.Add(permutationRoot); int index = 0; for(int i = 0 ; i < dependencyList.Count ; i++) { KrystalChildrenNode rootNode = new KrystalChildrenNode(i, dependencyList); // rootNode contains a tree of KrystalChildrenNodes if(K.IsConstantKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, constantRoot.Nodes); constantRoot.Nodes.Insert(index, rootNode); } else if(K.IsLineKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, lineRoot.Nodes); lineRoot.Nodes.Insert(index, rootNode); } else if(K.IsExpansionKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, expansionRoot.Nodes); expansionRoot.Nodes.Insert(index, rootNode); } else if(K.IsShapedExpansionKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, shapedExpansionRoot.Nodes); shapedExpansionRoot.Nodes.Insert(index, rootNode); } else if(K.IsModulationKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, modulationRoot.Nodes); modulationRoot.Nodes.Insert(index, rootNode); } else if(K.IsPermutationKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, permutationRoot.Nodes); permutationRoot.Nodes.Insert(index, rootNode); } } this.EndUpdate(); this.CollapseAll(); }
private void KrystalFamilyTreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (_previouslySelectedChildrenNode != null) { _previouslySelectedChildrenNode.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window); _previouslySelectedChildrenNode.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Black); } KrystalChildrenNode n = e.Node as KrystalChildrenNode; _previouslySelectedChildrenNode = n; if (n != null) { n.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Highlight); n.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Window); } if (_krystalFamilyTreeView.Focused) { _selectedTreeView = _krystalFamilyTreeView; if (n != null) { string filename; if (n.Text.Contains(": ")) { filename = n.Text.Remove(0, 3); } else { filename = n.Text; } this.SetForKrystal(filename); } } }
public KrystalChildrenNode(int index, List<Dependency> dependencyList) { Text = dependencyList[index].Name; for(int i = index; i < dependencyList.Count; i++) { int listIndex; if(dependencyList[i].Input1 != null && dependencyList[i].Input1.Equals(Text)) { KrystalChildrenNode input1Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input1Node.Text, this.Nodes); if(K.IsExpansionKrystalFilename(dependencyList[i].Name) || K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) input1Node.Text = input1Node.Text.Insert(0, "d: "); else if(K.IsModulationKrystalFilename(dependencyList[i].Name)) input1Node.Text = input1Node.Text.Insert(0, "x: "); else if(K.IsPermutationKrystalFilename(dependencyList[i].Name)) input1Node.Text = input1Node.Text.Insert(0, "s: "); this.Nodes.Insert(listIndex, (TreeNode)input1Node); } if(dependencyList[i].Input2 != null && dependencyList[i].Input2.Equals(Text)) { KrystalChildrenNode input2Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input2Node.Text, this.Nodes); if(K.IsExpansionKrystalFilename(dependencyList[i].Name) || K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) input2Node.Text = input2Node.Text.Insert(0, "p: "); else if(K.IsModulationKrystalFilename(dependencyList[i].Name)) input2Node.Text = input2Node.Text.Insert(0, "y: "); else if(K.IsPermutationKrystalFilename(dependencyList[i].Name)) input2Node.Text = input2Node.Text.Insert(0, "a: "); this.Nodes.Insert(listIndex, (TreeNode)input2Node); } if(dependencyList[i].Input3 != null && dependencyList[i].Input3.Equals(Text)) { KrystalChildrenNode input3Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input3Node.Text, this.Nodes); if(K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) input3Node.Text = input3Node.Text.Insert(0, "a: "); else if(K.IsPermutationKrystalFilename(dependencyList[i].Name)) input3Node.Text = input3Node.Text.Insert(0, "c: "); this.Nodes.Insert(listIndex, (TreeNode)input3Node); } if(dependencyList[i].Input4 != null && dependencyList[i].Input4.Equals(Text)) { KrystalChildrenNode input4Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input4Node.Text, this.Nodes); if(K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) input4Node.Text = input4Node.Text.Insert(0, "c: "); this.Nodes.Insert(listIndex, (TreeNode)input4Node); } } }
private void KrystalFamilyTreeView_AfterSelect(object sender, TreeViewEventArgs e) { if(_previouslySelectedChildrenNode != null) { _previouslySelectedChildrenNode.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window); _previouslySelectedChildrenNode.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Black); } KrystalChildrenNode n = e.Node as KrystalChildrenNode; _previouslySelectedChildrenNode = n; if(n != null) { n.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Highlight); n.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Window); } if(_krystalFamilyTreeView.Focused) { _selectedTreeView = _krystalFamilyTreeView; if(n != null) { string filename; if(n.Text.Contains(": ")) { filename = n.Text.Remove(0, 3); } else filename = n.Text; this.SetForKrystal(filename); } } }
public KrystalChildrenNode(int index, List <Dependency> dependencyList) { Text = dependencyList[index].Name; for (int i = index; i < dependencyList.Count; i++) { int listIndex; if (dependencyList[i].Input1 != null && dependencyList[i].Input1.Equals(Text)) { KrystalChildrenNode input1Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input1Node.Text, this.Nodes); if (K.IsExpansionKrystalFilename(dependencyList[i].Name) || K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) { input1Node.Text = input1Node.Text.Insert(0, "d: "); } else if (K.IsModulationKrystalFilename(dependencyList[i].Name)) { input1Node.Text = input1Node.Text.Insert(0, "x: "); } else if (K.IsPermutationKrystalFilename(dependencyList[i].Name)) { input1Node.Text = input1Node.Text.Insert(0, "s: "); } this.Nodes.Insert(listIndex, (TreeNode)input1Node); } if (dependencyList[i].Input2 != null && dependencyList[i].Input2.Equals(Text)) { KrystalChildrenNode input2Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input2Node.Text, this.Nodes); if (K.IsExpansionKrystalFilename(dependencyList[i].Name) || K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) { input2Node.Text = input2Node.Text.Insert(0, "p: "); } else if (K.IsModulationKrystalFilename(dependencyList[i].Name)) { input2Node.Text = input2Node.Text.Insert(0, "y: "); } else if (K.IsPermutationKrystalFilename(dependencyList[i].Name)) { input2Node.Text = input2Node.Text.Insert(0, "a: "); } this.Nodes.Insert(listIndex, (TreeNode)input2Node); } if (dependencyList[i].Input3 != null && dependencyList[i].Input3.Equals(Text)) { KrystalChildrenNode input3Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input3Node.Text, this.Nodes); if (K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) { input3Node.Text = input3Node.Text.Insert(0, "a: "); } else if (K.IsPermutationKrystalFilename(dependencyList[i].Name)) { input3Node.Text = input3Node.Text.Insert(0, "c: "); } this.Nodes.Insert(listIndex, (TreeNode)input3Node); } if (dependencyList[i].Input4 != null && dependencyList[i].Input4.Equals(Text)) { KrystalChildrenNode input4Node = new KrystalChildrenNode(i, dependencyList); listIndex = FindChildFollower(input4Node.Text, this.Nodes); if (K.IsShapedExpansionKrystalFilename(dependencyList[i].Name)) { input4Node.Text = input4Node.Text.Insert(0, "c: "); } this.Nodes.Insert(listIndex, (TreeNode)input4Node); } } }
public KrystalFamilyTreeView(List <Dependency> dependencyList) { this.Dock = System.Windows.Forms.DockStyle.Fill; this.Location = new System.Drawing.Point(0, 0); this.BeginUpdate(); this.Nodes.Clear(); TreeNode constantRoot = new TreeNode("Constants"); TreeNode lineRoot = new TreeNode("Lines"); TreeNode expansionRoot = new TreeNode("Expansions"); TreeNode shapedExpansionRoot = new TreeNode("Shaped Expansions"); TreeNode modulationRoot = new TreeNode("Modulations"); TreeNode permutationRoot = new TreeNode("Permutations"); this.Nodes.Add(constantRoot); this.Nodes.Add(lineRoot); this.Nodes.Add(expansionRoot); this.Nodes.Add(shapedExpansionRoot); this.Nodes.Add(modulationRoot); this.Nodes.Add(permutationRoot); int index = 0; for (int i = 0; i < dependencyList.Count; i++) { KrystalChildrenNode rootNode = new KrystalChildrenNode(i, dependencyList); // rootNode contains a tree of KrystalChildrenNodes if (K.IsConstantKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, constantRoot.Nodes); constantRoot.Nodes.Insert(index, rootNode); } else if (K.IsLineKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, lineRoot.Nodes); lineRoot.Nodes.Insert(index, rootNode); } else if (K.IsExpansionKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, expansionRoot.Nodes); expansionRoot.Nodes.Insert(index, rootNode); } else if (K.IsShapedExpansionKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, shapedExpansionRoot.Nodes); shapedExpansionRoot.Nodes.Insert(index, rootNode); } else if (K.IsModulationKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, modulationRoot.Nodes); modulationRoot.Nodes.Insert(index, rootNode); } else if (K.IsPermutationKrystalFilename(rootNode.Text)) { index = FindFollower(rootNode.Text, permutationRoot.Nodes); permutationRoot.Nodes.Insert(index, rootNode); } } this.EndUpdate(); this.CollapseAll(); }