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))
// 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)
{

View File

@ -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);
}

View File

@ -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
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}"))
{