From 8261a6bb550c3aee35c20e8208462a84201180b3 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 5 Sep 2014 14:29:20 +0000 Subject: [PATCH] Change a Property name (Prefix) to (PathPrefix) Added generic Properties (Prefix and Suffix) for vlnParagraph Changed Rtf to be lazy-loaded using new method BuildRtf --- PROMS/Volian.Print.Library/PromsPrinter.cs | 2 +- PROMS/Volian.Print.Library/vlnParagraph.cs | 76 +++++++++++++++------- 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 2b8adfd1..0d9f579b 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -1129,7 +1129,7 @@ namespace Volian.Print.Library float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin; // the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3. float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch); - vlnParagraph.Prefix = myItemInfo.Path; + vlnParagraph.PathPrefix = myItemInfo.Path; Rtf2Pdf.PdfDebug = true; Rtf2Pdf.Offset = new PointF(0, 2.5F); _MyHelper.ChangeBarDefinition = MyChangeBarDefinition; diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 67039c48..79133f69 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1826,8 +1826,23 @@ namespace Volian.Print.Library get { return _PrefixSpecialCharacter; } set { _PrefixSpecialCharacter = value; } } + private string _Prefix; + public string Prefix + { + get { return _Prefix; } + set { _Prefix = value; } + } + private string _Suffix; + public string Suffix + { + 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) { + Prefix = prefix; + Suffix = suffix; + MyItemInfo = itemInfo; // do some 'setup' for Calvert Alarms: if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) { @@ -1864,7 +1879,6 @@ namespace Volian.Print.Library if (MyTopRNO != null) MyTopRNO.LastRNO = this; } MyContentByte = cb; - MyItemInfo = itemInfo; if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID)) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); // if this a continuous subsection, refresh the style. @@ -2335,23 +2349,8 @@ namespace Volian.Print.Library //if (itemInfo.IsSection) // Rtf = GetRtf(itemInfo, prefix, " (Continued)"); //else - if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsCaution1 && - itemInfo.MyContent.Text.StartsWith(@"\u") && !itemInfo.MyContent.Text.StartsWith(@"\u160?")) - { - Rtf = GetRtf(itemInfo, " " + (prefix ?? ""), suffix); - PrefixSpecialCharacter = true; - } - else - { - Rtf = GetRtf(itemInfo, prefix, suffix); - } - // Need the following with some modifications for WCNCKL format: - if (Rtf.Contains("{Backspace}")) - { - XOffset -= 25; - Width += 24; - Rtf = Rtf.Replace("{Backspace}", ""); - } + // The following line may not be necessary RTF is lazyloaded + // BuildRtf(); if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate) { if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab @@ -2647,7 +2646,38 @@ namespace Volian.Print.Library if (savCheckListBottomMost != 0) YBottomMost = Math.Max(savCheckListBottomMost, YBottomMost); if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; } - + public override string Rtf + { + get + { + if(_Rtf == null)BuildRtf(); + return _Rtf; + } + set { _Rtf = value; } + } + private void BuildRtf() + { + if (_Rtf == null) + { + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && MyItemInfo.IsCaution1 && + MyItemInfo.MyContent.Text.StartsWith(@"\u") && !MyItemInfo.MyContent.Text.StartsWith(@"\u160?")) + { + Rtf = GetRtf(MyItemInfo, " " + (Prefix ?? ""), Suffix); + PrefixSpecialCharacter = true; + } + else + { + Rtf = GetRtf(MyItemInfo, Prefix, Suffix); + } + // Need the following with some modifications for WCNCKL format: + if (Rtf.Contains("{Backspace}")) + { + XOffset -= 25; + Width += 24; + Rtf = Rtf.Replace("{Backspace}", ""); + } + } + } // for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This // is flagged by the -1 row in the template definition. private bool KeepOnParentLine(ItemInfo itemInfo) @@ -3282,11 +3312,11 @@ namespace Volian.Print.Library get { return _MyTopRNO; } set { _MyTopRNO = value; } } - private static string _Prefix = ""; - public static string Prefix + private static string _PathPrefix = ""; + public static string PathPrefix { - get { return vlnParagraph._Prefix; } - set { vlnParagraph._Prefix = value; } + get { return vlnParagraph._PathPrefix; } + set { vlnParagraph._PathPrefix = value; } } protected float _YBottomMost; // Bottom of the paragraph including the children public float YBottomMost