From 77e02fd438bddf321387c6648b87ef6b60869468 Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 20 Aug 2014 13:49:22 +0000 Subject: [PATCH] Calvert Alarms: CONDITION/RESPONSE top continue messages improvements. --- .../Volian.Print.Library/VlnSvgPageHelper.cs | 38 +++++++----- PROMS/Volian.Print.Library/vlnParagraph.cs | 61 ++++++++++++++++--- 2 files changed, 75 insertions(+), 24 deletions(-) diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 0addb478..67cd155f 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -49,17 +49,17 @@ namespace Volian.Print.Library get { return _TopMessageRs; } set { _TopMessageRs = value; } } - private vlnText _TopMessageSub1; // BGE Alarms: in CONDITION/RESPONSE if break within substep - public vlnText TopMessageSub1 + private List _TopMessageSub1s=new List(); // BGE Alarms: in CONDITION/RESPONSE if break within substep + public List TopMessageSub1s { - get { return _TopMessageSub1; } - set { _TopMessageSub1 = value; } + get { return _TopMessageSub1s; } + set { _TopMessageSub1s = value; } } - private vlnText _TopMessageSub2; // BGE Alarms: in CONDITION/RESPONSE if break within substep - public vlnText TopMessageSub2 + private List _TopMessageSub2s=new List(); // BGE Alarms: in CONDITION/RESPONSE if break within substep + public List TopMessageSub2s { - get { return _TopMessageSub2; } - set { _TopMessageSub2 = value; } + get { return _TopMessageSub2s; } + set { _TopMessageSub2s = value; } } private vlnText _BottomMessage; public vlnText BottomMessage @@ -565,17 +565,23 @@ namespace Volian.Print.Library } TopMessageRs = null; // Only output it once. } - if (TopMessageSub1 != null) + if (TopMessageSub1s != null) { - TopMessageSub1.YOffset = AlarmYoffStart - 3 * vlnPrintObject.SixLinesPerInch; - TopMessageSub1.ToPdf(cb, 0, ref tmp, ref tmp); - TopMessageSub1 = null; // Only output it once. + foreach (vlnText vts1 in TopMessageSub1s) + { + vts1.YOffset = AlarmYoffStart - 3 * vlnPrintObject.SixLinesPerInch; + vts1.ToPdf(cb, 0, ref tmp, ref tmp); + } + TopMessageSub1s = null; // Only output it once. } - if (TopMessageSub2 != null) + if (TopMessageSub2s != null) { - TopMessageSub2.YOffset = AlarmYoffStart - 3 * vlnPrintObject.SixLinesPerInch; - TopMessageSub2.ToPdf(cb, 0, ref tmp, ref tmp); - TopMessageSub2 = null; // Only output it once. + foreach (vlnText vts2 in TopMessageSub2s) + { + vts2.YOffset = AlarmYoffStart - 3 * vlnPrintObject.SixLinesPerInch; + vts2.ToPdf(cb, 0, ref tmp, ref tmp); + } + TopMessageSub2s = null; // Only output it once. } if (BottomMessage != null) { diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 7952f9f2..ff5eabe4 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -1311,6 +1311,9 @@ namespace Volian.Print.Library // NOTE THAT this code is not complete - the positioning & addition of step tab for within table are not working correctly if ((docstyle.Continue.Top.HLS ?? 0) == 3) { + MyPageHelper.TopMessageSub1s = new List(); + MyPageHelper.TopMessageSub2s = new List(); + //string HLSTabTextForContMsg = MyHighLevelParagraph.MyItemInfo.MyTab.CleanText + " " + MyHighLevelParagraph.MyItemInfo.MyContent.Text; //int len = (HLSTabTextForContMsg.Length - 10) * 6; string tabText = @"\ul\b " + MyHighLevelParagraph.MyItemInfo.MyTab.CleanText.Trim() + @"\b0\ulnone"; @@ -1322,17 +1325,59 @@ namespace Volian.Print.Library vlnText vt2 = new vlnText(cb, this, stepText, stepText, MyHighLevelParagraph.XOffset, yTopMargin + 0.1F, docstyle.Continue.Top.Font); vt2.Width = MyHighLevelParagraph.Width; MyPageHelper.TopMessageRs.Add(vt2); - if (subTab != null && MyItemInfo.StepLevel > 2) - { + + // the following code is used to print the top continue messages in the Calvert Alarm format + // CONDITION/RESPONSE table. Messages only get printed if the break is on a substep at steplevel > 2. + // see comments within code for what the tab contains, it varies depending on which side + // break occurred & how deep in the step the break occurred. + if (subTab != null && MyItemInfo.StepLevel > 2) { + bool incond = !MyItemInfo.IsInRNO; float ybot = yTopMargin + (4 * SixLinesPerInch); - float xoffB = 0; - if (MyParent.MyTab != null) + string concatrnoTab = ""; // constructed tab for Response side + string concataerTab = ""; // constructed tab for Condition side + float xoffTab = 0; // position for Response tab + float xoffMsg = 0; // position for Response message + vlnParagraph useAerParaForTab = null; // use this paragraph under Conditions for locating tab & message + if (incond) { - xoffB = MyParent.MyTab.XOffset; - MyPageHelper.TopMessageSub1 = new vlnText(cb, this, MyParent.MyTab.Text, MyParent.MyTab.Text, xoffB, ybot, docstyle.Continue.Bottom.Font); + // If break is in Condition side of table, use Condition tab of parent & no tab for Response side. + // Both sides have the message '(continued)'. + useAerParaForTab = MyParent; + concataerTab = MyParent.MyTab != null ? MyParent.MyTab.Text.TrimEnd() : ""; + xoffTab = 0; // no rno tab + xoffMsg = ToInt(MyItemInfo.ActiveFormat.MyStepSectionLayoutData.ColRTable, 1) + (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ((useAerParaForTab != null && useAerParaForTab.MyTab!=null) ? useAerParaForTab.MyTab.Width : 7.2f); } - xoffB = MyParent.XOffset; - MyPageHelper.TopMessageSub2 = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); + else + { + // break occurred in Response side. Use the tabs up to highest RNO concatenated together. + vlnParagraph useRnoParaForTab = MyParent; + vlnParagraph useParaForTab = MyParent; + while (useParaForTab.MyItemInfo.IsInRNO) + { + concatrnoTab = (useParaForTab.MyTab != null ? useParaForTab.MyTab.Text.TrimEnd() : "") + concatrnoTab.Trim(); + useRnoParaForTab = useParaForTab; + useParaForTab = useParaForTab.MyParent; + } + xoffTab = useRnoParaForTab.MyTab.XOffset; + xoffMsg = useRnoParaForTab.XOffset; + + // aer message when rno broke. Need to concatenate up the Condition side also until + // hitting 1st non-sequential, i.e. moves out of Condition/Response table. + useAerParaForTab = useParaForTab; // useParaForTab is 1st found non-Response step, i.e. moved into Condition side of table + while (useParaForTab.MyItemInfo.IsSequential) + { + concataerTab = (useParaForTab.MyTab != null ? useParaForTab.MyTab.Text.TrimEnd() : "") + concataerTab.Trim(); + useAerParaForTab = useParaForTab; + useParaForTab = useParaForTab.MyParent; + } + } + // For RNO tab, add a vlntext for tab and one for continue message: + if (!incond) MyPageHelper.TopMessageSub1s.Add(new vlnText(cb, this, concatrnoTab, concatrnoTab, xoffTab, ybot, docstyle.Continue.Bottom.Font)); + MyPageHelper.TopMessageSub1s.Add(new vlnText(cb, this, myMsg, myMsg, xoffMsg, ybot, docstyle.Continue.Bottom.Font)); + + // for aer tab, add a vlntext for tab and one for continue message: + MyPageHelper.TopMessageSub2s.Add(new vlnText(cb, this, concataerTab, concataerTab, useAerParaForTab.MyTab.XOffset, ybot, docstyle.Continue.Bottom.Font)); + MyPageHelper.TopMessageSub2s.Add(new vlnText(cb, this, myMsg, myMsg, useAerParaForTab.XOffset, ybot, docstyle.Continue.Bottom.Font)); addExtraLine = true; } }