diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index c9438563..9baf4fad 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -64,18 +64,18 @@ namespace Volian.Print.Library float yWithinMargins = CalculateYLocation(yLocation, yTopMargin) - yBottomMargin; // -SixLinesPerInch; if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination()) { - ShowPageBreak(1, "Page Break between separate sections", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - + ShowPageBreak(1, "Page Break between separate sections", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); + // if parent was continuous & this is separate, need to paginate to get subsection on // its own page. This occurred in BGE/OI3 set/OI-7 procedure/10.0 Attachments. if (!(MyParent.MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.WCNTraining && (MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; - // B2017-273 added a check for Farley format, we don't want the subsection pagelist infor to appear on the parent section page - works with ToPDF() logic - (section has steps and a sub-section ex: FNP-2-EEP-0 Attachment 4) - if (MyItemInfo.ActiveFormat.Name.ToUpper().StartsWith("FNP") && (MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; + // B2017-273 added a check for Farley format, we don't want the subsection pagelist infor to appear on the parent section page - works with ToPDF() logic - (section has steps and a sub-section ex: FNP-2-EEP-0 Attachment 4) + if (MyItemInfo.ActiveFormat.Name.ToUpper().StartsWith("FNP") && (MyItemInfo as SectionInfo).IsSeparatePagination()) return 1; if (MyItemInfo.MyPrevious != null) // add if statement to fix Westinghouse print issue 3-21-2014 - return 1; + 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 @@ -191,7 +191,7 @@ namespace Volian.Print.Library //float yEndMsg = !MyItemInfo.IsSection && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? ((2 * SixLinesPerInch) - yEndsWithBlankLine) : 0; bool isFirstChild = MyItemInfo.MyPrevious == null; - bool nearTheTop = (yWithinMargins < yPageSize) && (yWithinMargins > (yPageSize - 5 * SixLinesPerInch)); + bool nearTheTop = (yWithinMargins < yPageSize) && (yWithinMargins > (yPageSize - 5 * SixLinesPerInch)); // if step is breaking over a number of pages, determine if the current step is the // location of a pagebreak. ParaBreaks contains the paragraphs that break within a step. if (MyPageHelper.ParaBreaks.Count > 0) @@ -202,8 +202,8 @@ namespace Volian.Print.Library { MyPageHelper.ParaBreaks.RemoveAt(0); reason = AddReason("Partial Step - Case 1"); - ShowPageBreak(1,reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step + ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); + return 2; // break on this item within a step } // check for rnos: else if (MyPageHelper.ParaBreaks[0].CheckAlternates(this)) @@ -211,7 +211,7 @@ namespace Volian.Print.Library MyPageHelper.ParaBreaks.RemoveAt(0); reason = AddReason("Partial Step - Case 2"); ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step + return 2; // break on this item within a step } /////////////////// // The following else ifs are reached if something previously went wrong in pagination & this code tries to account for it. @@ -224,7 +224,7 @@ namespace Volian.Print.Library MyPageHelper.ParaBreaks.RemoveAt(0); reason = AddReason("Partial Step - Case 3"); ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step + return 2; // break on this item within a step } // B2018-015 Pagination Issue VCS EOP-15.0 Step 15 - Handle when RNO is exactly aligned with the AER column // B2018-065 Calvert's continue message was not including the substep number in AOP-1A Attachment 1, added AERandRNO check @@ -240,12 +240,12 @@ namespace Volian.Print.Library //} reason = AddReason("Partial Step - Case 4"); ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); - return 2; // break on this item within a step + return 2; // break on this item within a step } - return 0; // this is not an item with a break + return 0; // this is not an item with a break } float mySize = YSize * MyPageHelper.YMultiplier; - vlnParagraph firstChild = ChildrenBelow.Count > 0 ? ChildrenBelow[0] : null; + vlnParagraph firstChild = ChildrenBelow.Count > 0 ? ChildrenBelow[0] : null; // Steps that have the smart template (the WCNCKL format for example), always include two children. if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate) // { @@ -277,8 +277,8 @@ namespace Volian.Print.Library // on that first step. 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; + sc == null ? 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; @@ -365,13 +365,13 @@ namespace Volian.Print.Library //C2019-042 Section_IsFoldout checks Section Number, Section Title, and use of check box if ((MyItemInfo.MyActiveSection.MyConfig as SectionConfig).Section_IsFoldout == "Y" && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps - && mySize > yPageSize + && mySize > yPageSize && mySize <= yPageSize * SixLinesPerInch / _SevenLinesPerInch) CompressFoldout = true; return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } - if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level - bool doSectionTitleContinued = false; + if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level + bool doSectionTitleContinued = false; if (MyPageHelper.NotesToFootNotes != null && MyPageHelper.NotesToFootNotes.Count > 0) { float vpHeight = SixLinesPerInch; @@ -396,11 +396,11 @@ namespace Volian.Print.Library // if this step contains Cautions or Notes page breaks have to be added for those. if (TopMostChild != this) PageBreakOnStep = true; - BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 + BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 ShowPageBreak(1, "Page Break on Steps, Cautions or Notes", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); return 1; } - + //MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text //Console.WriteLine("{0} Paginate", MyPageHelper.HLSText); StepConfig sc1 = MyItemInfo.MyConfig as StepConfig; @@ -445,16 +445,16 @@ 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. + // 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 if (MyItemInfo.IsHigh && mySize >= (2 * SixLinesPerInch) && MyItemInfo.MyDocStyle.Layout.FooterLength > 0 && (MyItemInfo.MyDocStyle.End.Message == null || MyItemInfo.MyDocStyle.End.Message == "") && MyItemInfo.NextItem == null && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) && (MyItemInfo.RNOs == null || MyItemInfo.RNOs.Count == 0)) mySize -= SixLinesPerInch; //// Account for extra lines in the end message (flag < 0) float adjMsgY = 0; - if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. + if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. { adjMsgY = (float)-MyItemInfo.MyDocStyle.End.Flag * SixLinesPerInch; if (yEndMsg != 0) yEndMsg += adjMsgY; @@ -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 @@ -500,7 +500,7 @@ namespace Volian.Print.Library // this next page size is the same as current page size. float yPageSizeNextPage = yPageSize; mySize = YSize; // reset in case mySize changed for current page is compressed - // 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. + // 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); @@ -509,18 +509,18 @@ namespace Volian.Print.Library if (MyPageHelper.DidFirstPageDocStyle && MyItemInfo.ActiveSection != null && (MyItemInfo.ActiveSection.MyDocStyle.StructureStyle.Where & E_DocStyleUse.UseOnAllButFirstPage) > 0)// C2018-003 fixed use of getting the active section yPageSizeNextPage = GetYPageSizeUseOnAllButFirstPage(); - if (KeepStepsOnPage - && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel - && YSize == ySizeIncludingFirst - && YSize + yEndMsg > yWithinMargins) + if (KeepStepsOnPage + && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel + && YSize == ySizeIncludingFirst + && YSize + yEndMsg > yWithinMargins) { // If the first step is the size of the entire step and the step has an end message then don't try to break the step KeepStepsOnPage = false; //_MyLog.WarnFormat("Kick Step to Next Page {0},{1}", MyItemInfo.ItemID, MyItemInfo.ShortPath); } if (yWithinMargins < SixLinesPerInch) KeepStepsOnPage = false; // if there is no room to print, don't keep steps on the page - // The following was added for IP2 background printing. There were situations where there was a HLS and its paragraph was - // put on next page (IP2 bck: E-3/References), and a paragraph was writing into the footer (FR-H.1 step 2.2.3.1. KBR 10/14/14) + // The following was added for IP2 background printing. There were situations where there was a HLS and its paragraph was + // put on next page (IP2 bck: E-3/References), and a paragraph was writing into the footer (FR-H.1 step 2.2.3.1. KBR 10/14/14) if (KeepStepsOnPage && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel && YSize == ySizeIncludingFirst @@ -560,7 +560,7 @@ namespace Volian.Print.Library float ySizeBtmCtnMess1 = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); float ySizeBtmEndMess1 = GetBottomEndMessageSize(MyItemInfo.MyDocStyle); // B2017-154 Don't leave an orphan on the next page if the high level step and first sub-step will fit on the current page - if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.NoOrphans1 && KeepStepsOnPage && ChildrenBelow.Count == 2)// Handle Orphans when there are two sub-steps and only one will fit. + if (MyItemInfo.ActiveFormat.MyStepSectionLayoutData.NoOrphans1 && KeepStepsOnPage && ChildrenBelow.Count == 2)// Handle Orphans when there are two sub-steps and only one will fit. { vlnParagraph orphan = ChildrenBelow[1];// Verify that the orphan has no children if (orphan.ChildrenBelow.Count == 0 && orphan.ChildrenAbove.Count == 0 && orphan.ChildrenLeft.Count == 0 && orphan.ChildrenRight.Count == 0) @@ -569,10 +569,23 @@ 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 (!KeepWithHeader && !KeepStepsOnPage && mySize - SixLinesPerInch + yEndMsg - tableSpaceAvailable <= yPageSizeNextPage) // if the entire step can fit on one page, do a page break + 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 //Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath); @@ -589,8 +602,8 @@ namespace Volian.Print.Library } // TODO - yEndMsg - compressed size? - // ySize7LPI includes a blank line after the step which we don't want to include in the page break test. - else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps + // ySize7LPI includes a blank line after the step which we don't want to include in the page break test. + else if (!KeepStepsOnPage && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CompressSteps //&& (mySize7LPI - SixLinesPerInch + yEndMsg - tableSpaceAvailable) < (yPageSizeNextPage * SixLinesPerInch / _SevenLinesPerInch))// RHM20150525 - Table Scrunch // if this is the first step, then the step has to fit in the space that remains on the page // otherwise it needs to fit on a blank page @@ -615,7 +628,7 @@ namespace Volian.Print.Library else // The entire step cannot fit on a blank page or KeepStepsOnPage is true. { // if there is more than half a page left, then start to print on the current page - float myFirstPieceSize = GetFirstPieceSize(); //Case 0 + float myFirstPieceSize = GetFirstPieceSize(); //Case 0 if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch; // TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20. //float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit @@ -649,19 +662,19 @@ namespace Volian.Print.Library // if the HLS is part of a Smart Template (i.e. WCNCKL table), don't add in an extra line because // that makes pagination work incorrectly because the Smart Template has a 'table' line after the // text. - float ySpaceOnFirstPage = yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate ? 0 : SixLinesPerInch); + float ySpaceOnFirstPage = yWithinMargins + (MyItemInfo.FormatStepData.UseSmartTemplate ? 0 : SixLinesPerInch); if (firstStep == "Yes") - //{ + //{ ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line - //ShowPageBreak(8, CheckForCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - //} - //else - // ShowPageBreak(6, CheckForCompression("HLS will have to split on current page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - //BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur - // B2020-027: adjust for lines that may print on first page of section only, added MyPageHelper.PrintedSectionPage - // B2020-108: The bug itself was related to keeping a table with its parent. However compression for some pages was - // not working because onnewpage was always false in the next BuildPageBreakList call. onnewpage is used to determine compression - // (has to be on a new page to compress page). Use calculated value rather than always false in this case. + //ShowPageBreak(8, CheckForCompression("First HLS has to split on current page"), firstStep, YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); + //} + //else + // ShowPageBreak(6, CheckForCompression("HLS will have to split on current page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); + //BuildPageBreakList(yWithinMargins + SixLinesPerInch, yPageSizeNextPage + yExtra2, KeepStepsOnPage); // Case 5 - Determine items where page break(s) occur + // B2020-027: adjust for lines that may print on first page of section only, added MyPageHelper.PrintedSectionPage + // B2020-108: The bug itself was related to keeping a table with its parent. However compression for some pages was + // not working because onnewpage was always false in the next BuildPageBreakList call. onnewpage is used to determine compression + // (has to be on a new page to compress page). Use calculated value rather than always false in this case. bool onnewpage = MyItemInfo.MyPrevious == null && (MyItemInfo.MyActiveSection as SectionInfo) != null && (MyItemInfo.MyActiveSection as SectionInfo).IsSeparatePagination(); // B2020-123: Missing section continue message, onnewpage needs to be set to true: @@ -670,16 +683,16 @@ namespace Volian.Print.Library onnewpage = true; MyParent.CalvertPrintedSubSectTitle = false; } - BuildPageBreakList(ySpaceOnFirstPage, yPageSize + yExtra2 + MyPageHelper.PrintedSectionPage, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, onnewpage); // Case 5 - Determine items where page break(s) occur - // ooooo ooooo ooooo .oooooo..o .oooooo..o oooo o8o . .oooooo. . - // `888' `888' `888' d8P' `Y8 d8P' `Y8 `888 `"' .o8 d8P' `Y8b .o8 - // 888 888 888 Y88bo. Y88bo. oo.ooooo. 888 oooo .o888oo 888 oooo oooo oooo d8b oooo d8b .ooooo. ooo. .oo. .o888oo - // 888ooooo888 888 `"Y8888o. `"Y8888o. 888' `88b 888 `888 888 888 `888 `888 `888""8P `888""8P d88' `88b `888P"Y88b 888 - // 888 888 888 `"Y88b `"Y88b 888 888 888 888 888 888 888 888 888 888 888ooo888 888 888 888 - // 888 888 888 o oo .d8P oo .d8P 888 888 888 888 888 . `88b ooo 888 888 888 888 888 .o 888 888 888 . - // o888o o888o o888ooooood8 8""88888P' 8""88888P' 888bod8P' o888o o888o "888" `Y8bood8P' `V88V"V8P' d888b d888b `Y8bod8P' o888o o888o "888" - // 888 - // o888o + BuildPageBreakList(ySpaceOnFirstPage, yPageSize + yExtra2 + MyPageHelper.PrintedSectionPage, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, onnewpage); // Case 5 - Determine items where page break(s) occur + // ooooo ooooo ooooo .oooooo..o .oooooo..o oooo o8o . .oooooo. . + // `888' `888' `888' d8P' `Y8 d8P' `Y8 `888 `"' .o8 d8P' `Y8b .o8 + // 888 888 888 Y88bo. Y88bo. oo.ooooo. 888 oooo .o888oo 888 oooo oooo oooo d8b oooo d8b .ooooo. ooo. .oo. .o888oo + // 888ooooo888 888 `"Y8888o. `"Y8888o. 888' `88b 888 `888 888 888 `888 `888 `888""8P `888""8P d88' `88b `888P"Y88b 888 + // 888 888 888 `"Y88b `"Y88b 888 888 888 888 888 888 888 888 888 888 888ooo888 888 888 888 + // 888 888 888 o oo .d8P oo .d8P 888 888 888 888 888 . `88b ooo 888 888 888 888 888 .o 888 888 888 . + // o888o o888o o888ooooood8 8""88888P' 8""88888P' 888bod8P' o888o o888o "888" `Y8bood8P' `V88V"V8P' d888b d888b `Y8bod8P' o888o o888o "888" + // 888 + // o888o if (firstStep == "Yes") { //ySpaceOnFirstPage = yWithinMargins; // Accounts for Section Title Line @@ -688,10 +701,10 @@ 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 + BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 ShowPageBreak(6, CheckForFirstCompression("HLS will have to split on next page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); return 1; } @@ -701,7 +714,7 @@ namespace Volian.Print.Library && ChildrenRight[0].YSize <= yPageSizeNextPage && ChildrenRight[0].YSize > yWithinMargins) { MyPageHelper.ParaBreaks.Clear(); - BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 + BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 ShowPageBreak(6, CheckForFirstCompression("HLS with RNO will have to split on next page"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); return 1; } @@ -714,7 +727,7 @@ namespace Volian.Print.Library ShowPageBreak(6, CheckForFirstCompression("HLS with Separate Pagination for SubSection"), "Special", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); return 1; } - return 0; // Stay on this page + return 0; // Stay on this page } // Less than half a page left, start printing on a new page. @@ -725,21 +738,21 @@ namespace Volian.Print.Library // Pagination Fix Break1LineShort2 //BuildPageBreakList(yPageSize + yExtra, yPageSize); // Case 1 :Works for ES05 Step 15 SubStep 7 // Pagination Fix Break1LineShort4 - BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 - // ooooo ooooo ooooo .oooooo..o .oooooo..o oooo o8o . ooooo ooo - // `888' `888' `888' d8P' `Y8 d8P' `Y8 `888 `"' .o8 `888b. `8' - // 888 888 888 Y88bo. Y88bo. oo.ooooo. 888 oooo .o888oo 8 `88b. 8 .ooooo. oooo oooo ooo - // 888ooooo888 888 `"Y8888o. `"Y8888o. 888' `88b 888 `888 888 8 `88b. 8 d88' `88b `88. `88. .8' - // 888 888 888 `"Y88b `"Y88b 888 888 888 888 888 8 `88b.8 888ooo888 `88..]88..8' - // 888 888 888 o oo .d8P oo .d8P 888 888 888 888 888 . 8 `888 888 .o `888'`888' - // o888o o888o o888ooooood8 8""88888P' 8""88888P' 888bod8P' o888o o888o "888" o8o `8 `Y8bod8P' `8' `8' - // 888 - // o888o + BuildPageBreakList(yPageSize + yExtra, yPageSizeNextPage + yExtra2, KeepStepsOnPage, yEndMsg, doSectionTitleContinued & SectionShowTitles, true); // Case 1 :Works for ES05 Step 15 SubStep 7 + // ooooo ooooo ooooo .oooooo..o .oooooo..o oooo o8o . ooooo ooo + // `888' `888' `888' d8P' `Y8 d8P' `Y8 `888 `"' .o8 `888b. `8' + // 888 888 888 Y88bo. Y88bo. oo.ooooo. 888 oooo .o888oo 8 `88b. 8 .ooooo. oooo oooo ooo + // 888ooooo888 888 `"Y8888o. `"Y8888o. 888' `88b 888 `888 888 8 `88b. 8 d88' `88b `88. `88. .8' + // 888 888 888 `"Y88b `"Y88b 888 888 888 888 888 8 `88b.8 888ooo888 `88..]88..8' + // 888 888 888 o oo .d8P oo .d8P 888 888 888 888 888 . 8 `888 888 .o `888'`888' + // o888o o888o o888ooooood8 8""88888P' 8""88888P' 888bod8P' o888o o888o "888" o8o `8 `Y8bod8P' `8' `8' + // 888 + // o888o if (firstStep == "Yes") ShowPageBreak(9, CheckForFirstCompression("First HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); else ShowPageBreak(3, CheckForFirstCompression("HLS will have to split on new page"), "Yes", YSize, yPageSizeNextPage, yWithinMargins, ManualPageBreak); - return 1; // Paginate on High Level Steps + return 1; // Paginate on High Level Steps } //if (yWithinMargins > yPageSize / 2) //{ @@ -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,14 +787,14 @@ 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; } private float GetBottomEndMessageSize(DocStyle docstyle) { float myBottomMsgSpace = 0; - if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. + if (MyItemInfo.IsHigh && MyItemInfo.NextItem == null && MyItemInfo.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page. { docstyle = MyItemInfo.MyDocStyle; string myBottomMsg = docstyle.End.Message; @@ -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 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,18 +888,18 @@ 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), + 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), MyItemInfo.ShortPath, instance, (manualPageBreak ? "Manual " : "") + message, breakOrNot, MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), hasBox, rnoSepIn ); //C2018-015 add debug pagination to meta file - if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9},{10},{11}", - MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1), + if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9},{10},{11}", + MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1), MyItemInfo.ShortPath, instance, (manualPageBreak ? "Manual " : "") + message, breakOrNot, MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), @@ -907,11 +920,11 @@ namespace Volian.Print.Library private List _AlternateBreaks = null; public List AlternateBreaks { - get + get { if (_AlternateBreaks == null) _AlternateBreaks = new List(); - return _AlternateBreaks; + return _AlternateBreaks; } } private void AddAlternateBreak(vlnParagraph vp) @@ -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; @@ -980,13 +993,13 @@ namespace Volian.Print.Library yLowerLimit = yStart + 2 * SixLinesPerInch; } // Make sure that the FirstPiece (Caution Note HLS and First Substeps) fit - float myFirstPieceSize = GetFirstPieceSize(); //Case 0 - // the following logic was added to fix Pagination for VCS BDMG1 Step 4 + float myFirstPieceSize = GetFirstPieceSize(); //Case 0 + // the following logic was added to fix Pagination for VCS BDMG1 Step 4 if (ChildrenRight.Count > 0 && ChildrenRight[0].YOffset == YOffset) { 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; @@ -1001,12 +1014,12 @@ namespace Volian.Print.Library float myBottomMsgSpace = GetBottomContinueMessageSize(docstyle); switch (docstyle.Continue.Bottom.Location) { - case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page - // The following format flag was added for FNP, without the flag (which stops the reset of BottomMsgSpace) - // a number of FNP procedures had overwritten steps/bottom continue message. An example can be - // found in FNP = SAMGS;FNP-1-SACRG-2, step 1. + case E_ContBottomLoc.BottomOfPage: // place continue message at bottom of page + // The following format flag was added for FNP, without the flag (which stops the reset of BottomMsgSpace) + // a number of FNP procedures had overwritten steps/bottom continue message. An example can be + // found in FNP = SAMGS;FNP-1-SACRG-2, step 1. if (!docstyle.Continue.Bottom.NoOverrideSpace) - myBottomMsgSpace = 0; + myBottomMsgSpace = 0; break; } // also account for phonelist for locating bottom continue message: @@ -1076,7 +1089,7 @@ namespace Volian.Print.Library // to have page breaks. As each of these are processed (after this code) the topmost item in PageBreakOnStepList is removed. // The following checks if the entire step will fit for these types of steps and if so return the next break, i.e. [0], from the PageBreakOnStepList. // The if was changed to fix B2017-161. - bool DidPreferredPageBreak = false; + bool DidPreferredPageBreak = false; if (PageBreakOnStepList.Count > 0 && (PageBreakOnStepList[0].YTop - (lastBreak == null ? ((TopMostChild != null) ? TopMostChild.YTop : 0) : lastBreak.YTop) <= ySpaceOnCurPage)) paraBreak = PageBreakOnStepList[0]; else @@ -1102,10 +1115,10 @@ namespace Volian.Print.Library // B2017-109: for supplemental information, if there is a preferred page break, account for it. // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 // Break after table if it's the only item left and there is enough space - if (paraBreak != null && paraBreak.MyGrid != null && ItemsLeft(myList) == 1 && + if (paraBreak != null && paraBreak.MyGrid != null && ItemsLeft(myList) == 1 && ((YSize - yTop) <= (paraBreak.MyGrid.SpaceAvailable + ySpaceOnCurPage - (accountForCalvertAlarmConditionResponseFooter + yEndMsg)))) break; - if (myPreferredBreaks != null && myPreferredBreaks.Count > 0 && myPreferredBreaks.Keys[0] < paraBreak.YOffset) + if (myPreferredBreaks != null && myPreferredBreaks.Count > 0 && myPreferredBreaks.Keys[0] < paraBreak.YOffset) { // B2017-122: don't use preferred break if the last break was before this break vlnParagraph prefBreak = myPreferredBreaks[myPreferredBreaks.Keys[0]]; @@ -1186,9 +1199,9 @@ namespace Volian.Print.Library } if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfcreekCKLFormat) { - if (!paraBreak.MyItemInfo.IsHigh // not a high level step - && paraBreak.MyParent.MyItemInfo.IsHigh // my parent is a hls - && paraBreak.MyItemInfo.MyPrevious == null // first substep + if (!paraBreak.MyItemInfo.IsHigh // not a high level step + && paraBreak.MyParent.MyItemInfo.IsHigh // my parent is a hls + && paraBreak.MyItemInfo.MyPrevious == null // first substep && paraBreak.MyParent.MyItemInfo.FormatStepData.UseSmartTemplate) // my parent has the checklist header { if (DebugPagination.IsOpen) DebugPagination.WriteLine("Breaking at parent of {0}", paraBreak.MyItemInfo.DisplayText); @@ -1362,7 +1375,7 @@ namespace Volian.Print.Library // | Flags compression for 1st page | // | (1st page doesn't use paraBreak) | // - if (lastBreak != null) // not on first page of step + if (lastBreak != null) // not on first page of step { lastBreak.PageBreakReason = "More of Step at 7 LPI"; lastBreak.CompressPartOfStep = true; @@ -1411,7 +1424,7 @@ namespace Volian.Print.Library RemoveProcessedParagraphs(myList, yTopNew - yTop); yTop = yTopNew; MyPageHelper.ParaBreaks.Add(paraBreak); - ySpaceOnNextPage1 -= paraBreak.GetSectionTopMessageSize(); // B2016-134: Account for wcntraining section top continue on substep containers (notes/cautions) + ySpaceOnNextPage1 -= paraBreak.GetSectionTopMessageSize(); // B2016-134: Account for wcntraining section top continue on substep containers (notes/cautions) SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; // B2016-266 Only set SectionTitleContinued1 if the format supports section continue messages bool doSectionTitleContinued1 = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader; @@ -1422,9 +1435,9 @@ namespace Volian.Print.Library doSectionTitleContinued1 = false; } if (doSectionTitleContinued1) ySpaceOnNextPage1 -= 2 * SixLinesPerInch; // B2016-195: Account for Section Continue Message - // B2017-161: unnecessary PageBreak for background documents: use the 'usedPageBreakOnStepList' flag when using the PageBreakOnStepList, don't adjust space on page to account - // for continue message, if there is not one. - // B2017-252 Pagination Fix - RNP was not paginating correctly. Added logic to set ySPaceOnCurPage if ySpaceOnNextPage was larger + // B2017-161: unnecessary PageBreak for background documents: use the 'usedPageBreakOnStepList' flag when using the PageBreakOnStepList, don't adjust space on page to account + // for continue message, if there is not one. + // B2017-252 Pagination Fix - RNP was not paginating correctly. Added logic to set ySPaceOnCurPage if ySpaceOnNextPage was larger if (!usedPageBreakOnStepList || ySpaceOnNextPage1 > ySpaceOnCurPage) ySpaceOnCurPage = ySpaceOnNextPage1; //ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line. @@ -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. . @@ -1479,8 +1492,8 @@ namespace Volian.Print.Library private int ItemsLeft(StepLevelList myList) { int retval = 0; - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation + foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. + foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation retval++; return retval; } @@ -1494,9 +1507,9 @@ namespace Volian.Print.Library // C2023-018: Remove the supplemental info & alarm check, doing the possible page breaks on sub-steps //if (!MyItemInfo.MyDocStyle.SupplementalInformation && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) return null; SortedList sdpara = null; - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. + foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. { - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation + foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation { vlnParagraph myPara = myList[stepLevel][yLocation]; StepConfig sci = myPara.MyItemInfo.MyConfig as StepConfig; @@ -1583,13 +1596,13 @@ namespace Volian.Print.Library /// /// 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. @@ -1613,9 +1626,9 @@ namespace Volian.Print.Library // } // } //} - foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. + foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. { - foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation + foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation { float spaceOnPage = yUpperLimit + yLocation; vlnParagraph myPara = myList[stepLevel][yLocation]; @@ -1638,11 +1651,11 @@ namespace Volian.Print.Library // 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 - // B2018-104: don't return if my parent is a high level - a top continue message was printing - // Was not complete, i.e. caused other pagination problems and was put back in: B2019-170: VCS page break causes printing of step on top of next page. - // Note that this bug fix for WCN was commented out. Harry Julian wanted this on 11/15/19. A new bug will be written for the WCN error. - // B2019-173 reintroduced this line: - && !myPara.MyItemInfo.IsHigh) + // B2018-104: don't return if my parent is a high level - a top continue message was printing + // Was not complete, i.e. caused other pagination problems and was put back in: B2019-170: VCS page break causes printing of step on top of next page. + // Note that this bug fix for WCN was commented out. Harry Julian wanted this on 11/15/19. A new bug will be written for the WCN error. + // B2019-173 reintroduced this line: + && !myPara.MyItemInfo.IsHigh) { //_MyLog.WarnFormat("\r\nMyParaBreak {0},{1},{2},{3},{4}", myPara, myPara.YSize, yUpperLimit, myPara.ChildrenRight[0].YSize, spaceOnPage); if (myPara != lastBreak) @@ -1726,10 +1739,10 @@ namespace Volian.Print.Library //while (myPara.MyParent.YTop == myPara.YTop) myPara = myPara.MyParent; while (myPara.MyParent != null && 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; - bool inSameBox = InSameBox(myPara, minPara2); // if this note/caution is in same box as the break, don't break within the notes/cautions in the same box + bool inSameBox = InSameBox(myPara, minPara2); // if this note/caution is in same box as the break, don't break within the notes/cautions in the same box if (!inSameBox && myPara.ChildrenAbove.Count == 0 && 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) + //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"); @@ -1755,7 +1768,7 @@ namespace Volian.Print.Library } } // B2019-103, B2019-114 Break at a step if the step will fit on a page by itself and it will - // not fit in the current page + // not fit in the current page float yAdjustLastSubStep = 0; if ((myPara.MyItemInfo.ActiveParent as ItemInfo).IsHigh && myPara.MyItemInfo.NextItem == null) { @@ -1766,8 +1779,8 @@ namespace Volian.Print.Library _MyLog.WarnFormat("Last Substep will fit on page by itself {0}", myPara.MyItemInfo.ShortPath); // add information in the error log } if (StepWillFitOnBlankPageButNotOnCurrentPage(myPara, yLocation, yStart, fullPage + yAdjustLastSubStep)) - if (myPara != lastBreak) - return myPara; + if (myPara != lastBreak) + 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) @@ -1787,7 +1800,7 @@ namespace Volian.Print.Library } } //DebugPagination.Write(minBuff.ToString()); - if (-yLocationMin > yUpperLimit && minPara2 != null) minPara = null; + if (-yLocationMin > yUpperLimit && minPara2 != null) minPara = null; // if breaking at a note/caution - don't break within the same box. Clear minPara (like code above) // so that minPara2 is used. @@ -1803,7 +1816,7 @@ namespace Volian.Print.Library DebugPagination.WriteLine("B2020-148 {0}", minPara2); _MyLog.WarnFormat("\r\n+++ Paginagion Change B2020-148 {0}", minPara2); } - return minPara ?? minPara2; + return minPara ?? minPara2; } // B2020-013 premature break in RNO column - Callaway OTO-AC-00002 step 2 @@ -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) { @@ -1969,7 +1982,7 @@ namespace Volian.Print.Library tsa = MyGrid.SpaceAvailable + MyGrid.LeadingSpaceAvailable; if (btmRight != 0) { - //_MyLog.WarnFormat("Item={00}, B={1} BR={2} T={3} TR={4}",MyItemInfo.ItemID , btm, btmRight, tsa, tsaRight); + //_MyLog.WarnFormat("Item={00}, B={1} BR={2} T={3} TR={4}",MyItemInfo.ItemID , btm, btmRight, tsa, tsaRight); if (btm < btmRight) tsa = tsaRight; } @@ -1979,7 +1992,7 @@ namespace Volian.Print.Library } public partial class VlnSvgPageHelper : SvgPageHelper { - private bool _OriginalPageBreak; // use 16bit page breaks. + private bool _OriginalPageBreak; // use 16bit page breaks. public bool OriginalPageBreak { get { return _OriginalPageBreak; }