Fixed logic for Calvert Alarm Condition/Response steps

Commented-out debug output
Added logic to keep text from being very bold when it starts with a bullet
Changed continue logic so that "(Continue)" does not overlap with the step tab.
This commit is contained in:
Rich 2014-08-22 13:42:53 +00:00
parent ba4f16b7e1
commit 9393fc01d4
3 changed files with 55 additions and 12 deletions

View File

@ -445,12 +445,14 @@ namespace Volian.Print.Library
// while the amount to print is larger than one page, i.e. ((YSize - yTop) > ySpaceOnCurPage)) // 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) // OR there are page breaks for HLS/cautions/notes remaining, typically for backgrounds (PageBreakOnStepList.Count > 0)
vlnParagraph paraBreak = null; vlnParagraph paraBreak = null;
while (((YSize - yTop) > ySpaceOnCurPage) || PageBreakOnStepList.Count > 0) float accountForCalvertAlarmConditionResponseFooter = 0;
while (((YSize - yTop) > (ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter)) || PageBreakOnStepList.Count > 0)
{ {
float ySpaceOnCurPageSave = ySpaceOnCurPage; float ySpaceOnCurPageSave = ySpaceOnCurPage;
ySpaceOnCurPage -= myBottomMsgSpace; ySpaceOnCurPage -= myBottomMsgSpace;
vlnParagraph lastBreak = paraBreak; 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); myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
//Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release //Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
if (paraBreak == null) if (paraBreak == null)
@ -469,11 +471,15 @@ namespace Volian.Print.Library
paraBreak = paraBreak.MyParent.ChildrenAbove[0]; 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. // 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, paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - vlnPrintObject.SixLinesPerInch * 4, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); 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) if (lastBreak == paraBreak)
{ {

View File

@ -117,7 +117,7 @@ namespace Volian.Print.Library
if (PdfDebug) if (PdfDebug)
{ {
int next = NextTextAtCounter; 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 ?? ""); string dbt = string.Format("[{0}]{1}", next, debugText ?? "");
DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, dbt, yDescent); DrawPdfDebug(cb, left, top, left + width, myColumnText.YLine, dbt, yDescent);
} }

View File

@ -743,6 +743,16 @@ namespace Volian.Print.Library
// was calculated when the paragraph was made. // was calculated when the paragraph was made.
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.StepPrintData.Justify == "Center" && !MyItemInfo.FormatStepData.StepLayoutData.AlignWithParentTab) if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.StepPrintData.Justify == "Center" && !MyItemInfo.FormatStepData.StepLayoutData.AlignWithParentTab)
IParagraph.Alignment = Element.ALIGN_CENTER; 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); 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 if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed. { // 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: // 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)); float xoff1 = xoffMsg;
MyPageHelper.TopMessageSub1s.Add(new vlnText(cb, this, myMsg, myMsg, xoffMsg, ybot, docstyle.Continue.Bottom.Font)); 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: // 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, concataerTab, concataerTab, useAerParaForTab.MyTab.XOffset, ybot, docstyle.Continue.Bottom.Font));
@ -1770,6 +1792,12 @@ namespace Volian.Print.Library
if (id == listid) return true; if (id == listid) return true;
return false; 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) 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: // do some 'setup' for Calvert Alarms:
@ -2275,7 +2303,16 @@ namespace Volian.Print.Library
//if (itemInfo.IsSection) //if (itemInfo.IsSection)
// Rtf = GetRtf(itemInfo, prefix, " (Continued)"); // Rtf = GetRtf(itemInfo, prefix, " (Continued)");
//else //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: // Need the following with some modifications for WCNCKL format:
if (Rtf.Contains("{Backspace}")) if (Rtf.Contains("{Backspace}"))
{ {
@ -2892,12 +2929,12 @@ namespace Volian.Print.Library
if (everyNLines == -99) return 0; if (everyNLines == -99) return 0;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) 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 (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.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.MyParent.GetNextItem() != null && MyItemInfo.MyParent.GetNextItem().MyContent.Type == MyItemInfo.MyContent.Type) return 0;
} }
} }
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.GetNextItem() == null) return SixLinesPerInch; 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. // Pagination issue to be used with yEndsWithBlankLine in Pagination code, but not checked in yet.