diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 0a1b6292..1960db1a 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -490,6 +490,8 @@ namespace Volian.Print.Library myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); //Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release + if (lastBreak != null && lastBreak.MyItemInfo.InList(80091)) + Console.WriteLine("After 80091 {0}",paraBreak.ToString()); if (paraBreak == null) { if (DebugPagination.IsOpen) DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}" @@ -678,6 +680,11 @@ namespace Volian.Print.Library { float spaceOnPage = yUpperLimit + yLocation; vlnParagraph myPara = myList[stepLevel][yLocation]; + if (MaxBreakLevel(yLocation, myList) > stepLevel) + { + //DebugPagination.WriteLine("Adjust for Max StepLevel"); + break; + } if (RNOContinueOnly && !myPara.MyItemInfo.IsInRNO) yAddForBtmMsg = myBottomMsgSpace; else @@ -688,7 +695,7 @@ namespace Volian.Print.Library && 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); - if(myPara != lastBreak) + if (myPara != lastBreak) return myPara; } // The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12) @@ -698,13 +705,13 @@ namespace Volian.Print.Library && 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); - if(myParent != lastBreak) + if (myParent != lastBreak) 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; - if(myPara != lastBreak) + (myPara.MyItemInfo.MyHLS.FormatStepData.Suffix ?? "") != "" ? 2 * SixLinesPerInch : 0; + if (myPara != lastBreak) { if ((-yLocation + yStart) >= yLowerLimit) // More than the lower limit { @@ -747,11 +754,11 @@ namespace Volian.Print.Library yLocationMin2 = yLocation; minPara2 = myPara; } - } + } } if (myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent; int everyNLines = myPara.MyItemInfo.MyPrevious != null && myPara.MyItemInfo.FormatStepData == null ? 1 : myPara.MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1; - if (wcnChkLstBorder -yLocation < yUpperLimit+yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder -yLocation == yUpperLimit+yAddForBtmMsg))) // Fix for OFN-RJ-23 + if (wcnChkLstBorder - yLocation < yUpperLimit + yAddForBtmMsg || (everyNLines != 99 && (wcnChkLstBorder - yLocation == yUpperLimit + yAddForBtmMsg))) // Fix for OFN-RJ-23 //if (-yLocation < yUpperLimit) // Before //if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null) { @@ -763,7 +770,7 @@ namespace Volian.Print.Library if (myPara != lastBreak) if ((-yLocation + yStart) >= yLowerLimit) // Only if it is more than the lower limit return myPara; - + // If this item will not fit on the current page, put a page break if (myPara.YBottom - myPara.YTop > (yUpperLimit + yLocation)) if (myPara != lastBreak) @@ -775,7 +782,7 @@ namespace Volian.Print.Library myPara.MyParent.YSize > (yUpperLimit + yLocation)) { //McGuire Unit 1 AOPs - AP/1/A/5500/07.SEnclosure 7.S31..S1..C1 - if ((-yLocation + yStart) >= yLowerLimit ) // Only if it is more than the lower limit + if ((-yLocation + yStart) >= yLowerLimit) // Only if it is more than the lower limit return myPara; } } @@ -787,7 +794,15 @@ namespace Volian.Print.Library //if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2); return minPara ?? minPara2; } - + private static int MaxBreakLevel(float yLocation, StepLevelList myList) + { + int maxLevel = 0; + foreach (int stepLevel in myList.Keys) + foreach (float yLoc in myList[stepLevel].Keys) + if (yLocation == yLoc) + maxLevel = Math.Max(stepLevel, maxLevel); + return maxLevel; + } //private void WalkStepLevel(float yTopMost) //{ // foreach (vlnParagraph child in ChildrenAbove)