Ejemplo n.º 1
0
 /// <summary> Populate the tree with the Files, Topics, and Comments  </summary>
 private void Populate()
 {
     tree.Nodes.Clear();
     foreach (BCFfile file in bcfs.BCFfiles)
     {
         BCFTreeNode tnf = AddFile(file);
         foreach (BCFmarkup.Markup markup in file.MarkupsList)
         {
             BCFTreeNode tnm = AddTopic(tnf, markup);
             foreach (BCFmarkup.Comment comment in markup.Comment)
             {
                 AddComment(tnm, comment);
             }
         }
     }
     // Select the first Topic of the last File
     if (tree.Nodes.Count > 0)
     {
         tree.ExpandAll();
         TreeNode last = tree.Nodes[tree.Nodes.Count - 1];
         tree.SelectedNode = (last.Nodes.Count > 0 ? last.Nodes[0] : tree.SelectedNode = last);
     }
     // Resize picture
     ResizeImage();
 }
Ejemplo n.º 2
0
            public int Compare(object x, object y)
            {
                int         result = 0;
                BCFTreeNode tx     = x as BCFTreeNode;
                BCFTreeNode ty     = y as BCFTreeNode;

                if (tx.NodeFile != null && ty.NodeFile != null)
                {
                    result = tx.NodeFile.Index - ty.NodeFile.Index;
                }
                else if (tx.NodeTopic != null && ty.NodeTopic != null)
                {
                    result = tx.NodeTopic.Topic.Index - ty.NodeTopic.Topic.Index;
                }
                else if (tx.NodeComment != null && ty.NodeComment != null)
                {
                    DateTime dx = tx.NodeComment.ModifiedDate;
                    DateTime dy = ty.NodeComment.ModifiedDate;
                    result = DateTime.Compare(dx, dy);
                }
                else // should not happen !
                {
                    result = string.Compare(tx.Text, ty.Text);
                }
                return(result);
            }
Ejemplo n.º 3
0
        /// <Summary> Add a Comment in the tree node of the Topic </Summary>
        /// <param name="parent">Topic owning this comment</param>
        /// <param name="comment">Comment to be added in tree node of a Topic</param>
        private BCFTreeNode AddComment(BCFTreeNode parent, BCFmarkup.Comment comment)
        {
            BCFTreeNode tn = new BCFTreeNode();

            tn.Text        = comment.CommentProperty;
            tn.NodeFile    = null;
            tn.NodeTopic   = null;
            tn.NodeComment = comment;
            parent.Nodes.Add(tn);
            return(tn);
        }
Ejemplo n.º 4
0
        /// <summary> Add a Topic in the tree </summary>
        /// <param name="parent">File owning this topic</param>
        /// <param name="topic">Topic to be added in tree</param>
        private BCFTreeNode AddTopic(BCFTreeNode parent, BCFmarkup.Markup topic)
        {
            BCFTreeNode tn = new BCFTreeNode();

            tn.Text        = topic.Topic.Title;
            tn.NodeFile    = null;
            tn.NodeTopic   = topic;
            tn.NodeComment = null;
            parent.Nodes.Add(tn);
            return(tn);
        }
Ejemplo n.º 5
0
        /// <summary> Add a File in the tree </summary>
        /// <param name="file">BCF file to be added in tree</param>
        private BCFTreeNode AddFile(BCFfile file)
        {
            BCFTreeNode tn = new BCFTreeNode();

            tn.Text        = file.Name;
            tn.NodeFile    = file;
            tn.NodeTopic   = null;
            tn.NodeComment = null;
            tree.Nodes.Add(tn);
            return(tn);
        }
Ejemplo n.º 6
0
        private void pict_DoubleClick(Object sender, EventArgs args)
        {
            BCFmarkup.ViewPoint v  = null;
            BCFTreeNode         tn = (BCFTreeNode)tree.SelectedNode;

            if (tn == null)
            {
                return;
            }
            if (tn.NodeTopic != null)
            {
                BCFmarkup.Markup topic = tn.NodeTopic;
                if (topic.Viewpoints.Count > 0)
                {
                    v = topic.Viewpoints[0];
                }
            }
            else if (tn.NodeComment != null)
            {
                BCFmarkup.Comment comment = tn.NodeComment;
                if (comment.Viewpoint != null)
                {
                    v = comment.MarkupViewPoint;
                }
                else
                {
                    BCFTreeNode      tp    = (BCFTreeNode)tree.SelectedNode.Parent;
                    BCFmarkup.Markup topic = tp.NodeTopic;
                    if (topic.Viewpoints.Count > 0)
                    {
                        v = topic.Viewpoints[0];
                    }
                }
            }
            if (v != null)
            {
                if (v.Bcfv.CameraDefined())
                {
                    if (MoveCamera != null)
                    {
                        MoveCamera(v.Bcfv);
                    }
                    else
                    {
                        MessageBox.Show(v.Bcfv.CameraText(), "Camera:");
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary> Fills the details of the selected Node </summary>
        /// <param name="sender">Not used</param>
        /// <param name="args">Not used</param>
        private void ShowDetails(Object sender, TreeViewEventArgs args)
        {
            list.Clear();
            BCFTreeNode tn = (BCFTreeNode)tree.SelectedNode;

            if (tn.NodeFile != null)
            {
                ShowFileDetails(tn.NodeFile);
            }
            else
            {
                BCFTreeNode pa = (BCFTreeNode)tn.Parent;
                if (tn.NodeTopic != null)
                {
                    ShowTopicDetails(tn.NodeTopic);
                }
                else
                {
                    BCFTreeNode gp = (BCFTreeNode)pa.Parent;
                    ShowCommentDetails(pa.NodeTopic, tn.NodeComment);
                }
            }
            list.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }