diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 56c340a6..945bca05 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -445,12 +445,14 @@ namespace Volian.Print.Library // while the amount to print is larger than one page, i.e. ((YSize - yTop) > ySpaceOnCurPage)) // OR there are page breaks for HLS/cautions/notes remaining, typically for backgrounds (PageBreakOnStepList.Count > 0) vlnParagraph paraBreak = null; - while (((YSize - yTop) > ySpaceOnCurPage) || PageBreakOnStepList.Count > 0) + float accountForCalvertAlarmConditionResponseFooter = 0; + while (((YSize - yTop) > (ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter)) || PageBreakOnStepList.Count > 0) { float ySpaceOnCurPageSave = ySpaceOnCurPage; ySpaceOnCurPage -= myBottomMsgSpace; vlnParagraph lastBreak = paraBreak; - paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, + paraBreak = FindPageBreak(yStart, ySpaceOnCurPage-accountForCalvertAlarmConditionResponseFooter, yLowerLimit, + myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); //Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release if (paraBreak == null) @@ -469,11 +471,15 @@ namespace Volian.Print.Library paraBreak = paraBreak.MyParent.ChildrenAbove[0]; } // If the lastbreak was part of a condition response and the location is part of a condition response account for the size of the footer. - else if (lastBreak != null && lastBreak.ParentHasCalvertMacro && paraBreak.ParentHasCalvertMacro) + else if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro && accountForCalvertAlarmConditionResponseFooter == 0) { paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - vlnPrintObject.SixLinesPerInch * 4, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); } + if (!paraBreak.MyItemInfo.IsCautionPart && !paraBreak.MyItemInfo.IsNotePart && paraBreak.ParentHasCalvertMacro) + accountForCalvertAlarmConditionResponseFooter = 5 * SixLinesPerInch; + else + accountForCalvertAlarmConditionResponseFooter = 0; } if (lastBreak == paraBreak) { diff --git a/PROMS/Volian.Print.Library/Rtf2Pdf.cs b/PROMS/Volian.Print.Library/Rtf2Pdf.cs index d267b2a3..490d3262 100644 --- a/PROMS/Volian.Print.Library/Rtf2Pdf.cs +++ b/PROMS/Volian.Print.Library/Rtf2Pdf.cs @@ -117,7 +117,7 @@ namespace Volian.Print.Library if (PdfDebug) { int next = NextTextAtCounter; - if (InList(next,258,259)) Console.WriteLine("here"); + //if (InList(next,2331,2332)) Console.WriteLine("here"); string dbt = string.Format("[{0}]{1}", next, debugText ?? ""); DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, dbt, yDescent); } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index e63af836..c5e2a3b8 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -743,6 +743,16 @@ namespace Volian.Print.Library // was calculated when the paragraph was made. if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.StepPrintData.Justify == "Center" && !MyItemInfo.FormatStepData.StepLayoutData.AlignWithParentTab) IParagraph.Alignment = Element.ALIGN_CENTER; + if (PrefixSpecialCharacter && IParagraph.Chunks.Count > 0) + { + Chunk chk = IParagraph.Chunks[0] as Chunk; + if (chk.Content == " ") + { + PrefixSpecialCharacter = false; + //Console.WriteLine("Special {0}", MyItemInfo.MyHLS.DisplayText); + IParagraph.Chunks.RemoveAt(0); + } + } retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin); if (retval == 0) // problem occurred - paragraph was not able to be printed on page { // pagination logic needs to be fixed. @@ -1372,8 +1382,20 @@ namespace Volian.Print.Library } } // 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)); + float xoff1 = xoffMsg; + if (!incond) + { + vlnText vtc = new vlnText(cb, this, concatrnoTab, concatrnoTab, xoffTab, ybot, docstyle.Continue.Bottom.Font); + MyPageHelper.TopMessageSub1s.Add(vtc); + Chunk chk = (vtc.IParagraph.Chunks[0]) as Chunk; + if (chk != null) + { + float xoff2 = xoffTab + chk.GetWidthPoint() + 6; + // If the "(continue)" is going to overlap the tab, then move the "Continue)" so that it doesn't overlap. + if (xoff2 > xoff1) xoff1 = xoff2; + } + } + MyPageHelper.TopMessageSub1s.Add(new vlnText(cb, this, myMsg, myMsg, xoff1, 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)); @@ -1770,6 +1792,12 @@ namespace Volian.Print.Library if (id == listid) return true; return false; } + private bool _PrefixSpecialCharacter = false; + public bool PrefixSpecialCharacter + { + get { return _PrefixSpecialCharacter; } + set { _PrefixSpecialCharacter = 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) { // do some 'setup' for Calvert Alarms: @@ -2275,7 +2303,16 @@ namespace Volian.Print.Library //if (itemInfo.IsSection) // Rtf = GetRtf(itemInfo, prefix, " (Continued)"); //else - Rtf = GetRtf(itemInfo, prefix, suffix); + 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}")) { @@ -2892,12 +2929,12 @@ 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.FormatStepData.SpaceIn && MyItemInfo.GetNextItem() == null) 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; - if (MyItemInfo.MyParent.GetNextItem() != null && MyItemInfo.MyParent.GetNextItem().MyContent.Type == MyItemInfo.MyContent.Type) return 0; - } + { + if (MyItemInfo.Steps != null && MyItemInfo.Steps.Count > 0 && MyItemInfo.Steps[0].MyContent.Type == MyItemInfo.MyContent.Type) return 0; + if (MyItemInfo.MyParent.GetNextItem() != null && MyItemInfo.MyParent.GetNextItem().MyContent.Type == MyItemInfo.MyContent.Type) return 0; + } } if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.GetNextItem() == null) return SixLinesPerInch; // Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.