Additional code to support special cases in Template for Calvert Alarms including a TemplateColumnMode and mix of Cautions/Notes

Added Support for BGE Alarms, bottom continue message location.
Additional code to support special cases in Template for Calvert Alarms and new flag SpecialCaseCalvertAlarm
Support for Docstyle DSS_PageBreakHLS for page break on HLS
Changes for Calvert Alarms use of template to define top portion of alarm pages and CONDITION/RESPONSE table support.
Handle 3 top/bottom continue messages for Calvert Alarms; support box around CONDITION/RESPONSE table in Calvert Alarms; {REVUNIT} fix;
if TabPtsPerChar format is 0, set to a default of 6
This commit is contained in:
Kathy Ruffing 2014-08-01 11:56:02 +00:00
parent b24dfe988d
commit 9b67771f55
7 changed files with 762 additions and 281 deletions

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,8 @@ namespace VEPROMS.CSLA.Library
BtwnTextAndBottom = 1,
BottomOfPage = 2,
BelowBottom1 = 3,
// BottomWithFooter added for BGE for Alarms. This puts continue message on bottom AND if in CONDITION/RESPONSE table, at bottom of both columns.
BottomWithFooter = 4,
EndOfText2 = 5,
BtwnTextAndBottom2 = 6 // Added for BGE, their continue message was a line or so too far down page.1
};

View File

@ -232,11 +232,14 @@ namespace VEPROMS.CSLA.Library
// count newlines - which gives number of template records.
int NumTemplates = 0;
if (TPL == null) return null;
int indx = TPL.IndexOf('\n');
// if the template is modified by the plant specific code in the format migration,
// it will contain an '&' rather than '&'.
string tTPL = TPL.Replace("&", "&");
int indx = tTPL.IndexOf('\n');
while (indx > -1)
{
NumTemplates++;
indx = TPL.Length > indx + 1 ? TPL.IndexOf('\n', indx + 1) : -1;
indx = tTPL.Length > indx + 1 ? tTPL.IndexOf('\n', indx + 1) : -1;
}
if (NumTemplates == 0) return null;
@ -261,7 +264,7 @@ namespace VEPROMS.CSLA.Library
int type = 0;
int start = 0;
int width = 0;
int nocol = 0;
short nocol = 0;
int row = 0;
string stmp = null;
if (!NewTemplateFormat)
@ -284,7 +287,7 @@ namespace VEPROMS.CSLA.Library
start = Convert.ToInt32(tmpNew[2]);
width = Convert.ToInt32(tmpNew[3]);
row = Convert.ToInt32(tmpNew[4]);
nocol = Convert.ToInt32(tmpNew[5]);
nocol = Convert.ToInt16(tmpNew[5]);
stmp = tmpNew.Length <= 6 ? null : tmpNew[6];
}
TPlate tp = new TPlate(level, type, start, width, row, nocol, stmp);
@ -558,6 +561,12 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region Templates
// the nocolm field -- divided into 4 four-bit subfields;
// starting with the 4 lowest order bits :
// field 1 - number of columns
// field 2 - the header macro to print instead of the text(fixed at 4 for now)
// field 3 - the number of blank lines after the header macro
// field 4 - 1 - identifies the template as being boxed, for latter retrieval
public class TPlate
{
public int level; // sub-step level
@ -565,9 +574,11 @@ namespace VEPROMS.CSLA.Library
public int start; // starting position (for horizontal only)
public int width; // width of text in characters (")
public int row;
public int nocolm; // 1 or 2 columns - default(0) is one column
public short nocolm; // 1 or 2 columns - default(0) is one column
public string text; // text to be automatically entered
public TPlate(int l, int t, int s, int w, int r, int c, string x)
public bool boxed;
public int hmacro = 0;
public TPlate(int l, int t, int s, int w, int r, short c, string x)
{
level = l;
type = t;
@ -575,6 +586,11 @@ namespace VEPROMS.CSLA.Library
width = w;
row = r;
nocolm = c;
hmacro = 0x00F0 & nocolm >> 4;
if (hmacro > 0) hmacro = 4; // bge - this was in 16bit code
int blines = (0x0F00 & nocolm) >> 8;
boxed = ((0xF000 & nocolm) >> 12) != 0;
nocolm = (short)(0x000F & nocolm);
text = x;
}
}
@ -705,6 +721,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _SpecialCaseCalvert, "@SpecialCaseCalvert");
}
}
private LazyLoad<bool> _SpecialCaseCalvertAlarm;
public bool SpecialCaseCalvertAlarm
{
get
{
return LazyLoad(ref _SpecialCaseCalvertAlarm, "@SpecialCaseCalvertAlarm");
}
}
private LazyLoad<bool> _SpecialStepsFoldout;
public bool SpecialStepsFoldout
{

View File

@ -156,7 +156,13 @@ namespace Volian.Print.Library
return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page
}
if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level
// Document style: DSS_PageBreakHLS breaks on hls.
if (MyItemInfo.IsHigh && (MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageBreakHLS) == E_DocStructStyle.DSS_PageBreakHLS)
{
BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage);
ShowPageBreak(1, "Page Break on DSS_PageBreakHLS", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 1;
}
// if this is a step, see if it has the 'PageBreakOnStep' format flag set to true, if so, break here.
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep)
{
@ -166,7 +172,7 @@ namespace Volian.Print.Library
ShowPageBreak(1, "Page Break on Steps, Cautions or Notes", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
return 1;
}
//MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text
//Console.WriteLine("{0} Paginate", MyPageHelper.HLSText);
StepConfig sc1 = MyItemInfo.MyConfig as StepConfig;

View File

@ -49,6 +49,18 @@ namespace Volian.Print.Library
get { return _TopMessageR; }
set { _TopMessageR = value; }
}
private vlnText _TopMessageSub1; // BGE Alarms: in CONDITION/RESPONSE if break within substep
public vlnText TopMessageSub1
{
get { return _TopMessageSub1; }
set { _TopMessageSub1 = value; }
}
private vlnText _TopMessageSub2; // BGE Alarms: in CONDITION/RESPONSE if break within substep
public vlnText TopMessageSub2
{
get { return _TopMessageSub2; }
set { _TopMessageSub2 = value; }
}
private vlnText _BottomMessage;
public vlnText BottomMessage
{
@ -61,6 +73,12 @@ namespace Volian.Print.Library
get { return _BottomMessageR; }
set { _BottomMessageR = value; }
}
private vlnText _BottomMessageA; // Added if there are 3 messages, at bottom AND in AER AND RNO (for BGEALARMS)
public vlnText BottomMessageA
{
get { return _BottomMessageA; }
set { _BottomMessageA = value; }
}
Dictionary<int, vlnParagraph> _MyParagraphs = new Dictionary<int, vlnParagraph>();
public Dictionary<int, vlnParagraph> MyParagraphs
{
@ -79,6 +97,18 @@ namespace Volian.Print.Library
get { return _PhoneListHeight; }
set { _PhoneListHeight = value; }
}
private float _AlarmYoffStart = 0;
public float AlarmYoffStart
{
get { return _AlarmYoffStart; }
set { _AlarmYoffStart = value; }
}
private float _AlarmYoffEnd = 0;
public float AlarmYoffEnd
{
get { return _AlarmYoffEnd; }
set { _AlarmYoffEnd = value; }
}
private PdfWriter _MyPdfWriter;
public PdfWriter MyPdfWriter
{
@ -203,12 +233,53 @@ namespace Volian.Print.Library
if (MySection.ColumnMode > 0)
DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0);
}
if (MySection.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
float left = (float)MySection.MyDocStyle.Layout.LeftMargin + 4.5f; // used 4.5 to make bge alarm lines closest to lining up with macro
float right = (float)MySection.MyDocStyle.Layout.PageWidth;
if (AlarmYoffStart > 0)
{
// draw vertical - either to the alarmyoffend or bottom of page
if (AlarmYoffEnd > 0) // ends on this page.
{
DrawVertical(writer.DirectContent, left, AlarmYoffStart, AlarmYoffEnd);
DrawVertical(writer.DirectContent, right, AlarmYoffStart, AlarmYoffEnd);
DrawVertical(writer.DirectContent, (right + left) / 2, AlarmYoffStart, AlarmYoffEnd);
DrawHorizontal(writer.DirectContent, left, right, AlarmYoffEnd);
AlarmYoffStart = 0;
AlarmYoffEnd = 0;
}
else
{
float yBottom = (float)(writer.DirectContent.PdfWriter.PageSize.Height - ((float)MySection.MyDocStyle.Layout.TopMargin + (float)MySection.MyDocStyle.Layout.PageLength));
DrawVertical(writer.DirectContent, left, AlarmYoffStart, yBottom);
DrawVertical(writer.DirectContent, right, AlarmYoffStart, yBottom);
DrawVertical(writer.DirectContent, (right + left) / 2, AlarmYoffStart, yBottom);
DrawHorizontal(writer.DirectContent, left, right, yBottom);
AlarmYoffStart = (float)writer.DirectContent.PdfWriter.PageSize.Height - (float)MySection.MyDocStyle.Layout.TopMargin;
}
}
}
PageListTopCheckOffHeader = null;
PageListLastCheckOffHeader = null;
YMultiplier = 1;
PrintedAPage = true;
}
private void DrawVertical(PdfContentByte cb, float x, float top, float bottom)
{
cb.SaveState();
if (PageListLayer != null) cb.BeginLayer(PageListLayer);
cb.SetColorStroke(new Color(PrintOverride.SvgColor));
//cb.SetColorStroke(lineColor);
cb.MoveTo(x, top);
cb.LineTo(x, bottom);
cb.Stroke();
if (PageListLayer != null) cb.EndLayer();
cb.RestoreState();
}
private void DrawPhoneList(PdfContentByte pdfContentByte, float leftMargin, float pageWidth, float yOff, string plist)
{
// draw the line above the phone list:
@ -490,6 +561,16 @@ namespace Volian.Print.Library
TopMessageR.ToPdf(cb, 0, ref tmp, ref tmp);
TopMessageR = null; // Only output it once.
}
if (TopMessageSub1 != null)
{
TopMessageSub1.ToPdf(cb, 0, ref tmp, ref tmp);
TopMessageSub1 = null; // Only output it once.
}
if (TopMessageSub2 != null)
{
TopMessageSub2.ToPdf(cb, 0, ref tmp, ref tmp);
TopMessageSub2 = null; // Only output it once.
}
if (BottomMessage != null)
{
BottomMessage.ToPdf(cb, 0, ref tmp, ref tmp);
@ -500,6 +581,11 @@ namespace Volian.Print.Library
BottomMessageR.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessageR = null; // Only output it once.
}
if (BottomMessageA != null)
{
BottomMessageA.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessageA = null; // Only output it once.
}
}
public void DrawBottomMessage(PdfContentByte cb)
{
@ -1472,7 +1558,11 @@ namespace Volian.Print.Library
string revUnit = null;
string unitNum = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList;
if (Rev != null && Rev != "")
{
revUnit = Rev;
int indxs = Rev.IndexOf(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/');
if (indxs > 0) revUnit = Rev.Substring(0, indxs);
}
else
revUnit = " ";

View File

@ -71,11 +71,16 @@ namespace Volian.Print.Library
bool didComponentTableRow = false;
float tableBottomMost = 0;
float xoffBase = xoff;
int prevTplRow = 0;
int maxRnoSav = maxRNO;
foreach (ItemInfo iChildItemInfo in itemInfoList)
{
maxRNO = maxRnoSav;
if (iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox && iChildItemInfo.IsHigh) bxIndex = null;
if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO)
maxRNO = (iChildItemInfo as SectionInfo).ColumnMode;
int maxRnoTemplate = iChildItemInfo.TemplateChildColumnMode;
if (maxRnoTemplate >= 0) maxRNO = maxRnoTemplate-1;
ItemInfo childItemInfo = iChildItemInfo;
int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
// if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution
@ -89,13 +94,41 @@ namespace Volian.Print.Library
// by the first level of children. The data for the column is the child of the column header.
// Sometimes the column will not have data, the following handles that case. Also, use
// the boolean didComponentTableRow to keep track of the bottom most yoff of the table row.
if ((childItemInfo.MyDocStyle.ComponentList) && childItemInfo.MyParent.IsInTemplate())
if ((childItemInfo.MyDocStyle.ComponentList) && childItemInfo.MyParent.IsInTemplate()||
(childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && childItemInfo.IsInTemplate()))
{
// childItemInfo = 'child' and set to use a template for defining size.
if (childItemInfo.Steps == null)
continue;
if (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
// if this template element has a -1 for row, print it (if = 0 this is a heading for edit
// and not printed). if this template element has a width of 0, then also print it,
// these are headings and should be printed). This was added for Calvert Alarm (BGEALN) format for
// DEVICE/SETPOINT (row=-1), and for POSSIBLE CAUSES, AUTOMATIC ACTIONS, etc (width=0)
// find the indexes into the template for this item. The index must be for the HLS this is
// or this is under.
int tindx = childItemInfo.TemplateIndex;
if (tindx == -1)
xoff = (float)childItemInfo.MyDocStyle.Layout.LeftMargin;
else if (childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row < 0 ||
childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].width == 0)
{
// move down for the 'POSSIBLE CAUSES'. To know it's that step type, check
// the column field in template. -1 represents staying on same row but using
// the start template field to get the xoffset.
if (prevTplRow == -1 && prevTplRow != childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row)
{
// position to the furthest down the page of the Device/setpoint/annunciator window:
yoff = Math.Max(yoff, Parent.YBottomMost + vlnPrintObject.SixLinesPerInch);
yoff = Math.Max(yoff, tableBottomMost + vlnPrintObject.SixLinesPerInch);
}
xoff = (float)childItemInfo.MyDocStyle.Layout.LeftMargin + (childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].start * 7.2f);
prevTplRow = childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row;
}
}
else
{
// childItemInfo = 'child' and set to use a template for defining size.
if (childItemInfo.Steps == null)
continue;
childItemInfo = childItemInfo.Steps[0];
didComponentTableRow = true;
}
@ -237,6 +270,11 @@ namespace Volian.Print.Library
para.PartsContainer.Add(box);
}
Add(para);
// Calvert Alarm's caution1 is the Annunciator window, i.e. in top right of page. Adjust
// y offset for this caution that is printed BELOW the hls.
if (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && iChildItemInfo.IsCaution1) para.MyHighLevelParagraph.YBottomMost = para.YBottomMost;
// para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box.
if (childItemInfo.IsStep && childItemInfo.MyHLS != null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost)
yoff = para.ChildrenBelow[0].YBottomMost;
@ -314,6 +352,7 @@ namespace Volian.Print.Library
get { return _PageBreakOnStep; }
set { _PageBreakOnStep = value; }
}
private bool HasCalvertMacro = false; // this step has the Calvert (BGE) Alarm CONDITION/RESPONSE macro associated with it
private float WidthNoLimit = 0;
private vlnTable _MyGrid;
public vlnTable MyGrid
@ -687,9 +726,17 @@ namespace Volian.Print.Library
if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText);
//Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content);
float retval = yLocation;
// 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.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type)||
(MyItemInfo.GetNextItem() != null && MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type)) 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.
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.GetNextItem() == null) || MyItemInfo.FormatStepData.SeparateBox) && Height < (1.2F * IParagraph.Leading))
if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.GetNextItem() == null) || MyItemInfo.FormatStepData.SeparateBox || doAlign) && Height < (1.2F * IParagraph.Leading))
IParagraph.Alignment = Element.ALIGN_CENTER;
// if this step is centered, but not part of the checklist or valvelist format, use itextsharp to center it.
// if it was part of the checklist or valvelist, then the centering is based on the column definitions for the table and
@ -837,6 +884,7 @@ namespace Volian.Print.Library
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
bool doThreeContinues = false;
// For BGE, the very first subsection's pagelist items were not correct - the section/meta section titles were
// at the wrong level. Reset the page helper's section.
if (MyItemInfo.IsSection && MyItemInfo.MyPrevious == null && MyItemInfo.MyParent.IsSection && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseWestinghouse)
@ -845,6 +893,13 @@ namespace Volian.Print.Library
MyPageHelper.ResetSvg();
}
// For Calvert Alarms: A macro exists around the CONDITION/RESPONSE portion. If the page break occurs so that
// this 'table' moved to the following page AND there is an associated note/caution that is not on the next page,
// remove the macro so that the header macro doesn't print on the page with the note (without this, an extraneous
// header for the 'table'is printed.
if (PartsLeft.Count != 0 && (PartsLeft[0] is vlnMacro) && MyPageHelper.ParaBreaks.Count != 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.MyPrevious == null)
if (!MyPageHelper.ParaBreaks[0].MyItemInfo.IsNote && !MyPageHelper.ParaBreaks[0].MyItemInfo.IsCaution) PartsLeft.Clear();
if (IsWordDocPara)
{
PdfReader tmp = null;
@ -880,7 +935,7 @@ namespace Volian.Print.Library
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue);
if (doSectionContinue) DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle);
if (doSectionContinue) DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, false);
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 10 {0}", cb.PdfWriter.CurrentPageNumber);
if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination())
@ -917,7 +972,7 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + YTopMost;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle);
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)
{
@ -929,7 +984,31 @@ namespace Volian.Print.Library
case 2: // Break within a Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle;
DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle);
bool doAlarmBox = false;
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
{
// Recognize that the break occurred WITHIN the CONDITION/RESPONSE table.
// Otherwise, we get extraneous header/top of box lines in pdf.
if (MyPageHelper.AlarmYoffStart > 0)
{
// if the first step in box is what broke to next page, then
// don't print the box on this page, only print it on next page:
if (MyItemInfo.MyPrevious == null)
MyPageHelper.AlarmYoffStart = 0;
else if (MyPageHelper.AlarmYoffEnd == 0)
{
// doThreeContinues flags when continue messages are printed in the
// bottom of the CONDITION/RESPONSE table columns.
doThreeContinues = MyItemInfo.StepLevel>1;
MyPageHelper.AlarmYoffEnd = CalculateYLocation(yLocation, yTopMargin);
}
doAlarmBox = true;
}
}
}
DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, doThreeContinues);
cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
@ -967,7 +1046,7 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
if (EmptyTopMostPart) yPageStart += SixLinesPerInch;
DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle);
DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, doThreeContinues?"2 ":null);
// If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader)
@ -977,6 +1056,17 @@ namespace Volian.Print.Library
}
MyPageHelper.YMultiplier = 1;
// For Calvert Alarms, if there was a page break and there is an box around the current
// step, need to add the header for the box, which is stored in a macro. Also set the
// 'AlarmYoffStart' value to where the vertical lines of the box start on this page.
if (doAlarmBox && MyItemInfo.StepLevel>1)
{
float alrmY = CalculateYOffset(yPageStart, yTopMargin);
PartsLeft.Add(new vlnMacro((float)docstyle.Layout.LeftMargin - 12, YOffset-(4*SixLinesPerInch), "H4")); // probably not the right paragraph?
MyPageHelper.AlarmYoffStart = alrmY - SixLinesPerInch;
yPageStart -= (4 * SixLinesPerInch);
}
// Now check if this is a template type step & if so, add the HLS's prefix/suffix to it.
if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{
@ -1055,6 +1145,20 @@ namespace Volian.Print.Library
MyPageHelper.ParaBreaks.RemoveAt(0);
yPageStart = yTopMargin + YTop;
}
// The following sets the beginning/ending y location for the lines around the
// CONDITION/RESPONSE text for Calvert Alarm format
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
int tindx = MyItemInfo.TemplateIndex;
if (tindx >= 0)
{
// save this position to start drawing the alarm box lines around substeps:
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[MyItemInfo.TemplateIndex].row > 0)
MyPageHelper.AlarmYoffStart = CalculateYOffset(yPageStart, yTopMargin) - SixLinesPerInch;
else if (MyPageHelper.AlarmYoffStart > 0 && MyPageHelper.AlarmYoffEnd == 0)
MyPageHelper.AlarmYoffEnd = CalculateYOffset(yPageStart, yTopMargin) + (2 * SixLinesPerInch);
}
}
yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
// If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update
// yPageStart for the AER (left column).
@ -1133,7 +1237,7 @@ namespace Volian.Print.Library
return yPageStart;
}
private void DoTopContinueMsg(PdfContentByte cb, ref float yPageStart, float yTopMargin, DocStyle docstyle)
private void DoTopContinueMsg(PdfContentByte cb, ref float yPageStart, float yTopMargin, DocStyle docstyle, string subTab)
{
string myMsg = docstyle.Continue.Top.Message;
MyPageHelper.TopMessageR = null;
@ -1186,6 +1290,27 @@ namespace Volian.Print.Library
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()));
if (myMsg.IndexOf(@"%c") > -1)
myMsg = myMsg.Replace(@"%c", " ");
// Calvert Alarms, step description have the alarm number as part of the top continue message
// Also, if the break is within the CONDITION/RESPONSE, there are continue messages in both columns at the top
// of the table, note that the continue messages WITHIN table are only printed when the
// steplevel is greater than 2 - this is from 16bit.
// NOTE THAT this code is not complete - the positioning & addition of step tab for within table are not working correctly
if ((docstyle.Continue.Top.HLS ?? 0) == 3)
{
string HLSTabTextForContMsg = MyHighLevelParagraph.MyItemInfo.MyTab.CleanText + " " + MyHighLevelParagraph.MyItemInfo.MyContent.Text;
int len = (HLSTabTextForContMsg.Length - 10) * 6;
HLSTabTextForContMsg = @"\ul\b " + MyHighLevelParagraph.MyItemInfo.MyTab.CleanText.Trim() + @" \b0\ulnone \b " + MyHighLevelParagraph.MyItemInfo.MyContent.Text + @"\b0";
MyPageHelper.TopMessageR = new vlnText(cb, this, HLSTabTextForContMsg, HLSTabTextForContMsg, (float)docstyle.Layout.PageWidth - len, yTopMargin + 0.1F, docstyle.Continue.Top.Font);
if (subTab != null && MyItemInfo.StepLevel > 2)
{
float ybot = yTopMargin + (4 * SixLinesPerInch);
float xoffB = (float)docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0;
MyPageHelper.TopMessageSub1 = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font);
xoffB = docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.MarginR ?? 0;
MyPageHelper.TopMessageSub2 = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font);
}
}
if (!PageBreakOnStep)
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
else
@ -1193,7 +1318,7 @@ namespace Volian.Print.Library
}
}
private void DoBottomContinueMsg(PdfContentByte cb, float yBottomMargin, float yLocation, DocStyle docstyle)
private void DoBottomContinueMsg(PdfContentByte cb, float yBottomMargin, float yLocation, DocStyle docstyle, bool doThreeContinues)
{
string myMsg = docstyle.Continue.Bottom.Message;
@ -1248,6 +1373,9 @@ namespace Volian.Print.Library
case E_ContBottomLoc.BelowBottom1:
msg_yLocation = msg_yLocation + yBtmMarginForMsg;
break;
case E_ContBottomLoc.BottomWithFooter: // put bottom message AND if in CONDITION/RESPONSE table, in both columns.
msg_yLocation = msg_yLocation + yBtmMarginForMsg;
break;
case E_ContBottomLoc.EndOfText2: // Like EndOfText but limited within yBottomMargin
msg_yLocation = Math.Max(msg_yLocation + yLocation - SixLinesPerInch, yBottomMargin + SixLinesPerInch);
break;
@ -1264,7 +1392,25 @@ namespace Volian.Print.Library
if (!PageBreakOnStep)
{
float xoffB = 0;
if (RNOContinueOnly)
// Added for Calvert Alarms: if 'doThreeContinues', continue message at bottom of page
// and a continue message at the bottom of each column.
if (doThreeContinues)
{
float ybot = yLocation;
xoffB = (float)docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0;
MyPageHelper.BottomMessageA = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font);
xoffB = docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.MarginR ?? 0;
MyPageHelper.BottomMessageR = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font);
MyPageHelper.AlarmYoffEnd -= SixLinesPerInch;
float tmp = (((float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin) / 2) - (myMsg.Length / 2 * 5);
xoffB = (float)docstyle.Layout.LeftMargin + tmp;
}
else if (docstyle.Continue.Bottom.Location == E_ContBottomLoc.BottomWithFooter)
{
float tmp = (((float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin) / 2) - (myMsg.Length / 2 * 5);
xoffB = (float)docstyle.Layout.LeftMargin + tmp;
}
else if (RNOContinueOnly)
{
// The following line was added for McGuire APs/AP/1/5500/12, Step 13
//if (msg_yLocation < yBottomMargin + SixLinesPerInch) msg_yLocation = yBottomMargin + SixLinesPerInch;
@ -1555,6 +1701,17 @@ namespace Volian.Print.Library
}
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:
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
// The CONDITION/RESPONSE portion of the alarm uses a macro to print the 'table' heading,
// i.e. the lines/boxes and text for CONDITION and RESPONSE. This does not have a tab,
// tabs are where the macros are usually stored, so flag this for future reference.
// The 2nd if is executed when the step is at the same y offset as the parent, i.e. DEVICE & SETPOINT text.
if (itemInfo.TemplateIndex > 0 && itemInfo.ActiveFormat.PlantFormat.FormatData.Templates[itemInfo.TemplateIndex].hmacro > 0)
HasCalvertMacro = true;
if (KeepOnParentLine(itemInfo)) yoff = parent.YOffset;
}
float yOffOrig = yoff;
BuildPlacekeeper(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
@ -1747,7 +1904,7 @@ namespace Volian.Print.Library
if (itemInfo.IsInRNO)
{
XOffset = MyTopRNO.MyTab != null ? MyTopRNO.MyTab.XOffset : MyTopRNO.XOffset;
Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 10; // subtract 10 (about a character) so it doesn't touch line
Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 10;
}
else
{
@ -1763,20 +1920,20 @@ namespace Volian.Print.Library
float yoffLeft = yoff;
if (ChildrenAbove != null)
ChildrenAbove.StepDesignator = null; //reset StepDesignator
if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote))
if (itemInfo.Cautions != null && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || itemInfo.Cautions[0].FormatStepData.Type != "Caution1") && !(itemInfo.IsCaution || itemInfo.IsNote))
{
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
// For deviations, the Cautions are always in the same place.
// Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS
float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
else
{
if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent;
yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
// For deviations, the Cautions are always in the same place.
// Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS
float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
else
{
if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent;
yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
}
if (itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote))
{
@ -1793,7 +1950,7 @@ namespace Volian.Print.Library
// yoff from this. Without this, an overlap of text between the note and the bottom of the
// RNO was occurring for FNP - Unit 2/AOP, AOP-4.0.
if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent;
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
}
@ -2029,6 +2186,11 @@ namespace Volian.Print.Library
}
else
{
// For Calvert Alarms, the 'CONDITION/RESPONSE' portion uses a macro to print
// the CONDITION and RESPONSE text with the lines around it. Add the macro here because
// there is no tab for the step & that's where the macro is usually stored:
if (HasCalvertMacro) PartsLeft.Add(new vlnMacro(xoff - 12f, yoff, "H4"));
//if (itemInfo.IsSection)
// Rtf = GetRtf(itemInfo, prefix, " (Continued)");
//else
@ -2107,6 +2269,7 @@ namespace Volian.Print.Library
// y direction (bottommost) across the row.
if (itemInfo.IsStep && itemInfo.MyHLS != null && (itemInfo.MyHLS.FormatStepData.UseSmartTemplate || (itemInfo.MyHLS.FormatStepData.UseOldTemplate && itemInfo.MyDocStyle.ComponentList)) && (TheStepLevel(itemInfo) >= 0))
savCheckListBottomMost = yoff + Height + (itemInfo.MyHLS.FormatStepData.UseSmartTemplate ? SixLinesPerInch : 0);
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsCaution1) savCheckListBottomMost = yoff + Height;
// Get Y offset for regular steps, or if section title is output or if not within row (not last column of
// text) for wcn checklist, i.e.
if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step
@ -2140,7 +2303,31 @@ namespace Volian.Print.Library
}
}
}
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
// For Calvert Alarms, the row has formatting that makes this template item have a header & box
// (CONDITION/RESPONSE), header with box around it is defined in genmac whereas the lines around
// substeps are drawn in pagehelper. Adjust some yoffsets around this box.
// Need to:
// 1) move the text down a bit for top line (1.5f * SixLinesPerInch)
// 2) move the substep down 2 lines (2 * SixLinesPerInch) for bottom of box
// and space before substep
// 3) if the previous item had this condition, add space for the
// line below.
if (HasCalvertMacro)
{
YOffset += (1.5f * vlnPrintObject.SixLinesPerInch);
yoff += (2 * vlnPrintObject.SixLinesPerInch);
}
if (itemInfo.MyPrevious != null && itemInfo.MyPrevious.TemplateIndex > 0)
{
if (itemInfo.MyPrevious.ActiveFormat.PlantFormat.FormatData.Templates[itemInfo.MyPrevious.TemplateIndex].hmacro > 0)
{
YOffset += (3 * vlnPrintObject.SixLinesPerInch);
yoff += (3 * vlnPrintObject.SixLinesPerInch);
}
}
}
CheckOff co = itemInfo.GetCheckOffStep();
if (co != null)
{
@ -2257,6 +2444,13 @@ namespace Volian.Print.Library
yoff += mySep.Height;// +SixLinesPerInch;
}
}
// For Calvert Alarms, 'Caution1' was used to implement the Annunciator Window, i.e. is printed
// below the HLS and close to the right margin.
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.Type == "Caution1")
{
yoff = ChildrenBelow.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
savCheckListBottomMost = yoff;
}
if (itemInfo.Steps != null && printsteps)
{
if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight")
@ -2295,6 +2489,16 @@ namespace Volian.Print.Library
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
}
// for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This
// is flagged by the -1 row in the template definition.
private bool KeepOnParentLine(ItemInfo itemInfo)
{
int tindx = itemInfo.TemplateIndex;
if (tindx < 0) return false;
if (itemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row == -1) return true;
return false;
}
private void AdjustYOffset(float yDelta)
{
YOffset -= yDelta;
@ -2782,7 +2986,16 @@ namespace Volian.Print.Library
if (!itemInfo.IsTable && StepRTB.MyFontFamily != null)
myFont = new System.Drawing.Font(StepRTB.MyFontFamily, myFont.Size, myFont.Style);
string stText = vlntxt.StartText;
string stText = null; // if Calvert (BGE) Alarms, the text is included in the macro, so save text as a blank:
if (HasCalvertMacro)
{
stText = " ";
// turn underline off
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, FontStyle.Regular); //myFont.Style. | FontStyle.Underline);
}
else
stText = vlntxt.StartText;
if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout)
{
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline);
@ -3115,7 +3328,7 @@ namespace Volian.Print.Library
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
return;
}
else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow")
else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow" && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || (!itemInfo.IsCaution && !itemInfo.IsNote)))
{
float childindent = itemInfo.MyParent.FormatStepData.ChildIndent ?? 0;
if (myTab != null)
@ -3143,6 +3356,30 @@ namespace Volian.Print.Library
}
if (itemInfo.IsHigh)
{
if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
// the HLS in the template prints the tab/step on the right edge of page. Don't
// do the other calculations to relocate it.
if (itemInfo.FormatStepData.UseOldTemplate && itemInfo.IsInTemplate())
{
MyTab.XOffset = XOffset - MyTab.Width;
return;
}
// the following code handles the xoffsets of tabs/HLS in the non-alarm sections for
// the Calvert Alarm format.
if (itemInfo.MyDocStyle.UseColSByLevel)
{
if (myTab != null)
{
myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray()));
myTab.XOffset = MyParent.XOffset;
XOffset = myTab.XOffset + MyTab.Width;
}
else
XOffset = MyParent.XOffset; // unnumbered hls
return;
}
}
float x = 0;
float xoff = 0;
if ((colOvrd ?? 0) != 0)
@ -3371,7 +3608,7 @@ namespace Volian.Print.Library
if (itemInfo.IsStep && itemInfo.MyHLS != null && UseTemplateWidthOrXOff(itemInfo) && (xwid = GetWidthOrStartFromTemplate(itemInfo, formatInfo, true)) > 0)
widOvrd = xwid;
else
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride == null ? null :
widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride == null ? null :
(float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO);
//widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
// Don't adjust the RNO width if in single column mode:
@ -3536,7 +3773,8 @@ namespace Volian.Print.Library
public bool UseTemplateKeepOnCurLine(ItemInfo itemInfo)
{
if (!itemInfo.IsStep || !itemInfo.MyDocStyle.ComponentList) return false;
if (itemInfo.MyHLS.FormatStepData.UseOldTemplate) return true;
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert
&& itemInfo.MyHLS.FormatStepData.UseOldTemplate) return true;
return false;
}
private bool UseTemplateWidthOrXOff(ItemInfo itemInfo)
@ -3549,7 +3787,14 @@ namespace Volian.Print.Library
{
ItemInfo useForTemplate = itemInfo.IsHigh ? itemInfo : itemInfo.MyParent;
int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx();
int tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type);
int tpIndx = -1;
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
if (itemInfo.IsCaution1) return false;
else tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, itemInfo.MyContent.Text);
}
else
tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type);
if (tpIndx > -1) return true;
}
return false;
@ -3560,19 +3805,39 @@ namespace Volian.Print.Library
int tmplIndx = 0;
if (itemInfo.MyDocStyle.ComponentList && !itemInfo.IsHigh)
{
// The ComponentTable format (FNP component table as one example), uses a template
// where the items in the template below the HLS are all paragraphs (the intermediate steps
// are TitleWithTextRight). Find the ordinal of in this list to get the index. Use the ordinal
// as an offset from the HLS's index into the template.
tmplIndx = itemInfo.MyParent.Ordinal + topIndx;
if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0;
// The following was added so that the Calvert Alarms sequentials under the CONDITION/RESPONSE would be
// printed as 2 column (data within the template definition set the columns to 2)
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
if (itemInfo.IsSequential && itemInfo.MyParent.TemplateIndex > 0)
{
if (bGetWidth && itemInfo.MyParent.ColumnMode == 1) // 2 columns
return (ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, itemInfo.ColumnMode) - MyTab.Width);
}
tmplIndx = itemInfo.TemplateIndex;
if (tmplIndx == -1) return 0;
}
else
{
// The ComponentTable format (FNP component table as one example), uses a template
// where the items in the template below the HLS are all paragraphs (the intermediate steps
// are TitleWithTextRight). Find the ordinal of in this list to get the index. Use the ordinal
// as an offset from the HLS's index into the template.
tmplIndx = itemInfo.MyParent.Ordinal + topIndx;
if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0;
}
}
else
{
tmplIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type);
if (tmplIndx == -1) return 0;
}
// Calvert Alarms' template defines number of columns & their width.
if (bGetWidth && formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width == 0)
{
int nocol = formatInfo.PlantFormat.FormatData.Templates[tmplIndx].nocolm == 0 ? 0 : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].nocolm - 1;
return ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, nocol);
}
int ncol = bGetWidth ? formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].start;
// now convert to the units for this format. The template width data is in number of columns.
return (ncol * itemInfo.FormatStepData.Font.CharsToTwips) + (bGetWidth ? 1 : 0); // + 1 is slight adjustment so column doesn't wrap

View File

@ -119,7 +119,7 @@ namespace Volian.Print.Library
Text = cleanTab;
MyFont = vFont;
// BGE has a format flag to increase size of font, if top level:
if (doSectTab && myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && myparent.MyItemInfo.MyParent.IsProcedure)
if (doSectTab && myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && myparent.MyItemInfo.MyParent.IsProcedure)
vFont = new VE_Font(vFont.Family, 14, (E_Style)vFont.Style | E_Style.Bold, 8);
float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName);
float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName);
@ -130,12 +130,12 @@ namespace Volian.Print.Library
Width = 90;
}
else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
//if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
//if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
else if (CCCs != IIIs)
{
float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6;
Width = tPtPerChar * origTab.Length;
Width = (tPtPerChar == 0 ? 6 : tPtPerChar) * origTab.Length;
// Check the following, it may be needed for FPL:
//origTab1 = origTab1.TrimStart(" ".ToCharArray());
// 6 = number of points per character. 4 characters between end of tab and beginning of text
@ -144,7 +144,7 @@ namespace Volian.Print.Library
}
else
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
// Pairie Island (NSP) Caution and Note tabs use a larger font
// When using a bullet, we need to use the font size of the Caution/Note text instead of the tab.
// To do this we set the TabData.Bullet.Separate to true (currently - 4/26/2013 - only NSP uses this).
@ -170,7 +170,7 @@ namespace Volian.Print.Library
if (CCCs != IIIs)
{
float? tPtPerChar1 = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar;
if (tPtPerChar1!=null)
if (tPtPerChar1 != null)
Width = (float)tPtPerChar1 * origTab.Length;
else
{
@ -241,7 +241,7 @@ namespace Volian.Print.Library
Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
if (ScriptCaution)
{
Rtf = GetRtf("\u25CFCaution ", vFont);
Rtf = GetRtf("\u25CFCaution ", vFont);
Rtf = Rtf.Replace("\u25CF", @"\f1\fs20 \u9679?\f0\par\f0\fs64 "); // bullet 25CF // jsj- force bullet size (is different than tab text)
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
Rtf = Rtf.Replace("Caution ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
@ -294,12 +294,12 @@ namespace Volian.Print.Library
XOffset = xoffset;
// the width was just a little small, so it was wrapping - but only if there were no spaces at end
// so use this condition to do minimal impact (WCN1 format, for section tabs with three places, i.e. 6.1.2
if (!cleanTab.EndsWith(" "))Width += .1f;
if (!cleanTab.EndsWith(" ")) Width += .1f;
}
else
{
// if using a proportional font and the tab font/size is different than the text font/size
if (CCCs != IIIs &&
if (CCCs != IIIs &&
(MyFont.Family != myparent.MyItemInfo.FormatStepData.Font.Family ||
MyFont.Size != myparent.MyItemInfo.FormatStepData.Font.Size))
{
@ -308,14 +308,14 @@ namespace Volian.Print.Library
string txt = Text;
if (alignAsIfBulleted)
txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
System.Drawing.Font font = new System.Drawing.Font(MyFont.Family,(float)MyFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
System.Drawing.Font font = new System.Drawing.Font(MyFont.Family, (float)MyFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size);
Width = w;
Width = w;
}
XOffset = xoffset - Width;
}
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{