diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index d42156fb..d1aa5330 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -1169,6 +1169,13 @@ namespace VEPROMS.CSLA.Library StepData sd = sdlist[stepType]; return (sd.Type == type); } + public bool IsCautionOrNotePart + { + get + { + return (IsCautionPart || IsNotePart); + } + } public bool IsCaution { get @@ -3270,6 +3277,9 @@ namespace VEPROMS.CSLA.Library prevTbFormat = MyPrevious.IsInRNO ? prevStepData.TabData.RNOIdentPrint : prevStepData.TabData.IdentPrint; prevTbFormat = ReplaceStepToken(prevTbFormat); } + + // for calvert alarms, need to check if next item is a different type, if a different type. + // If it is the same type, clear the header so that the header text isn't printed two times. bool specialCalvertAlarm = false; if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) { @@ -3292,7 +3302,7 @@ namespace VEPROMS.CSLA.Library // use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab // with a bullet. Also, if only one in group and tab text ends with 'S', remove it: bool mixCandN = MixCautionNotesDiffType(); - if ((MyPrevious == null && NextItem == null) || mixCandN || FormatStepData.SeparateBox) + if ((MyPrevious == null && (NextItem == null||specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox) { if (_MyHeader.CleanText.ToUpper().EndsWith("S")) { diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index c8dba4e3..9eecfa21 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -196,7 +196,12 @@ namespace Volian.Print.Library int ln = 1; // a format flag determines whether there is a space before the note/caution. if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; if (!boxHLS || (boxHLS && !childItemInfo.HasCautionOrNote)) - yoff += ln * vlnPrintObject.SixLinesPerInch; + { + if (!formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + yoff += ln * vlnPrintObject.SixLinesPerInch; + else + yoff += vlnPrintObject.SixLinesPerInch; + } } bxIndex = bxIndx; } @@ -211,7 +216,14 @@ namespace Volian.Print.Library if (box != null) { box.Height = yoff - box.YOffset; // new height, with children - if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null + if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null + && ((childItemInfo.MyPrevious.IsCautionOrNotePart && childItemInfo.IsCautionOrNotePart) + || childItemInfo.FormatStepData.SeparateBox)) + yoff += vlnPrintObject.SixLinesPerInch * 2; + } + else if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null && ((childItemInfo.MyPrevious.IsCaution && childItemInfo.IsCaution) || (childItemInfo.MyPrevious.IsNote && childItemInfo.IsNote) || childItemInfo.FormatStepData.SeparateBox)) yoff += vlnPrintObject.SixLinesPerInch * 2; @@ -735,10 +747,11 @@ namespace Volian.Print.Library // Calvert Alarms have a special case, center text if the next/previous is not the same type of caution or note. // Calvert Alarms have a note1 that is a warning. if a regular note preceeded it, this regular note was not centered. bool doAlign = false; - if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) { - if ((MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type)|| - (MyItemInfo.GetNextItem() != null && MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type)) doAlign = true; + bool diffAsPrev = MyItemInfo.MyPrevious == null || (MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type); + bool diffAsNext = MyItemInfo.GetNextItem() == null || (MyItemInfo.GetNextItem() != null && MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type); + if (diffAsPrev && diffAsNext) doAlign = true; } // Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2 // multiplier accounts for both. @@ -2942,7 +2955,9 @@ namespace Volian.Print.Library if (everyNLines == -99) return 0; if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) { - if ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && !MyItemInfo.FormatStepData.SpaceIn && MyItemInfo.GetNextItem() == null) return 0; + if ((MyItemInfo.IsCaution || MyItemInfo.IsNote || MyItemInfo.MyParent.IsCaution || MyItemInfo.MyParent.IsNote) && !MyItemInfo.FormatStepData.SpaceIn + && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0) + && (MyItemInfo.GetNextItem() == null || MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type)) return 0; if (everyNLines == 99 && MyItemInfo.GetNextItem() == null) { if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0;