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; } }
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(); }
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(); }
public GuidePage GetNextPage(GuidePage current, bool setCurrent) { int idx = pages.IndexOf(current); GuidePage ret = GetPage(idx + 1); if (setCurrent) { currentPage = ret; } return(ret); }
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; }
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); } } }
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); }
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(); } }
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; } } }
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(); } }
private void NextPage() { currentPage = GetPage(currentPage.idx + 1); }
public GuidePage GetNextPage(GuidePage current, bool setCurrent) { int idx = pages.IndexOf(current); GuidePage ret = GetPage(idx + 1); if (setCurrent) currentPage = ret; return ret; }