From a4f0a04c5d79ec394ffa222b8193fc8b066b2d6b Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 9 Oct 2014 18:22:53 +0000 Subject: [PATCH] Added logic to speed-up printing --- PROMS/Volian.Print.Library/PromsPrinter.cs | 2 +- PROMS/Volian.Print.Library/vlnParagraph.cs | 53 ++++++++++++++-------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index e7ad59cd..dffaf465 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -1168,7 +1168,7 @@ namespace Volian.Print.Library Rtf2Pdf.PdfDebug = true; Rtf2Pdf.Offset = new PointF(0, 2.5F); _MyHelper.ChangeBarDefinition = MyChangeBarDefinition; - vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0); + vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true); float localYPageStart = 0; float yPageStart = yTopMargin; if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index a28a5cf7..54eb1f5b 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -273,7 +273,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); + vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true); // if doing the component list (FNP), keep track of the bottom most columns' data // so this can be returned after the row is done. @@ -1176,7 +1176,7 @@ namespace Volian.Print.Library if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate) { DoSubs = false; - vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0); + vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0,false); smartPara.PrintHeader = true; float mytmpfloat = smartPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); yPageStart -= smartPara.Height; @@ -1239,7 +1239,7 @@ namespace Volian.Print.Library { vlnParagraph sectContPara; string contMsg = MyItemInfo.MyActiveSection.MyDocStyle.Continue.SectionTitle.AppendToTitle; - sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null ||contMsg == "")?" (Continued)":contMsg, 0); + sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false); float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); if (sectContPara.SectionContinuePrinted) yPageStart -= sectContPara.Height * 2; @@ -1918,7 +1918,7 @@ namespace Volian.Print.Library get { return _Suffix; } set { _Suffix = value; } } - public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent) + public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren) { Prefix = prefix; Suffix = suffix; @@ -2162,12 +2162,12 @@ namespace Volian.Print.Library // For deviations, the Cautions are always in the same place. // Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if(loadChildren) yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } else { if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; - yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if (loadChildren) yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } } if (DoSubs && itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote)) @@ -2177,7 +2177,7 @@ namespace Volian.Print.Library // For deviations, the Cautions are always in the same place. // Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin + 6 + (float)(itemInfo.ActiveFormat.MyStepSectionLayoutData.WidT); - yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoffDev, yoff, yoff, rnoLevel, maxRNO, formatInfo)); + if (loadChildren) yoffLeft = Math.Max(yoffLeft, ChildrenLeft.Add(cb, itemInfo.Notes, xoffDev, yoff, yoff, rnoLevel, maxRNO, formatInfo)); } else { @@ -2185,7 +2185,7 @@ namespace Volian.Print.Library // yoff from this. Without this, an overlap of text between the note and the bottom of the // RNO was occurring for FNP - Unit 2/AOP, AOP-4.0. if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; - yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if (loadChildren) yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } } @@ -2521,7 +2521,7 @@ namespace Volian.Print.Library if (itemInfo.Steps != null) { if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight") - tyoff = ChildrenRight.Add(cb, itemInfo.Steps, XOffset + 72, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if (loadChildren) tyoff = ChildrenRight.Add(cb, itemInfo.Steps, XOffset + 72, yoff, yoff, rnoLevel, maxRNO, formatInfo); } yoff += Height; yoff = Math.Max(yoff, tyoff); @@ -2590,7 +2590,7 @@ namespace Volian.Print.Library float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); if (DoSubs && rnoLevel < maxRNO && itemInfo.RNOs != null) { - yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo); + if (loadChildren) yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo); if (ChildrenRight[0].ChildrenAbove.Count > 0) { float adj = ChildrenRight[0].YOffset - YOffset; @@ -2634,9 +2634,13 @@ namespace Volian.Print.Library } bool rightLonger = yOffRight > yoff; if (!aerTableOrFigure && itemInfo.RNOLevel == 0) // Centered Table - yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, rightLonger ? yOffRight : yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); + { + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, rightLonger ? yOffRight : yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); + } else // AER or RNO Table - yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.Tables, XOffset, yoff + yoffadj, yOffRight + yoffadj, rnoLevel, maxRNO, formatInfo); } yOffRight = Math.Max(yOffRight, yoffLeft); // Look for the meta section case where the 'Editable' flag is set to 'N', which means that @@ -2670,7 +2674,7 @@ namespace Volian.Print.Library PartsBelow.Add(mySep); yoff += mySep.Height;// +SixLinesPerInch; } - yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, MyTab.XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); + if (loadChildren) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, MyTab.XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); if ((itemInfo.ActiveFormat.MyStepSectionPrintData.HLRNOStpSeparatorString ?? "") != "") { string tmpSepStr = itemInfo.ActiveFormat.MyStepSectionPrintData.HLRNOStpSeparatorString; @@ -2685,22 +2689,31 @@ namespace Volian.Print.Library // below the HLS and close to the right margin. if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.Type == "Caution1") { - yoff = ChildrenBelow.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); savCheckListBottomMost = yoff; } if (DoSubs && itemInfo.Steps != null && printsteps) { if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight") - if(rnoBefore) - yoff = ChildrenBelow.Add(cb, itemInfo.Steps, MyTab.XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); + if (rnoBefore) + { + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.Steps, MyTab.XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); + } else - yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); + if (loadChildren) yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo); } - if (itemInfo.Sections != null) yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - if (itemInfo.Procedures != null) yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if (itemInfo.Sections != null) + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + if (itemInfo.Procedures != null) + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); // Don't add the RNO to print if doing backgrounds. That piece of data is part of the pagelist item. if (rnoAfter) - yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); + if (loadChildren) + yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo); yoff = Math.Max(yoff, yOffRight); // TODO - use RNOSepAfterAER flag too: string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString;