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

@ -33,7 +33,7 @@ namespace VEPROMS.CSLA.Library
{ {
Console.WriteLine("{0} - {1} Items in the dictionary", title, _CacheByPrimaryKey.Count); Console.WriteLine("{0} - {1} Items in the dictionary", title, _CacheByPrimaryKey.Count);
foreach (List<Item> itmlst in _CacheByPrimaryKey.Values) foreach (List<Item> itmlst in _CacheByPrimaryKey.Values)
foreach(Item itm in itmlst) foreach (Item itm in itmlst)
Console.WriteLine("Item {0} UniqueID {1}", itm.ItemID, itm.MyItemUnique); Console.WriteLine("Item {0} UniqueID {1}", itm.ItemID, itm.MyItemUnique);
Console.WriteLine("- - - - - -"); Console.WriteLine("- - - - - -");
} }
@ -199,7 +199,7 @@ namespace VEPROMS.CSLA.Library
using (DocVersion parentItemDV = parentInfoDV.Get()) using (DocVersion parentItemDV = parentInfoDV.Get())
{ {
ItemInfo firstinfo = parentInfoDV.FirstChild(); ItemInfo firstinfo = parentInfoDV.FirstChild();
parentItemDV.MyItem = wasfirstchild?parentInfoDV.Procedures[1].Get():this; parentItemDV.MyItem = wasfirstchild ? parentInfoDV.Procedures[1].Get() : this;
parentItemDV.Save(); parentItemDV.Save();
if (!wasfirstchild && firstinfo != null) if (!wasfirstchild && firstinfo != null)
{ {
@ -236,7 +236,7 @@ namespace VEPROMS.CSLA.Library
//} //}
//private void ShowItemAndSections(string title, ItemInfo pinfo) //private void ShowItemAndSections(string title, ItemInfo pinfo)
//{ //{
// //
// pinfo.ShowThis(title + "-Parent"); // pinfo.ShowThis(title + "-Parent");
// int i=0; // int i=0;
// foreach (ItemInfo child in pinfo.Sections) // foreach (ItemInfo child in pinfo.Sections)
@ -322,9 +322,9 @@ namespace VEPROMS.CSLA.Library
} }
#endregion #endregion
#region ItemInfo #region ItemInfo
public partial class ItemInfo:IVEDrillDownReadOnly public partial class ItemInfo : IVEDrillDownReadOnly
{ {
public bool InList(params int [] IDs) public bool InList(params int[] IDs)
{ {
foreach (int id in IDs) foreach (int id in IDs)
if (id == ItemID) return true; if (id == ItemID) return true;
@ -388,14 +388,14 @@ namespace VEPROMS.CSLA.Library
get { return _Moving; } get { return _Moving; }
set { _Moving = value; } set { _Moving = value; }
} }
public static void RefreshParent(Item tmp,ItemInfo pInfo) public static void RefreshParent(Item tmp, ItemInfo pInfo)
{ {
string key = tmp.ItemID.ToString(); string key = tmp.ItemID.ToString();
ConvertListToDictionary(); ConvertListToDictionary();
if (_CacheByPrimaryKey.ContainsKey(key)) if (_CacheByPrimaryKey.ContainsKey(key))
foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key]) foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key])
{ {
tmpInfo._ActiveParent=pInfo; tmpInfo._ActiveParent = pInfo;
tmpInfo.RefreshItemParts(); tmpInfo.RefreshItemParts();
} }
} }
@ -760,7 +760,7 @@ namespace VEPROMS.CSLA.Library
string suffix = ""; string suffix = "";
foreach (Match m2 in m2s) foreach (Match m2 in m2s)
{ {
int i = ((int) '0') + int.Parse(m2.Groups[2].Value); int i = ((int)'0') + int.Parse(m2.Groups[2].Value);
char c = (char)i; char c = (char)i;
suffix = c.ToString(); suffix = c.ToString();
switch (m2.Groups[1].Value) switch (m2.Groups[1].Value)
@ -794,8 +794,8 @@ namespace VEPROMS.CSLA.Library
} }
private static int CalcStepLevel(ItemInfo item) private static int CalcStepLevel(ItemInfo item)
{ {
if(item == null) return 0; if (item == null) return 0;
int id=0; int id = 0;
// Determines the substep level. // Determines the substep level.
int level = CountLevels(item); int level = CountLevels(item);
@ -828,15 +828,15 @@ namespace VEPROMS.CSLA.Library
// Paginate before first caution, not between cautions. // Paginate before first caution, not between cautions.
else if (item.IsCautionPart) else if (item.IsCautionPart)
{ {
if (item.MyPrevious == null) level-=(1 + firstInc); if (item.MyPrevious == null) level -= (1 + firstInc);
else level+=3; else level += 3;
} }
// Paginate before first note, if the step does not have a caution. // Paginate before first note, if the step does not have a caution.
// Otherwise, try to keep the notes together. // Otherwise, try to keep the notes together.
else if (item.IsNotePart) else if (item.IsNotePart)
{ {
if (parent.Cautions == null && item.MyPrevious == null) level-=(1 + firstInc); if (parent.Cautions == null && item.MyPrevious == null) level -= (1 + firstInc);
else level+=3; else level += 3;
} }
// Try not to paginate on a table. // Try not to paginate on a table.
else if (item.IsTablePart) else if (item.IsTablePart)
@ -844,7 +844,7 @@ namespace VEPROMS.CSLA.Library
level += 2; level += 2;
} }
// For an RNO to the right, make it the same level as the AER item. // For an RNO to the right, make it the same level as the AER item.
else if(item.IsRNOPart) else if (item.IsRNOPart)
{ {
level = (item.ActiveParent as ItemInfo).StepLevel + item.RNOLevel - item.ColumnMode; level = (item.ActiveParent as ItemInfo).StepLevel + item.RNOLevel - item.ColumnMode;
// RHM Change 20140522 // RHM Change 20140522
@ -898,9 +898,9 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
if (MyHeader==null)return false; if (MyHeader == null) return false;
if (MyHeader.CleanText==null) return false; if (MyHeader.CleanText == null) return false;
if (MyHeader.CleanText=="") return false; if (MyHeader.CleanText == "") return false;
return true; return true;
} }
} }
@ -977,19 +977,19 @@ namespace VEPROMS.CSLA.Library
} }
private void SpinThroughChildren() private void SpinThroughChildren()
{ {
if(MyContent.ContentPartCount > 0) if (MyContent.ContentPartCount > 0)
foreach(PartInfo partInfo in MyContent.ContentParts) foreach (PartInfo partInfo in MyContent.ContentParts)
foreach (ItemInfo itemInfo in partInfo.MyItems) foreach (ItemInfo itemInfo in partInfo.MyItems)
itemInfo.SpinThroughChildren(); itemInfo.SpinThroughChildren();
} }
#endregion #endregion
#region LoadAtOnce #region LoadAtOnce
// Method to Get Item and children // Method to Get Item and children
public static ItemInfo GetItemAndChildren(int? itemID,int? parentID) public static ItemInfo GetItemAndChildren(int? itemID, int? parentID)
{ {
try try
{ {
ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new ItemAndChildrenCriteria(itemID,parentID)); ItemInfo tmp = DataPortal.Fetch<ItemInfo>(new ItemAndChildrenCriteria(itemID, parentID));
AddToCache(tmp); AddToCache(tmp);
if (tmp.ErrorMessage == "No Record Found") tmp = null; if (tmp.ErrorMessage == "No Record Found") tmp = null;
return tmp; return tmp;
@ -1041,7 +1041,7 @@ namespace VEPROMS.CSLA.Library
{ {
while (dr.Read()) while (dr.Read())
{ {
if (dr.GetInt32("Level")==0) if (dr.GetInt32("Level") == 0)
{ {
//tmp = itemInfo; //tmp = itemInfo;
ReadData(dr); ReadData(dr);
@ -1337,7 +1337,7 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
return ((IsProcedure || IsSection || IsHigh)?0:(IsRNOPart?1:0)+((ItemInfo)ActiveParent).RNOLevel); return ((IsProcedure || IsSection || IsHigh) ? 0 : (IsRNOPart ? 1 : 0) + ((ItemInfo)ActiveParent).RNOLevel);
} }
} }
public void CheckColumnMode(int itemID) public void CheckColumnMode(int itemID)
@ -1345,20 +1345,25 @@ namespace VEPROMS.CSLA.Library
List<ItemInfo> lst = _CacheByPrimaryKey[itemID.ToString()]; List<ItemInfo> lst = _CacheByPrimaryKey[itemID.ToString()];
foreach (ItemInfo ii in lst) foreach (ItemInfo ii in lst)
{ {
Console.WriteLine("{0} - {1}", ii.MyItemInfoUnique,(ii.ActiveSection as SectionInfo).SectionConfig.Section_ColumnMode); Console.WriteLine("{0} - {1}", ii.MyItemInfoUnique, (ii.ActiveSection as SectionInfo).SectionConfig.Section_ColumnMode);
} }
} }
public int ColumnMode public int ColumnMode
{ {
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)
{ {
SectionInfo si = null; SectionInfo si = null;
if (IsSection) si = this as SectionInfo; if (IsSection) si = this as SectionInfo;
else si = ActiveSection as SectionInfo; else si = ActiveSection as SectionInfo;
if(si == null) if (si == null)
si = SectionInfo.Get(ActiveSection.ItemID); //ActiveSection as SectionInfo; si = SectionInfo.Get(ActiveSection.ItemID); //ActiveSection as SectionInfo;
if (si != null) if (si != null)
{ {
@ -1367,7 +1372,7 @@ namespace VEPROMS.CSLA.Library
return (int)si.SectionConfig.Section_ColumnMode - 1; return (int)si.SectionConfig.Section_ColumnMode - 1;
} }
} }
return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) -1; return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) - 1;
} }
} }
/// <summary> /// <summary>
@ -1417,7 +1422,7 @@ namespace VEPROMS.CSLA.Library
public ItemInfo LastChild(E_FromType partType) public ItemInfo LastChild(E_FromType partType)
{ {
ItemInfoList myitems = Lookup((int)partType); ItemInfoList myitems = Lookup((int)partType);
if (myitems !=null) return myitems[myitems.Count-1]; if (myitems != null) return myitems[myitems.Count - 1];
return null; return null;
} }
public ItemInfo FirstChild(E_FromType partType) public ItemInfo FirstChild(E_FromType partType)
@ -1495,7 +1500,7 @@ namespace VEPROMS.CSLA.Library
get get
{ {
ItemInfo temp = FirstSibling; ItemInfo temp = FirstSibling;
if(temp.ActiveParent.IsDocVersion)return false; if (temp.ActiveParent.IsDocVersion) return false;
if (temp.MyParent.IsSection) return false; // already at hls if (temp.MyParent.IsSection) return false; // already at hls
if (temp.IsProcedure || temp.IsSection) return false; if (temp.IsProcedure || temp.IsSection) return false;
while (((ItemInfo)temp.ActiveParent).IsHigh == false) while (((ItemInfo)temp.ActiveParent).IsHigh == false)
@ -1609,7 +1614,7 @@ namespace VEPROMS.CSLA.Library
else else
_Ordinal = 1; _Ordinal = 1;
} }
return (int) _Ordinal; return (int)_Ordinal;
} }
} }
public string CslaType public string CslaType
@ -1623,11 +1628,10 @@ namespace VEPROMS.CSLA.Library
//string number = cont.Number; //string number = cont.Number;
string number = DisplayNumber; string number = DisplayNumber;
//if (cont.Type >= 20000) number = Ordinal.ToString() + "."; //if (cont.Type >= 20000) number = Ordinal.ToString() + ".";
if (cont.Type >= 20000) number = MyTab==null?"":MyTab.CleanText; if (cont.Type >= 20000) number = MyTab == null ? "" : MyTab.CleanText;
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)
//{ //{
@ -1650,16 +1654,16 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
if (_SearchPath==null) if (_SearchPath == null)
{ {
if (IsProcedure) if (IsProcedure)
_SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText ; _SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText;
else if (IsSection) else if (IsSection)
_SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText; _SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText;
else else
{ {
PartInfo myPart = FirstSibling.ItemPartCount > 0 ? FirstSibling.ItemParts[0] : null; PartInfo myPart = FirstSibling.ItemPartCount > 0 ? FirstSibling.ItemParts[0] : null;
if(myPart != null) if (myPart != null)
_SearchPath = myPart.SearchPath + (!IsHigh ? "." : "\u0007") + Ordinal.ToString(); _SearchPath = myPart.SearchPath + (!IsHigh ? "." : "\u0007") + Ordinal.ToString();
else else
_SearchPath = ActiveParent.SearchPath + (!IsHigh ? "." : "\u0007") + Ordinal.ToString(); _SearchPath = ActiveParent.SearchPath + (!IsHigh ? "." : "\u0007") + Ordinal.ToString();
@ -1801,7 +1805,7 @@ namespace VEPROMS.CSLA.Library
retval = StripRtfFormatting(retval); retval = StripRtfFormatting(retval);
retval = StripLinks(retval); retval = StripLinks(retval);
retval = ReplaceSpecialCharacters(retval); retval = ReplaceSpecialCharacters(retval);
retval = retval.Replace("\u2011","-"); retval = retval.Replace("\u2011", "-");
retval = retval.Replace("\r\n", ";"); retval = retval.Replace("\r\n", ";");
retval = retval.Replace("\n", ";"); //added for consistency checking with approved version retval = retval.Replace("\n", ";"); //added for consistency checking with approved version
return retval; return retval;
@ -1835,7 +1839,7 @@ namespace VEPROMS.CSLA.Library
private static string ReplaceSpecialCharacter(Match m) private static string ReplaceSpecialCharacter(Match m)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int i = int.Parse(m.ToString().Substring(2,m.ToString().Length-3)); int i = int.Parse(m.ToString().Substring(2, m.ToString().Length - 3));
sb.Append((char)i); sb.Append((char)i);
return sb.ToString(); return sb.ToString();
} }
@ -1905,7 +1909,7 @@ namespace VEPROMS.CSLA.Library
case 2: // step types case 2: // step types
int typindx = type - 20000; // what to do for other types rather than steps int typindx = type - 20000; // what to do for other types rather than steps
font = format.PlantFormat.FormatData.StepDataList[typindx].Font; font = format.PlantFormat.FormatData.StepDataList[typindx].Font;
if (typindx == _ParagraphType) font = AdjustForTextSubFollowsTextStyle(format,typindx,font); if (typindx == _ParagraphType) font = AdjustForTextSubFollowsTextStyle(format, typindx, font);
if (IsRNOPart && MyParent.IsHigh && FormatStepData.BoldHighLevel) font = BoldTextStyle(font); if (IsRNOPart && MyParent.IsHigh && FormatStepData.BoldHighLevel) font = BoldTextStyle(font);
break; break;
} }
@ -1918,13 +1922,13 @@ namespace VEPROMS.CSLA.Library
} }
private VE_Font BoldTextStyle(VE_Font font) private VE_Font BoldTextStyle(VE_Font font)
{ {
E_Style myStyle = (E_Style) font.Style; E_Style myStyle = (E_Style)font.Style;
myStyle |= E_Style.Bold; myStyle |= E_Style.Bold;
if (myStyle != font.Style) if (myStyle != font.Style)
font = new VE_Font(font.Family, (int)font.Size, myStyle, (float)font.CPI); font = new VE_Font(font.Family, (int)font.Size, myStyle, (float)font.CPI);
return font; return font;
} }
private const int _ParagraphType=24; private const int _ParagraphType = 24;
protected VE_Font AdjustForTextSubFollowsTextStyle(VE_Font font) protected VE_Font AdjustForTextSubFollowsTextStyle(VE_Font font)
{ {
return AdjustForTextSubFollowsTextStyle(ActiveFormat, this.FormatStepType, font); return AdjustForTextSubFollowsTextStyle(ActiveFormat, this.FormatStepType, font);
@ -1938,7 +1942,7 @@ namespace VEPROMS.CSLA.Library
bool isMmBold = (myFormatStepData.Font.Style & E_Style.MmBold) > 0; bool isMmBold = (myFormatStepData.Font.Style & E_Style.MmBold) > 0;
myFormatStepData = format.PlantFormat.FormatData.StepDataList[ParentNoteOrCaution.FormatStepType]; myFormatStepData = format.PlantFormat.FormatData.StepDataList[ParentNoteOrCaution.FormatStepType];
font = myFormatStepData.Font; font = myFormatStepData.Font;
E_Style myStyle = (E_Style) font.Style; E_Style myStyle = (E_Style)font.Style;
myStyle ^= (myStyle & E_Style.Bold); myStyle ^= (myStyle & E_Style.Bold);
myStyle ^= (myStyle & E_Style.MmBold); myStyle ^= (myStyle & E_Style.MmBold);
myStyle |= isBold ? E_Style.Bold : 0; myStyle |= isBold ? E_Style.Bold : 0;
@ -2022,7 +2026,7 @@ namespace VEPROMS.CSLA.Library
{ {
get get
{ {
string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((DisplayNumber ?? "")==""? DisplayText: DisplayNumber)); string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((DisplayNumber ?? "") == "" ? DisplayText : DisplayNumber));
ItemInfo parent = this; ItemInfo parent = this;
while (parent.MyPrevious != null) parent = parent.MyPrevious; while (parent.MyPrevious != null) parent = parent.MyPrevious;
if (parent.ItemPartCount == 0) if (parent.ItemPartCount == 0)
@ -2046,7 +2050,7 @@ namespace VEPROMS.CSLA.Library
else else
{ {
PartInfo partInfo = parent.ItemParts[0]; PartInfo partInfo = parent.ItemParts[0];
return partInfo.MyContent.ContentItems.Items[0].ShortPath + "." + ((E_FromType)partInfo.FromType).ToString().Substring(0,1) + number; return partInfo.MyContent.ContentItems.Items[0].ShortPath + "." + ((E_FromType)partInfo.FromType).ToString().Substring(0, 1) + number;
} }
} }
} }
@ -2105,7 +2109,7 @@ namespace VEPROMS.CSLA.Library
foreach (PartInfo partInfo in MyContent.ContentParts) foreach (PartInfo partInfo in MyContent.ContentParts)
if (partInfo.FromType == fromType) if (partInfo.FromType == fromType)
{ {
if(LoadAllAtOnce) if (LoadAllAtOnce)
itemInfoList = partInfo._MyItems;// = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType); itemInfoList = partInfo._MyItems;// = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType);
else else
itemInfoList = partInfo._MyItems = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType); itemInfoList = partInfo._MyItems = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType);
@ -2143,25 +2147,25 @@ namespace VEPROMS.CSLA.Library
} }
private ItemInfoList _Procedures; private ItemInfoList _Procedures;
public ItemInfoList Procedures public ItemInfoList Procedures
{ get { return Lookup(1,ref _Procedures); } } { get { return Lookup(1, ref _Procedures); } }
private ItemInfoList _Sections; private ItemInfoList _Sections;
public ItemInfoList Sections public ItemInfoList Sections
{ get { return Lookup(2,ref _Sections); } } { get { return Lookup(2, ref _Sections); } }
private ItemInfoList _Cautions; private ItemInfoList _Cautions;
public ItemInfoList Cautions public ItemInfoList Cautions
{ get { return Lookup(3,ref _Cautions); } } { get { return Lookup(3, ref _Cautions); } }
private ItemInfoList _Notes; private ItemInfoList _Notes;
public ItemInfoList Notes public ItemInfoList Notes
{ get { return Lookup(4,ref _Notes); } } { get { return Lookup(4, ref _Notes); } }
private ItemInfoList _RNOs; private ItemInfoList _RNOs;
public ItemInfoList RNOs public ItemInfoList RNOs
{ get { return Lookup(5,ref _RNOs); } } { get { return Lookup(5, ref _RNOs); } }
private ItemInfoList _Steps; private ItemInfoList _Steps;
public ItemInfoList Steps public ItemInfoList Steps
{ get { return Lookup(6,ref _Steps); } } { get { return Lookup(6, ref _Steps); } }
private ItemInfoList _Tables; private ItemInfoList _Tables;
public ItemInfoList Tables public ItemInfoList Tables
{ get { return Lookup(7,ref _Tables); } } { get { return Lookup(7, ref _Tables); } }
//public void ResetChildren() //public void ResetChildren()
//{ //{
// _Procedures = null; // _Procedures = null;
@ -2229,9 +2233,9 @@ namespace VEPROMS.CSLA.Library
{ {
if (MyContent.MyEntry == null) if (MyContent.MyEntry == null)
{ {
if(DisplayNumber == string.Empty) if (DisplayNumber == string.Empty)
return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "..."; return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "...";
return DisplayNumber.Replace("\u2011","-"); return DisplayNumber.Replace("\u2011", "-");
} }
if (MyContent.Number != "") // Add LIB to the Section Number if (MyContent.Number != "") // Add LIB to the Section Number
return ((MyContent.MyEntry.MyDocument.LibTitle ?? "") == "" ? "" : "\u1D38\u1D35\u1D2E ") + DisplayNumber; return ((MyContent.MyEntry.MyDocument.LibTitle ?? "") == "" ? "" : "\u1D38\u1D35\u1D2E ") + DisplayNumber;
@ -2242,7 +2246,7 @@ namespace VEPROMS.CSLA.Library
} }
if (DisplayText.Length <= 10) if (DisplayText.Length <= 10)
return DisplayText.Replace("\u2011", "-"); return DisplayText.Replace("\u2011", "-");
return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0]+ "..."; return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "...";
} }
} }
#endregion #endregion
@ -2300,8 +2304,8 @@ namespace VEPROMS.CSLA.Library
} }
else // Steps and Sections only else // Steps and Sections only
{ {
for(int i = 0;i<_PartInfoList.Count;i++) for (int i = 0; i < _PartInfoList.Count; i++)
if(_PartInfoList[i].ToString() == "Sections" || _PartInfoList[i].ToString() == "Steps") if (_PartInfoList[i].ToString() == "Sections" || _PartInfoList[i].ToString() == "Steps")
return _PartInfoList[i].GetChildren(); return _PartInfoList[i].GetChildren();
return null; return null;
} }
@ -2360,7 +2364,7 @@ namespace VEPROMS.CSLA.Library
if (IsHigh) _MyHLS = this; if (IsHigh) _MyHLS = this;
else else
{ {
if(MyActiveParent is ItemInfo) if (MyActiveParent is ItemInfo)
_MyHLS = ((ItemInfo)MyActiveParent).MyHLS; _MyHLS = ((ItemInfo)MyActiveParent).MyHLS;
} }
} }
@ -2422,7 +2426,7 @@ namespace VEPROMS.CSLA.Library
int itemID = 0; int itemID = 0;
if (parentContent.ContentItems.Count == 0) if (parentContent.ContentItems.Count == 0)
parentContent.RefreshContentItems(); parentContent.RefreshContentItems();
using(ItemInfoList list = parentContent.ContentItems) using (ItemInfoList list = parentContent.ContentItems)
itemID = list[0].ItemID; itemID = list[0].ItemID;
if (itemID == 0) if (itemID == 0)
_ActiveParent = this; _ActiveParent = this;
@ -2495,7 +2499,7 @@ namespace VEPROMS.CSLA.Library
get get
{ {
//if (_ActiveFormat == null) // jsj added check for NULL ActiveParent //if (_ActiveFormat == null) // jsj added check for NULL ActiveParent
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null)? ActiveParent.ActiveFormat : null); _ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null) ? ActiveParent.ActiveFormat : null);
//Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name); //Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
return _ActiveFormat; return _ActiveFormat;
} }
@ -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
@ -2659,7 +2665,7 @@ namespace VEPROMS.CSLA.Library
string cltext = null; string cltext = null;
int stepType = (int)(MyContent.Type % 10000); int stepType = (int)(MyContent.Type % 10000);
string tbformat; string tbformat;
if((ActiveFormat.MyStepSectionLayoutData.UseRNOParentIdent ?? "") != "" && bool.Parse(ActiveFormat.MyStepSectionLayoutData.UseRNOParentIdent)) if ((ActiveFormat.MyStepSectionLayoutData.UseRNOParentIdent ?? "") != "" && bool.Parse(ActiveFormat.MyStepSectionLayoutData.UseRNOParentIdent))
tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint == "" ? this.MyParent.FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint == "" ? this.MyParent.FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint;
else else
tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint;
@ -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}"))
{ {
@ -2782,7 +2787,7 @@ namespace VEPROMS.CSLA.Library
// the ident of the step: // the ident of the step:
bool useSubStepTabs = false; bool useSubStepTabs = false;
if (doMeta && IsHigh if (doMeta && IsHigh
&& !seqtabs[(localPrintLevel<0?0:localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}") && !seqtabs[(localPrintLevel < 0 ? 0 : localPrintLevel) % seqtabs.Count].TabToken.Contains("{numericWpar}")
&& tbformat.Contains("{")) useSubStepTabs = true; && tbformat.Contains("{")) useSubStepTabs = true;
// Check to be sure the parent tab should be included... If this sequential is within a note // Check to be sure the parent tab should be included... If this sequential is within a note
@ -2875,7 +2880,7 @@ namespace VEPROMS.CSLA.Library
if (!(((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && this.MyHLS.MyContent.Type == 20002)) if (!(((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && this.MyHLS.MyContent.Type == 20002))
{ {
int indxlb = tbformat.IndexOf("#"); int indxlb = tbformat.IndexOf("#");
string ofst = tbformat.Substring(indxlb+1, 3); string ofst = tbformat.Substring(indxlb + 1, 3);
_MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CharsToTwips; _MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CharsToTwips;
} }
tbformat = tbformat.Replace("#2#", "").Replace("#1#", ""); tbformat = tbformat.Replace("#2#", "").Replace("#1#", "");
@ -2884,12 +2889,13 @@ namespace VEPROMS.CSLA.Library
{ {
int begPos = tbformat.IndexOf("{Pos"); int begPos = tbformat.IndexOf("{Pos");
int endPos = tbformat.IndexOf("}"); int endPos = tbformat.IndexOf("}");
string ofst = tbformat.Substring(begPos + 4, endPos-begPos-4); string ofst = tbformat.Substring(begPos + 4, endPos - begPos - 4);
_MyTab.Position = -(Convert.ToInt32(ofst) * (int)FormatStepData.TabData.Font.CPI); _MyTab.Position = -(Convert.ToInt32(ofst) * (int)FormatStepData.TabData.Font.CPI);
tbformat = tbformat.Remove(begPos,endPos+1); tbformat = tbformat.Remove(begPos, endPos + 1);
} }
// 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
@ -2907,7 +2913,7 @@ namespace VEPROMS.CSLA.Library
tbformat = tbformat.Replace("{alpha}", alpha.ToLower()); tbformat = tbformat.Replace("{alpha}", alpha.ToLower());
tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower()); tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower());
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && tbformat.Contains("{ALPHA}") && alpha.Length > 1) if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert && tbformat.Contains("{ALPHA}") && alpha.Length > 1)
tbformat = tbformat.Replace("{ALPHA}. ", alpha+"."); // if double chars, remove one of the space for BGE tbformat = tbformat.Replace("{ALPHA}. ", alpha + "."); // if double chars, remove one of the space for BGE
else else
tbformat = tbformat.Replace("{ALPHA}", alpha); tbformat = tbformat.Replace("{ALPHA}", alpha);
@ -2917,7 +2923,7 @@ namespace VEPROMS.CSLA.Library
string roman = RomanNumbering(ordinal); string roman = RomanNumbering(ordinal);
tbformat = tbformat.Replace("{roman}", roman.ToLower()); tbformat = tbformat.Replace("{roman}", roman.ToLower());
tbformat = tbformat.Replace("{ROMAN}", roman); tbformat = tbformat.Replace("{ROMAN}", roman);
tbformat = tbformat.Substring(0, tbformat.Length - ((roman.Length - 1)>0?(roman.Length - 1):0)); tbformat = tbformat.Substring(0, tbformat.Length - ((roman.Length - 1) > 0 ? (roman.Length - 1) : 0));
} }
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.VirtualDotInHLSTab && tbformat.Contains("numeric") & ordinal > 9) _MyTab.AdjustTabSpace = true; if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.VirtualDotInHLSTab && tbformat.Contains("numeric") & ordinal > 9) _MyTab.AdjustTabSpace = true;
if (tbformat.Contains("{numeric}") && ((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && MyContent.Type == 20002) if (tbformat.Contains("{numeric}") && ((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && MyContent.Type == 20002)
@ -2929,18 +2935,18 @@ namespace VEPROMS.CSLA.Library
// otherwise add a space. // otherwise add a space.
if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat && IsBackgroundStep()) if (ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat && IsBackgroundStep())
{ {
string stpTab = (!tbformat.Contains(".")?" ":"") + ordinal.ToString(); string stpTab = (!tbformat.Contains(".") ? " " : "") + ordinal.ToString();
tbformat = tbformat.Replace("{numeric}", stpTab); tbformat = tbformat.Replace("{numeric}", stpTab);
} }
else else
tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2,'0') : ordinal.ToString().PadLeft(2)); tbformat = tbformat.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
if (tbformate != null) tbformate = tbformate.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2)); if (tbformate != null) tbformate = tbformate.Replace("{numeric}", trimTabStart ? ordinal.ToString() : FormatStepData.AtLeastTwoDigits ? ordinal.ToString().PadLeft(2, '0') : ordinal.ToString().PadLeft(2));
tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString()); tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString());
if (tbformat.Contains("{asterisk}")) if (tbformat.Contains("{asterisk}"))
{ {
// if this has a checkoff - need to set location of the asterisk - because the asterisk has to come before // if this has a checkoff - need to set location of the asterisk - because the asterisk has to come before
// the checkoff. Otherwise, it doesn't matter // the checkoff. Otherwise, it doesn't matter
_MyTab.AsteriskOffset = - 10; _MyTab.AsteriskOffset = -10;
tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this. tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this.
} }
int macroindx = tbformat.IndexOf("{!C"); int macroindx = tbformat.IndexOf("{!C");
@ -2980,7 +2986,7 @@ namespace VEPROMS.CSLA.Library
// 0 - Left // 0 - Left
// 1 - Right // 1 - Right
// 2 or greater - Center // 2 or greater - Center
int sepLoc = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Location?? 2; //default to Center int sepLoc = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Location ?? 2; //default to Center
switch (sepLoc) switch (sepLoc)
{ {
case 0: case 0:
@ -3027,13 +3033,13 @@ namespace VEPROMS.CSLA.Library
if (newtab.Contains("{numeric}") || newtab.Contains("{LNK Step Num}")) if (newtab.Contains("{numeric}") || newtab.Contains("{LNK Step Num}"))
{ {
newtab = tbformat; newtab = tbformat;
newtab = @"\ul " + newtab.Substring(0,newtab.IndexOf(":")+1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":")+1); newtab = @"\ul " + newtab.Substring(0, newtab.IndexOf(":") + 1) + @"\ulnone " + newtab.Substring(newtab.IndexOf(":") + 1);
} }
// also see if there is the 'pagelist' string in this tab: // also see if there is the 'pagelist' string in this tab:
else if ((FormatStepData.TabData.Font.Style & E_Style.Underline) == E_Style.Underline) else if ((FormatStepData.TabData.Font.Style & E_Style.Underline) == E_Style.Underline)
// the reason that the underline commands were not included in format file is that the '\' character // the reason that the underline commands were not included in format file is that the '\' character
// is used as a separator and the following code will not impact other formats // is used as a separator and the following code will not impact other formats
HighLevelStepTabPageList = @"\ul " + FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab).Trim() + @"\ulnone " + (tbformat.StartsWith(" ")?"":" ") + tbformat; HighLevelStepTabPageList = @"\ul " + FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab).Trim() + @"\ulnone " + (tbformat.StartsWith(" ") ? "" : " ") + tbformat;
else else
HighLevelStepTabPageList = FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab) + tbformat; HighLevelStepTabPageList = FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab) + tbformat;
_MyTab.AltPrintTab = newtab; _MyTab.AltPrintTab = newtab;
@ -3078,7 +3084,7 @@ namespace VEPROMS.CSLA.Library
private string GetToken(string tbformat) private string GetToken(string tbformat)
{ {
int stindx = tbformat.IndexOf("{"); int stindx = tbformat.IndexOf("{");
return (tbformat.Substring(stindx, tbformat.IndexOf("}")-stindx+1)); return (tbformat.Substring(stindx, tbformat.IndexOf("}") - stindx + 1));
} }
public int GetStepLevel() // ref int bias) public int GetStepLevel() // ref int bias)
@ -3102,7 +3108,7 @@ namespace VEPROMS.CSLA.Library
// If high level RNOs are numbered, use the next level of tabs for lower // If high level RNOs are numbered, use the next level of tabs for lower
// level RNOs - unless DontOffsetTab format flag is set // level RNOs - unless DontOffsetTab format flag is set
if (LastRNO != null && LastRNO.IsHigh && TopRNO.FormatStepData.NumberHighLevel && TopRNO.FormatStepData.OffsetTab) if (LastRNO != null && LastRNO.IsHigh && TopRNO.FormatStepData.NumberHighLevel && TopRNO.FormatStepData.OffsetTab)
OffsetTab = TopRNO.FormatStepData.NumberHighLevel?1:0; OffsetTab = TopRNO.FormatStepData.NumberHighLevel ? 1 : 0;
_PrintBias = 0; _PrintBias = 0;
if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}")) if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}"))
level--; level--;
@ -3256,7 +3262,7 @@ namespace VEPROMS.CSLA.Library
if (FormatStepData.TabData.Justify == "Center") if (FormatStepData.TabData.Justify == "Center")
{ {
_MyHeader.Justify = ContentAlignment.MiddleCenter; _MyHeader.Justify = ContentAlignment.MiddleCenter;
_MyHeader.Text = (!FormatStepData.TabData.NoTrim)?tbformat.Replace("\\xA0"," ").Trim():tbformat.Replace("\\xA0"," "); _MyHeader.Text = (!FormatStepData.TabData.NoTrim) ? tbformat.Replace("\\xA0", " ").Trim() : tbformat.Replace("\\xA0", " ");
_MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text); _MyHeader.CleanText = StripRtfFormatting(_MyHeader.Text);
// if there is only step in the group or we have a change in step type (caution/note) when there is // if there is only step in the group or we have a change in step type (caution/note) when there is
// use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab // use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab
@ -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;
} }
@ -3383,7 +3398,7 @@ namespace VEPROMS.CSLA.Library
//if ((FormatStepData.TabData.Font.Style & E_Style.Italics) > 0) style |= FontStyle.Italic; //if ((FormatStepData.TabData.Font.Style & E_Style.Italics) > 0) style |= FontStyle.Italic;
//_MyTab.MyFont.WindowsFont = new Font(FormatStepData.TabData.Font.WindowsFont.FontFamily, FormatStepData.TabData.Font.WindowsFont.Size, style); //_MyTab.MyFont.WindowsFont = new Font(FormatStepData.TabData.Font.WindowsFont.FontFamily, FormatStepData.TabData.Font.WindowsFont.Size, style);
// clear the underlining for this tab's font: // clear the underlining for this tab's font:
E_Style es = ((E_Style)_MyTab.MyFont.Style) &~ E_Style.Underline; E_Style es = ((E_Style)_MyTab.MyFont.Style) & ~E_Style.Underline;
_MyTab.MyFont = new VE_Font(_MyTab.MyFont.Family, (int)_MyTab.MyFont.Size, es, (float)_MyTab.MyFont.CPI); _MyTab.MyFont = new VE_Font(_MyTab.MyFont.Family, (int)_MyTab.MyFont.Size, es, (float)_MyTab.MyFont.CPI);
return true; return true;
} }
@ -3400,7 +3415,7 @@ namespace VEPROMS.CSLA.Library
return retval; return retval;
} }
// Westinghouse and 16bit had 'AA', 'BB', etc. Logic supports unlimited cases ('aa','aaa','aaaa', etc.) // Westinghouse and 16bit had 'AA', 'BB', etc. Logic supports unlimited cases ('aa','aaa','aaaa', etc.)
retval = retval.PadRight(1 + ((number-1)/26), Letter(1 + ((number - 1) % 26))[0]); retval = retval.PadRight(1 + ((number - 1) / 26), Letter(1 + ((number - 1) % 26))[0]);
return retval; return retval;
} }
private string Letter(int number) private string Letter(int number)
@ -3463,7 +3478,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (parent.IsCautionPart || parent.IsNotePart) if (parent.IsCautionPart || parent.IsNotePart)
_ParentNoteOrCaution = parent; _ParentNoteOrCaution = parent;
else if(!parent.IsHigh) else if (!parent.IsHigh)
{ {
_ParentNoteOrCaution = parent.ParentNoteOrCaution; _ParentNoteOrCaution = parent.ParentNoteOrCaution;
} }
@ -3505,7 +3520,7 @@ namespace VEPROMS.CSLA.Library
bool addToList = true; bool addToList = true;
if (macro.NotInRNO && IsInRNO) addToList = false; if (macro.NotInRNO && IsInRNO) addToList = false;
if (((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_DontDoCheckOffs) == E_DocStructStyle.DSS_DontDoCheckOffs) && if (((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_DontDoCheckOffs) == E_DocStructStyle.DSS_DontDoCheckOffs) &&
macro.Name.ToUpper()=="CHECKOFF") addToList = false; macro.Name.ToUpper() == "CHECKOFF") addToList = false;
if (macro.Grouping != null && macro.Grouping > 0) if (macro.Grouping != null && macro.Grouping > 0)
{ {
int count = 0; int count = 0;
@ -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;
@ -3634,7 +3726,7 @@ namespace VEPROMS.CSLA.Library
{ {
if (!IsStep) return null; if (!IsStep) return null;
if (SectionDefaultEnabled) return SectionDefaultEnabledCheckOff; if (SectionDefaultEnabled) return SectionDefaultEnabledCheckOff;
if(!SectionHasCheckOffs()) return null; if (!SectionHasCheckOffs()) return null;
int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined
if (stpCoIndx == -1) return null; if (stpCoIndx == -1) return null;
if (stpCoIndx > 1) return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; if (stpCoIndx > 1) return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx];
@ -3714,6 +3806,7 @@ namespace VEPROMS.CSLA.Library
} }
} }
#endregion #endregion
} }
#endregion ItemInfo #endregion ItemInfo
#region Tab #region Tab
@ -3818,11 +3911,11 @@ namespace VEPROMS.CSLA.Library
} }
} }
public static ItemInfoList GetList(int? itemID,int type) public static ItemInfoList GetList(int? itemID, int type)
{ {
try try
{ {
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListCriteria(itemID,type)); ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListCriteria(itemID, type));
ItemInfo.AddList(tmp); ItemInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
#if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList #if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList
@ -3910,7 +4003,7 @@ namespace VEPROMS.CSLA.Library
[Serializable()] [Serializable()]
private class ItemListCriteria private class ItemListCriteria
{ {
public ItemListCriteria(int? itemID,int type) public ItemListCriteria(int? itemID, int type)
{ {
_ItemID = itemID; _ItemID = itemID;
_Type = type; _Type = type;
@ -4156,7 +4249,7 @@ namespace VEPROMS.CSLA.Library
#else #else
cm.CommandText = "getItemsByPartType"; cm.CommandText = "getItemsByPartType";
#endif #endif
cm.Parameters.AddWithValue("@FromType", (int) criteria.Type); cm.Parameters.AddWithValue("@FromType", (int)criteria.Type);
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {
@ -4201,7 +4294,7 @@ namespace VEPROMS.CSLA.Library
{ {
try try
{ {
ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters,unitPrefix)); ItemInfoList tmp = DataPortal.Fetch<ItemInfoList>(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters, unitPrefix));
ItemInfo.AddList(tmp); ItemInfo.AddList(tmp);
tmp.AddEvents(); tmp.AddEvents();
return tmp; return tmp;
@ -4291,7 +4384,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@StepTypeList", criteria.StepTypeList); cm.Parameters.AddWithValue("@StepTypeList", criteria.StepTypeList);
cm.Parameters.AddWithValue("@SearchString", criteria.SearchString); cm.Parameters.AddWithValue("@SearchString", criteria.SearchString);
cm.Parameters.AddWithValue("@CaseSensitive", criteria.CaseSensitive); cm.Parameters.AddWithValue("@CaseSensitive", criteria.CaseSensitive);
cm.Parameters.AddWithValue("@IncludeLinks", (int) criteria.IncludeLinks); cm.Parameters.AddWithValue("@IncludeLinks", (int)criteria.IncludeLinks);
cm.Parameters.AddWithValue("@IncludeRtfFormatting", criteria.IncludeRtfFormatting ? 1 : 0); cm.Parameters.AddWithValue("@IncludeRtfFormatting", criteria.IncludeRtfFormatting ? 1 : 0);
cm.Parameters.AddWithValue("@IncludeSpecialCharacters", criteria.IncludeSpecialCharacters ? 1 : 0); cm.Parameters.AddWithValue("@IncludeSpecialCharacters", criteria.IncludeSpecialCharacters ? 1 : 0);
cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix); cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix);
@ -4718,7 +4811,7 @@ namespace VEPROMS.CSLA.Library
get { return _ApplicabilityUnit; } get { return _ApplicabilityUnit; }
set { _ApplicabilityUnit = value; } set { _ApplicabilityUnit = value; }
} }
public TransitionLookup(int applicabilityUnit, int procID, Dictionary<int,ItemInfo> mylookup) public TransitionLookup(int applicabilityUnit, int procID, Dictionary<int, ItemInfo> mylookup)
{ {
_MyLookups = new Dictionary<int, Dictionary<int, ItemInfo>>(); _MyLookups = new Dictionary<int, Dictionary<int, ItemInfo>>();
_MyLookups.Add(procID, mylookup); _MyLookups.Add(procID, mylookup);
@ -4764,7 +4857,7 @@ namespace VEPROMS.CSLA.Library
get get
{ {
string slashReplace = this.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_"; string slashReplace = this.ActiveFormat.PlantFormat.FormatData.PrintData.SlashReplace ?? "_";
return DisplayNumber.Replace("/", slashReplace).Replace("\\", slashReplace).Replace("*","Master"); return DisplayNumber.Replace("/", slashReplace).Replace("\\", slashReplace).Replace("*", "Master");
} }
} }
private DateTime? _ChangeBarDate = null; private DateTime? _ChangeBarDate = null;
@ -4841,7 +4934,7 @@ namespace VEPROMS.CSLA.Library
} }
public new Procedure Get() public new Procedure Get()
{ {
return (Procedure) (_Editable = Procedure.Get(ItemID)); return (Procedure)(_Editable = Procedure.Get(ItemID));
} }
public static void RefreshPageNumTransitions(ProcedureInfo tmp) public static void RefreshPageNumTransitions(ProcedureInfo tmp)
{ {
@ -5010,7 +5103,7 @@ namespace VEPROMS.CSLA.Library
this.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); this.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
} }
return _ProcedureConfig; return _ProcedureConfig;
// return (_ProcedureConfig != null ? _ProcedureConfig : _ProcedureConfig = new ProcedureConfig(this)); // return (_ProcedureConfig != null ? _ProcedureConfig : _ProcedureConfig = new ProcedureConfig(this));
} }
} }
@ -5021,7 +5114,7 @@ namespace VEPROMS.CSLA.Library
#endregion #endregion
public new ConfigDynamicTypeDescriptor MyConfig public new ConfigDynamicTypeDescriptor MyConfig
{ {
get { return ProcedureConfig ; } get { return ProcedureConfig; }
set { _ProcedureConfig = null; } set { _ProcedureConfig = null; }
} }
public DocVersionInfo MyDocVersion public DocVersionInfo MyDocVersion
@ -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);
@ -5214,7 +5308,7 @@ namespace VEPROMS.CSLA.Library
if (DisplayNumber.LastIndexOf('.') == DisplayNumber.Length - 1) return DisplayNumber; if (DisplayNumber.LastIndexOf('.') == DisplayNumber.Length - 1) return DisplayNumber;
string retStr = null; string retStr = null;
string ch = DisplayNumber != null && DisplayNumber != "" ? DisplayNumber.Substring(0,1) : null; string ch = DisplayNumber != null && DisplayNumber != "" ? DisplayNumber.Substring(0, 1) : null;
int Snum = GetSectionNum(); int Snum = GetSectionNum();
if (Snum == -1) if (Snum == -1)
{ {
@ -5223,7 +5317,7 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
string tmp = DisplayNumber.IndexOf(".")>-1?DisplayNumber.Substring(0,DisplayNumber.IndexOf(".")):DisplayNumber; string tmp = DisplayNumber.IndexOf(".") > -1 ? DisplayNumber.Substring(0, DisplayNumber.IndexOf(".")) : DisplayNumber;
if (underline) if (underline)
retStr = @"\ul " + tmp + "." + Snum.ToString() + @"\ul0 "; retStr = @"\ul " + tmp + "." + Snum.ToString() + @"\ul0 ";
else else
@ -5235,16 +5329,16 @@ namespace VEPROMS.CSLA.Library
private int GetSectionNum() private int GetSectionNum()
{ {
int indx = -1; int indx = -1;
if (DisplayNumber != null && DisplayNumber != "" && (indx = DisplayNumber.IndexOf("."))>-1) if (DisplayNumber != null && DisplayNumber != "" && (indx = DisplayNumber.IndexOf(".")) > -1)
{ {
// if there is a number after the '.', return it as a number. For example if it is 001, return a 1: // if there is a number after the '.', return it as a number. For example if it is 001, return a 1:
string tmpstr = indx+1<DisplayNumber.Length?DisplayNumber.Substring(indx+1):null; string tmpstr = indx + 1 < DisplayNumber.Length ? DisplayNumber.Substring(indx + 1) : null;
// if the section's tab is a letter, we don't want a 0 on the section.... for example A.0. // if the section's tab is a letter, we don't want a 0 on the section.... for example A.0.
if (IsSection && tmpstr == null && System.Char.IsLetter(DisplayNumber.TrimStart(), 0)) return -1; if (IsSection && tmpstr == null && System.Char.IsLetter(DisplayNumber.TrimStart(), 0)) return -1;
if (tmpstr != null && tmpstr.IndexOf('-') >= 0) return -1; if (tmpstr != null && tmpstr.IndexOf('-') >= 0) return -1;
if (tmpstr == null) return 0; if (tmpstr == null) return 0;
Int32 x; Int32 x;
if(Int32.TryParse(tmpstr, out x))return x; if (Int32.TryParse(tmpstr, out x)) return x;
return -1; return -1;
} }
return (-1); return (-1);
@ -5254,7 +5348,7 @@ namespace VEPROMS.CSLA.Library
int indx = DisplayNumber.IndexOf("."); int indx = DisplayNumber.IndexOf(".");
if (indx < 0 || indx + 1 == DisplayNumber.Length) return false; if (indx < 0 || indx + 1 == DisplayNumber.Length) return false;
// for it to be a 'TrueSectionNum', there can be no letters after the '.' // for it to be a 'TrueSectionNum', there can be no letters after the '.'
for (int lindx = indx+1; lindx < DisplayNumber.Length - 1; lindx++) if (DisplayNumber[lindx] < '0' || DisplayNumber[lindx] > '9') return false; for (int lindx = indx + 1; lindx < DisplayNumber.Length - 1; lindx++) if (DisplayNumber[lindx] < '0' || DisplayNumber[lindx] > '9') return false;
return true; return true;
} }
// the following returns the 'index' into the format's CheckOffHeaderList. // the following returns the 'index' into the format's CheckOffHeaderList.
@ -5542,6 +5636,6 @@ namespace VEPROMS.CSLA.Library
{ {
Nothing = 0, Nothing = 0,
Value = 1, Value = 1,
Everything =2 Everything = 2
} }
} }

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
@ -170,7 +170,7 @@ namespace Volian.Print.Library
if (CCCs != IIIs) if (CCCs != IIIs)
{ {
float? tPtPerChar1 = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar; float? tPtPerChar1 = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar;
if (tPtPerChar1!=null) if (tPtPerChar1 != null)
Width = (float)tPtPerChar1 * origTab.Length; Width = (float)tPtPerChar1 * origTab.Length;
else else
{ {
@ -294,7 +294,7 @@ namespace Volian.Print.Library
XOffset = xoffset; XOffset = xoffset;
// the width was just a little small, so it was wrapping - but only if there were no spaces at end // 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 // 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 else
{ {
@ -308,7 +308,7 @@ namespace Volian.Print.Library
string txt = Text; string txt = Text;
if (alignAsIfBulleted) if (alignAsIfBulleted)
txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
System.Drawing.Font font = new System.Drawing.Font(MyFont.Family,(float)MyFont.Size); System.Drawing.Font font = new System.Drawing.Font(MyFont.Family, (float)MyFont.Size);
iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font);
float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size); float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size);
Width = w; Width = w;