If the pagebreak is occuring at a location in the AER and RNO columns, use the maximum step level to determine the proper place to break.

This commit is contained in:
Rich 2014-09-03 19:49:07 +00:00
parent f8aad3efbc
commit 74f88b6c1c

View File

@ -680,110 +680,114 @@ namespace Volian.Print.Library
{
float spaceOnPage = yUpperLimit + yLocation;
vlnParagraph myPara = myList[stepLevel][yLocation];
if (MaxBreakLevel(yLocation, myList) > stepLevel)
int maxLev = stepLevel;
if (spaceOnPage > 0 && (maxLev = MaxBreakLevel(yLocation, myList, stepLevel)) > stepLevel)
{
//DebugPagination.WriteLine("Adjust for Max StepLevel");
break;
//DebugPagination.WriteLine("'Adjust for Max StepLevel',{0},{1},{2},'{3}'",myPara.MyItemInfo.ItemID,stepLevel,maxLev, myPara.MyItemInfo.ShortPath);
//break;
}
if (RNOContinueOnly && !myPara.MyItemInfo.IsInRNO)
yAddForBtmMsg = myBottomMsgSpace;
else
yAddForBtmMsg = 0;
spaceOnPage += yAddForBtmMsg;
// The following lines were added for Comanche Peak ECA-TP-11-001A.SProcedure Steps.S17 (Printed as Step 12)
if (spaceOnPage > 0 && 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);
if (myPara != lastBreak)
return myPara;
}
// The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12)
vlnParagraph myParent = myPara.MyParent;
spaceOnPage = yAddForBtmMsg + yUpperLimit + myPara.YTop + yLocation - myParent.YTop;
if (spaceOnPage > 0 && 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);
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)
{
if ((-yLocation + yStart) >= yLowerLimit) // More than the lower limit
if (RNOContinueOnly && !myPara.MyItemInfo.IsInRNO)
yAddForBtmMsg = myBottomMsgSpace;
else
yAddForBtmMsg = 0;
spaceOnPage += yAddForBtmMsg;
// The following lines were added for Comanche Peak ECA-TP-11-001A.SProcedure Steps.S17 (Printed as Step 12)
if (spaceOnPage > 0 && myPara.YSize > fullPage && myPara.ChildrenRight != null && myPara.ChildrenRight.Count > 0
&& myPara.ChildrenRight[0].YSize <= fullPage && myPara.ChildrenRight[0].YSize > spaceOnPage)
{
if (yLocationMin == null) // No old location
{
//minBuff.AppendLine(string.Format("OLD1 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin = yLocation;
minPara = myPara;
}
else if (-yLocation < -yLocationMin && -yLocationMin >= yUpperLimit) // New location is smaller and old location excedes limit
{
//minBuff.AppendLine(string.Format("NEW1A >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin = yLocation;
minPara = myPara;
}
else if (-yLocation > -yLocationMin && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit
{
//minBuff.AppendLine(string.Format("NEWB1 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin = yLocation;
minPara = myPara;
}
}
else // Less than the lower limit
{
if (yLocationMin2 == null)
{
//minBuff.AppendLine(string.Format("OLD2 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin2 = yLocation;
minPara2 = myPara;
}
else if (-yLocation < -yLocationMin2 && -yLocationMin2 >= yUpperLimit) // New location is smaller and old location excedes limit
{
//minBuff.AppendLine(string.Format("NEW2A >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin2 = yLocation;
minPara2 = myPara;
}
else if (-yLocation > -yLocationMin2 && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit
{
//minBuff.AppendLine(string.Format("NEW2B >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
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 (-yLocation < yUpperLimit) // Before
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
{
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
// The top of this step is more than 1/2 way down the page
if ((-yLocation + yStart) >= yLowerLimit)
//_MyLog.WarnFormat("\r\nMyParaBreak {0},{1},{2},{3},{4}", myPara, myPara.YSize, yUpperLimit, myPara.ChildrenRight[0].YSize, spaceOnPage);
if (myPara != lastBreak)
return myPara;
}
// The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12)
vlnParagraph myParent = myPara.MyParent;
spaceOnPage = yAddForBtmMsg + yUpperLimit + myPara.YTop + yLocation - myParent.YTop;
if (spaceOnPage > 0 && 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);
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)
{
if ((-yLocation + yStart) >= yLowerLimit) // More than the lower limit
{
if (yLocationMin == null) // No old location
{
//minBuff.AppendLine(string.Format("OLD1 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin = yLocation;
minPara = myPara;
}
else if (-yLocation < -yLocationMin && -yLocationMin >= yUpperLimit) // New location is smaller and old location excedes limit
{
//minBuff.AppendLine(string.Format("NEW1A >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin = yLocation;
minPara = myPara;
}
else if (-yLocation > -yLocationMin && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit
{
//minBuff.AppendLine(string.Format("NEWB1 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin = yLocation;
minPara = myPara;
}
}
else // Less than the lower limit
{
if (yLocationMin2 == null)
{
//minBuff.AppendLine(string.Format("OLD2 >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin2 = yLocation;
minPara2 = myPara;
}
else if (-yLocation < -yLocationMin2 && -yLocationMin2 >= yUpperLimit) // New location is smaller and old location excedes limit
{
//minBuff.AppendLine(string.Format("NEW2A >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
yLocationMin2 = yLocation;
minPara2 = myPara;
}
else if (-yLocation > -yLocationMin2 && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit
{
//minBuff.AppendLine(string.Format("NEW2B >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit));
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 (-yLocation < yUpperLimit) // Before
//if (-yLocation < yWithinMargins && myList[stepLevel][yLocation].MyItemInfo.MyPrevious != null)
{
//ItemInfo prev = myList[stepLevel][yLocation].MyItemInfo.MyPrevious;
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 5609) Console.WriteLine("aer");
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
// The top of this step is more than 1/2 way down the page
if ((-yLocation + yStart) >= yLowerLimit)
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)
if ((-yLocation + yStart) >= yLowerLimit) // Only if it is more than the lower limit
return myPara;
// if is a caution or note & parent is a substep and entire substep doesn't fit, break.
if ((myPara.MyItemInfo.IsNote || myPara.MyItemInfo.IsCaution) &&
!myPara.MyParent.MyItemInfo.IsHigh &&
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
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)
if ((-yLocation + yStart) >= yLowerLimit) // Only if it is more than the lower limit
return myPara;
// if is a caution or note & parent is a substep and entire substep doesn't fit, break.
if ((myPara.MyItemInfo.IsNote || myPara.MyItemInfo.IsCaution) &&
!myPara.MyParent.MyItemInfo.IsHigh &&
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
return myPara;
}
}
}
}
@ -794,13 +798,17 @@ namespace Volian.Print.Library
//if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2);
return minPara ?? minPara2;
}
private static int MaxBreakLevel(float yLocation, StepLevelList myList)
private static int MaxBreakLevel(float yLocation, StepLevelList myList, int maxLevel)
{
int maxLevel = 0;
foreach (int stepLevel in myList.Keys)
foreach (float yLoc in myList[stepLevel].Keys)
if (yLocation == yLoc)
maxLevel = Math.Max(stepLevel, maxLevel);
if (stepLevel > maxLevel)
{
//vlnParagraph myPara = myList[stepLevel][yLoc];
//DebugPagination.WriteLine("'MaxBreakLevel',{0},{1},'{2}'", myPara.MyItemInfo.ItemID, stepLevel, myPara.MyItemInfo.ShortPath);
maxLevel = stepLevel;
}
return maxLevel;
}
//private void WalkStepLevel(float yTopMost)