Esempio n. 1
0
        private void AncestorsTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (_previouslySelectedAncestorsNode != null)
            {
                _previouslySelectedAncestorsNode.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
                _previouslySelectedAncestorsNode.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Black);
            }

            AncestorsNode n = e.Node as AncestorsNode;

            _previouslySelectedAncestorsNode = n;
            n.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Highlight);
            n.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);

            if (_ancestorsTreeView.Focused)
            {
                _selectedTreeView = _ancestorsTreeView;
                if (n != null)
                {
                    string filename;
                    if (n.Text.Contains(": "))
                    {
                        filename = n.Text.Remove(0, 3);
                    }
                    else
                    {
                        filename = n.Text;
                    }

                    SetForKrystal(filename);
                }
            }
        }
Esempio n. 2
0
        private void SetFirstAncestorAppearance()
        {
            if (_previouslySelectedAncestorsNode != null)
            {
                _previouslySelectedAncestorsNode.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
                _previouslySelectedAncestorsNode.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Black);
            }

            AncestorsNode n = this._ancestorsTreeView.Nodes[0] as AncestorsNode;

            if (n != null)
            {
                _previouslySelectedAncestorsNode = n;
                n.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Highlight);
                n.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
            }
        }
        public KrystalAncestorsTreeView(Krystal krystal, List <Dependency> dependencyList)
        {
            this.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.Location = new System.Drawing.Point(0, 0);

            this.BeginUpdate();
            this.Nodes.Clear();
            AncestorsNode rootNode = null;

            if (krystal == null)
            {
                rootNode = new AncestorsNode("", dependencyList);
            }
            else
            {
                rootNode = new AncestorsNode(krystal.Name, dependencyList);                 // recursively creates a tree of LineageNodes
            }
            this.Nodes.Add(rootNode);
            this.EndUpdate();
            this.ExpandAll();
        }
 public AncestorsNode(string name, List <Dependency> dependencyList)
 {
     Text = name;
     for (int i = dependencyList.Count - 1; i >= 0; i--)
     {
         if (dependencyList[i].Name.Equals(Text))
         {
             if (K.IsExpansionKrystalFilename(Text))
             {
                 AncestorsNode densityNode = new AncestorsNode(dependencyList[i].Input1, dependencyList);
                 densityNode.Text = densityNode.Text.Insert(0, "d: ");
                 this.Nodes.Add((TreeNode)densityNode);
                 AncestorsNode pointsNode = new AncestorsNode(dependencyList[i].Input2, dependencyList);
                 pointsNode.Text = pointsNode.Text.Insert(0, "p: ");
                 this.Nodes.Add((TreeNode)pointsNode);
                 AncestorsNode fieldNode = new AncestorsNode(dependencyList[i].Field, dependencyList);
                 fieldNode.Text = fieldNode.Text.Insert(0, "e: ");
                 this.Nodes.Add((TreeNode)fieldNode);
             }
             if (K.IsShapedExpansionKrystalFilename(Text))
             {
                 AncestorsNode densityNode = new AncestorsNode(dependencyList[i].Input1, dependencyList);
                 densityNode.Text = densityNode.Text.Insert(0, "d: ");
                 this.Nodes.Add((TreeNode)densityNode);
                 AncestorsNode pointsNode = new AncestorsNode(dependencyList[i].Input2, dependencyList);
                 pointsNode.Text = pointsNode.Text.Insert(0, "p: ");
                 this.Nodes.Add((TreeNode)pointsNode);
                 AncestorsNode axisNode = new AncestorsNode(dependencyList[i].Input3, dependencyList);
                 axisNode.Text = axisNode.Text.Insert(0, "a: ");
                 this.Nodes.Add((TreeNode)axisNode);
                 AncestorsNode contourNode = new AncestorsNode(dependencyList[i].Input4, dependencyList);
                 contourNode.Text = contourNode.Text.Insert(0, "c: ");
                 this.Nodes.Add((TreeNode)contourNode);
                 AncestorsNode fieldNode = new AncestorsNode(dependencyList[i].Field, dependencyList);
                 fieldNode.Text = fieldNode.Text.Insert(0, "e: ");
                 this.Nodes.Add((TreeNode)fieldNode);
             }
             else if (K.IsModulationKrystalFilename(Text))
             {
                 AncestorsNode xNode = new AncestorsNode(dependencyList[i].Input1, dependencyList);
                 xNode.Text = xNode.Text.Insert(0, "x: ");
                 this.Nodes.Add((TreeNode)xNode);
                 AncestorsNode yNode = new AncestorsNode(dependencyList[i].Input2, dependencyList);
                 yNode.Text = yNode.Text.Insert(0, "y: ");
                 this.Nodes.Add((TreeNode)yNode);
                 AncestorsNode fieldNode = new AncestorsNode(dependencyList[i].Field, dependencyList);
                 fieldNode.Text = fieldNode.Text.Insert(0, "m: ");
                 this.Nodes.Add((TreeNode)fieldNode);
             }
             else if (K.IsPermutationKrystalFilename(Text))
             {
                 AncestorsNode sourceNode = new AncestorsNode(dependencyList[i].Input1, dependencyList);
                 sourceNode.Text = sourceNode.Text.Insert(0, "s: ");
                 this.Nodes.Add((TreeNode)sourceNode);
                 AncestorsNode axisNode = new AncestorsNode(dependencyList[i].Input2, dependencyList);
                 axisNode.Text = axisNode.Text.Insert(0, "a: ");
                 this.Nodes.Add((TreeNode)axisNode);
                 AncestorsNode contourNode = new AncestorsNode(dependencyList[i].Input3, dependencyList);
                 contourNode.Text = contourNode.Text.Insert(0, "c: ");
                 this.Nodes.Add((TreeNode)contourNode);
             }
             break;
         }
     }
 }