From 9b67771f5520e3984c0b41af5d74f5d0a961d1e9 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 1 Aug 2014 11:56:02 +0000 Subject: [PATCH] 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 --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 536 ++++++++++-------- PROMS/VEPROMS.CSLA.Library/Format/ENums.cs | 2 + .../Format/PlantFormat.cs | 36 +- PROMS/Volian.Print.Library/Pagination.cs | 10 +- .../Volian.Print.Library/VlnSvgPageHelper.cs | 90 +++ PROMS/Volian.Print.Library/vlnParagraph.cs | 345 +++++++++-- PROMS/Volian.Print.Library/vlnTab.cs | 24 +- 7 files changed, 762 insertions(+), 281 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index aefe6d56..106f5e1b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -33,7 +33,7 @@ namespace VEPROMS.CSLA.Library { Console.WriteLine("{0} - {1} Items in the dictionary", title, _CacheByPrimaryKey.Count); foreach (List 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("- - - - - -"); } @@ -140,7 +140,7 @@ namespace VEPROMS.CSLA.Library origNextItem.MyPrevious = this.MyPrevious; this.Save(); } - + // check to see if the item is being moved into the middle of some items. newPreviousItem is the item defined // by index-1, i.e. inserting below newPreviousItem. ItemInfo newPreviousInfo = (index == 0) ? null : children[index - 1]; @@ -155,7 +155,7 @@ namespace VEPROMS.CSLA.Library newNextItem.Save(); } } - + // adjust the previous node, i.e. may either be at same level or, if first in list, adjust the parent... // if 'newPreviousItem' isn't null, then adding to the middle of the list. if (newPreviousInfo != null) @@ -198,8 +198,8 @@ namespace VEPROMS.CSLA.Library { using (DocVersion parentItemDV = parentInfoDV.Get()) { - ItemInfo firstinfo = parentInfoDV.FirstChild(); - parentItemDV.MyItem = wasfirstchild?parentInfoDV.Procedures[1].Get():this; + ItemInfo firstinfo = parentInfoDV.FirstChild(); + parentItemDV.MyItem = wasfirstchild ? parentInfoDV.Procedures[1].Get() : this; parentItemDV.Save(); if (!wasfirstchild && firstinfo != null) { @@ -223,7 +223,7 @@ namespace VEPROMS.CSLA.Library //ShowItemAndSections("After MoveItem", pInfo as ItemInfo); if (parentInfoDV != null) DocVersionInfo.ResetProcedures(parentInfoDV.VersionID); - if (parentInfo != null) + if (parentInfo != null) ItemInfo.ResetParts(parentInfo.ItemID); //ShowItemAndSections("After Refresh", pInfo as ItemInfo); } @@ -236,7 +236,7 @@ namespace VEPROMS.CSLA.Library //} //private void ShowItemAndSections(string title, ItemInfo pinfo) //{ -// + // // pinfo.ShowThis(title + "-Parent"); // int i=0; // foreach (ItemInfo child in pinfo.Sections) @@ -322,9 +322,9 @@ namespace VEPROMS.CSLA.Library } #endregion #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) if (id == ItemID) return true; @@ -388,14 +388,14 @@ namespace VEPROMS.CSLA.Library get { return _Moving; } set { _Moving = value; } } - public static void RefreshParent(Item tmp,ItemInfo pInfo) + public static void RefreshParent(Item tmp, ItemInfo pInfo) { string key = tmp.ItemID.ToString(); ConvertListToDictionary(); if (_CacheByPrimaryKey.ContainsKey(key)) foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key]) { - tmpInfo._ActiveParent=pInfo; + tmpInfo._ActiveParent = pInfo; tmpInfo.RefreshItemParts(); } } @@ -459,7 +459,7 @@ namespace VEPROMS.CSLA.Library /// memory before printing. Find the next item from memory (do not go out to database). /// /// - public ItemInfo GetNextItem() + public ItemInfo GetNextItem() { ItemInfo mypar = this.MyParent as ItemInfo; if (mypar == null) return null; @@ -523,7 +523,7 @@ namespace VEPROMS.CSLA.Library if (ms && mn) pTab = pTab.TrimEnd() + "."; // remove ending '.' (if this is a hls, don't remove the '.') - if (!itemInfo.IsHigh && thisTab.EndsWith(".")) thisTab = thisTab.Substring(0, thisTab.Length - 1); + if (!itemInfo.IsHigh && thisTab.EndsWith(".")) thisTab = thisTab.Substring(0, thisTab.Length - 1); return pTab + thisTab.Trim(); } internal static void SetParentSectionAndDocVersion(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup) @@ -606,8 +606,8 @@ namespace VEPROMS.CSLA.Library private int _PrintLevel = 0; public int PrintLevel { - get - { + get + { if (_PrintLevel != 0) return _PrintLevel; int _PrintBias = 0; _PrintLevel = GetStepLevel(); //ref _PrintBias); @@ -720,7 +720,7 @@ namespace VEPROMS.CSLA.Library private int _StepLevel = -2;// Not yet calculated public int StepLevel { - get + get { if (_StepLevel == -2) { @@ -728,7 +728,7 @@ namespace VEPROMS.CSLA.Library //ItemInfo parent = ActiveParent as ItemInfo; //Console.WriteLine("{0},{1},{2},{3},{4},{5},{6}",ItemID, DBSequence, _StepLevel, MyContent.Type % 10000, parent.MyContent.Type % 10000,HasCautionOrNote ? 1 : 0, parent.Cautions == null? 0 : 1); } - return _StepLevel; + return _StepLevel; } set { _StepLevel = value; } } @@ -760,7 +760,7 @@ namespace VEPROMS.CSLA.Library string suffix = ""; 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; suffix = c.ToString(); switch (m2.Groups[1].Value) @@ -794,8 +794,8 @@ namespace VEPROMS.CSLA.Library } private static int CalcStepLevel(ItemInfo item) { - if(item == null) return 0; - int id=0; + if (item == null) return 0; + int id = 0; // Determines the substep level. int level = CountLevels(item); @@ -826,17 +826,17 @@ namespace VEPROMS.CSLA.Library level += 2; } // Paginate before first caution, not between cautions. - else if (item.IsCautionPart) + else if (item.IsCautionPart) { - if (item.MyPrevious == null) level-=(1 + firstInc); - else level+=3; + if (item.MyPrevious == null) level -= (1 + firstInc); + else level += 3; } // Paginate before first note, if the step does not have a caution. // Otherwise, try to keep the notes together. else if (item.IsNotePart) { - if (parent.Cautions == null && item.MyPrevious == null) level-=(1 + firstInc); - else level+=3; + if (parent.Cautions == null && item.MyPrevious == null) level -= (1 + firstInc); + else level += 3; } // Try not to paginate on a table. else if (item.IsTablePart) @@ -844,7 +844,7 @@ namespace VEPROMS.CSLA.Library level += 2; } // 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; // RHM Change 20140522 @@ -898,9 +898,9 @@ namespace VEPROMS.CSLA.Library { get { - if (MyHeader==null)return false; - if (MyHeader.CleanText==null) return false; - if (MyHeader.CleanText=="") return false; + if (MyHeader == null) return false; + if (MyHeader.CleanText == null) return false; + if (MyHeader.CleanText == "") return false; return true; } } @@ -977,19 +977,19 @@ namespace VEPROMS.CSLA.Library } private void SpinThroughChildren() { - if(MyContent.ContentPartCount > 0) - foreach(PartInfo partInfo in MyContent.ContentParts) + if (MyContent.ContentPartCount > 0) + foreach (PartInfo partInfo in MyContent.ContentParts) foreach (ItemInfo itemInfo in partInfo.MyItems) itemInfo.SpinThroughChildren(); } #endregion #region LoadAtOnce // Method to Get Item and children - public static ItemInfo GetItemAndChildren(int? itemID,int? parentID) + public static ItemInfo GetItemAndChildren(int? itemID, int? parentID) { try { - ItemInfo tmp = DataPortal.Fetch(new ItemAndChildrenCriteria(itemID,parentID)); + ItemInfo tmp = DataPortal.Fetch(new ItemAndChildrenCriteria(itemID, parentID)); AddToCache(tmp); if (tmp.ErrorMessage == "No Record Found") tmp = null; return tmp; @@ -1041,7 +1041,7 @@ namespace VEPROMS.CSLA.Library { while (dr.Read()) { - if (dr.GetInt32("Level")==0) + if (dr.GetInt32("Level") == 0) { //tmp = itemInfo; ReadData(dr); @@ -1277,7 +1277,7 @@ namespace VEPROMS.CSLA.Library if (parent == null) return false; // IsHigh was returning true if this item is a caution or note off of a section.. // from the (parent.MyContent.Type / 1000) == 1. - if (IsCaution || IsNote) return false; + if (IsCaution || IsNote) return false; if ((parent.MyContent.Type / 10000) == 1) return true; return false; @@ -1322,7 +1322,7 @@ namespace VEPROMS.CSLA.Library } public bool IsInRNO { - get + get { if (IsHigh) return false; if (IsRNOPart) return true; @@ -1337,7 +1337,7 @@ namespace VEPROMS.CSLA.Library { 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) @@ -1345,20 +1345,25 @@ namespace VEPROMS.CSLA.Library List lst = _CacheByPrimaryKey[itemID.ToString()]; 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 { 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 if (ActiveSection != null) { SectionInfo si = null; if (IsSection) si = this as SectionInfo; else si = ActiveSection as SectionInfo; - if(si == null) + if (si == null) si = SectionInfo.Get(ActiveSection.ItemID); //ActiveSection as SectionInfo; if (si != null) { @@ -1367,7 +1372,7 @@ namespace VEPROMS.CSLA.Library return (int)si.SectionConfig.Section_ColumnMode - 1; } } - return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) -1; + return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) - 1; } } /// @@ -1417,7 +1422,7 @@ namespace VEPROMS.CSLA.Library public ItemInfo LastChild(E_FromType partType) { ItemInfoList myitems = Lookup((int)partType); - if (myitems !=null) return myitems[myitems.Count-1]; + if (myitems != null) return myitems[myitems.Count - 1]; return null; } public ItemInfo FirstChild(E_FromType partType) @@ -1495,9 +1500,9 @@ namespace VEPROMS.CSLA.Library get { 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.IsProcedure || temp.IsSection) return false; + if (temp.IsProcedure || temp.IsSection) return false; while (((ItemInfo)temp.ActiveParent).IsHigh == false) temp = ((ItemInfo)temp.ActiveParent).FirstSibling; return temp.IsStepPart; @@ -1609,7 +1614,7 @@ namespace VEPROMS.CSLA.Library else _Ordinal = 1; } - return (int) _Ordinal; + return (int)_Ordinal; } } public string CslaType @@ -1623,11 +1628,10 @@ namespace VEPROMS.CSLA.Library //string number = cont.Number; string number = DisplayNumber; //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, cont.Text).Trim(); //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) //{ @@ -1638,40 +1642,40 @@ namespace VEPROMS.CSLA.Library internal string _SearchDVPath; public string SearchDVPath { - get + get { if (_SearchDVPath == null) _SearchDVPath = ActiveParent.SearchDVPath; - return _SearchDVPath; + return _SearchDVPath; } } internal string _SearchPath; public string SearchPath { - get + get { - if (_SearchPath==null) + if (_SearchPath == null) { if (IsProcedure) - _SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText ; + _SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText; else if (IsSection) _SearchPath = ActiveParent.SearchPath + "\u0007" + (DisplayNumber ?? "") + "\u0011" + DisplayText; else { PartInfo myPart = FirstSibling.ItemPartCount > 0 ? FirstSibling.ItemParts[0] : null; - if(myPart != null) + if (myPart != null) _SearchPath = myPart.SearchPath + (!IsHigh ? "." : "\u0007") + Ordinal.ToString(); else _SearchPath = ActiveParent.SearchPath + (!IsHigh ? "." : "\u0007") + Ordinal.ToString(); } } - return _SearchPath; + return _SearchPath; } } - public string ShortSearchPath - { - get { return ConvertToDisplayText(Regex.Replace(_SearchPath ?? "", "\x11.*?\x07", "\x07")); } - } + public string ShortSearchPath + { + get { return ConvertToDisplayText(Regex.Replace(_SearchPath ?? "", "\x11.*?\x07", "\x07")); } + } internal int _SearchAnnotationID; public int SearchAnnotationID { @@ -1766,7 +1770,7 @@ namespace VEPROMS.CSLA.Library //end jcb added inherited applicability public string DisplayText { - get + get { string str = MyContent.Text; str = Regex.Replace(str, @"\<[uU]\>", MyDocVersion.DocVersionConfig.Unit_Number); @@ -1774,12 +1778,12 @@ namespace VEPROMS.CSLA.Library // str = str.Replace("", MyDocVersion.DocVersionConfig.Unit_Number); //if (str.Contains("")) // str = str.Replace("", MyDocVersion.DocVersionConfig.Unit_Number); - return ConvertToDisplayText(str); + return ConvertToDisplayText(str); } } public string DisplayNumber { - get + get { string str = (this.IsProcedure) ? MyDocVersion.UnitSpecific(MyContent.Number, 0) : MyContent.Number; str = Regex.Replace(str, @"\", MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase); @@ -1801,7 +1805,7 @@ namespace VEPROMS.CSLA.Library retval = StripRtfFormatting(retval); retval = StripLinks(retval); retval = ReplaceSpecialCharacters(retval); - retval = retval.Replace("\u2011","-"); + retval = retval.Replace("\u2011", "-"); retval = retval.Replace("\r\n", ";"); retval = retval.Replace("\n", ";"); //added for consistency checking with approved version return retval; @@ -1835,7 +1839,7 @@ namespace VEPROMS.CSLA.Library private static string ReplaceSpecialCharacter(Match m) { 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); return sb.ToString(); } @@ -1905,7 +1909,7 @@ namespace VEPROMS.CSLA.Library case 2: // step types int typindx = type - 20000; // what to do for other types rather than steps 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); break; } @@ -1918,13 +1922,13 @@ namespace VEPROMS.CSLA.Library } 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; if (myStyle != font.Style) font = new VE_Font(font.Family, (int)font.Size, myStyle, (float)font.CPI); return font; } - private const int _ParagraphType=24; + private const int _ParagraphType = 24; protected VE_Font AdjustForTextSubFollowsTextStyle(VE_Font font) { return AdjustForTextSubFollowsTextStyle(ActiveFormat, this.FormatStepType, font); @@ -1938,7 +1942,7 @@ namespace VEPROMS.CSLA.Library bool isMmBold = (myFormatStepData.Font.Style & E_Style.MmBold) > 0; myFormatStepData = format.PlantFormat.FormatData.StepDataList[ParentNoteOrCaution.FormatStepType]; 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.MmBold); myStyle |= isBold ? E_Style.Bold : 0; @@ -2022,7 +2026,7 @@ namespace VEPROMS.CSLA.Library { get { - string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((DisplayNumber ?? "")==""? DisplayText: DisplayNumber)); + string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((DisplayNumber ?? "") == "" ? DisplayText : DisplayNumber)); ItemInfo parent = this; while (parent.MyPrevious != null) parent = parent.MyPrevious; if (parent.ItemPartCount == 0) @@ -2046,7 +2050,7 @@ namespace VEPROMS.CSLA.Library else { 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) if (partInfo.FromType == fromType) { - if(LoadAllAtOnce) + if (LoadAllAtOnce) itemInfoList = partInfo._MyItems;// = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType); else itemInfoList = partInfo._MyItems = ItemInfoList.GetList(partInfo.ItemID, partInfo.FromType); @@ -2143,25 +2147,25 @@ namespace VEPROMS.CSLA.Library } private ItemInfoList _Procedures; public ItemInfoList Procedures - { get { return Lookup(1,ref _Procedures); } } + { get { return Lookup(1, ref _Procedures); } } private ItemInfoList _Sections; public ItemInfoList Sections - { get { return Lookup(2,ref _Sections); } } + { get { return Lookup(2, ref _Sections); } } private ItemInfoList _Cautions; public ItemInfoList Cautions - { get { return Lookup(3,ref _Cautions); } } + { get { return Lookup(3, ref _Cautions); } } private ItemInfoList _Notes; public ItemInfoList Notes - { get { return Lookup(4,ref _Notes); } } + { get { return Lookup(4, ref _Notes); } } private ItemInfoList _RNOs; public ItemInfoList RNOs - { get { return Lookup(5,ref _RNOs); } } + { get { return Lookup(5, ref _RNOs); } } private ItemInfoList _Steps; public ItemInfoList Steps - { get { return Lookup(6,ref _Steps); } } + { get { return Lookup(6, ref _Steps); } } private ItemInfoList _Tables; public ItemInfoList Tables - { get { return Lookup(7,ref _Tables); } } + { get { return Lookup(7, ref _Tables); } } //public void ResetChildren() //{ // _Procedures = null; @@ -2229,9 +2233,9 @@ namespace VEPROMS.CSLA.Library { if (MyContent.MyEntry == null) { - if(DisplayNumber == string.Empty) + if (DisplayNumber == string.Empty) return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "..."; - return DisplayNumber.Replace("\u2011","-"); + return DisplayNumber.Replace("\u2011", "-"); } if (MyContent.Number != "") // Add LIB to the Section Number return ((MyContent.MyEntry.MyDocument.LibTitle ?? "") == "" ? "" : "\u1D38\u1D35\u1D2E ") + DisplayNumber; @@ -2242,7 +2246,7 @@ namespace VEPROMS.CSLA.Library } if (DisplayText.Length <= 10) return DisplayText.Replace("\u2011", "-"); - return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0]+ "..."; + return DisplayText.Replace("\u2011", "-").Split(" ,.;:-_".ToCharArray())[0] + "..."; } } #endregion @@ -2300,8 +2304,8 @@ namespace VEPROMS.CSLA.Library } else // Steps and Sections only { - for(int i = 0;i<_PartInfoList.Count;i++) - if(_PartInfoList[i].ToString() == "Sections" || _PartInfoList[i].ToString() == "Steps") + for (int i = 0; i < _PartInfoList.Count; i++) + if (_PartInfoList[i].ToString() == "Sections" || _PartInfoList[i].ToString() == "Steps") return _PartInfoList[i].GetChildren(); return null; } @@ -2334,14 +2338,14 @@ namespace VEPROMS.CSLA.Library { if (_MyProcedure == null) { - // Walk up active parents until the parent is not an item - ItemInfo tmp = this; - while (tmp.ActiveParent != null && !tmp.ActiveParent.IsDocVersion) - tmp = (ItemInfo)tmp.ActiveParent; - if (tmp is ProcedureInfo) + // Walk up active parents until the parent is not an item + ItemInfo tmp = this; + while (tmp.ActiveParent != null && !tmp.ActiveParent.IsDocVersion) + tmp = (ItemInfo)tmp.ActiveParent; + if (tmp is ProcedureInfo) _MyProcedure = tmp as ProcedureInfo; - else - _MyProcedure = ProcedureInfo.Get(tmp.ItemID); + else + _MyProcedure = ProcedureInfo.Get(tmp.ItemID); } return _MyProcedure; } @@ -2353,18 +2357,18 @@ namespace VEPROMS.CSLA.Library private ItemInfo _MyHLS = null; public ItemInfo MyHLS { - get + get { if (_MyHLS == null) { if (IsHigh) _MyHLS = this; else { - if(MyActiveParent is ItemInfo) + if (MyActiveParent is ItemInfo) _MyHLS = ((ItemInfo)MyActiveParent).MyHLS; } } - return _MyHLS; + return _MyHLS; } } private string _CombinedTab = null; @@ -2415,20 +2419,20 @@ namespace VEPROMS.CSLA.Library //using (ContentInfo parentContent = ParentContent) //{ ContentInfo parentContent = ParentContent; - if (parentContent == null)// || parentContent.ContentItemCount == 0) + if (parentContent == null)// || parentContent.ContentItemCount == 0) + _ActiveParent = this; + else + { + int itemID = 0; + if (parentContent.ContentItems.Count == 0) + parentContent.RefreshContentItems(); + using (ItemInfoList list = parentContent.ContentItems) + itemID = list[0].ItemID; + if (itemID == 0) _ActiveParent = this; else - { - int itemID = 0; - if (parentContent.ContentItems.Count == 0) - parentContent.RefreshContentItems(); - using(ItemInfoList list = parentContent.ContentItems) - itemID = list[0].ItemID; - if (itemID == 0) - _ActiveParent = this; - else - _ActiveParent = ItemInfo.Get(itemID); - } + _ActiveParent = ItemInfo.Get(itemID); + } //} } } @@ -2441,7 +2445,7 @@ namespace VEPROMS.CSLA.Library _ActiveParent = value; } } - internal ItemInfo _ActiveSection = null; + internal ItemInfo _ActiveSection = null; /// /// MyActiveSection is used to determine if _ActiveSection is null or not. /// @@ -2481,8 +2485,8 @@ namespace VEPROMS.CSLA.Library int subtyp = typ % 10000; if (subtyp >= ActiveFormat.PlantFormat.DocStyles.DocStyleList.Count) return ActiveFormat.PlantFormat.DocStyles.DocStyleList[0]; _MyDocStyle = ActiveFormat.PlantFormat.DocStyles.DocStyleList[subtyp]; - } - return _MyDocStyle; + } + return _MyDocStyle; } set { @@ -2495,7 +2499,7 @@ namespace VEPROMS.CSLA.Library get { //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); return _ActiveFormat; } @@ -2503,9 +2507,11 @@ namespace VEPROMS.CSLA.Library } public FormatInfo LocalFormat { - get { + get + { //Console.WriteLine("Local {0}", (MyContent.MyFormat==null)?"MYformat is null": MyContent.MyFormat.Name); - return MyContent.MyFormat; } + return MyContent.MyFormat; + } } private bool _IsDeleted = false; public bool IsDeleted @@ -2532,7 +2538,7 @@ namespace VEPROMS.CSLA.Library private ConfigDynamicTypeDescriptor _MyConfig = null; public ConfigDynamicTypeDescriptor MyConfig { - get + get { if (_MyConfig == null) { @@ -2549,7 +2555,7 @@ namespace VEPROMS.CSLA.Library break; } } - return _MyConfig; + return _MyConfig; } set { @@ -2571,7 +2577,7 @@ namespace VEPROMS.CSLA.Library public Color ForeColor { get { return (HasBrokenRules != null ? Color.Red : (MyContent.ContentItemCount > 1 ? Color.Blue : Color.Black)); } } public Color BackColor - { get { return (ItemAnnotationCount > 0 ? Color.Yellow : Color.White); } } + { get { return (ItemAnnotationCount > 0 ? Color.Yellow : Color.White); } } #endregion #region Constructor internal ItemInfo(SafeDataReader dr, bool forIRichtem) @@ -2598,7 +2604,7 @@ namespace VEPROMS.CSLA.Library protected Tab _MyTab; public Tab MyTab { - get + get { if (!_TagsSetup) SetupTags(); return _MyTab; @@ -2613,12 +2619,12 @@ namespace VEPROMS.CSLA.Library protected MetaTag _MyHeader; public MetaTag MyHeader { - get + get { if (!_TagsSetup) SetupTags(); - return _MyHeader; + return _MyHeader; } - set + set { _MyHeader = value; } @@ -2627,10 +2633,10 @@ namespace VEPROMS.CSLA.Library protected MetaTag _MyFooter; public MetaTag MyFooter { - get + get { if (!_TagsSetup) SetupTags(); - return _MyFooter; + return _MyFooter; } set { _MyFooter = value; } } @@ -2659,7 +2665,7 @@ namespace VEPROMS.CSLA.Library string cltext = null; int stepType = (int)(MyContent.Type % 10000); 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; else tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; @@ -2672,8 +2678,8 @@ namespace VEPROMS.CSLA.Library _MyTab.Text = tstr; _MyTab.CleanText = tstr; return; - } - + } + if (((ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) && ((IsHigh && FormatStepData.PageBreakOnStep) || (IsRNOPart && MyHLS.FormatStepData.PageBreakOnStep))) tbformate = IsRNOPart ? MyHLS.FormatStepData.TabData.RNOIdentEdit : FormatStepData.TabData.IdentEdit; @@ -2684,8 +2690,7 @@ namespace VEPROMS.CSLA.Library if (ActiveFormat.Name.ToUpper() == "WCNCKL" && FormatStepData.StepLayoutData.AlignWithParentTab) tbformat = tbformat.TrimStart(" ".ToCharArray()); } 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}")) { @@ -2713,7 +2718,7 @@ namespace VEPROMS.CSLA.Library try { // NumberWithLevel flag is used by BGE. It does tabbing in rno column by incrementing of rno and rno substeps - if (FormatStepData.NumberWithLevel) + if (FormatStepData.NumberWithLevel) { int ord = Ordinal - 1; string incSub = Ordinal.ToString(); @@ -2769,11 +2774,11 @@ namespace VEPROMS.CSLA.Library bool doMeta = false; if (sd.StepSectionLayoutData.TieTabToLevel && ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) { - if (sd.StepSectionLayoutData.ShowSectionTitles - && !MyDocStyle.CancelSectTitle - && !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel)) - localPrintLevel = PrintLevel + CurrentSectionLevel(); - doMeta = true; + if (sd.StepSectionLayoutData.ShowSectionTitles + && !MyDocStyle.CancelSectTitle + && !(MyDocStyle.SpecialStepsFoldout && MyDocStyle.UseColSByLevel)) + localPrintLevel = PrintLevel + CurrentSectionLevel(); + doMeta = true; } SeqTabFmtList seqtabs = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.SeqTabFmtList; // Start with basic cases of alpha/numeric/seq: @@ -2782,7 +2787,7 @@ namespace VEPROMS.CSLA.Library // the ident of the step: bool useSubStepTabs = false; 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; // Check to be sure the parent tab should be included... If this sequential is within a note @@ -2802,7 +2807,7 @@ namespace VEPROMS.CSLA.Library tbformat = (lv == 0) ? "{numeric}." : "{alpha}."; } bool trimTabStart = false; - + if (useSubStepTabs || tbformat.IndexOf("{seq}") > -1) { // If the document style has the flag DSS_UnNumLikeRoman, don't do the normal tab, change to alpha @@ -2821,7 +2826,7 @@ namespace VEPROMS.CSLA.Library localPrintLevel += 5; } int itmp = (localPrintLevel + PrintBias + OffsetTab) % seqtabs.Count; - if (!tbformat.Contains(@"{!C")) + if (!tbformat.Contains(@"{!C")) tbformat = seqtabs[itmp].PrintTabFormat; // seqtab in 16bit, i.e. '. or )' etc. else tbformat = tbformat.Replace("{seq}", seqtabs[itmp].PrintTabFormat); @@ -2843,7 +2848,7 @@ namespace VEPROMS.CSLA.Library // so that when the above code ran to reset the tab, it would crash because the // printlevel was not recalculated. PrintLevel = 0; - + // If token includes 'Wpar', the parent tab prefix's the tab. if (localPrintLevel > 0 && (tbformat.IndexOf("{numericWpar}") > -1 || tbformat.IndexOf("{alphaWpar}") > -1 || tbformat.IndexOf("{ALPHAWpar}") > -1)) { @@ -2866,16 +2871,16 @@ namespace VEPROMS.CSLA.Library tbformat = parentTab + (parentTab.EndsWith(".") ? "" : ".") + tbformat.TrimStart(); } } - + if (tbformat.IndexOf("#2#") > -1 || tbformat.IndexOf("#1#") > -1) { //16 bit code limits the #2# offset logic to the docstyle cannot have the DSS_ADDDOTZEROSTDHLS & // its HLS is type std high: if (!(((MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_AddDotZeroStdHLS) == E_DocStructStyle.DSS_AddDotZeroStdHLS) && this.MyHLS.MyContent.Type == 20002)) - { - int indxlb = tbformat.IndexOf("#"); - string ofst = tbformat.Substring(indxlb+1, 3); + { + int indxlb = tbformat.IndexOf("#"); + string ofst = tbformat.Substring(indxlb + 1, 3); _MyTab.Offset = Convert.ToInt32(ofst.Substring(0, 1)) * (int)FormatStepData.TabData.Font.CharsToTwips; } tbformat = tbformat.Replace("#2#", "").Replace("#1#", ""); @@ -2884,12 +2889,13 @@ namespace VEPROMS.CSLA.Library { int begPos = tbformat.IndexOf("{Pos"); 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); - 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' // and also determine whether the tab itself gets converted to a bullet. + 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 @@ -2907,17 +2913,17 @@ namespace VEPROMS.CSLA.Library tbformat = tbformat.Replace("{alpha}", alpha.ToLower()); tbformat = tbformat.Replace("{alphaWpar}", alpha.ToLower()); 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 tbformat = tbformat.Replace("{ALPHA}", alpha); - + tbformat = tbformat.Replace("{ALPHAWpar}", alpha); if (tbformat.ToUpper().Contains("ROMAN")) { - string roman = RomanNumbering(ordinal); - tbformat = tbformat.Replace("{roman}", roman.ToLower()); - tbformat = tbformat.Replace("{ROMAN}", roman); - tbformat = tbformat.Substring(0, tbformat.Length - ((roman.Length - 1)>0?(roman.Length - 1):0)); + string roman = RomanNumbering(ordinal); + tbformat = tbformat.Replace("{roman}", roman.ToLower()); + tbformat = tbformat.Replace("{ROMAN}", roman); + 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 (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. 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); } 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)); tbformat = tbformat.Replace("{numericWpar}", ordinal.ToString()); if (tbformat.Contains("{asterisk}")) { // 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 - _MyTab.AsteriskOffset = - 10; + _MyTab.AsteriskOffset = -10; tbformat = tbformat.Replace("{asterisk}", ""); // the asteriskoffset flags a '*' to be printed at xloc - this. } int macroindx = tbformat.IndexOf("{!C"); @@ -2968,7 +2974,7 @@ namespace VEPROMS.CSLA.Library { // check if there is font information for the separator, use it. If not use the font information // that is associated with the tab. - VE_Font hdrFont = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator == null ? null : + VE_Font hdrFont = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator == null ? null : ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Separator.Font; if (hdrFont == null) hdrFont = FormatStepData.TabData.Font; if (_MyHeader == null) _MyHeader = new MetaTag(hdrFont); @@ -2980,7 +2986,7 @@ namespace VEPROMS.CSLA.Library // 0 - Left // 1 - Right // 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) { case 0: @@ -2990,7 +2996,7 @@ namespace VEPROMS.CSLA.Library _MyHeader.Justify = ContentAlignment.MiddleRight; break; default: - _MyHeader.Justify = ContentAlignment.MiddleCenter; + _MyHeader.Justify = ContentAlignment.MiddleCenter; break; } //_MyHeader.Justify = ContentAlignment.MiddleCenter; @@ -3022,18 +3028,18 @@ namespace VEPROMS.CSLA.Library int indxnewtab = FormatStepData.TabData.IdentAltPrint.LastIndexOf('\\'); if (indxnewtab >= 0) { - _MyTab.BasicTab = isAlpha ? alpha : ordinal.ToString(); + _MyTab.BasicTab = isAlpha ? alpha : ordinal.ToString(); newtab = FormatStepData.TabData.IdentAltPrint.Substring(indxnewtab + 1); if (newtab.Contains("{numeric}") || newtab.Contains("{LNK Step Num}")) { 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: 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 - // 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; + // 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 + HighLevelStepTabPageList = @"\ul " + FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab).Trim() + @"\ulnone " + (tbformat.StartsWith(" ") ? "" : " ") + tbformat; else HighLevelStepTabPageList = FormatStepData.TabData.IdentAltPrint.Substring(0, indxnewtab) + tbformat; _MyTab.AltPrintTab = newtab; @@ -3078,7 +3084,7 @@ namespace VEPROMS.CSLA.Library private string GetToken(string tbformat) { 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) @@ -3089,7 +3095,7 @@ namespace VEPROMS.CSLA.Library ItemInfo TopRNO = null; while (par != null && !par.IsSection && !par.IsProcedure && !par.IsHigh) { - if (par.IsRNOPart) + if (par.IsRNOPart) { LastRNO = par.MyParent; TopRNO = par; @@ -3102,7 +3108,7 @@ namespace VEPROMS.CSLA.Library // If high level RNOs are numbered, use the next level of tabs for lower // level RNOs - unless DontOffsetTab format flag is set 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; if (par.FormatStepData != null && par.FormatStepData.TabData.IdentPrint.Contains("{ALPHA}")) level--; @@ -3161,9 +3167,9 @@ namespace VEPROMS.CSLA.Library { SectionConfig sc = new SectionConfig(si); //SectionConfig sc = ii.MyConfig as SectionConfig; - if (sc != null && sc.SubSection_AutoIndent == "Y") - countlev++; - } + if (sc != null && sc.SubSection_AutoIndent == "Y") + countlev++; + } } ii = ii.MyParent; } @@ -3231,7 +3237,7 @@ namespace VEPROMS.CSLA.Library } return ActiveSection.MyTab.CleanText.TrimEnd(); } - + private string CheckNoteCautionTab(string tbformat) { tbformat = ReplaceStepToken(tbformat); @@ -3256,9 +3262,9 @@ namespace VEPROMS.CSLA.Library if (FormatStepData.TabData.Justify == "Center") { _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); - // 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 // with a bullet. Also, if only one in group and tab text ends with 'S', remove it: bool mixCandN = MixCautionNotesDiffType(); @@ -3294,7 +3300,7 @@ namespace VEPROMS.CSLA.Library else if (this.NextItem == null) tbformat = ""; } - if (!this.FormatStepData.SeparateBox && + if (!this.FormatStepData.SeparateBox && (tbformat == nextTbFormat || tbformat == prevTbFormat)) { tbformat = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; @@ -3350,9 +3356,18 @@ namespace VEPROMS.CSLA.Library } 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 (IsNote && ((NextItem != null && NextItem.IsCaution) || (MyPrevious != null && MyPrevious.IsCaution))) return true; - if (IsCaution && ((NextItem != null && NextItem.IsNote) || (MyPrevious != null && MyPrevious.IsNote))) return true; + if (IsNote && ((GetNextItem() != null && GetNextItem().IsCaution) || (MyPrevious != null && MyPrevious.IsCaution))) return true; + if (IsCaution && ((GetNextItem() != null && GetNextItem().IsNote) || (MyPrevious != null && MyPrevious.IsNote))) return true; return false; } @@ -3383,7 +3398,7 @@ namespace VEPROMS.CSLA.Library //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); // 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); return true; } @@ -3400,7 +3415,7 @@ namespace VEPROMS.CSLA.Library return retval; } // 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; } private string Letter(int number) @@ -3454,23 +3469,23 @@ namespace VEPROMS.CSLA.Library private ItemInfo _ParentNoteOrCaution; public ItemInfo ParentNoteOrCaution { - get + get { if (!_ParentNoteOrCautionLoaded) { ItemInfo parent = ActiveParent as ItemInfo; if (parent != null) { - if (parent.IsCautionPart || parent.IsNotePart) + if (parent.IsCautionPart || parent.IsNotePart) _ParentNoteOrCaution = parent; - else if(!parent.IsHigh) + else if (!parent.IsHigh) { _ParentNoteOrCaution = parent.ParentNoteOrCaution; } } _ParentNoteOrCautionLoaded = true; } - return _ParentNoteOrCaution; + return _ParentNoteOrCaution; } } #endregion @@ -3505,7 +3520,7 @@ namespace VEPROMS.CSLA.Library bool addToList = true; if (macro.NotInRNO && IsInRNO) addToList = false; 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) { int count = 0; @@ -3523,12 +3538,67 @@ namespace VEPROMS.CSLA.Library } #endregion #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() { - 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; } - public int GetSmartTemplateTopLevelIndxOfThisType(int oftype) + public int GetSmartTemplateTopLevelIndxOfThisType(int oftype) // used for inserting steps { if (FormatStepData == null) return -1; FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData; @@ -3538,16 +3608,17 @@ namespace VEPROMS.CSLA.Library } public int GetSmartTemplateTopLevelIndx() { + if (FormatStepData == null) return -1; FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData; if (formatData.TopTemplateTypes == null || formatData.TopTemplateTypes.Count == 0) return -1; ItemInfo tmp = this; while (!tmp.IsSection) - { + { if (formatData.TopTemplateTypes.ContainsKey((int)tmp.MyContent.Type - 20001)) return formatData.TopTemplateTypes[(int)tmp.MyContent.Type - 20001]; tmp = tmp.MyParent; - } + } return -1; - } + } public int GetSmartTemplateIndex(int topIndx, int curStepType) { FormatData formatData = FormatStepData.MyFormat.PlantFormat.FormatData; @@ -3559,7 +3630,28 @@ namespace VEPROMS.CSLA.Library // now see if we're on the topType, if so, look under this one // for the step type that we're on. If found return the index of it. if (formatData.Templates[indx].type == curType) return indx; - indx++; + indx++; + } + 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. } @@ -3568,7 +3660,7 @@ namespace VEPROMS.CSLA.Library private string _SectionCheckOffHeader; public string SectionCheckOffHeader { - get + get { if (_SectionCheckOffHeader == null) { @@ -3587,7 +3679,7 @@ namespace VEPROMS.CSLA.Library } } } - return _SectionCheckOffHeader; + return _SectionCheckOffHeader; } } public bool SectionHasCheckOffs() @@ -3595,7 +3687,7 @@ namespace VEPROMS.CSLA.Library // To determine if the section has a checkoff... // Section won't have checkoffs if there is no checkofflist, or ProcData pd = ActiveFormat.PlantFormat.FormatData.ProcData; - if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.Count <= 0) return false; + if (pd.CheckOffData == null || pd.CheckOffData.CheckOffList == null || pd.CheckOffData.CheckOffList.Count <= 0) return false; if (pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return true; //if (pd.CheckOffData == null || pd.CheckOffData.CheckOffHeaderList == null || pd.CheckOffData.CheckOffHeaderList.Count <= 1) return false; @@ -3634,7 +3726,7 @@ namespace VEPROMS.CSLA.Library { if (!IsStep) return null; if (SectionDefaultEnabled) return SectionDefaultEnabledCheckOff; - if(!SectionHasCheckOffs()) return null; + if (!SectionHasCheckOffs()) return null; int stpCoIndx = CheckOffIndex(); // this step has a checkoff defined if (stpCoIndx == -1) return null; if (stpCoIndx > 1) return ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffList[stpCoIndx]; @@ -3714,6 +3806,7 @@ namespace VEPROMS.CSLA.Library } } #endregion + } #endregion ItemInfo #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 { - ItemInfoList tmp = DataPortal.Fetch(new ItemListCriteria(itemID,type)); + ItemInfoList tmp = DataPortal.Fetch(new ItemListCriteria(itemID, type)); ItemInfo.AddList(tmp); tmp.AddEvents(); #if (!ItemWithContent) // If ItemWithContent is set, the content is returned with the ItemInfoList @@ -3910,7 +4003,7 @@ namespace VEPROMS.CSLA.Library [Serializable()] private class ItemListCriteria { - public ItemListCriteria(int? itemID,int type) + public ItemListCriteria(int? itemID, int type) { _ItemID = itemID; _Type = type; @@ -4007,7 +4100,7 @@ namespace VEPROMS.CSLA.Library { cm.CommandType = CommandType.StoredProcedure; #if ItemWithContent - cm.CommandText = "vesp_ListItemsAndContent"; + cm.CommandText = "vesp_ListItemsAndContent"; #else cm.CommandText = "vesp_ListItems"; #endif @@ -4152,11 +4245,11 @@ namespace VEPROMS.CSLA.Library { cm.CommandType = CommandType.StoredProcedure; #if ItemWithContent - cm.CommandText = "getItemsByPartTypeAndContent"; + cm.CommandText = "getItemsByPartTypeAndContent"; #else cm.CommandText = "getItemsByPartType"; #endif - cm.Parameters.AddWithValue("@FromType", (int) criteria.Type); + cm.Parameters.AddWithValue("@FromType", (int)criteria.Type); cm.CommandTimeout = Database.DefaultTimeout; using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) { @@ -4201,7 +4294,7 @@ namespace VEPROMS.CSLA.Library { try { - ItemInfoList tmp = DataPortal.Fetch(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters,unitPrefix)); + ItemInfoList tmp = DataPortal.Fetch(new ItemListSearchCriteria(docVersionList, stepTypeList, searchString, caseSensitive, includeLinks, includeRtfFormatting, includeSpecialCharacters, unitPrefix)); ItemInfo.AddList(tmp); tmp.AddEvents(); return tmp; @@ -4263,7 +4356,7 @@ namespace VEPROMS.CSLA.Library get { return _UnitPrefix; } set { _UnitPrefix = value; } } - public ItemListSearchCriteria(string docVersionList, string stepTypeList, string searchString, + public ItemListSearchCriteria(string docVersionList, string stepTypeList, string searchString, int caseSensitive, ItemSearchIncludeLinks includeLinks, bool includeRtfFormatting, bool includeSpecialCharacters, string unitPrefix) { _DocVersionList = docVersionList; @@ -4291,7 +4384,7 @@ namespace VEPROMS.CSLA.Library cm.Parameters.AddWithValue("@StepTypeList", criteria.StepTypeList); cm.Parameters.AddWithValue("@SearchString", criteria.SearchString); 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("@IncludeSpecialCharacters", criteria.IncludeSpecialCharacters ? 1 : 0); cm.Parameters.AddWithValue("@UnitPrefix", criteria.UnitPrefix); @@ -4718,7 +4811,7 @@ namespace VEPROMS.CSLA.Library get { return _ApplicabilityUnit; } set { _ApplicabilityUnit = value; } } - public TransitionLookup(int applicabilityUnit, int procID, Dictionary mylookup) + public TransitionLookup(int applicabilityUnit, int procID, Dictionary mylookup) { _MyLookups = new Dictionary>(); _MyLookups.Add(procID, mylookup); @@ -4764,13 +4857,13 @@ namespace VEPROMS.CSLA.Library get { 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; public DateTime ChangeBarDate { - get + get { if (_ChangeBarDate == null) { @@ -4779,14 +4872,14 @@ namespace VEPROMS.CSLA.Library if ((cbDTS ?? "") != "") _ChangeBarDate = DateTime.Parse(cbDTS); } - return (DateTime)_ChangeBarDate; + return (DateTime)_ChangeBarDate; } set { _ChangeBarDate = value; } } public Dictionary MyLookup = null; - public override void SetupTags() + public override void SetupTags() { - base.SetupTags(); + base.SetupTags(); } protected override void RefreshFields(Item tmp) { @@ -4841,7 +4934,7 @@ namespace VEPROMS.CSLA.Library } public new Procedure Get() { - return (Procedure) (_Editable = Procedure.Get(ItemID)); + return (Procedure)(_Editable = Procedure.Get(ItemID)); } public static void RefreshPageNumTransitions(ProcedureInfo tmp) { @@ -4892,9 +4985,9 @@ namespace VEPROMS.CSLA.Library //} //else //{ - tmp.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitID; - (tmp.MyConfig as ProcedureConfig).SelectedSlave = args.UnitID; - ItemInfo.SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion); + tmp.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitID; + (tmp.MyConfig as ProcedureConfig).SelectedSlave = args.UnitID; + ItemInfo.SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion); //} } return tmp; @@ -5001,8 +5094,8 @@ namespace VEPROMS.CSLA.Library [NonSerialized] private ProcedureConfig _ProcedureConfig; public ProcedureConfig ProcedureConfig - { - get + { + get { if (_ProcedureConfig == null) { @@ -5010,8 +5103,8 @@ namespace VEPROMS.CSLA.Library this.MyContent.Changed += new ContentInfoEvent(MyContent_Changed); } return _ProcedureConfig; -// return (_ProcedureConfig != null ? _ProcedureConfig : _ProcedureConfig = new ProcedureConfig(this)); - } + // return (_ProcedureConfig != null ? _ProcedureConfig : _ProcedureConfig = new ProcedureConfig(this)); + } } void MyContent_Changed(object sender) @@ -5021,7 +5114,7 @@ namespace VEPROMS.CSLA.Library #endregion public new ConfigDynamicTypeDescriptor MyConfig { - get { return ProcedureConfig ; } + get { return ProcedureConfig; } set { _ProcedureConfig = null; } } public DocVersionInfo MyDocVersion @@ -5186,13 +5279,14 @@ namespace VEPROMS.CSLA.Library [Serializable()] public partial class SectionInfo : ItemInfo, IVEDrillDownReadOnly { + //private int? _TemplateColumnMode public override void SetupTags() { _MyTab = new Tab(ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Font); string sectTab = GetSectionTab(false); _MyTab.Text = sectTab; _MyTab.CleanText = sectTab.PadRight(20); - MyHeader = new MetaTag(ActiveFormat.PlantFormat.FormatData.SectData.SectionHeader.Font); + MyHeader = new MetaTag(ActiveFormat.PlantFormat.FormatData.SectData.SectionHeader.Font); _MyHeader.Text = null; MyFooter = null; _TagsSetup = true; @@ -5214,7 +5308,7 @@ namespace VEPROMS.CSLA.Library if (DisplayNumber.LastIndexOf('.') == DisplayNumber.Length - 1) return DisplayNumber; 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(); if (Snum == -1) { @@ -5223,11 +5317,11 @@ namespace VEPROMS.CSLA.Library } 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) - retStr = @"\ul " + tmp + "." + Snum.ToString() + @"\ul0 "; - else - retStr = tmp + "." + Snum.ToString(); + retStr = @"\ul " + tmp + "." + Snum.ToString() + @"\ul0 "; + else + retStr = tmp + "." + Snum.ToString(); } return retStr; } @@ -5235,16 +5329,16 @@ namespace VEPROMS.CSLA.Library private int GetSectionNum() { 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: - string tmpstr = indx+1= 0) return -1; if (tmpstr == null) return 0; Int32 x; - if(Int32.TryParse(tmpstr, out x))return x; + if (Int32.TryParse(tmpstr, out x)) return x; return -1; } return (-1); @@ -5254,7 +5348,7 @@ namespace VEPROMS.CSLA.Library int indx = DisplayNumber.IndexOf("."); if (indx < 0 || indx + 1 == DisplayNumber.Length) return false; // 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; } // the following returns the 'index' into the format's CheckOffHeaderList. @@ -5417,7 +5511,7 @@ namespace VEPROMS.CSLA.Library MyFooter = new MetaTag(FormatStepData.TabData.Font); SetTabText(); } - + #endregion protected override void RefreshFields(Item tmp) { @@ -5542,6 +5636,6 @@ namespace VEPROMS.CSLA.Library { Nothing = 0, Value = 1, - Everything =2 + Everything = 2 } } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs index 7ce5d66c..cf65a13b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/ENums.cs @@ -117,6 +117,8 @@ namespace VEPROMS.CSLA.Library BtwnTextAndBottom = 1, BottomOfPage = 2, BelowBottom1 = 3, + // BottomWithFooter added for BGE for Alarms. This puts continue message on bottom AND if in CONDITION/RESPONSE table, at bottom of both columns. + BottomWithFooter = 4, EndOfText2 = 5, BtwnTextAndBottom2 = 6 // Added for BGE, their continue message was a line or so too far down page.1 }; diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index 35120667..8acdda86 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -232,11 +232,14 @@ namespace VEPROMS.CSLA.Library // count newlines - which gives number of template records. int NumTemplates = 0; if (TPL == null) return null; - int indx = TPL.IndexOf('\n'); + // if the template is modified by the plant specific code in the format migration, + // it will contain an '&' rather than '&'. + string tTPL = TPL.Replace("&", "&"); + int indx = tTPL.IndexOf('\n'); while (indx > -1) { NumTemplates++; - indx = TPL.Length > indx + 1 ? TPL.IndexOf('\n', indx + 1) : -1; + indx = tTPL.Length > indx + 1 ? tTPL.IndexOf('\n', indx + 1) : -1; } if (NumTemplates == 0) return null; @@ -261,7 +264,7 @@ namespace VEPROMS.CSLA.Library int type = 0; int start = 0; int width = 0; - int nocol = 0; + short nocol = 0; int row = 0; string stmp = null; if (!NewTemplateFormat) @@ -284,7 +287,7 @@ namespace VEPROMS.CSLA.Library start = Convert.ToInt32(tmpNew[2]); width = Convert.ToInt32(tmpNew[3]); row = Convert.ToInt32(tmpNew[4]); - nocol = Convert.ToInt32(tmpNew[5]); + nocol = Convert.ToInt16(tmpNew[5]); stmp = tmpNew.Length <= 6 ? null : tmpNew[6]; } TPlate tp = new TPlate(level, type, start, width, row, nocol, stmp); @@ -558,6 +561,12 @@ namespace VEPROMS.CSLA.Library } #endregion #region Templates + // the nocolm field -- divided into 4 four-bit subfields; + // starting with the 4 lowest order bits : + // field 1 - number of columns + // field 2 - the header macro to print instead of the text(fixed at 4 for now) + // field 3 - the number of blank lines after the header macro + // field 4 - 1 - identifies the template as being boxed, for latter retrieval public class TPlate { public int level; // sub-step level @@ -565,9 +574,11 @@ namespace VEPROMS.CSLA.Library public int start; // starting position (for horizontal only) public int width; // width of text in characters (") public int row; - public int nocolm; // 1 or 2 columns - default(0) is one column + public short nocolm; // 1 or 2 columns - default(0) is one column public string text; // text to be automatically entered - public TPlate(int l, int t, int s, int w, int r, int c, string x) + public bool boxed; + public int hmacro = 0; + public TPlate(int l, int t, int s, int w, int r, short c, string x) { level = l; type = t; @@ -575,6 +586,11 @@ namespace VEPROMS.CSLA.Library width = w; row = r; nocolm = c; + hmacro = 0x00F0 & nocolm >> 4; + if (hmacro > 0) hmacro = 4; // bge - this was in 16bit code + int blines = (0x0F00 & nocolm) >> 8; + boxed = ((0xF000 & nocolm) >> 12) != 0; + nocolm = (short)(0x000F & nocolm); text = x; } } @@ -705,6 +721,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _SpecialCaseCalvert, "@SpecialCaseCalvert"); } } + private LazyLoad _SpecialCaseCalvertAlarm; + public bool SpecialCaseCalvertAlarm + { + get + { + return LazyLoad(ref _SpecialCaseCalvertAlarm, "@SpecialCaseCalvertAlarm"); + } + } private LazyLoad _SpecialStepsFoldout; public bool SpecialStepsFoldout { diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 29ca2c6d..baa6ad46 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -156,7 +156,13 @@ namespace Volian.Print.Library return 0; // Don't Paginate (page break) on a Step Section if it's first thing on page } if (!MyItemInfo.IsHigh) return 0; // Don't Paginate on a Substep level - + // Document style: DSS_PageBreakHLS breaks on hls. + if (MyItemInfo.IsHigh && (MyItemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_PageBreakHLS) == E_DocStructStyle.DSS_PageBreakHLS) + { + BuildPageBreakList(yPageSize, yPageSize, KeepStepsOnPage); + ShowPageBreak(1, "Page Break on DSS_PageBreakHLS", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); + return 1; + } // if this is a step, see if it has the 'PageBreakOnStep' format flag set to true, if so, break here. if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.PageBreakOnStep) { @@ -166,7 +172,7 @@ namespace Volian.Print.Library ShowPageBreak(1, "Page Break on Steps, Cautions or Notes", "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak); return 1; } - + //MyPageHelper.HLSText = MyItemInfo.DisplayText; // save the High Level Step Text //Console.WriteLine("{0} Paginate", MyPageHelper.HLSText); StepConfig sc1 = MyItemInfo.MyConfig as StepConfig; diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 5011ee97..d130b6d6 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -49,6 +49,18 @@ namespace Volian.Print.Library get { return _TopMessageR; } set { _TopMessageR = value; } } + private vlnText _TopMessageSub1; // BGE Alarms: in CONDITION/RESPONSE if break within substep + public vlnText TopMessageSub1 + { + get { return _TopMessageSub1; } + set { _TopMessageSub1 = value; } + } + private vlnText _TopMessageSub2; // BGE Alarms: in CONDITION/RESPONSE if break within substep + public vlnText TopMessageSub2 + { + get { return _TopMessageSub2; } + set { _TopMessageSub2 = value; } + } private vlnText _BottomMessage; public vlnText BottomMessage { @@ -61,6 +73,12 @@ namespace Volian.Print.Library get { return _BottomMessageR; } set { _BottomMessageR = value; } } + private vlnText _BottomMessageA; // Added if there are 3 messages, at bottom AND in AER AND RNO (for BGEALARMS) + public vlnText BottomMessageA + { + get { return _BottomMessageA; } + set { _BottomMessageA = value; } + } Dictionary _MyParagraphs = new Dictionary(); public Dictionary MyParagraphs { @@ -79,6 +97,18 @@ namespace Volian.Print.Library get { return _PhoneListHeight; } set { _PhoneListHeight = value; } } + private float _AlarmYoffStart = 0; + public float AlarmYoffStart + { + get { return _AlarmYoffStart; } + set { _AlarmYoffStart = value; } + } + private float _AlarmYoffEnd = 0; + public float AlarmYoffEnd + { + get { return _AlarmYoffEnd; } + set { _AlarmYoffEnd = value; } + } private PdfWriter _MyPdfWriter; public PdfWriter MyPdfWriter { @@ -203,12 +233,53 @@ namespace Volian.Print.Library if (MySection.ColumnMode > 0) DrawCenterLine(writer.DirectContent, MySection.MyDocStyle.Layout.LeftMargin + MySection.MyDocStyle.CenterLineX ?? 0, MySection.MyDocStyle.CenterLineYTop ?? 0, MySection.MyDocStyle.CenterLineYBottom ?? 0); } + + if (MySection.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + float left = (float)MySection.MyDocStyle.Layout.LeftMargin + 4.5f; // used 4.5 to make bge alarm lines closest to lining up with macro + float right = (float)MySection.MyDocStyle.Layout.PageWidth; + if (AlarmYoffStart > 0) + { + // draw vertical - either to the alarmyoffend or bottom of page + if (AlarmYoffEnd > 0) // ends on this page. + { + DrawVertical(writer.DirectContent, left, AlarmYoffStart, AlarmYoffEnd); + DrawVertical(writer.DirectContent, right, AlarmYoffStart, AlarmYoffEnd); + DrawVertical(writer.DirectContent, (right + left) / 2, AlarmYoffStart, AlarmYoffEnd); + DrawHorizontal(writer.DirectContent, left, right, AlarmYoffEnd); + AlarmYoffStart = 0; + AlarmYoffEnd = 0; + } + else + { + float yBottom = (float)(writer.DirectContent.PdfWriter.PageSize.Height - ((float)MySection.MyDocStyle.Layout.TopMargin + (float)MySection.MyDocStyle.Layout.PageLength)); + DrawVertical(writer.DirectContent, left, AlarmYoffStart, yBottom); + DrawVertical(writer.DirectContent, right, AlarmYoffStart, yBottom); + DrawVertical(writer.DirectContent, (right + left) / 2, AlarmYoffStart, yBottom); + DrawHorizontal(writer.DirectContent, left, right, yBottom); + AlarmYoffStart = (float)writer.DirectContent.PdfWriter.PageSize.Height - (float)MySection.MyDocStyle.Layout.TopMargin; + } + } + } PageListTopCheckOffHeader = null; PageListLastCheckOffHeader = null; YMultiplier = 1; PrintedAPage = true; } + private void DrawVertical(PdfContentByte cb, float x, float top, float bottom) + { + cb.SaveState(); + if (PageListLayer != null) cb.BeginLayer(PageListLayer); + cb.SetColorStroke(new Color(PrintOverride.SvgColor)); + //cb.SetColorStroke(lineColor); + cb.MoveTo(x, top); + cb.LineTo(x, bottom); + cb.Stroke(); + if (PageListLayer != null) cb.EndLayer(); + cb.RestoreState(); + } + private void DrawPhoneList(PdfContentByte pdfContentByte, float leftMargin, float pageWidth, float yOff, string plist) { // draw the line above the phone list: @@ -490,6 +561,16 @@ namespace Volian.Print.Library TopMessageR.ToPdf(cb, 0, ref tmp, ref tmp); TopMessageR = null; // Only output it once. } + if (TopMessageSub1 != null) + { + TopMessageSub1.ToPdf(cb, 0, ref tmp, ref tmp); + TopMessageSub1 = null; // Only output it once. + } + if (TopMessageSub2 != null) + { + TopMessageSub2.ToPdf(cb, 0, ref tmp, ref tmp); + TopMessageSub2 = null; // Only output it once. + } if (BottomMessage != null) { BottomMessage.ToPdf(cb, 0, ref tmp, ref tmp); @@ -500,6 +581,11 @@ namespace Volian.Print.Library BottomMessageR.ToPdf(cb, 0, ref tmp, ref tmp); BottomMessageR = null; // Only output it once. } + if (BottomMessageA != null) + { + BottomMessageA.ToPdf(cb, 0, ref tmp, ref tmp); + BottomMessageA = null; // Only output it once. + } } public void DrawBottomMessage(PdfContentByte cb) { @@ -1472,7 +1558,11 @@ namespace Volian.Print.Library string revUnit = null; string unitNum = MySection.MyDocVersion.DocVersionConfig.Print_UnitNumberForPageList; if (Rev != null && Rev != "") + { revUnit = Rev; + int indxs = Rev.IndexOf(MySection.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/'); + if (indxs > 0) revUnit = Rev.Substring(0, indxs); + } else revUnit = " "; diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index cdada466..554749f1 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -71,11 +71,16 @@ namespace Volian.Print.Library bool didComponentTableRow = false; float tableBottomMost = 0; float xoffBase = xoff; + int prevTplRow = 0; + int maxRnoSav = maxRNO; foreach (ItemInfo iChildItemInfo in itemInfoList) { + maxRNO = maxRnoSav; if (iChildItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox && iChildItemInfo.IsHigh) bxIndex = null; if (iChildItemInfo.IsSection && (iChildItemInfo as SectionInfo).ColumnMode != maxRNO) maxRNO = (iChildItemInfo as SectionInfo).ColumnMode; + int maxRnoTemplate = iChildItemInfo.TemplateChildColumnMode; + if (maxRnoTemplate >= 0) maxRNO = maxRnoTemplate-1; ItemInfo childItemInfo = iChildItemInfo; int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex; // if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution @@ -89,13 +94,41 @@ namespace Volian.Print.Library // by the first level of children. The data for the column is the child of the column header. // Sometimes the column will not have data, the following handles that case. Also, use // the boolean didComponentTableRow to keep track of the bottom most yoff of the table row. - if ((childItemInfo.MyDocStyle.ComponentList) && childItemInfo.MyParent.IsInTemplate()) + if ((childItemInfo.MyDocStyle.ComponentList) && childItemInfo.MyParent.IsInTemplate()|| + (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && childItemInfo.IsInTemplate())) { - // childItemInfo = 'child' and set to use a template for defining size. - if (childItemInfo.Steps == null) - continue; + if (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + // if this template element has a -1 for row, print it (if = 0 this is a heading for edit + // and not printed). if this template element has a width of 0, then also print it, + // these are headings and should be printed). This was added for Calvert Alarm (BGEALN) format for + // DEVICE/SETPOINT (row=-1), and for POSSIBLE CAUSES, AUTOMATIC ACTIONS, etc (width=0) + // find the indexes into the template for this item. The index must be for the HLS this is + // or this is under. + int tindx = childItemInfo.TemplateIndex; + if (tindx == -1) + xoff = (float)childItemInfo.MyDocStyle.Layout.LeftMargin; + else if (childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row < 0 || + childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].width == 0) + { + // move down for the 'POSSIBLE CAUSES'. To know it's that step type, check + // the column field in template. -1 represents staying on same row but using + // the start template field to get the xoffset. + if (prevTplRow == -1 && prevTplRow != childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row) + { + // position to the furthest down the page of the Device/setpoint/annunciator window: + yoff = Math.Max(yoff, Parent.YBottomMost + vlnPrintObject.SixLinesPerInch); + yoff = Math.Max(yoff, tableBottomMost + vlnPrintObject.SixLinesPerInch); + } + xoff = (float)childItemInfo.MyDocStyle.Layout.LeftMargin + (childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].start * 7.2f); + prevTplRow = childItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row; + } + } else { + // childItemInfo = 'child' and set to use a template for defining size. + if (childItemInfo.Steps == null) + continue; childItemInfo = childItemInfo.Steps[0]; didComponentTableRow = true; } @@ -237,6 +270,11 @@ namespace Volian.Print.Library para.PartsContainer.Add(box); } Add(para); + + // Calvert Alarm's caution1 is the Annunciator window, i.e. in top right of page. Adjust + // y offset for this caution that is printed BELOW the hls. + if (childItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && iChildItemInfo.IsCaution1) para.MyHighLevelParagraph.YBottomMost = para.YBottomMost; + // para.YBottomMost will have y for bottom of any substeps that are also enclosed in the box. if (childItemInfo.IsStep && childItemInfo.MyHLS != null && childItemInfo.MyHLS.FormatStepData.UseSmartTemplate && para.ChildrenBelow.Count > 0 && para.ChildrenBelow[0].YBottomMost > para.YBottomMost) yoff = para.ChildrenBelow[0].YBottomMost; @@ -314,6 +352,7 @@ namespace Volian.Print.Library get { return _PageBreakOnStep; } set { _PageBreakOnStep = value; } } + private bool HasCalvertMacro = false; // this step has the Calvert (BGE) Alarm CONDITION/RESPONSE macro associated with it private float WidthNoLimit = 0; private vlnTable _MyGrid; public vlnTable MyGrid @@ -687,9 +726,17 @@ namespace Volian.Print.Library if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); //Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); float retval = yLocation; + // Calvert Alarms have a special case, center text if the next/previous is not the same type of caution or note. + // Calvert Alarms have a note1 that is a warning. if a regular note preceeded it, this regular note was not centered. + bool doAlign = false; + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + if ((MyItemInfo.MyPrevious != null && MyItemInfo.MyContent.Type != MyItemInfo.MyPrevious.MyContent.Type)|| + (MyItemInfo.GetNextItem() != null && MyItemInfo.MyContent.Type != MyItemInfo.GetNextItem().MyContent.Type)) doAlign = true; + } // Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2 // multiplier accounts for both. - if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.GetNextItem() == null) || MyItemInfo.FormatStepData.SeparateBox) && Height < (1.2F * IParagraph.Leading)) + if (!MyItemInfo.IsStepSection && MyItemInfo.FormatStepData.CenterOneLineOnly && ((MyItemInfo.MyPrevious == null && MyItemInfo.GetNextItem() == null) || MyItemInfo.FormatStepData.SeparateBox || doAlign) && Height < (1.2F * IParagraph.Leading)) IParagraph.Alignment = Element.ALIGN_CENTER; // if this step is centered, but not part of the checklist or valvelist format, use itextsharp to center it. // if it was part of the checklist or valvelist, then the centering is based on the column definitions for the table and @@ -837,6 +884,7 @@ namespace Volian.Print.Library } public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) { + bool doThreeContinues = false; // For BGE, the very first subsection's pagelist items were not correct - the section/meta section titles were // at the wrong level. Reset the page helper's section. if (MyItemInfo.IsSection && MyItemInfo.MyPrevious == null && MyItemInfo.MyParent.IsSection && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseWestinghouse) @@ -845,6 +893,13 @@ namespace Volian.Print.Library MyPageHelper.ResetSvg(); } + // For Calvert Alarms: A macro exists around the CONDITION/RESPONSE portion. If the page break occurs so that + // this 'table' moved to the following page AND there is an associated note/caution that is not on the next page, + // remove the macro so that the header macro doesn't print on the page with the note (without this, an extraneous + // header for the 'table'is printed. + if (PartsLeft.Count != 0 && (PartsLeft[0] is vlnMacro) && MyPageHelper.ParaBreaks.Count != 0 && MyPageHelper.ParaBreaks[0].MyItemInfo.MyPrevious == null) + if (!MyPageHelper.ParaBreaks[0].MyItemInfo.IsNote && !MyPageHelper.ParaBreaks[0].MyItemInfo.IsCaution) PartsLeft.Clear(); + if (IsWordDocPara) { PdfReader tmp = null; @@ -880,7 +935,7 @@ namespace Volian.Print.Library OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); docstyle = MyItemInfo.MyDocStyle; bool doSectionContinue = !MyItemInfo.IsSection && ((docstyle.StructureStyle.Style & E_DocStructStyle.BottomSectionContinue) == E_DocStructStyle.BottomSectionContinue); - if (doSectionContinue) DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle); + if (doSectionContinue) DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, false); cb.PdfDocument.NewPage(); //_MyLog.InfoFormat("NewPage 10 {0}", cb.PdfWriter.CurrentPageNumber); if (MyItemInfo.IsSection && MyParent != null && MyParent.MyItemInfo.IsSection && (MyItemInfo as SectionInfo).IsSeparatePagination()) @@ -917,7 +972,7 @@ namespace Volian.Print.Library yPageStart = yTopMargin + YTopMost; DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); - if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle); + if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null); // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) { @@ -929,7 +984,31 @@ namespace Volian.Print.Library case 2: // Break within a Step OutputOtherPageSteps(cb, YTopMost, yPageStart, yTopMargin, yBottomMargin); docstyle = MyItemInfo.MyDocStyle; - DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle); + bool doAlarmBox = false; + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + { + // Recognize that the break occurred WITHIN the CONDITION/RESPONSE table. + // Otherwise, we get extraneous header/top of box lines in pdf. + if (MyPageHelper.AlarmYoffStart > 0) + { + // if the first step in box is what broke to next page, then + // don't print the box on this page, only print it on next page: + if (MyItemInfo.MyPrevious == null) + MyPageHelper.AlarmYoffStart = 0; + else if (MyPageHelper.AlarmYoffEnd == 0) + { + // doThreeContinues flags when continue messages are printed in the + // bottom of the CONDITION/RESPONSE table columns. + doThreeContinues = MyItemInfo.StepLevel>1; + MyPageHelper.AlarmYoffEnd = CalculateYLocation(yLocation, yTopMargin); + } + doAlarmBox = true; + } + } + } + + DoBottomContinueMsg(cb, yBottomMargin, yLocation, docstyle, doThreeContinues); cb.PdfDocument.NewPage(); //_MyLog.InfoFormat("NewPage 11 {0}", cb.PdfWriter.CurrentPageNumber); ResetDocStyleAndValues(ref yTopMargin, ref yBottomMargin); @@ -967,7 +1046,7 @@ namespace Volian.Print.Library yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch; DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); if (EmptyTopMostPart) yPageStart += SixLinesPerInch; - DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle); + DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle, doThreeContinues?"2 ":null); // If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader) @@ -977,6 +1056,17 @@ namespace Volian.Print.Library } MyPageHelper.YMultiplier = 1; + // For Calvert Alarms, if there was a page break and there is an box around the current + // step, need to add the header for the box, which is stored in a macro. Also set the + // 'AlarmYoffStart' value to where the vertical lines of the box start on this page. + if (doAlarmBox && MyItemInfo.StepLevel>1) + { + float alrmY = CalculateYOffset(yPageStart, yTopMargin); + PartsLeft.Add(new vlnMacro((float)docstyle.Layout.LeftMargin - 12, YOffset-(4*SixLinesPerInch), "H4")); // probably not the right paragraph? + MyPageHelper.AlarmYoffStart = alrmY - SixLinesPerInch; + yPageStart -= (4 * SixLinesPerInch); + } + // Now check if this is a template type step & if so, add the HLS's prefix/suffix to it. if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate) { @@ -1055,6 +1145,20 @@ namespace Volian.Print.Library MyPageHelper.ParaBreaks.RemoveAt(0); yPageStart = yTopMargin + YTop; } + // The following sets the beginning/ending y location for the lines around the + // CONDITION/RESPONSE text for Calvert Alarm format + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + int tindx = MyItemInfo.TemplateIndex; + if (tindx >= 0) + { + // save this position to start drawing the alarm box lines around substeps: + if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.Templates[MyItemInfo.TemplateIndex].row > 0) + MyPageHelper.AlarmYoffStart = CalculateYOffset(yPageStart, yTopMargin) - SixLinesPerInch; + else if (MyPageHelper.AlarmYoffStart > 0 && MyPageHelper.AlarmYoffEnd == 0) + MyPageHelper.AlarmYoffEnd = CalculateYOffset(yPageStart, yTopMargin) + (2 * SixLinesPerInch); + } + } yPageStart = ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); // If the yPageStart changes by more than a small amount (pagination) in the RNO (right column), then update // yPageStart for the AER (left column). @@ -1133,7 +1237,7 @@ namespace Volian.Print.Library return yPageStart; } - private void DoTopContinueMsg(PdfContentByte cb, ref float yPageStart, float yTopMargin, DocStyle docstyle) + private void DoTopContinueMsg(PdfContentByte cb, ref float yPageStart, float yTopMargin, DocStyle docstyle, string subTab) { string myMsg = docstyle.Continue.Top.Message; MyPageHelper.TopMessageR = null; @@ -1186,6 +1290,27 @@ namespace Volian.Print.Library myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray())); if (myMsg.IndexOf(@"%c") > -1) myMsg = myMsg.Replace(@"%c", " "); + + // Calvert Alarms, step description have the alarm number as part of the top continue message + // Also, if the break is within the CONDITION/RESPONSE, there are continue messages in both columns at the top + // of the table, note that the continue messages WITHIN table are only printed when the + // steplevel is greater than 2 - this is from 16bit. + // NOTE THAT this code is not complete - the positioning & addition of step tab for within table are not working correctly + if ((docstyle.Continue.Top.HLS ?? 0) == 3) + { + string HLSTabTextForContMsg = MyHighLevelParagraph.MyItemInfo.MyTab.CleanText + " " + MyHighLevelParagraph.MyItemInfo.MyContent.Text; + int len = (HLSTabTextForContMsg.Length - 10) * 6; + HLSTabTextForContMsg = @"\ul\b " + MyHighLevelParagraph.MyItemInfo.MyTab.CleanText.Trim() + @" \b0\ulnone \b " + MyHighLevelParagraph.MyItemInfo.MyContent.Text + @"\b0"; + MyPageHelper.TopMessageR = new vlnText(cb, this, HLSTabTextForContMsg, HLSTabTextForContMsg, (float)docstyle.Layout.PageWidth - len, yTopMargin + 0.1F, docstyle.Continue.Top.Font); + if (subTab != null && MyItemInfo.StepLevel > 2) + { + float ybot = yTopMargin + (4 * SixLinesPerInch); + float xoffB = (float)docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0; + MyPageHelper.TopMessageSub1 = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); + xoffB = docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.MarginR ?? 0; + MyPageHelper.TopMessageSub2 = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); + } + } if (!PageBreakOnStep) MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); else @@ -1193,7 +1318,7 @@ namespace Volian.Print.Library } } - private void DoBottomContinueMsg(PdfContentByte cb, float yBottomMargin, float yLocation, DocStyle docstyle) + private void DoBottomContinueMsg(PdfContentByte cb, float yBottomMargin, float yLocation, DocStyle docstyle, bool doThreeContinues) { string myMsg = docstyle.Continue.Bottom.Message; @@ -1248,6 +1373,9 @@ namespace Volian.Print.Library case E_ContBottomLoc.BelowBottom1: msg_yLocation = msg_yLocation + yBtmMarginForMsg; break; + case E_ContBottomLoc.BottomWithFooter: // put bottom message AND if in CONDITION/RESPONSE table, in both columns. + msg_yLocation = msg_yLocation + yBtmMarginForMsg; + break; case E_ContBottomLoc.EndOfText2: // Like EndOfText but limited within yBottomMargin msg_yLocation = Math.Max(msg_yLocation + yLocation - SixLinesPerInch, yBottomMargin + SixLinesPerInch); break; @@ -1264,7 +1392,25 @@ namespace Volian.Print.Library if (!PageBreakOnStep) { float xoffB = 0; - if (RNOContinueOnly) + // Added for Calvert Alarms: if 'doThreeContinues', continue message at bottom of page + // and a continue message at the bottom of each column. + if (doThreeContinues) + { + float ybot = yLocation; + xoffB = (float)docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.Margin ?? 0; + MyPageHelper.BottomMessageA = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); + xoffB = docstyle.Layout.LeftMargin + docstyle.Continue.Bottom.MarginR ?? 0; + MyPageHelper.BottomMessageR = new vlnText(cb, this, myMsg, myMsg, xoffB, ybot, docstyle.Continue.Bottom.Font); + MyPageHelper.AlarmYoffEnd -= SixLinesPerInch; + float tmp = (((float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin) / 2) - (myMsg.Length / 2 * 5); + xoffB = (float)docstyle.Layout.LeftMargin + tmp; + } + else if (docstyle.Continue.Bottom.Location == E_ContBottomLoc.BottomWithFooter) + { + float tmp = (((float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin) / 2) - (myMsg.Length / 2 * 5); + xoffB = (float)docstyle.Layout.LeftMargin + tmp; + } + else if (RNOContinueOnly) { // The following line was added for McGuire APs/AP/1/5500/12, Step 13 //if (msg_yLocation < yBottomMargin + SixLinesPerInch) msg_yLocation = yBottomMargin + SixLinesPerInch; @@ -1555,6 +1701,17 @@ namespace Volian.Print.Library } public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent) { + // do some 'setup' for Calvert Alarms: + if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + // The CONDITION/RESPONSE portion of the alarm uses a macro to print the 'table' heading, + // i.e. the lines/boxes and text for CONDITION and RESPONSE. This does not have a tab, + // tabs are where the macros are usually stored, so flag this for future reference. + // The 2nd if is executed when the step is at the same y offset as the parent, i.e. DEVICE & SETPOINT text. + if (itemInfo.TemplateIndex > 0 && itemInfo.ActiveFormat.PlantFormat.FormatData.Templates[itemInfo.TemplateIndex].hmacro > 0) + HasCalvertMacro = true; + if (KeepOnParentLine(itemInfo)) yoff = parent.YOffset; + } float yOffOrig = yoff; BuildPlacekeeper(parent, itemInfo); if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null) @@ -1747,7 +1904,7 @@ namespace Volian.Print.Library if (itemInfo.IsInRNO) { XOffset = MyTopRNO.MyTab != null ? MyTopRNO.MyTab.XOffset : MyTopRNO.XOffset; - Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 10; // subtract 10 (about a character) so it doesn't touch line + Width = (float)itemInfo.MyDocStyle.Layout.PageWidth - XOffset - 10; } else { @@ -1763,20 +1920,20 @@ namespace Volian.Print.Library float yoffLeft = yoff; if (ChildrenAbove != null) ChildrenAbove.StepDesignator = null; //reset StepDesignator - if (itemInfo.Cautions != null && !(itemInfo.IsCaution || itemInfo.IsNote)) + if (itemInfo.Cautions != null && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || itemInfo.Cautions[0].FormatStepData.Type != "Caution1") && !(itemInfo.IsCaution || itemInfo.IsNote)) { - if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) - { - // For deviations, the Cautions are always in the same place. - // Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS - float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - } - else - { - if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; - yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); - } + if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format) + { + // For deviations, the Cautions are always in the same place. + // Fix for Catawba E-1 deviation for step 10. Has note/caution off of a paragraph instead of HLS + float xoffDev = (float)itemInfo.MyDocStyle.Layout.LeftMargin; + yoffLeft = ChildrenLeft.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + } + else + { + if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; + yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + } } if (itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote)) { @@ -1793,7 +1950,7 @@ namespace Volian.Print.Library // yoff from this. Without this, an overlap of text between the note and the bottom of the // RNO was occurring for FNP - Unit 2/AOP, AOP-4.0. if (yoffRightParent > yoff && ((itemInfo.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DoubleBoxHLS) != E_DocStructStyle.DoubleBoxHLS)) yoff = yoffRightParent; - yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + yoff = ChildrenAbove.Add(cb, itemInfo.Notes, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); } } @@ -2029,6 +2186,11 @@ namespace Volian.Print.Library } else { + // For Calvert Alarms, the 'CONDITION/RESPONSE' portion uses a macro to print + // the CONDITION and RESPONSE text with the lines around it. Add the macro here because + // there is no tab for the step & that's where the macro is usually stored: + if (HasCalvertMacro) PartsLeft.Add(new vlnMacro(xoff - 12f, yoff, "H4")); + //if (itemInfo.IsSection) // Rtf = GetRtf(itemInfo, prefix, " (Continued)"); //else @@ -2107,6 +2269,7 @@ namespace Volian.Print.Library // y direction (bottommost) across the row. if (itemInfo.IsStep && itemInfo.MyHLS != null && (itemInfo.MyHLS.FormatStepData.UseSmartTemplate || (itemInfo.MyHLS.FormatStepData.UseOldTemplate && itemInfo.MyDocStyle.ComponentList)) && (TheStepLevel(itemInfo) >= 0)) savCheckListBottomMost = yoff + Height + (itemInfo.MyHLS.FormatStepData.UseSmartTemplate ? SixLinesPerInch : 0); + if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsCaution1) savCheckListBottomMost = yoff + Height; // Get Y offset for regular steps, or if section title is output or if not within row (not last column of // text) for wcn checklist, i.e. if ((!itemInfo.IsStepSection && itemInfo.MyHLS != null && !itemInfo.MyHLS.FormatStepData.UseSmartTemplate) // regular step @@ -2140,7 +2303,31 @@ namespace Volian.Print.Library } } } - + if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + // For Calvert Alarms, the row has formatting that makes this template item have a header & box + // (CONDITION/RESPONSE), header with box around it is defined in genmac whereas the lines around + // substeps are drawn in pagehelper. Adjust some yoffsets around this box. + // Need to: + // 1) move the text down a bit for top line (1.5f * SixLinesPerInch) + // 2) move the substep down 2 lines (2 * SixLinesPerInch) for bottom of box + // and space before substep + // 3) if the previous item had this condition, add space for the + // line below. + if (HasCalvertMacro) + { + YOffset += (1.5f * vlnPrintObject.SixLinesPerInch); + yoff += (2 * vlnPrintObject.SixLinesPerInch); + } + if (itemInfo.MyPrevious != null && itemInfo.MyPrevious.TemplateIndex > 0) + { + if (itemInfo.MyPrevious.ActiveFormat.PlantFormat.FormatData.Templates[itemInfo.MyPrevious.TemplateIndex].hmacro > 0) + { + YOffset += (3 * vlnPrintObject.SixLinesPerInch); + yoff += (3 * vlnPrintObject.SixLinesPerInch); + } + } + } CheckOff co = itemInfo.GetCheckOffStep(); if (co != null) { @@ -2257,6 +2444,13 @@ namespace Volian.Print.Library yoff += mySep.Height;// +SixLinesPerInch; } } + // For Calvert Alarms, 'Caution1' was used to implement the Annunciator Window, i.e. is printed + // below the HLS and close to the right margin. + if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.Type == "Caution1") + { + yoff = ChildrenBelow.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); + savCheckListBottomMost = yoff; + } if (itemInfo.Steps != null && printsteps) { if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight") @@ -2295,6 +2489,16 @@ namespace Volian.Print.Library if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; } + // for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This + // is flagged by the -1 row in the template definition. + private bool KeepOnParentLine(ItemInfo itemInfo) + { + int tindx = itemInfo.TemplateIndex; + if (tindx < 0) return false; + if (itemInfo.ActiveFormat.PlantFormat.FormatData.Templates[tindx].row == -1) return true; + return false; + } + private void AdjustYOffset(float yDelta) { YOffset -= yDelta; @@ -2782,7 +2986,16 @@ namespace Volian.Print.Library if (!itemInfo.IsTable && StepRTB.MyFontFamily != null) myFont = new System.Drawing.Font(StepRTB.MyFontFamily, myFont.Size, myFont.Style); - string stText = vlntxt.StartText; + string stText = null; // if Calvert (BGE) Alarms, the text is included in the macro, so save text as a blank: + if (HasCalvertMacro) + { + stText = " "; + // turn underline off + myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, FontStyle.Regular); //myFont.Style. | FontStyle.Underline); + } + else + stText = vlntxt.StartText; + if (itemInfo.IsHigh && itemInfo.MyDocStyle.UndSpecialStepsFoldout) { myFont = new System.Drawing.Font(myFont.FontFamily, myFont.Size, myFont.Style | FontStyle.Underline); @@ -3115,7 +3328,7 @@ namespace Volian.Print.Library XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; return; } - else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow") + else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow" && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || (!itemInfo.IsCaution && !itemInfo.IsNote))) { float childindent = itemInfo.MyParent.FormatStepData.ChildIndent ?? 0; if (myTab != null) @@ -3143,6 +3356,30 @@ namespace Volian.Print.Library } if (itemInfo.IsHigh) { + if (formatInfo.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + // the HLS in the template prints the tab/step on the right edge of page. Don't + // do the other calculations to relocate it. + if (itemInfo.FormatStepData.UseOldTemplate && itemInfo.IsInTemplate()) + { + MyTab.XOffset = XOffset - MyTab.Width; + return; + } + // the following code handles the xoffsets of tabs/HLS in the non-alarm sections for + // the Calvert Alarm format. + if (itemInfo.MyDocStyle.UseColSByLevel) + { + if (myTab != null) + { + myTab.Rtf = myTab.Rtf.Replace(myTab.Text, myTab.Text.TrimStart(" ".ToCharArray())); + myTab.XOffset = MyParent.XOffset; + XOffset = myTab.XOffset + MyTab.Width; + } + else + XOffset = MyParent.XOffset; // unnumbered hls + return; + } + } float x = 0; float xoff = 0; if ((colOvrd ?? 0) != 0) @@ -3371,7 +3608,7 @@ namespace Volian.Print.Library if (itemInfo.IsStep && itemInfo.MyHLS != null && UseTemplateWidthOrXOff(itemInfo) && (xwid = GetWidthOrStartFromTemplate(itemInfo, formatInfo, true)) > 0) widOvrd = xwid; else - widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride == null ? null : + widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride == null ? null : (float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO); //widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; // Don't adjust the RNO width if in single column mode: @@ -3536,7 +3773,8 @@ namespace Volian.Print.Library public bool UseTemplateKeepOnCurLine(ItemInfo itemInfo) { if (!itemInfo.IsStep || !itemInfo.MyDocStyle.ComponentList) return false; - if (itemInfo.MyHLS.FormatStepData.UseOldTemplate) return true; + if (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert + && itemInfo.MyHLS.FormatStepData.UseOldTemplate) return true; return false; } private bool UseTemplateWidthOrXOff(ItemInfo itemInfo) @@ -3549,7 +3787,14 @@ namespace Volian.Print.Library { ItemInfo useForTemplate = itemInfo.IsHigh ? itemInfo : itemInfo.MyParent; int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx(); - int tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type); + int tpIndx = -1; + if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + if (itemInfo.IsCaution1) return false; + else tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, itemInfo.MyContent.Text); + } + else + tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type); if (tpIndx > -1) return true; } return false; @@ -3560,19 +3805,39 @@ namespace Volian.Print.Library int tmplIndx = 0; if (itemInfo.MyDocStyle.ComponentList && !itemInfo.IsHigh) { - // The ComponentTable format (FNP component table as one example), uses a template - // where the items in the template below the HLS are all paragraphs (the intermediate steps - // are TitleWithTextRight). Find the ordinal of in this list to get the index. Use the ordinal - // as an offset from the HLS's index into the template. - tmplIndx = itemInfo.MyParent.Ordinal + topIndx; - if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0; + // The following was added so that the Calvert Alarms sequentials under the CONDITION/RESPONSE would be + // printed as 2 column (data within the template definition set the columns to 2) + if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) + { + if (itemInfo.IsSequential && itemInfo.MyParent.TemplateIndex > 0) + { + if (bGetWidth && itemInfo.MyParent.ColumnMode == 1) // 2 columns + return (ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, itemInfo.ColumnMode) - MyTab.Width); + } + tmplIndx = itemInfo.TemplateIndex; + if (tmplIndx == -1) return 0; + } + else + { + // The ComponentTable format (FNP component table as one example), uses a template + // where the items in the template below the HLS are all paragraphs (the intermediate steps + // are TitleWithTextRight). Find the ordinal of in this list to get the index. Use the ordinal + // as an offset from the HLS's index into the template. + tmplIndx = itemInfo.MyParent.Ordinal + topIndx; + if (tmplIndx < 0 || tmplIndx > formatInfo.PlantFormat.FormatData.Templates.Count - 1) return 0; + } } else { tmplIndx = itemInfo.GetSmartTemplateIndex(topIndx, (int)itemInfo.MyContent.Type); if (tmplIndx == -1) return 0; } - + // Calvert Alarms' template defines number of columns & their width. + if (bGetWidth && formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width == 0) + { + int nocol = formatInfo.PlantFormat.FormatData.Templates[tmplIndx].nocolm == 0 ? 0 : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].nocolm - 1; + return ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, nocol); + } int ncol = bGetWidth ? formatInfo.PlantFormat.FormatData.Templates[tmplIndx].width : formatInfo.PlantFormat.FormatData.Templates[tmplIndx].start; // now convert to the units for this format. The template width data is in number of columns. return (ncol * itemInfo.FormatStepData.Font.CharsToTwips) + (bGetWidth ? 1 : 0); // + 1 is slight adjustment so column doesn't wrap diff --git a/PROMS/Volian.Print.Library/vlnTab.cs b/PROMS/Volian.Print.Library/vlnTab.cs index 233826da..07ad2baa 100644 --- a/PROMS/Volian.Print.Library/vlnTab.cs +++ b/PROMS/Volian.Print.Library/vlnTab.cs @@ -119,7 +119,7 @@ namespace Volian.Print.Library Text = cleanTab; MyFont = vFont; // BGE has a format flag to increase size of font, if top level: - if (doSectTab && myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && myparent.MyItemInfo.MyParent.IsProcedure) + if (doSectTab && myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumber.Level0Big && myparent.MyItemInfo.MyParent.IsProcedure) vFont = new VE_Font(vFont.Family, 14, (E_Style)vFont.Style | E_Style.Bold, 8); float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName); float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName); @@ -130,12 +130,12 @@ namespace Volian.Print.Library Width = 90; } else if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0) - //if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0) + //if ((myparent.MyItemInfo.FormatStepData != null) && (myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0) Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth; else if (CCCs != IIIs) { float tPtPerChar = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar ?? 6; - Width = tPtPerChar * origTab.Length; + Width = (tPtPerChar == 0 ? 6 : tPtPerChar) * origTab.Length; // Check the following, it may be needed for FPL: //origTab1 = origTab1.TrimStart(" ".ToCharArray()); // 6 = number of points per character. 4 characters between end of tab and beginning of text @@ -144,7 +144,7 @@ namespace Volian.Print.Library } else Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName); //MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); - + // Pairie Island (NSP) Caution and Note tabs use a larger font // When using a bullet, we need to use the font size of the Caution/Note text instead of the tab. // To do this we set the TabData.Bullet.Separate to true (currently - 4/26/2013 - only NSP uses this). @@ -170,7 +170,7 @@ namespace Volian.Print.Library if (CCCs != IIIs) { float? tPtPerChar1 = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TabPtsPerChar; - if (tPtPerChar1!=null) + if (tPtPerChar1 != null) Width = (float)tPtPerChar1 * origTab.Length; else { @@ -241,7 +241,7 @@ namespace Volian.Print.Library Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394 if (ScriptCaution) { - Rtf = GetRtf("\u25CFCaution ", vFont); + Rtf = GetRtf("\u25CFCaution ", vFont); Rtf = Rtf.Replace("\u25CF", @"\f1\fs20 \u9679?\f0\par\f0\fs64 "); // bullet 25CF // jsj- force bullet size (is different than tab text) if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null) Rtf = Rtf.Replace("Caution ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?"); @@ -294,12 +294,12 @@ namespace Volian.Print.Library XOffset = xoffset; // the width was just a little small, so it was wrapping - but only if there were no spaces at end // so use this condition to do minimal impact (WCN1 format, for section tabs with three places, i.e. 6.1.2 - if (!cleanTab.EndsWith(" "))Width += .1f; + if (!cleanTab.EndsWith(" ")) Width += .1f; } else { // if using a proportional font and the tab font/size is different than the text font/size - if (CCCs != IIIs && + if (CCCs != IIIs && (MyFont.Family != myparent.MyItemInfo.FormatStepData.Font.Family || MyFont.Size != myparent.MyItemInfo.FormatStepData.Font.Size)) { @@ -308,14 +308,14 @@ namespace Volian.Print.Library string txt = Text; if (alignAsIfBulleted) txt += myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB; - System.Drawing.Font font = new System.Drawing.Font(MyFont.Family,(float)MyFont.Size); - iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); + System.Drawing.Font font = new System.Drawing.Font(MyFont.Family, (float)MyFont.Size); + iTextSharp.text.Font iFont = Volian.Svg.Library.VolianPdf.GetFont(font); float w = iFont.BaseFont.GetWidthPointKerned(txt, (float)MyFont.Size); - Width = w; + Width = w; } XOffset = xoffset - Width; } - + } public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin) {