Exemplo n.º 1
0
        public void TransformBoundsForNewPage(GuidePage newPage)
        {
            Bounds oldBounds = bounds.Clone();

            bounds.top    = newPage.GetNextTop();
            bounds.height = oldBounds.height;
            bounds.left   = (oldBounds.left - page.contentBounds.left) + newPage.contentBounds.left;
            bounds.width  = oldBounds.width;

            ApplyBounds();
        }
Exemplo n.º 2
0
        public void MoveFrameToNext(bool split)
        {
            GuidePage beforePage = guide.currentPage;

            GuidePage newPage = beforePage;
            bool      fits    = false;

            while (!fits)
            {
                newPage = guide.GetNextPage(newPage, true);
                fits    = split || (newPage.contentBounds.bottom - newPage.GetNextTop() + 1) >= this.bounds.height;

                if (newPage.frames.Count == 0 && this.bounds.height > newPage.contentBounds.height)
                {
                    Log("!! Warning: frame larger than page size");
                    fits = true;
                }
            }

            if (split)
            {
                SplitFrame(newPage);
            }
            else
            {
                // move whole TF onto next page

                bool backfill = type == FrameType.Image &&
                                mode == Mode.SingleColumn &&
                                page.contentBounds.bottom - bounds.top > 25;

                GuideFrame prev  = page.GetPreviousFrame(this);
                GuideFrame prev2 = null;
                if (prev != null && !backfill)
                {
                    prev2 = page.GetPreviousFrame(prev);

                    if (prev.IsHeading())
                    {
                        if (prev2 != null && prev2.IsHeading())
                        {
                            prev2.MoveToPage(newPage);
                            prev.MoveToPage(newPage);
                        }
                        else
                        {
                            prev.MoveToPage(newPage);
                        }
                        backfill = false;
                    }
                    else if (prev2 != null &&
                             prev2.IsHeading() &&
                             (page.contentBounds.bottom - prev2.bounds.bottom < 20 || prev.bounds.height < 10))
                    {
                        prev2.MoveToPage(newPage);
                        prev.MoveToPage(newPage);
                        backfill = false;
                    }
                }

                MoveToPage(newPage);

                if (backfill)
                {
                    guide.currentPage = beforePage;
                }
                else
                {
                    guide.currentPage = newPage;
                }
            }
        }
Exemplo n.º 3
0
        void ProcessHeader(XmlElement node)
        {
            string intro           = GetAttr(node, "intro");
            string name            = GetAttr(node, "name");
            string sun             = GetAttr(node, "sun");
            string rock            = GetAttr(node, "rock");
            string walk            = GetAttr(node, "walk");
            string history         = GetAttr(node, "history");
            string access          = GetAttr(node, "access");
            string acknowledgement = GetAttr(node, "acknowledgement");

            GuideFrame frame = GetTextFrame(Mode.SingleColumn, FrameType.Multi, true);


            frame.AddPara(name, "heading1", true);
            frame.bounds.top -= 4;
            frame.ApplyBounds();
            frame.ResizeAndPaginate();
            frame.bottomOffset += 2;

            double bottomExtra = 0;
            double iconTop     = currentPage.GetNextTop();

            bool done = false;

            string graphPath = GetAttachmentPath("graph.pdf");

            if (File.Exists(graphPath) && this.xml.SelectNodes("//climb").Count > 0)
            {
                Bounds graphBounds = new Bounds();
                graphBounds.top    = iconTop;
                graphBounds.height = GRAPHSIZE;
                graphBounds.left   = currentPage.contentBounds.left;
                graphBounds.width  = GRAPHSIZE;
                //PlaceImageInRect( graphPath, graphBounds, true, idPDFCrop.idCropContent);
                PlaceImageInRect(graphPath, graphBounds, true, idPDFCrop.idCropContentAllLayers);

                bottomExtra = graphBounds.bottom + 3;

                done = true;
            }
            if (walk.Length > 0 || sun.Length > 0 || rock.Length > 0)
            {
                done    = true;
                iconTop = DoHeaderIcon(iconTop, "walk2.pdf", walk);
                iconTop = DoHeaderIcon(iconTop, "sun2.pdf", sun);
                iconTop = DoHeaderIcon(iconTop, "rock2.pdf", rock);

                iconTop += 4;
            }

            if (done)
            {
                bottomExtra            = Math.Max(iconTop, bottomExtra);
                currentPage.nextTopMin = bottomExtra;

                MasterSpread master = GetMaster("FP-Master");

                // assume every rect needs moving
                Rectangles rects = master.Rectangles;
                foreach (Rectangle rect in rects)
                {
                    Bounds b = new Bounds(rect.GeometricBounds);
                    b.bottom             = bottomExtra - 2;
                    rect.GeometricBounds = b.raw;
                }
            }
            else
            {
                frame.bottomOffset += 2;
            }

            //DoIndentedText(walk, "Walk");
            //DoIndentedText(sun, "Sun");
            //DoIndentedText(rock, "Rock");



            DoIndentedText(acknowledgement, "Author");
            DoIndentedText(intro, "Intro");
            DoIndentedText(history, "History");
            DoIndentedText(access, "Access");

            currentPage.frames[currentPage.frames.Count - 1].bottomOffset += 1;
            //currentPage.currentY += 3;
        }