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

View File

@ -1352,6 +1352,11 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
// if Calvert Alarms, the column mode may be defined in the template code - check
// for this 1st.
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
if (TemplateColumnMode != -1) return TemplateColumnMode;
// check config value on my section, if null/default use Pmode of active format // check config value on my section, if null/default use Pmode of active format
if (ActiveSection != null) if (ActiveSection != null)
{ {
@ -1627,7 +1632,6 @@ namespace VEPROMS.CSLA.Library
return string.Format("{0} {1}", number, DisplayText).Trim(); // Need TrimEnd(); for IP3 return string.Format("{0} {1}", number, DisplayText).Trim(); // Need TrimEnd(); for IP3
//return string.Format("{0} {1}", number, cont.Text).Trim(); //return string.Format("{0} {1}", number, cont.Text).Trim();
//return string.Format("{0} {1}", cont.Number, cont.Text); //return string.Format("{0} {1}", cont.Number, cont.Text);
//return "Now is the time for all good men to come to the aid of their country!";
} }
//public string ToString(string str,System.IFormatProvider ifp) //public string ToString(string str,System.IFormatProvider ifp)
//{ //{
@ -2503,9 +2507,11 @@ namespace VEPROMS.CSLA.Library
} }
public FormatInfo LocalFormat public FormatInfo LocalFormat
{ {
get { get
{
//Console.WriteLine("Local {0}", (MyContent.MyFormat==null)?"MYformat is null": MyContent.MyFormat.Name); //Console.WriteLine("Local {0}", (MyContent.MyFormat==null)?"MYformat is null": MyContent.MyFormat.Name);
return MyContent.MyFormat; } return MyContent.MyFormat;
}
} }
private bool _IsDeleted = false; private bool _IsDeleted = false;
public bool IsDeleted public bool IsDeleted
@ -2685,7 +2691,6 @@ namespace VEPROMS.CSLA.Library
} }
if (((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) || if (((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)) ((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations))
{ {
if (tbformat.Contains("{LNK C/N Num}")) if (tbformat.Contains("{LNK C/N Num}"))
{ {
@ -2890,6 +2895,7 @@ namespace VEPROMS.CSLA.Library
} }
// if this is a caution/note type determine where 'NOTE/CAUTION' tab goes, as tab or as 'header' // if this is a caution/note type determine where 'NOTE/CAUTION' tab goes, as tab or as 'header'
// and also determine whether the tab itself gets converted to a bullet. // and also determine whether the tab itself gets converted to a bullet.
if (IsCaution || IsNote) tbformat = CheckNoteCautionTab(tbformat); if (IsCaution || IsNote) tbformat = CheckNoteCautionTab(tbformat);
// if there is a section prefix, trim any spaces from the start of this tab, so we don't have // if there is a section prefix, trim any spaces from the start of this tab, so we don't have
@ -3350,9 +3356,18 @@ namespace VEPROMS.CSLA.Library
} }
public bool MixCautionNotesDiffType() public bool MixCautionNotesDiffType()
{ {
// for calvert alarms, if there is a note and a warning, these are both 'IsNote', but they
// have different tabs, so we want the mix to be true so that the tab code handles the
// tabbing correctly.
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{
if (MyPrevious != null && MyContent.Type != MyPrevious.MyContent.Type) return true;
if (GetNextItem() != null && MyContent.Type != GetNextItem().MyContent.Type) return true;
}
if (!FormatStepData.MixCautionsAndNotes) return false; if (!FormatStepData.MixCautionsAndNotes) return false;
if (IsNote && ((NextItem != null && NextItem.IsCaution) || (MyPrevious != null && MyPrevious.IsCaution))) return true; if (IsNote && ((GetNextItem() != null && GetNextItem().IsCaution) || (MyPrevious != null && MyPrevious.IsCaution))) return true;
if (IsCaution && ((NextItem != null && NextItem.IsNote) || (MyPrevious != null && MyPrevious.IsNote))) return true; if (IsCaution && ((GetNextItem() != null && GetNextItem().IsNote) || (MyPrevious != null && MyPrevious.IsNote))) return true;
return false; return false;
} }
@ -3523,12 +3538,67 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region UseSmartTemplate #region UseSmartTemplate
// TemplateIndex is for Calvert only:
private int _TemplateIndex = -2; // -2 not set; -1 not a template
public int TemplateIndex
{
get
{
if (_TemplateIndex == -2)
{
_TemplateIndex = GetSmartTemplateTopLevelIndx();
if (_TemplateIndex != -1)
{
if (!IsHigh) _TemplateIndex = GetSmartTemplateIndex(_TemplateIndex, MyContent.Text);
}
}
return _TemplateIndex;
}
set { _TemplateIndex = value; }
}
private int? _TemplateChildColumnMode = null;
public int TemplateChildColumnMode
{
get
{
if (_TemplateChildColumnMode == null)
{
if (TemplateIndex >= 0)
{
_TemplateChildColumnMode = ActiveFormat.PlantFormat.FormatData.Templates[TemplateIndex].nocolm;
if (_TemplateChildColumnMode == 0) _TemplateChildColumnMode = 1; // 0 is default, set to 1 column
}
else
_TemplateChildColumnMode = -1;
}
return _TemplateChildColumnMode ?? -1;
}
}
private int? _TemplateColumnMode = null;
public int TemplateColumnMode
{
get
{
if (_TemplateColumnMode == null)
{
ItemInfo pi = ActiveParent as ItemInfo;
if (!pi.IsStep) // only steps are in template
_TemplateColumnMode = -1;
else if (pi.FormatStepData.UseOldTemplate)
_TemplateColumnMode = pi.TemplateChildColumnMode;
else
_TemplateColumnMode = pi.TemplateColumnMode; // go up parents until find of columnmode or section
}
return _TemplateColumnMode ?? -1;
}
}
public bool IsInTemplate() public bool IsInTemplate()
{ {
if (IsStep && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes.ContainsKey((int)MyContent.Type - 20001)) return true; if (IsStep && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes != null && FormatStepData.MyFormat.PlantFormat.FormatData.TopTemplateTypes.ContainsKey((int)MyContent.Type - 20001)) return true;
return false; return false;
} }
public int GetSmartTemplateTopLevelIndxOfThisType(int oftype) public int GetSmartTemplateTopLevelIndxOfThisType(int oftype) // used for inserting steps
{ {
if (FormatStepData == null) return -1; if (FormatStepData == null) return -1;
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData; FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
@ -3538,6 +3608,7 @@ namespace VEPROMS.CSLA.Library
} }
public int GetSmartTemplateTopLevelIndx() public int GetSmartTemplateTopLevelIndx()
{ {
if (FormatStepData == null) return -1;
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData; FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1; if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
ItemInfo tmp = this; ItemInfo tmp = this;
@ -3563,6 +3634,27 @@ namespace VEPROMS.CSLA.Library
} }
return -1; // didn't find this step type in the template width override list. return -1; // didn't find this step type in the template width override list.
} }
// GetSmartTemplateIndex(int topIndx, string strtxt): Added for Calvert Alarms since their
// template also uses the text, not just the type, to find a match in the template.
public int GetSmartTemplateIndex(int topIndx, string strtxt)
{
string txt = strtxt.Replace(@"\u160?"," ");
if (FormatStepData == null) return -1;
FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData;
if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1;
int indx = topIndx;
while (indx < formatData.Templates.Count)
{
if (IsHigh && formatData.Templates[indx].type == (MyContent.Type - 20001)) return indx;
if (txt == null && formatData.Templates[indx].type == (MyContent.Type - 20001)) return indx;
// now see if we're on the topType, if so, look under this one for the step type
// that we're on, the TEXT ALSO NEEDS TO MATCH. If found return the index of it.
if (txt != null && formatData.Templates[indx].text!=null && (txt.Trim() == formatData.Templates[indx].text.Trim())) return indx;
indx++;
}
return -1; // didn't find this step type in the template width override list.
}
#endregion #endregion
#region CheckOffs #region CheckOffs
private string _SectionCheckOffHeader; private string _SectionCheckOffHeader;
@ -3714,6 +3806,7 @@ namespace VEPROMS.CSLA.Library
} }
} }
#endregion #endregion
} }
#endregion ItemInfo #endregion ItemInfo
#region Tab #region Tab
@ -5186,6 +5279,7 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly
{ {
//private int? _TemplateColumnMode
public override void SetupTags() public override void SetupTags()
{ {
_MyTab = new Tab(ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Font); _MyTab = new Tab(ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Font);

View File

@ -117,6 +117,8 @@ namespace VEPROMS.CSLA.Library
BtwnTextAndBottom = 1, BtwnTextAndBottom = 1,
BottomOfPage = 2, BottomOfPage = 2,
BelowBottom1 = 3, 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, EndOfText2 = 5,
BtwnTextAndBottom2 = 6 // Added for BGE, their continue message was a line or so too far down page.1 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. // count newlines - which gives number of template records.
int NumTemplates = 0; int NumTemplates = 0;
if (TPL == null) return null; 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 '&amp;' rather than '&'.
string tTPL = TPL.Replace("&amp;", "&");
int indx = tTPL.IndexOf('\n');
while (indx > -1) while (indx > -1)
{ {
NumTemplates++; 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; if (NumTemplates == 0) return null;
@ -261,7 +264,7 @@ namespace VEPROMS.CSLA.Library
int type = 0; int type = 0;
int start = 0; int start = 0;
int width = 0; int width = 0;
int nocol = 0; short nocol = 0;
int row = 0; int row = 0;
string stmp = null; string stmp = null;
if (!NewTemplateFormat) if (!NewTemplateFormat)
@ -284,7 +287,7 @@ namespace VEPROMS.CSLA.Library
start = Convert.ToInt32(tmpNew[2]); start = Convert.ToInt32(tmpNew[2]);
width = Convert.ToInt32(tmpNew[3]); width = Convert.ToInt32(tmpNew[3]);
row = Convert.ToInt32(tmpNew[4]); row = Convert.ToInt32(tmpNew[4]);
nocol = Convert.ToInt32(tmpNew[5]); nocol = Convert.ToInt16(tmpNew[5]);
stmp = tmpNew.Length <= 6 ? null : tmpNew[6]; stmp = tmpNew.Length <= 6 ? null : tmpNew[6];
} }
TPlate tp = new TPlate(level, type, start, width, row, nocol, stmp); TPlate tp = new TPlate(level, type, start, width, row, nocol, stmp);
@ -558,6 +561,12 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region Templates #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 class TPlate
{ {
public int level; // sub-step level public int level; // sub-step level
@ -565,9 +574,11 @@ namespace VEPROMS.CSLA.Library
public int start; // starting position (for horizontal only) public int start; // starting position (for horizontal only)
public int width; // width of text in characters (") public int width; // width of text in characters (")
public int row; 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 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; level = l;
type = t; type = t;
@ -575,6 +586,11 @@ namespace VEPROMS.CSLA.Library
width = w; width = w;
row = r; row = r;
nocolm = c; 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; text = x;
} }
} }
@ -705,6 +721,14 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _SpecialCaseCalvert, "@SpecialCaseCalvert"); return LazyLoad(ref _SpecialCaseCalvert, "@SpecialCaseCalvert");
} }
} }
private LazyLoad<bool> _SpecialCaseCalvertAlarm;
public bool SpecialCaseCalvertAlarm
{
get
{
return LazyLoad(ref _SpecialCaseCalvertAlarm, "@SpecialCaseCalvertAlarm");
}
}
private LazyLoad<bool> _SpecialStepsFoldout; private LazyLoad<bool> _SpecialStepsFoldout;
public 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 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 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 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) if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep)
{ {

View File

@ -49,6 +49,18 @@ namespace Volian.Print.Library
get { return _TopMessageR; } get { return _TopMessageR; }
set { _TopMessageR = value; } 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; private vlnText _BottomMessage;
public vlnText BottomMessage public vlnText BottomMessage
{ {
@ -61,6 +73,12 @@ namespace Volian.Print.Library
get { return _BottomMessageR; } get { return _BottomMessageR; }
set { _BottomMessageR = value; } 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>(); Dictionary<int, vlnParagraph> _MyParagraphs = new Dictionary<int, vlnParagraph>();
public Dictionary<int, vlnParagraph> MyParagraphs public Dictionary<int, vlnParagraph> MyParagraphs
{ {
@ -79,6 +97,18 @@ namespace Volian.Print.Library
get { return _PhoneListHeight; } get { return _PhoneListHeight; }
set { _PhoneListHeight = value; } 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; private PdfWriter _MyPdfWriter;
public PdfWriter MyPdfWriter public PdfWriter MyPdfWriter
{ {
@ -203,12 +233,53 @@ namespace Volian.Print.Library
if (MySection.ColumnMode > 0) if (MySection.ColumnMode > 0)
DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 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; PageListTopCheckOffHeader = null;
PageListLastCheckOffHeader = null; PageListLastCheckOffHeader = null;
YMultiplier = 1; YMultiplier = 1;
PrintedAPage = true; 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) private void DrawPhoneList(PdfContentByte pdfContentByte, float leftMargin, float pageWidth, float yOff, string plist)
{ {
// draw the line above the phone list: // draw the line above the phone list:
@ -490,6 +561,16 @@ namespace Volian.Print.Library
TopMessageR.ToPdf(cb, 0, ref tmp, ref tmp); TopMessageR.ToPdf(cb, 0, ref tmp, ref tmp);
TopMessageR = null; // Only output it once. 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) if (BottomMessage != null)
{ {
BottomMessage.ToPdf(cb, 0, ref tmp, ref tmp); 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.ToPdf(cb, 0, ref tmp, ref tmp);
BottomMessageR = null; // Only output it once. 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) public void DrawBottomMessage(PdfContentByte cb)
{ {
@ -1472,7 +1558,11 @@ namespace Volian.Print.Library
string revUnit = null; string revUnit = null;
string unitNum = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList; string unitNum = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList;
if (Rev != null && Rev != "") if (Rev != null && Rev != "")
{
revUnit = Rev; revUnit = Rev;
int indxs = Rev.IndexOf(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/');
if (indxs > 0) revUnit = Rev.Substring(0, indxs);
}
else else
revUnit = " "; revUnit = " ";

View File

@ -71,11 +71,16 @@ namespace Volian.Print.Library
bool didComponentTableRow = false; bool didComponentTableRow = false;
float tableBottomMost = 0; float tableBottomMost = 0;
float xoffBase = xoff; float xoffBase = xoff;
int prevTplRow = 0;
int maxRnoSav = maxRNO;
foreach (ItemInfo iChildItemInfo in itemInfoList) foreach (ItemInfo iChildItemInfo in itemInfoList)
{ {
maxRNO = maxRnoSav;
if (iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox && iChildItemInfo.IsHigh) bxIndex = null; if (iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox && iChildItemInfo.IsHigh) bxIndex = null;
if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO) if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO)
maxRNO = (iChildItemInfo as SectionInfo).ColumnMode; maxRNO = (iChildItemInfo as SectionInfo).ColumnMode;
int maxRnoTemplate = iChildItemInfo.TemplateChildColumnMode;
if (maxRnoTemplate >= 0) maxRNO = maxRnoTemplate-1;
ItemInfo childItemInfo = iChildItemInfo; ItemInfo childItemInfo = iChildItemInfo;
int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex; 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 // 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. // 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 // 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. // 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()))
{
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. // childItemInfo = 'child' and set to use a template for defining size.
if (childItemInfo.Steps == null) if (childItemInfo.Steps == null)
continue; continue;
else
{
childItemInfo = childItemInfo.Steps[0]; childItemInfo = childItemInfo.Steps[0];
didComponentTableRow = true; didComponentTableRow = true;
} }
@ -237,6 +270,11 @@ namespace Volian.Print.Library
para.PartsContainer.Add(box); para.PartsContainer.Add(box);
} }
Add(para); 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. // 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) 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; yoff = para.ChildrenBelow[0].YBottomMost;
@ -314,6 +352,7 @@ namespace Volian.Print.Library
get { return _PageBreakOnStep; } get { return _PageBreakOnStep; }
set { _PageBreakOnStep = value; } 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 float WidthNoLimit = 0;
private vlnTable _MyGrid; private vlnTable _MyGrid;
public 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); 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); //Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content);
float retval = yLocation; 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 // 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. // 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; 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 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 // 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) 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 // 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. // 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) 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(); 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) if (IsWordDocPara)
{ {
PdfReader tmp = null; PdfReader tmp = null;
@ -880,7 +935,7 @@ namespace Volian.Print.Library
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle; docstyle = MyItemInfo.MyDocStyle;
bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue); 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(); cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 10 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 10 {0}", cb.PdfWriter.CurrentPageNumber);
if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination()) if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination())
@ -917,7 +972,7 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + YTopMost; yPageStart = yTopMargin + YTopMost;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); 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 "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) if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader)
{ {
@ -929,7 +984,31 @@ namespace Volian.Print.Library
case 2: // Break within a Step case 2: // Break within a Step
OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin);
docstyle = MyItemInfo.MyDocStyle; 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(); cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber);
ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin);
@ -967,7 +1046,7 @@ namespace Volian.Print.Library
yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch; yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
if (EmptyTopMostPart) yPageStart += SixLinesPerInch; 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 "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader)
@ -977,6 +1056,17 @@ namespace Volian.Print.Library
} }
MyPageHelper.YMultiplier = 1; 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. // 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) if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{ {
@ -1055,6 +1145,20 @@ namespace Volian.Print.Library
MyPageHelper.ParaBreaks.RemoveAt(0); MyPageHelper.ParaBreaks.RemoveAt(0);
yPageStart = yTopMargin + YTop; 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); yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
// If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update // If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update
// yPageStart for the AER (left column). // yPageStart for the AER (left column).
@ -1133,7 +1237,7 @@ namespace Volian.Print.Library
return yPageStart; 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; string myMsg = docstyle.Continue.Top.Message;
MyPageHelper.TopMessageR = null; MyPageHelper.TopMessageR = null;
@ -1186,6 +1290,27 @@ namespace Volian.Print.Library
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray())); myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()));
if (myMsg.IndexOf(@"%c") > -1) if (myMsg.IndexOf(@"%c") > -1)
myMsg = myMsg.Replace(@"%c", " "); 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) 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); 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 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; string myMsg = docstyle.Continue.Bottom.Message;
@ -1248,6 +1373,9 @@ namespace Volian.Print.Library
case E_ContBottomLoc.BelowBottom1: case E_ContBottomLoc.BelowBottom1:
msg_yLocation = msg_yLocation + yBtmMarginForMsg; msg_yLocation = msg_yLocation + yBtmMarginForMsg;
break; 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 case E_ContBottomLoc.EndOfText2: // Like EndOfText but limited within yBottomMargin
msg_yLocation = Math.Max(msg_yLocation + yLocation - SixLinesPerInch, yBottomMargin + SixLinesPerInch); msg_yLocation = Math.Max(msg_yLocation + yLocation - SixLinesPerInch, yBottomMargin + SixLinesPerInch);
break; break;
@ -1264,7 +1392,25 @@ namespace Volian.Print.Library
if (!PageBreakOnStep) if (!PageBreakOnStep)
{ {
float xoffB = 0; 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 // The following line was added for McGuire APs/AP/1/5500/12, Step 13
//if (msg_yLocation < yBottomMargin + SixLinesPerInch) msg_yLocation = yBottomMargin + SixLinesPerInch; //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) 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; float yOffOrig = yoff;
BuildPlacekeeper(parent, itemInfo); BuildPlacekeeper(parent, itemInfo);
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
@ -1747,7 +1904,7 @@ namespace Volian.Print.Library
if (itemInfo.IsInRNO) if (itemInfo.IsInRNO)
{ {
XOffset = MyTopRNO.MyTab != null ? MyTopRNO.MyTab.XOffset : MyTopRNO.XOffset; 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 else
{ {
@ -1763,7 +1920,7 @@ namespace Volian.Print.Library
float yoffLeft = yoff; float yoffLeft = yoff;
if (ChildrenAbove != null) if (ChildrenAbove != null)
ChildrenAbove.StepDesignator = null; //reset StepDesignator 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) if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{ {
@ -2029,6 +2186,11 @@ namespace Volian.Print.Library
} }
else 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) //if (itemInfo.IsSection)
// Rtf = GetRtf(itemInfo, prefix, " (Continued)"); // Rtf = GetRtf(itemInfo, prefix, " (Continued)");
//else //else
@ -2107,6 +2269,7 @@ namespace Volian.Print.Library
// y direction (bottommost) across the row. // 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)) 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); 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 // 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. // text) for wcn checklist, i.e.
if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step 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(); CheckOff co = itemInfo.GetCheckOffStep();
if (co != null) if (co != null)
{ {
@ -2257,6 +2444,13 @@ namespace Volian.Print.Library
yoff += mySep.Height;// +SixLinesPerInch; 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.Steps != null && printsteps)
{ {
if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight") if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight")
@ -2295,6 +2489,16 @@ namespace Volian.Print.Library
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; 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) private void AdjustYOffset(float yDelta)
{ {
YOffset -= yDelta; YOffset -= yDelta;
@ -2782,7 +2986,16 @@ namespace Volian.Print.Library
if (!itemInfo.IsTable && StepRTB.MyFontFamily != null) if (!itemInfo.IsTable && StepRTB.MyFontFamily != null)
myFont = new System.Drawing.Font(StepRTB.MyFontFamily, myFont.Size, myFont.Style); 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) if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout)
{ {
myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline); 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; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
return; 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; float childindent = itemInfo.MyParent.FormatStepData.ChildIndent ?? 0;
if (myTab != null) if (myTab != null)
@ -3143,6 +3356,30 @@ namespace Volian.Print.Library
} }
if (itemInfo.IsHigh) 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 x = 0;
float xoff = 0; float xoff = 0;
if ((colOvrd ?? 0) != 0) if ((colOvrd ?? 0) != 0)
@ -3536,7 +3773,8 @@ namespace Volian.Print.Library
public bool UseTemplateKeepOnCurLine(ItemInfo itemInfo) public bool UseTemplateKeepOnCurLine(ItemInfo itemInfo)
{ {
if (!itemInfo.IsStep || !itemInfo.MyDocStyle.ComponentList) return false; 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; return false;
} }
private bool UseTemplateWidthOrXOff(ItemInfo itemInfo) private bool UseTemplateWidthOrXOff(ItemInfo itemInfo)
@ -3549,7 +3787,14 @@ namespace Volian.Print.Library
{ {
ItemInfo useForTemplate = itemInfo.IsHigh ? itemInfo : itemInfo.MyParent; ItemInfo useForTemplate = itemInfo.IsHigh ? itemInfo : itemInfo.MyParent;
int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx(); 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; if (tpIndx > -1) return true;
} }
return false; return false;
@ -3559,6 +3804,20 @@ namespace Volian.Print.Library
int topIndx = itemInfo.GetSmartTemplateTopLevelIndx(); int topIndx = itemInfo.GetSmartTemplateTopLevelIndx();
int tmplIndx = 0; int tmplIndx = 0;
if (itemInfo.MyDocStyle.ComponentList && !itemInfo.IsHigh) if (itemInfo.MyDocStyle.ComponentList && !itemInfo.IsHigh)
{
// 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 // 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 // where the items in the template below the HLS are all paragraphs (the intermediate steps
@ -3567,12 +3826,18 @@ namespace Volian.Print.Library
tmplIndx = itemInfo.MyParent.Ordinal + topIndx; tmplIndx = itemInfo.MyParent.Ordinal + topIndx;
if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0; if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0;
} }
}
else else
{ {
tmplIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type); tmplIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type);
if (tmplIndx == -1) return 0; 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; 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. // 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 return (ncol * itemInfo.FormatStepData.Font.CharsToTwips) + (bGetWidth ? 1 : 0); // + 1 is slight adjustment so column doesn't wrap

View File

@ -135,7 +135,7 @@ namespace Volian.Print.Library
else if (CCCs != IIIs) else if (CCCs != IIIs)
{ {
float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6; 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: // Check the following, it may be needed for FPL:
//origTab1 = origTab1.TrimStart(" ".ToCharArray()); //origTab1 = origTab1.TrimStart(" ".ToCharArray());
// 6 = number of points per character. 4 characters between end of tab and beginning of text // 6 = number of points per character. 4 characters between end of tab and beginning of text