From e0b20d8ab1d6355c7113a5a16d971b873eb14236 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 2 Oct 2013 22:15:04 +0000 Subject: [PATCH] =?UTF-8?q?Logic=20for=20Comanche=20Peak=E2=80=99s=20Step?= =?UTF-8?q?=20Designator=20and=20boxed=20Cautions=20and=20Notes=20Supporti?= =?UTF-8?q?ng=20logic=20for=20used=20by=20the=20redefined=20=E2=80=9CWidth?= =?UTF-8?q?Override=E2=80=9D=20Added=20support=20the=20=E2=80=9C{UNITNUMBE?= =?UTF-8?q?R}=E2=80=9D=20pagelist=20token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Volian.Print.Library/VlnSvgPageHelper.cs | 4 + PROMS/Volian.Print.Library/vlnParagraph.cs | 104 +++++++++++++----- PROMS/Volian.Print.Library/vlnPrintObject.cs | 2 +- 3 files changed, 82 insertions(+), 28 deletions(-) diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 8eb6645a..25112a9a 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -1084,6 +1084,10 @@ namespace Volian.Print.Library plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text); //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text))); break; + case "{UNITNUMBER}": + case "[UNITNUMBER]": + plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Number); + break; case "{ATTACHNUM}": case "[ATTACHNUM]": plstr = plstr.Replace(token, "1"); // used by SHESDD - but 16bit returns '1' unless has format flag 'MoveParensToToken' that was only in SCE (San Onofre) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 3fd009f6..ffef68f3 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -28,6 +28,28 @@ namespace Volian.Print.Library { _Parent = parent; } + // Step Designators are used by Comanche Peak and stored in their CAUTION2 type + // We need to save this information and not process it like a normal Caution. + private string _StepDesignator; + public string StepDesignator + { + get { return _StepDesignator; } + set { _StepDesignator = value; } + } + private float? _StepDesignatorColumn; + + public float? StepDesignatorColumn + { + get { return _StepDesignatorColumn; } + set { _StepDesignatorColumn = value; } + } + private VE_Font _StepDesignatorFont; + + public VE_Font StepDesignatorFont + { + get { return _StepDesignatorFont; } + set { _StepDesignatorFont = value; } + } public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo) { int? bxIndex = null; @@ -93,7 +115,7 @@ namespace Volian.Print.Library else // Change Box Style { bool handleSeparateBox = true; - if (childItemInfo.IsCaution && !childItemInfo.FormatStepData.SeparateBoxCautions) handleSeparateBox = false; + if (childItemInfo.IsCaution && !childItemInfo.FormatStepData.SeparateBox && !childItemInfo.FormatStepData.SeparateBoxCautions) handleSeparateBox = false; if (childItemInfo.IsNote && !childItemInfo.FormatStepData.SeparateBox) handleSeparateBox = false; if (bxIndx != null && (handleSeparateBox || bxIndex != bxIndx)) @@ -109,38 +131,52 @@ namespace Volian.Print.Library box = new vlnBox(); box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; int ln = 1; // a format flag determines whether there is a space before the note/caution. - if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; + //if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; if (childItemInfo.MixCautionNotesDiffType()) ln += 2; box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); + if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; yoff += ln * vlnPrintObject.SixLinesPerInch; } } bxIndex = bxIndx; } - if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; - if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); - vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); - if (box != null && box.MyParent == null) + // Comanche peak Step Designator + if (childItemInfo.IsCaution2 && childItemInfo.SameRowAsParent) { - box.MyParent = para; - para.PartsContainer.Add(box); + // Save the Step Designator information + _StepDesignator = childItemInfo.DisplayText; + int typ = ((int)childItemInfo.MyContent.Type) % 10000; + _StepDesignatorColumn = formatInfo.PlantFormat.FormatData.StepDataList[typ].ColOverride; + E_Style es = (E_Style)childItemInfo.FormatStepData.Font.Style; + _StepDesignatorFont = new VE_Font(childItemInfo.FormatStepData.Font.Family, (int)childItemInfo.FormatStepData.Font.Size, es, (float)childItemInfo.FormatStepData.Font.CPI); } - Add(para); - // para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box. - if (childItemInfo.IsStep && childItemInfo.MyHLS !=null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost) - yoff = para.ChildrenBelow[0].YBottomMost; else - yoff = para.YBottomMost; - if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt) { - box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch); - box = null; // if doing boxed steps, only do single sibling at a time. - } - if (boxHLS) - { - box.YOffset = para.YTop - (2 * vlnPrintObject.SixLinesPerInch); - box.Height = para.YBottomMost - box.YOffset; // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); - box = null; + if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; + if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); + vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); + if (box != null && box.MyParent == null) + { + box.MyParent = para; + para.PartsContainer.Add(box); + } + Add(para); + // para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box. + if (childItemInfo.IsStep && childItemInfo.MyHLS != null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost) + yoff = para.ChildrenBelow[0].YBottomMost; + else + yoff = para.YBottomMost; + if (childItemInfo.FormatStepData != null && childItemInfo.FormatStepData.BoxIt) + { + box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch); + box = null; // if doing boxed steps, only do single sibling at a time. + } + if (boxHLS) + { + box.YOffset = para.YTop - (2 * vlnPrintObject.SixLinesPerInch); + box.Height = para.YBottomMost - box.YOffset; // para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); + box = null; + } } boxHLS = false; lastChild = childItemInfo; @@ -1303,12 +1339,14 @@ namespace Volian.Print.Library if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); float yoffLeft = yoff; + if (ChildrenAbove != null) + ChildrenAbove.StepDesignator = null; //reset StepDesignator if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote)) { if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); else - yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } if (itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote)) { @@ -1317,6 +1355,18 @@ namespace Volian.Print.Library else yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } + // Comanche Peak uses CAUTION2 type to enter a Step Designator, which is placed to the left of the step number. + // The Step Designator information is saved during the processing of the Cautions (ChildrenAbove) + // defined in the vlnParagraphs class (of which ChildrenAbove is defined) + if (ChildrenAbove.StepDesignator != null) + { + string pref = ChildrenAbove.StepDesignator; + float colOvrd = (float)(ChildrenAbove.StepDesignatorColumn??0); + float xPref = (colOvrd > 0)? colOvrd : mytab.XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI)); + PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, ChildrenAbove.StepDesignatorFont)); + ChildrenAbove.StepDesignator = null; + ChildrenAbove.StepDesignatorColumn = null; + } // if this is a hls with a box, adjust the starting y location for the hls. this is done here // in case this hls had a boxed caution and/or note before it. Also, this code is here rather @@ -1517,7 +1567,6 @@ namespace Volian.Print.Library VE_Font tmpFont = new VE_Font(_MyItemInfo.FormatStepData.Font.Family, (int)_MyItemInfo.FormatStepData.Font.Size, es, (float)_MyItemInfo.FormatStepData.Font.CPI); PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, tmpFont)); } - } // If checklists, the substeps are printed in a row, need to keep track of the 'longest' in // y direction (bottommost) across the row. @@ -2500,7 +2549,8 @@ namespace Volian.Print.Library if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate && (xwid = GetWidthFromTemplate(itemInfo, formatInfo)) > 0) widOvrd = xwid; else - widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; + widOvrd = itemInfo.FormatStepData == null ? null : (float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO); + //widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; if (itemInfo.IsRNOPart && itemInfo.MyParent.IsHigh && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt != null) { string[] splitRNOWidthAlt = itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt.Split(','); @@ -2578,10 +2628,10 @@ namespace Volian.Print.Library else if (itemInfo.IsCaution || itemInfo.IsNote) { float mycolT = (float)formatInfo.MyStepSectionLayoutData.ColT; - if(formatInfo.MyStepSectionLayoutData.Dev_Format) + if (formatInfo.MyStepSectionLayoutData.Dev_Format) Width = (float)formatInfo.MyStepSectionLayoutData.WidT + 1; else - Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT; + Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT; XOffset += mycolT; // adjust caution/note text position if (PartsLeft != null)// adjust tab position foreach(vlnPrintObject vpo in PartsLeft) diff --git a/PROMS/Volian.Print.Library/vlnPrintObject.cs b/PROMS/Volian.Print.Library/vlnPrintObject.cs index de13f367..5d0384d3 100644 --- a/PROMS/Volian.Print.Library/vlnPrintObject.cs +++ b/PROMS/Volian.Print.Library/vlnPrintObject.cs @@ -250,7 +250,7 @@ namespace Volian.Print.Library /// public static int ToInt(string value, int i) { - string s = value.Split(",".ToCharArray())[i]; + string s = (value.Contains(",")) ? value.Split(",".ToCharArray())[i] : value; return ToInt(s); } public static string GetRtf(string text, VE_Font vFont)