From 750c8df8958d84f270ab6f6ffabdd212848f7a0c Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 17 Jan 2014 16:12:20 +0000 Subject: [PATCH] Revised code to assure setpoint ro's were underlined and non-setpoint ro's were not underlined during printing Revised code to assure ro's in grids are not colored red during printing Added code to override Height property of vlnPrintObject class in vlnBox class Added code to utilize BoxLeftAdj property Removed blank lines and previous debug code Added code to assure spaces between note and caution boxes are added when separate box format flag is used Added code to implement %c token in continue message of Byron/Braidwood formats Added code to utilize BoxLeftAdj property Added code to correct underline termination issue involving reference objects and transitions Changed Height property to virtual to allow overriding in inherited classes --- PROMS/Volian.Controls.Library/DisplayText.cs | 7 +++--- PROMS/Volian.Print.Library/Grid2Pdf.cs | 5 ++++ PROMS/Volian.Print.Library/vlnBox.cs | 15 ++++++++++++ PROMS/Volian.Print.Library/vlnParagraph.cs | 24 +++++++++++--------- PROMS/Volian.Print.Library/vlnPrintObject.cs | 2 +- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index 9aef9747..59424b2d 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -1179,10 +1179,11 @@ namespace Volian.Controls.Library afterRO = Regex.Replace(afterRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // Remove Comments // Underline all ROs, values and Units - if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo) + if (isSetpoint && _MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo) { // TO DO: Need to check if step text is already underlined - rtnstr = @"\ul " + rtnstr + @"\ulnone "; + if ((_MyItemInfo.FormatStepData.Font.Style & E_Style.Underline) == 0) + rtnstr = @"\ul " + rtnstr + @"\ulnone "; } // UpcaseAllRoUnits - Uppercases ALL ROs units everywhere. @@ -1195,7 +1196,7 @@ namespace Volian.Controls.Library // Caps ROs anywhere if no lower case text follows // and an upper case letter immediately precedes the RO. - + if (isSetpoint && _MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapSPIfLastLower && !Regex.IsMatch(afterRO, @".*(? -1) myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray())); + if (myMsg.IndexOf(@"%c") > -1) + myMsg = myMsg.Replace(@"%c", " "); if (!PageBreakOnStep) MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); else @@ -1340,6 +1339,8 @@ namespace Volian.Print.Library } public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent) { + if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) + _MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj); ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles; if (itemInfo.IsSection && itemInfo.ActiveSection.DisplayText.ToUpper().Contains("") && !itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) ShowSectionTitles = false; @@ -2385,11 +2386,11 @@ namespace Volian.Print.Library { foreach (UnderlineTerminate ut in utl) { - if (rtf.Contains(ut.Text)) + MatchCollection mc = Regex.Matches(rtf, "(? 0) { - int indxC = rtf.IndexOf(ut.Text); - rtf = rtf.Substring(0, indxC) + @"\ulnone " + rtf.Substring(indxC); - break; + Match m = mc[mc.Count - 1]; + rtf = rtf.Substring(0, m.Index) + @"\ulnone " + rtf.Substring(m.Index); } } } @@ -2402,6 +2403,7 @@ namespace Volian.Print.Library get { return _XOffsetBox; } set { _XOffsetBox = value; } } + private float _MyBoxLeftAdj = 0; private float SetHeader(vlnParagraph para, PdfContentByte cb, ItemInfo itemInfo, FormatInfo formatInfo) { float xoff = (float)itemInfo.MyDocStyle.Layout.LeftMargin; @@ -2419,7 +2421,7 @@ namespace Volian.Print.Library if (bx.TabPos > 0) xoff += (float)bx.TabPos; // xoff starts as left margin else - xoff += (float)((bx.TxtStart + XOffsetBox + (bx.TxtWidth / 2)) - (hdrWidth / 2)); // xoff starts as left margin + xoff += (float)((bx.TxtStart + _MyBoxLeftAdj + XOffsetBox + (bx.TxtWidth / 2)) - (hdrWidth / 2)); // xoff starts as left margin } else if (formatInfo.MyStepSectionLayoutData.Separator.Location > 0) xoff = XOffset + AdjustToCharPosition((float)((para.Width - hdrWidth) / formatInfo.MyStepSectionLayoutData.Separator.Location), itemInfo.MyHeader.MyFont.CPI); @@ -2428,7 +2430,7 @@ namespace Volian.Print.Library } else xoff = XOffset; // XOffset has left margin included - vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff, YOffset, itemInfo.MyHeader.MyFont); + vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff + _MyBoxLeftAdj, YOffset, itemInfo.MyHeader.MyFont); PartsAbove.Add(myHeader); return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? MyItemInfo.FormatStepData.SpaceIn ? SixLinesPerInch : 0 : 0); } @@ -2794,7 +2796,7 @@ namespace Volian.Print.Library XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox; } else - XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox; + XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + _MyBoxLeftAdj + tabWidth + XOffsetBox; if (myTab != null) myTab.XOffset = XOffset - tabWidth; } //else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh) diff --git a/PROMS/Volian.Print.Library/vlnPrintObject.cs b/PROMS/Volian.Print.Library/vlnPrintObject.cs index d9019fee..be36532e 100644 --- a/PROMS/Volian.Print.Library/vlnPrintObject.cs +++ b/PROMS/Volian.Print.Library/vlnPrintObject.cs @@ -97,7 +97,7 @@ namespace Volian.Print.Library set { _Width = value; } } protected float _Height; - public float Height + public virtual float Height { get {