Esempio n. 1
0
        public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            if (_regionSettings != null)
            {
                xPos += _regionSettings.Indent;

                if (layer == PrintLayer.Background && _regionSettings.HasBackground)
                {
                    TextExtents extents = GetExtents(cr);

                    // If there is a background, draw it here.
                    cr.SetSourceRGB(_regionSettings.Background.Red, _regionSettings.Background.Green, _regionSettings.Background.Blue);

                    cr.Rectangle(xPos
                                 , yPos - extents.Height - extents.YAdvance
                                 , extents.Width - _regionSettings.Indent
                                 , extents.Height + extents.YAdvance);
                    cr.Fill();
                }
                else if (layer == PrintLayer.Text)
                {
                    xPos += _regionSettings.PaddingLeft;
                    yPos -= _regionSettings.PaddingBottom;
                }
            }
            _children.VerticalDraw(cr, xPos, yPos, layer);
        }
Esempio n. 2
0
        public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            if (layer == PrintLayer.Text)
            {
                cr.SetFont(_fontInfo);

                yPos -= _extents.YAdvance;

                if (_fontInfo.Underline == true)
                {
                    TextExtents extents = GetExtents(cr);

                    cr.Rectangle(xPos
                                 , yPos - _fontInfo.UnderlineHeight
                                 , extents.Width
                                 , _fontInfo.UnderlineHeight);

                    cr.Fill();

                    yPos -= _fontInfo.UnderlineHeight + 2.0;
                }

                cr.MoveTo(xPos, yPos);
                cr.ShowText(_text);
            }
        }
Esempio n. 3
0
        public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            if (layer == PrintLayer.Text)
            {
                yPos -= _extents.YAdvance;

                // Only draw the line if there is enough space to display it
                if (_extents.Width > 2)
                {
                    yPos -= (_extents.Height / 2) - (_lineThickness / 2);

                    cr.Rectangle(xPos
                                 , yPos
                                 , _extents.Width
                                 , _lineThickness);
                    cr.Fill();
                }

                if (_lineType == PrintLineType.Double)
                {
                    yPos -= 4;

                    cr.Rectangle(xPos
                                 , yPos
                                 , _extents.Width
                                 , _lineThickness);
                    cr.Fill();
                }
            }
        }
Esempio n. 4
0
        //        public override TextExtents GetExtents(Cairo.Context cr)
        //        {
        //            TextExtents extents = new TextExtents();
        //            extents.Height = _pageSettings.PageHeight;
        //            extents.Width = _pageSettings.PageWidth;
        //            return extents;
        //        }

        public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            if (layer == PrintLayer.DisplayBackground)
            {
                // Create the shadow effect
                cr.SetSourceRGBA(0.5, 0.5, 0.5, 0.5);
                cr.Rectangle(xPos + Constants.SHADOW_WIDTH
                             , yPos + Constants.SHADOW_WIDTH
                             , _pageSettings.PaperWidth
                             , _pageSettings.PaperHeight);
                cr.Fill();



                cr.SetSourceRGB(1, 1, 1);
                cr.Rectangle(xPos
                             , yPos
                             , _pageSettings.PaperWidth
                             , _pageSettings.PaperHeight);
                cr.Fill();
            }

            double pageTop = yPos;

            yPos += _pageSettings.TopMargin;
            xPos += _pageSettings.LeftMargin;

            if (_header != null)
            {
                yPos += _header.GetExtents(cr).Height;
                _header.Draw(cr, xPos, yPos, layer);
            }

            // Move the cursor to the bottom of the page elements.
            TextExtents extents = GetExtents(cr);

            yPos += extents.Height + extents.YAdvance;

            // Draw the page elements in reverse order.
            base.Draw(cr, xPos, yPos, layer);

            if (_footer != null)
            {
                yPos = pageTop + _pageSettings.PageHeight;
                _footer.Draw(cr, xPos, yPos, layer);
            }
        }
Esempio n. 5
0
        public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            _children.HorizontalDraw(cr, xPos, yPos, layer);

            if (_chordLine.Count > 0)
            {
                yPos -= _extents.Height;

                TextNode chord = _chordLine[0] as TextNode;
                if (chord != null)
                {
                    yPos -= _chordExtents.YAdvance;
                }

                _chordLine.HorizontalDraw(cr, xPos, yPos, layer);
            }
        }
Esempio n. 6
0
        public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            if (_isHeader)
            {
                if (_lineNode != null)
                {
                    _lineNode.Draw(cr, xPos, yPos, layer);
                    yPos -= _lineNode.GetExtents(cr).Height + _fields[0].GetExtents(cr).YAdvance;
                }

                DrawText(cr, xPos, yPos, layer);
            }
            else
            {
                DrawText(cr, xPos, yPos, layer);

                if (_lineNode != null)
                {
                    yPos -= _fields[0].GetExtents(cr).Height + _fields[0].GetExtents(cr).YAdvance;
                    _lineNode.Draw(cr, xPos, yPos, layer);
                }
            }
        }
Esempio n. 7
0
 public override void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
 {
     _children.HorizontalDraw(cr, xPos, yPos, layer);
 }
Esempio n. 8
0
        public static void VerticalDraw(this List <BaseNode> list, Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            // Draw all of the children vertically, but to keep the lines correctly, we will actually
            // render them in reverse from the bottom up.
            for (int i = list.Count - 1; i >= 0; i--)
            {
                BaseNode    node    = list[i];
                TextExtents extents = node.GetExtents(cr);

                node.Draw(cr, xPos, yPos, layer);

                yPos -= extents.Height + extents.YAdvance;
            }
        }
Esempio n. 9
0
        public static void HorizontalDraw(this List <BaseNode> list, Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
        {
            // Draw all of the children side-by-side
            foreach (BaseNode node in list)
            {
                TextExtents extents = node.GetExtents(cr);

                node.Draw(cr, xPos, yPos, layer);

                xPos += extents.Width;
            }
        }
Esempio n. 10
0
 public virtual void Draw(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
 {
 }
Esempio n. 11
0
 private void DrawText(Cairo.Context cr, double xPos, double yPos, PrintLayer layer)
 {
     _fields[0].Draw(cr, xPos, yPos, layer);
     _fields[1].Draw(cr, xPos + (_pageWidth / 2.0) - (_fields[1].GetExtents(cr).Width / 2.0), yPos, layer);
     _fields[2].Draw(cr, xPos + _pageWidth - _fields[2].GetExtents(cr).Width, yPos, layer);
 }