Determine the height of the Section Continue message at the top of a page, so that the steps paginate properly.

This commit is contained in:
Rich 2015-02-26 18:47:30 +00:00
parent 5f8c27367f
commit 5d227213c5

View File

@ -517,6 +517,7 @@ namespace Volian.Print.Library
}
private void BuildPageBreakList(float ySpaceOnCurPage, float yPageSize, bool KeepStepsOnPage, float yEndMsg)
{
float topContinueHeight=2 * SixLinesPerInch;
int profileDepth = ProfileTimer.Push(">>>> BuildPageBreakList");
// if this paragraph is flagged to pagebreakonstep (i.e. these are used by background documents
// to get each hls/caution/note to be on its own page), then any of the children above should
@ -587,7 +588,16 @@ namespace Volian.Print.Library
string myTopMsg = docstyle.Continue.Top.Message;
float myTopMsgSpace = ((myTopMsg ?? "") != "") ? 2 * SixLinesPerInch : 0;
if (myTopMsgSpace > 0)
{
vlnParagraph parSection = this.MyParent;
while (!parSection.MyItemInfo.IsSection) parSection = parSection.MyParent;
topContinueHeight = parSection.ContinueHeight;
if (topContinueHeight > myTopMsgSpace)
{
myTopMsgSpace = topContinueHeight;
}
}
// while the amount to print is larger than one page, i.e. ((YSize - yTop) > ySpaceOnCurPage))
// OR there are page breaks for HLS/cautions/notes remaining, typically for backgrounds (PageBreakOnStepList.Count > 0)
vlnParagraph paraBreak = null;
@ -617,12 +627,12 @@ namespace Volian.Print.Library
ySpaceOnCurPage -= yEndMsg;
ySpaceOnCurPage -= myBottomMsgSpace;
vlnParagraph lastBreak = paraBreak;
if (PageBreakOnStepList.Count > 0 && (PageBreakOnStepList[0].YTop - (lastBreak == null?0:lastBreak.YTop) <= ySpaceOnCurPage))
if (PageBreakOnStepList.Count > 0 && (PageBreakOnStepList[0].YTop - (lastBreak == null ? 0 : lastBreak.YTop) <= ySpaceOnCurPage))
paraBreak = PageBreakOnStepList[0];
else
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage-accountForCalvertAlarmConditionResponseFooter, yLowerLimit,
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter, yLowerLimit,
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
// Do Not Remove: The following is used for debug - useful place to debug
//if (paraBreak.MyItemInfo.InList(207, 211, 214, 219, 221, 216, 197)) Console.WriteLine("BUILD2: Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
//if (lastBreak != null && lastBreak.MyItemInfo.InList(80091, 1985))
@ -727,7 +737,7 @@ namespace Volian.Print.Library
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - vlnPrintObject.SixLinesPerInch * 4, yLowerLimit, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
if (paraBreak.MyItemInfo.MyPrevious == null)
if(paraBreak.MyParent.ChildrenAbove.Count > 0)
if (paraBreak.MyParent.ChildrenAbove.Count > 0)
paraBreak = paraBreak.MyParent.ChildrenAbove[0];
else
paraBreak = paraBreak.MyParent;
@ -759,7 +769,7 @@ namespace Volian.Print.Library
}
if (lastBreak == paraBreak)
{
throw (new Exception(string.Format("Pagination Infinite Loop {0}",lastBreak.MyItemInfo.ShortPath)));
throw (new Exception(string.Format("Pagination Infinite Loop {0}", lastBreak.MyItemInfo.ShortPath)));
}
// If the paraBreak is in an RNO and the location of the RNO is within the range of the AER parent, then break on the AER.
if (paraBreak.MyItemInfo.IsInRNO)
@ -770,7 +780,7 @@ namespace Volian.Print.Library
{
if (aerParent.ChildrenAbove != null && aerParent.ChildrenAbove.Count > 0) // If the aerParent has caution or note
aerParent = aerParent.ChildrenAbove[0];//, break on the caution or note.
if (aerParent != lastBreak)paraBreak = aerParent;
if (aerParent != lastBreak) paraBreak = aerParent;
}
}
// MNS Pagination - Mike Weiner Case 1b to keep substeps together on one page
@ -812,7 +822,7 @@ namespace Volian.Print.Library
{
// If the next page break is beyond the next hls/caution/note, use the next
// hls/caution/note.
if (PageBreakOnStepList[0].YTop <= paraBreak.YTop )
if (PageBreakOnStepList[0].YTop <= paraBreak.YTop)
{
paraBreak = PageBreakOnStepList[0];
PageBreakOnStepList.RemoveAt(0);
@ -830,7 +840,7 @@ namespace Volian.Print.Library
RemoveProcessedParagraphs(myList, yTopNew - yTop);
yTop = yTopNew;
MyPageHelper.ParaBreaks.Add(paraBreak);
ySpaceOnCurPage = yPageSize - (myTopMsgSpace + (yEndMsg == 0 ? SixLinesPerInch: 0 )); // Allow for continue message and blank line.
ySpaceOnCurPage = yPageSize - (myTopMsgSpace + (yEndMsg == 0 ? SixLinesPerInch : 0)); // Allow for continue message and blank line.
ySpaceOnCurPage -= accountForSmartTemplateHeader;
//ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line.