C2024-003-print-sub-section

This commit is contained in:
Paul Larsen 2024-02-28 09:16:47 -05:00
parent fcaa0ce41d
commit 578b8842f7

View File

@ -75,7 +75,7 @@ namespace Volian.Print.Library
if (MyItemInfo.MyPrevious != null) // add if statement to fix Westinghouse print issue 3-21-2014
return 1;
}
if (MyItemInfo.IsSection && _ChildrenBelow == null && YSize > (yLocation-yBottomMargin))
if (MyItemInfo.IsSection && _ChildrenBelow == null && YSize > (yLocation - yBottomMargin))
{
ShowPageBreak(1, "Page Break before empty section", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 1;
@ -171,7 +171,7 @@ namespace Volian.Print.Library
// line above the end message, thus 2 not 3. This change was made on July 20, 2011 by RHM & KBR. The
// procedure in questions was VEWCNEMG\EMGAPP.PRC, ES-01, Step 8.
//float yEndMsg = !_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
float yEndMsg = (!_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null)? GetEndMessageHeight(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages
float yEndMsg = (!_skipEndMessage && !MyItemInfo.IsSection && MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.NextItem == null) ? GetEndMessageHeight(MyItemInfo.MyDocStyle) : 0; // B2018-068 account for mult-line End Messages
// also consider if there is a phone list at the bottom of the page, add the amount of space the phone
// list requires onto yEndMsg to make it easier to figure out pagination (include an extra line for the
@ -202,7 +202,7 @@ namespace Volian.Print.Library
{
MyPageHelper.ParaBreaks.RemoveAt(0);
reason = AddReason("Partial Step - Case 1");
ShowPageBreak(1,reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 2; // break on this item within a step
}
// check for rnos:
@ -278,7 +278,7 @@ namespace Volian.Print.Library
StepConfig sc = firstChild.MyItemInfo.MyConfig as StepConfig;
ManualPageBreak = MyPageHelper.OriginalPageBreak ? (sc == null ? false : sc.Step_ManualPagebreak) :
sc == null ? false :
(MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null)? sc.Step_NewManualPagebreak : false;
(MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks == null) ? sc.Step_NewManualPagebreak : false;
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
if (sc != null && sc.Step_NewManualPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null &&
!MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(firstChild.MyItemInfo.ItemID)) MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(firstChild.MyItemInfo.ItemID);
@ -309,7 +309,7 @@ namespace Volian.Print.Library
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle);
float ySizeBtmEndMess = GetBottomEndMessageSize(MyItemInfo.MyDocStyle);
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess -ySizeBtmEndMess);
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > (yWithinMargins - ySizeBtmCtnMess - ySizeBtmEndMess);
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
KeepStepsOnPage = false;
if (ySizeIncludingFirst == YSize) KeepStepsOnPage = false;
@ -445,8 +445,8 @@ namespace Volian.Print.Library
if (BreakHighLevelStepWithSection) KeepWithHeader = true;
// for a HLS that has an asterisk box with the rno separator IN the box, adjust the size by 2 lines to account for box.
if (MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0 &&
(MyItemInfo.RNOs==null ||MyItemInfo.RNOs.Count==0))
mySize += (2*SixLinesPerInch);
(MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0))
mySize += (2 * SixLinesPerInch);
// mySize is the size of this step and includes an extra blank line. For HLS, if this is the last step in section & there is room in footer to keep
// step on the page, do so by eliminating the blank line before doing the test to see if it fits.
// B2017-254 Fixed Pagination Logic when checking to see if the current item is the last high level step
@ -486,7 +486,7 @@ namespace Volian.Print.Library
// 888 888 888 o oo .d8P `888'`888' 888 888 888 888 888 888 .
// o888o o888o o888ooooood8 8""88888P' `8' `8' o888o o888o o888o o888o o888o "888"
//Console.WriteLine("'PageBreak',1,'No','HLS will fit on page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
ShowPageBreak(-1, "HLS will fit on page", firstStep, YSize, yPageSize, yWithinMargins,ManualPageBreak);
ShowPageBreak(-1, "HLS will fit on page", firstStep, YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 0;
}
// !MyItemInfo.IsHigh - if (MyItemInfo.IsRNOPart && MyParent.XOffset < XOffset) return 0; // Don't paginate on an RNO to the right
@ -569,9 +569,22 @@ namespace Volian.Print.Library
KeepStepsOnPage = false;
}
}
// B2023-116: Vogtle alarm pagination - sub-steps are separating from their HLS even if there is room for some (not all). See comment above for setting of
// 'alarmPageKeepHighWithSubs'.
if (KeepStepsOnPage && !alarmPageKeepHighWithSubs && ySizeIncludingFirst > (yWithinMargins - ySizeBtmCtnMess1 - ySizeBtmEndMess1)) KeepStepsOnPage = false;
if (KeepStepsOnPage && ySizeIncludingFirst > (yWithinMargins - ySizeBtmCtnMess1 - ySizeBtmEndMess1))
{
// B2023-116: Vogtle alarm pagination - sub-steps are separating from their HLS even if there is room for some (not all).
// See comment above for setting of 'alarmPageKeepHighWithSubs'.
if (alarmPageKeepHighWithSubs)
{
// F2024-006: Vogtle Alarms pagination - compare the size of the step and its first sub-step with what we think we have left on the
// page. if not enough room with a continue message then set KeepStepsOnPage to start this step on its own page.
// This solved an issue where the last line of step text was printing on top of the bottom continue message
float myFirstPieceSize = GetFirstPieceSize(true);
if (myFirstPieceSize > yWithinMargins)
KeepStepsOnPage = false;
}
else
KeepStepsOnPage = false;
}
if (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg - tableSpaceAvailable <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break
{
// Don't want extra line before step
@ -688,7 +701,7 @@ namespace Volian.Print.Library
else
ShowPageBreak(6, CheckForFirstCompression("HLS will have to split on current page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak);
// B2018-081 - Fix pagination when a Step and it's substeps are so complicated that the high level step is separated from its high level RNO
if(this.MyItemInfo.IsHigh && MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.IsHigh)
if (this.MyItemInfo.IsHigh && MyPageHelper.ParaBreaks.Count > 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.IsHigh)
{
MyPageHelper.ParaBreaks.Clear();
BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7
@ -760,7 +773,7 @@ namespace Volian.Print.Library
bool hasRNO = false;
if (itemInfo1.IsInRNO) hasRNO |= true;
else
hasAER |=true;
hasAER |= true;
if (itemInfo2.IsInRNO) hasRNO |= true;
else
hasAER |= true;
@ -774,7 +787,7 @@ namespace Volian.Print.Library
if (endmsg != "")
{
string[] splitOn = { "\\par" }; // B2018-058 account for RTF newlines ( used for V.C. Summer End messages)
EndMsgHeight = (endmsg.Split(splitOn,StringSplitOptions.RemoveEmptyEntries).Length + 1) * SixLinesPerInch;
EndMsgHeight = (endmsg.Split(splitOn, StringSplitOptions.RemoveEmptyEntries).Length + 1) * SixLinesPerInch;
}
return EndMsgHeight;
}
@ -863,7 +876,7 @@ namespace Volian.Print.Library
// B2020-159: If forced pagination errors occurred, add a description to be placed on a dialog after printing.
if (PromsPrinter.ForcedPaginations == null) PromsPrinter.ForcedPaginations = new List<string>();
string path = MyItemInfo.Path.Replace(MyItemInfo.MyProcedure.DisplayText, "").Replace(MyItemInfo.MyProcedure.DisplayNumber, "").TrimStart(" ,".ToCharArray());
PromsPrinter.ForcedPaginations.Add(string.Format("{0}\t{1}\t{2}", MyPromsPrinter.PDFFile.Substring(0,MyPromsPrinter.PDFFile.IndexOf(".")), path, MyItemInfo.PageNumber));
PromsPrinter.ForcedPaginations.Add(string.Format("{0}\t{1}\t{2}", MyPromsPrinter.PDFFile.Substring(0, MyPromsPrinter.PDFFile.IndexOf(".")), path, MyItemInfo.PageNumber));
}
if (MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.Merge && MyPageHelper.CreatingSupInfoPage)
@ -875,7 +888,7 @@ namespace Volian.Print.Library
if (breakOrNot != "No")
{
bool hasBox = MyItemInfo.IsStep && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex != null && MyItemInfo.MyHLS.FormatStepData.StepLayoutData.STBoxindex >= 0;
bool rnoSepIn = (MyItemInfo.RNOs==null ||MyItemInfo.RNOs.Count==0);
bool rnoSepIn = (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0);
// DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance);
if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9},{10},{11}",
MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1),
@ -921,10 +934,10 @@ namespace Volian.Print.Library
private bool CheckAlternates(vlnParagraph vpBrk)
{
if (_AlternateBreaks == null) return false;
foreach(vlnParagraph vp in AlternateBreaks)
foreach (vlnParagraph vp in AlternateBreaks)
if (vp.MyItemInfo.ItemID == vpBrk.MyItemInfo.ItemID)
{
// _MyLog.WarnFormat("alternate used '{0}'-'{1}'",vpBrk.MyItemInfo.ShortPath,vp.MyItemInfo.ShortPath);
// _MyLog.WarnFormat("alternate used '{0}'-'{1}'",vpBrk.MyItemInfo.ShortPath,vp.MyItemInfo.ShortPath);
return true;
}
return false;
@ -986,7 +999,7 @@ namespace Volian.Print.Library
{
float myFirstPieceRNOSize = 0;
myFirstPieceRNOSize = ChildrenRight[0].GetFirstPieceSize();
if(myFirstPieceRNOSize < ySpaceOnCurPage)
if (myFirstPieceRNOSize < ySpaceOnCurPage)
if (ChildrenBelow.Count > 0)
{
float myFirstPieceAERSize = ChildrenBelow[0].GetFirstPieceSize() + ChildrenBelow[0].YOffset - YOffset;
@ -1452,7 +1465,7 @@ namespace Volian.Print.Library
}
float ySpaceAt7LPI = (adjustedCurPageYSpace - (accountForCalvertAlarmConditionResponseFooter + yEndMsg)) * SixLinesPerInch / _SevenLinesPerInch;
if ((YSize - yTop) > (adjustedCurPageYSpace - (accountForCalvertAlarmConditionResponseFooter + yEndMsg))
&& (YSize - yTop) < ySpaceAt7LPI )
&& (YSize - yTop) < ySpaceAt7LPI)
{
// Compress Rest of Step
// .oooooo. ooooooooo. .
@ -1583,13 +1596,13 @@ namespace Volian.Print.Library
/// <param name="myList"></param>
/// <returns></returns>
private static vlnParagraph FindPageBreak1(float yStart, float yUpperLimit, float yLowerLimit, StepLevelList myList, vlnParagraph lastBreak, float fullPage,
float myBottomMsgSpace,bool RNOContinueOnly, float yTop)
float myBottomMsgSpace, bool RNOContinueOnly, float yTop)
{
vlnParagraph minPara = null;
//StringBuilder minBuff = new StringBuilder();
float? yLocationMin=null;
float? yLocationMin = null;
vlnParagraph minPara2 = null;
float? yLocationMin2=null;
float? yLocationMin2 = null;
float yAddForBtmMsg = 0;
// useful for debugging pagination issues, lastbreak gets the paragraph at the top of the previous page, shows all
// of the locations within 'range' on the next page.
@ -1811,7 +1824,7 @@ namespace Volian.Print.Library
// B2020-073 was not keeping all of RNO sub-step together - Comanche Peak FRC-0.1 (unit 1) Step 14
// B2020-081 was breaking on an AER substep that has an long RNO - should keep AER substep and part of RNO on the page = D.C. Cook "Current (Post FLEX) U1 NOP NOT [EOPs]" set, ES-0.1 step 1.
// B2020-085 was breaking first child of second RNO (third IF in RNO) - should break on second child of second RNO - D.C. Cook AOP Unit 1 002-020 Step 15
// B2020-099 was breaking on last sub-step of previous RNO - Calvert Approved Procedures; Abnormal Procedures Unit 2; AOP-2A; Section VII; Step 11.RNO.11.1.c
// B2020-099 was breaking on last sub-step of previous RNO - Calvert Approved Procedures; Abnormal Procedures <20> Unit 2; AOP-2A; Section VII; Step 11.RNO.11.1.c
private vlnParagraph HasSecondRNOThatWillFit(float yStart, float yLowerLimit, float yUpperLimit, StepLevelList myList, int stepLevel, float yTop)
{
// B2020-120: for calvert alarms/condition response table, don't run code for second rno
@ -1823,7 +1836,7 @@ namespace Volian.Print.Library
return this;
// see if there is a second RNO then see if it will fit on the page
vlnParagraph tmp = this;
while (!tmp.MyItemInfo.IsRNOPart && tmp.MyParent!=null) tmp = tmp.MyParent; // if on a substep of an RNO, move up the substep's parent (RNO)
while (!tmp.MyItemInfo.IsRNOPart && tmp.MyParent != null) tmp = tmp.MyParent; // if on a substep of an RNO, move up the substep's parent (RNO)
vlnParagraph parent = tmp;
while (parent.MyParent != null && !parent.MyParent.MyItemInfo.IsSection) parent = parent.MyParent; // this will take us to the High level step
float yTopParent = parent.YTopMost; // this is where the HLS starts printing
@ -1862,13 +1875,13 @@ namespace Volian.Print.Library
return maxBottomMost;
}
private static bool StepWillFitOnBlankPageButNotOnCurrentPage(vlnParagraph myPara, float yLocation, float yStart,float fullPage)
private static bool StepWillFitOnBlankPageButNotOnCurrentPage(vlnParagraph myPara, float yLocation, float yStart, float fullPage)
{
// B2019-150 & B2019-151 Pagination Bugs Seen for Summer EOP4.1 Step 10 and
// SAG Step 9. Added format flag to limit when this logic would be used.
if (myPara.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnStepThatWillFitOnBlankPage == false)
return false;
float spaceOnCurrentPage = fullPage - (-yLocation+yStart);
float spaceOnCurrentPage = fullPage - (-yLocation + yStart);
// B2019-124 - Pagination - if substep will fit on a blank page but will not fit on the current page
// And is not the first substep then break
// B2019-130 - in Calvert data (FSG-1 Appendix 1 Unit 1 Actions, step E.1.g) the THEN sub step was placed on the next page
@ -1914,7 +1927,7 @@ namespace Volian.Print.Library
if (myPara.MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertPagination)
return (myPara.YOffset <= myParaBreak.YOffset &&
(myPara.YOffset + myPara.Height) >= myParaBreak.YOffset);
return(myPara.YOffset == myParaBreak.YOffset);
return (myPara.YOffset == myParaBreak.YOffset);
}
private bool HasAncestor(vlnParagraph myParaBreak)
{