Exemple #1
0
        private Node create(Node node, Node selectedNode, Node lastSelectedNode)
        {
            Node n = new Node();

            n.tagDeleted   = node.tagDeleted;
            n.tokenType    = node.tokenType;
            n.xmlTagName   = node.xmlTagName;
            n.namespaceURI = node.namespaceURI;
            n.isVisible    = node.isVisible;
            n.isGlyph      = node.isGlyph;
            n.skip         = node.skip;

            n.literalText  = node.literalText;
            n.literalCaret = node.literalCaret;
            n.literalStart = node.literalStart;
            n.yOffset      = node.yOffset;
            n.displayStyle = node.displayStyle;

            n.glyph = node.glyph;

            n.scriptLevel_ = node.scriptLevel_;

            n.type_ = node.type_;
            if (node.attrs != null)
            {
                n.attrs = new AttributeList();
                node.attrs.CopyTo(n.attrs);
            }
            n.FontStyle = node.FontStyle;
            if (node.style_ != null)
            {
                n.style_ = new StyleAttributes();
                node.style_.CopyTo(n.style_);
            }
            if (node == selectedNode)
            {
                this.selected_ = n;
            }
            if (node == lastSelectedNode)
            {
                this.lastSel_ = n;
            }
            if (node.HasChildren())
            {
                NodesList list  = node.GetChildrenNodes();
                int       count = list.Count;
                for (int i = 0; i < count; i++)
                {
                    Node c     = list.Get(i);
                    Node child = this.create(c, selectedNode, lastSelectedNode);
                    if (child != null)
                    {
                        n.AdoptChild(child);
                    }
                }
            }
            return(n);
        }
Exemple #2
0
        public override void getSize(Node containerNode)
        {
            if (containerNode.firstChild == null)
            {
                base.painter_.MeasureBox(containerNode, containerNode.style_, "X");
            }
            else if (this.isStretchy)
            {
                int rowB           = containerNode.box.Baseline;
                int rowH           = containerNode.box.Height;
                int normBase       = base.painter_.MeasureBaseline(containerNode, containerNode.style_, "X");
                int baseLine_Shift = base.painter_.CenterHeight(containerNode);
                if (!base.painter_.IsAboveBaseline(base.rect.height, base.rect.baseline, normBase))
                {
                    NodesList list = containerNode.GetChildrenNodes();
                    for (int i = 0; i < list.Count; i++)
                    {
                        Node node = list.Get(i);
                        if (base.painter_.IsStretchy(node))
                        {
                            int w = node.box.Width;

                            try
                            {
                                ((Box_Mo)node.box).updateRowSize(node, rowH, rowB, baseLine_Shift);
                            }
                            catch
                            {
                            }

                            base.rect.width -= w - node.box.Width;
                            if (node.box.Height > base.rect.height)
                            {
                                base.rect.height = node.box.Height;
                            }
                            if (node.box.Baseline > base.rect.baseline)
                            {
                                base.rect.baseline = node.box.Baseline;
                            }
                        }
                    }
                }
            }
        }