From 650aa8aa17c4a95705fadefb9e6880286307a145 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 15 Nov 2013 14:10:24 +0000 Subject: [PATCH] Logic changed to support very long RNO with unrelated long AER. If the RNO will fit on a page by itself, and it will not fit if it starts where it is, it breaks the pagebefore the AER step. --- PROMS/Volian.Print.Library/Pagination.cs | 25 +++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index dd28ff2a..8a0ea111 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -370,7 +370,7 @@ namespace Volian.Print.Library while (((YSize - yTop) > ySpaceOnCurPage) || PageBreakOnStepList.Count > 0) { ySpaceOnCurPage -= myBottomMsgSpace; - paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList, paraBreak); + paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace); if (paraBreak == null) { _MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'" @@ -418,24 +418,31 @@ namespace Volian.Print.Library /// /// /// - private static vlnParagraph FindPageBreak(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak) + private static vlnParagraph FindPageBreak(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak, float fullPage) { vlnParagraph minPara = null; foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. { foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation { + float spaceOnPage = yUpperLimit + yLocation; vlnParagraph myPara = myList[stepLevel][yLocation]; // The following lines were added for Comanche Peak ECA-TP-11-001A.SProcedure Steps.S17 (Printed as Step 12) - if (myPara.YSize > yUpperLimit && myPara.ChildrenRight != null && myPara.ChildrenRight.Count > 0 && myPara.ChildrenRight[0].YSize <= yUpperLimit) + if (myPara.YSize > fullPage && myPara.ChildrenRight != null && myPara.ChildrenRight.Count > 0 + && myPara.ChildrenRight[0].YSize <= fullPage && myPara.ChildrenRight[0].YSize > spaceOnPage) + { + _MyLog.WarnFormat("\r\nMyParaBreak {0},{1},{2},{3},{4}", myPara, myPara.YSize, yUpperLimit, myPara.ChildrenRight[0].YSize, spaceOnPage); return myPara; + } // The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12) - // ******************** NEEDS TO BE FIXED ********************** - //vlnParagraph myParent = myPara.MyParent; - //if (myParent != lastBreak && myParent.YSize > yUpperLimit && myParent.ChildrenRight != null && myParent.ChildrenRight.Count > 0 && myParent.ChildrenRight[0].YSize <= yUpperLimit) - // _MyLog.WarnFormat("\r\nMyParentBreak {0},{1},{2},{3}", myParent, myParent.YSize, yUpperLimit,myParent.ChildrenRight[0].YSize); - //Console.WriteLine("Here"); - //return myParent; + vlnParagraph myParent = myPara.MyParent; + spaceOnPage = yUpperLimit + myPara.YTop + yLocation - myParent.YTop; + if (myParent != lastBreak && myParent.YSize > fullPage && myParent.ChildrenRight != null && myParent.ChildrenRight.Count > 0 + && myParent.ChildrenRight[0].YSize <= fullPage && myParent.ChildrenRight[0].YSize > spaceOnPage) + { + _MyLog.WarnFormat("\r\nMyParentBreak {0},{1},{2},{3},{4}", myParent, myParent.YSize, yUpperLimit, myParent.ChildrenRight[0].YSize, spaceOnPage); + return myParent; + } // The top of this step will fit onto page (-yLocation < yWithinMargins) float wcnChkLstBorder = myPara.MyItemInfo.MyHLS != null && myPara.MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate && (myPara.MyItemInfo.MyHLS.FormatStepData.Suffix ?? "") != "" ? 2*SixLinesPerInch : 0;