WCNTRN :Implement printing of items for Wolf Creek Training format

This commit is contained in:
Kathy Ruffing 2015-06-04 14:54:55 +00:00
parent c0dc3f174b
commit ea525e2b0b

View File

@ -1414,7 +1414,7 @@ namespace Volian.Print.Library
}
yPageStart = yTopMargin + YTopMost;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
// KBR for WCNTRN work: SectionTopMessage(cb, yTopMargin, yLocation);
SectionTopMessage(cb, yTopMargin, yLocation);
if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
// If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection))
@ -1553,7 +1553,7 @@ namespace Volian.Print.Library
doSectionTitleContinued = (sch == null || sch.Section_PrintHdr == "Y") && !MyItemInfo.MyDocStyle.CancelSectTitle;
}
}
// KBR for WCNTRN work:SectionTopMessage(cb, yTopMargin, yLocation);
SectionTopMessage(cb, yTopMargin, yLocation);
if (!doSectionTitleContinued || !SectionShowTitles)
addExtraLines = DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, doThreeContinues && MyItemInfo.MyParent != null && MyItemInfo.MyParent.MyTab != null ? MyItemInfo.MyParent.MyTab.CleanText : null);
@ -1851,29 +1851,30 @@ namespace Volian.Print.Library
ProfileTimer.Pop(profileDepth);
return yPageStart;
}
// KBR: WCNTRN work
//private void SectionTopMessage(PdfContentByte cb, float yTopMargin, float yLocation)
//{
// if (MyItemInfo.MyDocStyle.SectTop != null && MyItemInfo.MyDocStyle.SectTop.Message != null)
// {
// float sectMsgY = CalculateYLocation(YTop, yTopMargin);
// if (MyPageHelper.YMultiplier != 1)
// {
// sectMsgY = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier;
// }
// VE_Font sctMsgFont = MyItemInfo.MyDocStyle.SectTop.Font;
// string scttop = null;
// if (!MyItemInfo.IsStepSection && MyItemInfo.MyDocStyle.SectTop.Message != null)
// scttop = MyItemInfo.MyDocStyle.SectTop.Message.Replace("%s", (MyItemInfo.ActiveSection as SectionInfo).DisplayNumber);
// else
// scttop = (MyItemInfo as SectionInfo).DisplayNumber;
// float scttopWidth = scttop.Length * 6;
// float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin;
// float sctcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (scttopWidth / 2);
// vlnText mySectMsg = new vlnText(cb, this, scttop, scttop, sctcntrX, sectMsgY, sctMsgFont);
// PartsLeft.Add(mySectMsg);
// }
//}
// For WCNTRN (Wolf Creek Training format): the following prints the section number (and continued, if
// section is continued from previous page) in the Responsibility column.
private void SectionTopMessage(PdfContentByte cb, float yTopMargin, float yLocation)
{
if (MyItemInfo.MyDocStyle.SectTop != null && MyItemInfo.MyDocStyle.SectTop.Message != null)
{
float sectMsgY = CalculateYLocation(YTop, yTopMargin);
if (MyPageHelper.YMultiplier != 1)
{
sectMsgY = -1 + yTopMargin - (yTopMargin - yLocation) * MyPageHelper.YMultiplier;
}
VE_Font sctMsgFont = MyItemInfo.MyDocStyle.SectTop.Font;
string scttop = null;
if (!MyItemInfo.IsStepSection && MyItemInfo.MyDocStyle.SectTop.Message != null)
scttop = MyItemInfo.MyDocStyle.SectTop.Message.Replace("%s", (MyItemInfo.ActiveSection as SectionInfo).DisplayNumber);
else
scttop = (MyItemInfo as SectionInfo).DisplayNumber;
float scttopWidth = scttop.Length * 6;
float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin;
float sctcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (scttopWidth / 2);
vlnText mySectMsg = new vlnText(cb, this, scttop, scttop, sctcntrX, sectMsgY, sctMsgFont);
PartsLeft.Add(mySectMsg);
}
}
// Added to try to resolve a problem when printing FNP-1-FRP-I.3 Attachment 3 Table 1.
// May be needed to evaluate this problem in the future.
//private void CompareSectionInfo(SectionInfo si, SectionInfo si1)
@ -3359,6 +3360,8 @@ namespace Volian.Print.Library
}
}
}
// for WCNTRN, do the responsibility:
if (formatInfo.PlantFormat.FormatData.PrintData.WCNTraining) DoResponsibility(cb, YOffset);
float yOffRight = yoff;
float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
if (DoSubs && rnoLevel < maxRNO && itemInfo.RNOs != null)
@ -3518,6 +3521,17 @@ namespace Volian.Print.Library
}
yoff += (myRnoSep.Height + SixLinesPerInch);
}
// if in WCNTRN (Wolf Creek Training), need to consider the ysize of the Responsibility text when setting
// YBottomMost, i.e. if the Responsibilty has more height (y-direction) compared to the actual step text,
// need to move down on page the height of the responsibility.
if (formatInfo.PlantFormat.FormatData.PrintData.WCNTraining && MyItemInfo.IsHigh)
{
if (PartsLeft.Count > 0 && PartsLeft[0] is vlnText)
{
foreach (vlnText vt in PartsLeft)
yoff = Math.Max(yoff, vt.YOffset + vt.Height);
}
}
YBottomMost = yoff;
if ((MyItemInfo.IsHigh || MyItemInfo.IsCaution1) && MyItemInfo.MyDocStyle.LandscapePageList && MyItemInfo.MyDocStyle.ComponentList)
@ -3533,6 +3547,34 @@ namespace Volian.Print.Library
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
ProfileTimer.Pop(profileDepth);
}
private void DoResponsibility(PdfContentByte cb, float yoff) // WCNTRN's text in 1st column (saved in config for HLS)
{
StepConfig sc2 = MyItemInfo.MyConfig as StepConfig;
if (sc2 != null)
{
string resp = sc2.Step_Responsibility;
if (resp != null && resp != "") // lines are separated by "\r\n"
{
resp = resp.TrimEnd();
if (!resp.EndsWith("\r\n")) resp = resp + "\r\n"; // parsing needs this.
int indx = resp.IndexOf("\r\n");
int stindx = 0;
float y = yoff;
while (indx > -1)
{
string subresp = resp.Substring(stindx, indx - stindx);
float respWidth = subresp.Length * 6;
float ctr = (float)MyItemInfo.MyDocStyle.SectTop.Margin;
float respcntrX = (float)MyItemInfo.MyDocStyle.Layout.LeftMargin + ctr - (respWidth / 2);
vlnText myResp = new vlnText(cb, this, subresp, subresp, respcntrX, y, MyItemInfo.FormatStepData.Font);
PartsLeft.Add(myResp);
y += SixLinesPerInch;
stindx = indx + 2;
indx = stindx < resp.Length ? resp.IndexOf("\r\n", stindx) : -1;
}
}
}
}
public override string Rtf
{
get