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:
parent
5f8c27367f
commit
5d227213c5
@ -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))
|
||||
paraBreak = PageBreakOnStepList[0];
|
||||
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))
|
||||
@ -722,16 +732,16 @@ namespace Volian.Print.Library
|
||||
paraBreak = paraBreak.MyParent;
|
||||
}
|
||||
// If the lastbreak was part of a condition response and the location is part of a condition response account for the size of the footer.
|
||||
else if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && accountForCalvertAlarmConditionResponseFooter == 0)
|
||||
else if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && accountForCalvertAlarmConditionResponseFooter == 0)
|
||||
{
|
||||
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
|
||||
else
|
||||
paraBreak = paraBreak.MyParent;
|
||||
//_MyLog.WarnFormat("Keep notes and cautions with CR text {0},'{1}','{2}','{3}'", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyParent.MyParent.MyItemInfo.DisplayText);
|
||||
//_MyLog.WarnFormat("Keep notes and cautions with CR text {0},'{1}','{2}','{3}'", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyParent.MyParent.MyItemInfo.DisplayText);
|
||||
}
|
||||
if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro)
|
||||
{
|
||||
@ -750,16 +760,16 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro)
|
||||
if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro)
|
||||
accountForCalvertAlarmConditionResponseFooter = 5 * SixLinesPerInch;
|
||||
else
|
||||
accountForCalvertAlarmConditionResponseFooter = 0;
|
||||
//if (lastBreak != null && paraBreak.MyItemInfo.Ordinal == 1 && !paraBreak.MyItemInfo.IsCautionOrNotePart)
|
||||
//_MyLog.WarnFormat("'Strange Break',{0},'{1}','{2}','{3}',{4}", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyItemInfo.MyHLS.DisplayText,lastBreak.MyItemInfo.ItemID);
|
||||
//_MyLog.WarnFormat("'Strange Break',{0},'{1}','{2}','{3}',{4}", paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.ShortPath, paraBreak.MyItemInfo.MyProcedure.DisplayNumber, paraBreak.MyItemInfo.MyHLS.DisplayText,lastBreak.MyItemInfo.ItemID);
|
||||
}
|
||||
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
|
||||
@ -781,7 +791,7 @@ namespace Volian.Print.Library
|
||||
if (!firstLevel.MyItemInfo.IsHigh)
|
||||
{
|
||||
while (!firstLevel.MyParent.MyItemInfo.IsHigh) firstLevel = firstLevel.MyParent;
|
||||
if (firstLevel.MyParent.ChildrenBelow != null && firstLevel.MyParent.ChildrenBelow.Count > 0 && firstLevel.MyParent.ChildrenBelow[0] != firstLevel &&
|
||||
if (firstLevel.MyParent.ChildrenBelow != null && firstLevel.MyParent.ChildrenBelow.Count > 0 && firstLevel.MyParent.ChildrenBelow[0] != firstLevel &&
|
||||
firstLevel.YSize < yPageSize - (myTopMsgSpace + SixLinesPerInch))
|
||||
{
|
||||
vlnParagraph firstLevel1 = firstLevel;
|
||||
@ -800,8 +810,8 @@ namespace Volian.Print.Library
|
||||
//if (lastBreak != paraBreak.MyParent && paraBreak.MyItemInfo.IsTable && paraBreak.YSize < ySpaceOnCurPage && paraBreak.MyParent.MyItemInfo.DisplayText.ToUpper().Contains("TABLE"))
|
||||
// paraBreak = paraBreak.MyParent;
|
||||
//paraBreak.ShowPageBreak(999, paraBreak.MyItemInfo.ShortPath, "Yes",paraBreak.YTop, paraBreak.YSize, paraBreak.Height, false);
|
||||
//_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'"
|
||||
//, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath);
|
||||
//_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'"
|
||||
//, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath);
|
||||
// yTopNew is y Location of this page break. YTopMost is top of HLS, including any Cautions/Notes/Boxes/etc
|
||||
//float yTopNew = paraBreak.YVeryTop - YTopMost;
|
||||
//float yTopNew = paraBreak.YTopMost - YTopMost;
|
||||
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user