From a4395852b665b45490bccd74a4030bfb7ca3579e Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 3 Sep 2020 16:50:54 +0000 Subject: [PATCH] B2020-112: Pagination of complicated AER/RNO B2020-123: Missing section continue message for Calvert OI & STP --- PROMS/Volian.Print.Library/Pagination.cs | 22 ++++++++--- PROMS/Volian.Print.Library/vlnParagraph.cs | 43 +++++++++++++++++++--- 2 files changed, 53 insertions(+), 12 deletions(-) diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index bc579ab9..bd21096d 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -416,6 +416,8 @@ namespace Volian.Print.Library float yExtra2 = (SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0; if (KeepStepsOnPage && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.PaginateOnLowerStepLevel && ySizeIncludingFirst > yWithinMargins) KeepStepsOnPage = false; + // B2020-123: Missing section continue message + if (MyParent.CalvertPrintedSubSectTitle) nearTheTop = true; bool KeepWithHeader = isFirstChild && nearTheTop; 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. @@ -511,8 +513,9 @@ namespace Volian.Print.Library //yExtra2 -= sectionSpace; // This was removed for Calvert STP O-73H-2 Section 6.3.O.4 and 6.3.R.3 } } - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && yPageSizeNextPage < yWithinMargins + 3*72 && MyItemInfo.MyPrevious == null) - KeepStepsOnPage = true; + // Added for section that was breaking from steps this code was removed to fix B2020-112 + //if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && yPageSizeNextPage < yWithinMargins + 3 * 72 && MyItemInfo.MyPrevious == null) + // KeepStepsOnPage = true; float mySize7LPI = mySize; // +SixLinesPerInch; if (_Match16BitPagination) mySize7LPI += SixLinesPerInch; float tableSpaceAvailable = TableSpaceAvailable;// RHM20150525 - Table Scrunch @@ -621,6 +624,12 @@ namespace Volian.Print.Library // (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: + if (MyParent.CalvertPrintedSubSectTitle) + { + 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 @@ -1242,7 +1251,8 @@ namespace Volian.Print.Library //float yTopNew = paraBreak.YTopMost - YTopMost; if (JustATableThatWillFit(paraBreak, yPageSize - (myTopMsgSpace + yEndMsg))) paraBreak = paraBreak.ChildrenBelow[0]; - float ySpaceOnNextPage1 = yPageSize - (myTopMsgSpace + (yEndMsg == 0 ? SixLinesPerInch : 0)); // Allow for continue message and blank line. + // B2020-112: complicated AER/RNO. yEndMsg was accounted for twice + float ySpaceOnNextPage1 = yPageSize - (myTopMsgSpace); // + (yEndMsg == 0 ? SixLinesPerInch : 0)); // Allow for continue message and blank line. ySpaceOnNextPage1 -= accountForSmartTemplateHeader; // This fixes B2016-174: // Added the check to not go into this code if on a step that needs to break. If the conditions were met, this @@ -1557,9 +1567,9 @@ namespace Volian.Print.Library } // 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 + float spaceOnPage1 = yAddForBtmMsg + yUpperLimit + myPara.YTop + yLocation - myParent.YTop; + if (spaceOnPage1 > 0 && myParent != lastBreak && myParent.YSize > fullPage && myParent.ChildrenRight != null && myParent.ChildrenRight.Count > 0 + && myParent.ChildrenRight[0].YSize <= fullPage && myParent.ChildrenRight[0].YSize > spaceOnPage1 // 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 the 'IsHigh' portion and added IsRNOPart, the HLS & RNOPart print at same location on page so code needs diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 1854aa22..3bad46e9 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -164,7 +164,10 @@ namespace Volian.Print.Library if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.MatchUpRNO) { if (childItemInfo.MyParent != null && childItemInfo.MyParent.MyParent != null && !childItemInfo.MyParent.MyParent.IsHigh) + { yoff += vlnPrintObject.SixLinesPerInch; + Parent.AdjustForMatchUpRNO = vlnPrintObject.SixLinesPerInch; // B2020-112 + } } // if this is a caution/note and it has a caution/note substep, do it before this caution/note, so that // it comes above it. @@ -282,6 +285,7 @@ namespace Volian.Print.Library box.DefBox = vlnBox.DOUBLEboxHLS; bxHlsDraw = true; } + vlnParagraph para = null; // Comanche peak or WCN bck Step designator if (childItemInfo.IsCaution2 && childItemInfo.SameRowAsParent || childItemInfo.IsCaution1 && childItemInfo.SameRowAsParent) @@ -305,7 +309,7 @@ namespace Volian.Print.Library box = null; yoff += 1 * vlnPrintObject.SixLinesPerInch; } - vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, pp); + para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, pp); // if doing the component list (FNP), keep track of the bottom most columns' data // so this can be returned after the row is done. @@ -392,7 +396,10 @@ namespace Volian.Print.Library yoff += (nxtIsBoxed * vlnPrintObject.SixLinesPerInch); } if (childItemInfo.IsSequential && childItemInfo.NextItem != null && childItemInfo.MyParent.IsHigh && ((childItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.XBlankW1stLevSub) == E_DocStructStyle.XBlankW1stLevSub)) + { yoff += vlnPrintObject.SixLinesPerInch; + if (para != null) para.AdjustForXBlankW1stLevSub = vlnPrintObject.SixLinesPerInch; // B2020-112 + } boxHLS = false; lastChild = childItemInfo; } @@ -1196,6 +1203,7 @@ namespace Volian.Print.Library get { return _PrintHeader; } set { _PrintHeader = value; } } + private bool CalvertPrintedSubSectTitle = false; // B2020-123 private static List myAttributes = new List(); private static void AddAttribute(string attr) { @@ -1490,7 +1498,9 @@ namespace Volian.Print.Library } return (prTab + thisTab.Trim()).TrimEnd(".".ToCharArray()); } - private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header) + private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header) + public float AdjustForXBlankW1stLevSub = 0; // B2020-112 this & next line + public float AdjustForMatchUpRNO = 0; protected float _ContinueHeight = 0; public virtual float ContinueHeight { @@ -1783,8 +1793,9 @@ namespace Volian.Print.Library if (MyPageHelper.CreatingSupInfoPage) yPageStart -= (2 * SixLinesPerInch); if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, null); // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it - if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection)) + if ((!MyItemInfo.IsSection || MyItemInfo.IsSubsection) && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection)) { + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert ) CalvertPrintedSubSectTitle = true; // B2020-123 SectionConfig sch = MyItemInfo.ActiveSection.MyConfig as SectionConfig; doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle; } @@ -2183,6 +2194,7 @@ namespace Volian.Print.Library } } int profileDepth2 = ProfileTimer.Push(">>>> vlnParagraph.ParagraphToPdf"); + if (MyItemInfo.IsSubsection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) CalvertPrintedSubSectTitle = true; // B2020-123 yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); ProfileTimer.Pop(profileDepth2); // If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update @@ -2632,7 +2644,7 @@ namespace Volian.Print.Library // the second, third, etc background Caution/Note pages begin printing two additional lines from the top of the page // to fix, added a check to see the the item we are printing has the PageBrrakOnStep flag set, if it's set, // then DON'T add two lines to the yPageStart (for the top conitnue message) - if (myMsg != null && myMsg != "" && !MyItemInfo.FormatStepData.PageBreakOnStep) + if (myMsg != null && myMsg != "" && !MyItemInfo.IsSection && !MyItemInfo.FormatStepData.PageBreakOnStep) // B2020-123 { yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message if (myMsg.IndexOf(@"%sR") > -1) @@ -6630,8 +6642,27 @@ namespace Volian.Print.Library if (!this.ContainsKey(stepLevel)) this.Add(stepLevel, new SortedDictionary()); // using a negative for yLocation so that its in descending order: - if (!this[stepLevel].ContainsKey(-yLocation)) - this[stepLevel].Add(-yLocation, para); + // B2020-112: Make various adjustments to location if there are format flags used + float adjust = para.YVeryTop - para.YTop; + if (para.MyItemInfo.MyParent.IsHigh && (para.ChildrenAbove == null || para.ChildrenAbove.Count == 0)) + { + //Console.WriteLine("Adjust Add extra Line (flag) = '{0}'", para); + adjust -= para.AdjustForXBlankW1stLevSub; + } + else if (para.MyParent.MyItemInfo.IsHigh && (para.MyParent.ChildrenAbove != null && para.MyParent.ChildrenAbove.Count > 0) + && para.MyParent.ChildrenAbove[0] == para) + { + //Console.WriteLine("Adjust Add extra Line (flag) = '{0}'", para); + adjust -= para.MyParent.AdjustForXBlankW1stLevSub; + } + if (para.AdjustForMatchUpRNO != 0 && (para.ChildrenAbove == null || para.ChildrenAbove.Count == 0)) + adjust -= para.AdjustForMatchUpRNO; + else if (para.MyParent.AdjustForMatchUpRNO != 0 && (para.MyParent.ChildrenAbove != null && para.MyParent.ChildrenAbove.Count > 0) + && para.MyParent.ChildrenAbove[0] == para) + adjust -= para.MyParent.AdjustForMatchUpRNO; + + if (!this[stepLevel].ContainsKey(-(yLocation + adjust))) + this[stepLevel].Add(-(yLocation + adjust), para); } } public class ParagraphLocations : List