Esempio n. 1
0
        public void ResizeAndPaginate()
        {
            //Bounds bounds = new Bounds(textFrame.GeometricBounds);

            if (textFrame.Paragraphs.Count == 0 && textFrame.AllGraphics.Count == 0)
            {
                bounds.height = 0.001;
                ApplyBounds();
                //textFrame.GeometricBounds = bounds.raw;
                //$.global.textFrames.pop();
            }
            else
            {
                //DoResize(textFrame, bounds);
                ResizeToFit();

                GuidePage pageBefore = this.page;
                if (OverflowsPage())
                {
                    HandlePageOverflow();
                }

                //pageBefore.currentY = bounds.bottom;
            }
        }
Esempio n. 2
0
        public GuideFrame(TextFrame tf, Guide g, GuidePage p, Mode m, FrameType t)
        {
            this.textFrame = tf;
            this.guide     = g;
            this.page      = p;
            this.mode      = m;
            this.type      = t;

            SyncBounds();
        }
Esempio n. 3
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();
        }
Esempio n. 4
0
        public GuidePage GetNextPage(GuidePage current, bool setCurrent)
        {
            int       idx = pages.IndexOf(current);
            GuidePage ret = GetPage(idx + 1);

            if (setCurrent)
            {
                currentPage = ret;
            }

            return(ret);
        }
Esempio n. 5
0
        public void MoveToPage(GuidePage newPage)
        {
            textFrame.Move(newPage.page, miss);


            TransformBoundsForNewPage(newPage);

            this.page.frames.Remove(this);
            this.page = newPage;
            this.page.frames.Add(this);

            //newPage.currentFrame = this;
        }
Esempio n. 6
0
        private void DoIndentedText(string text, string heading)
        {
            if (text.Length > 0)
            {
                text = HandleText(text);

                GuideFrame left = LeftHeader(heading);

                GuideFrame right       = GetTextFrame(Mode.SingleColumn, FrameType.Text, true);
                Bounds     rightBounds = right.bounds;

                rightBounds.top   = left.bounds.top + 1;
                rightBounds.left += INDENTED + 1;
                right.ApplyBounds();
                right.AddPara(text, "text", true);

                right.ResizeToFit();

                if (right.OverflowsPage())
                {
                    if (right.page.contentBounds.bottom - right.bounds.top > 20)
                    {
                        GuidePage newPage = this.GetNextPage(right.page, true);

                        GuideFrame newFrame = right.SplitFrame(newPage);

                        newFrame.bounds.left = newFrame.page.contentBounds.left + INDENTED + 2;
                        //newFrame.TransformBoundsForNewPage(newPage);
                        newFrame.bounds.top = right.page.contentBounds.top;
                        newFrame.ApplyBounds();
                        newFrame.ResizeToFit();
                    }
                    else
                    {
                        //MoveFrameToNext(left, leftBounds, false);
                        left.MoveFrameToNext(false);

                        right.MoveToPage(currentPage);
                        right.bounds.top = left.bounds.top + 1;
                        right.ApplyBounds();
                        right.ResizeToFit();
                    }
                }
                else
                {
                    currentPage.nextTopMin = Math.Max(left.bounds.bottom + left.bottomOffset, right.bounds.bottom + left.bottomOffset);
                }
            }
        }
Esempio n. 7
0
        public GuideFrame SplitFrame(GuidePage newPage)
        {
            GuideFrame newFrame = newPage.CreateTextFrame(this.mode, this.type);

            // thread the current frame to the next, and set it to the end of page
            textFrame.NextTextFrame   = newFrame.textFrame;
            bounds.bottom             = page.contentBounds.bottom;
            textFrame.GeometricBounds = bounds.raw;

            // size the new frame

            //Bounds newBounds = newFrame.bounds;
            newFrame.ResizeToFit();

            //currentPage.currentY = newBounds.bottom;

            return(newFrame);
        }
Esempio n. 8
0
        public void DoUpdate()
        {
            bool loaded = LoadXml();

            if (!loaded || xml == null)
            {
                Log("!! Could not load xml");
            }
            else
            {
                ClearPages();

                currentPage = GetPage(0);

                SetRunningColour();
                currentPage.ApplyMaster("FP-Master");

                SetupSidebar();

                DoProcessXml();
                ClearEmptyPages();
            }
        }
Esempio n. 9
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;
                }
            }
        }
Esempio n. 10
0
        public void DoUpdate()
        {
            LoadXml();

            if (xml==null)
                Log("!! Could not load xml");
            else
            {
                ClearPages();

                currentPage = GetPage(0);

                SetRunningColour();
                currentPage.ApplyMaster("FP-Master");

                SetupSidebar();

                DoProcessXml();
                ClearEmptyPages();
            }
        }
Esempio n. 11
0
 private void NextPage()
 {
     currentPage = GetPage(currentPage.idx + 1);
 }
Esempio n. 12
0
        public GuidePage GetNextPage(GuidePage current, bool setCurrent)
        {
            int idx = pages.IndexOf(current);
            GuidePage ret = GetPage(idx + 1);

            if (setCurrent)
                currentPage = ret;

            return ret;
        }
Esempio n. 13
0
 private void NextPage()
 {
     currentPage = GetPage(currentPage.idx + 1);
 }