From 74886aa3b4607c7002265a5c91d67dfc7293a1ae Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 8 Jan 2014 20:13:11 +0000 Subject: [PATCH] Added code to handle diamond1 format item Added RNOWidthAdj flag for Braidwood --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 80 +++++++++++-------- .../Format/PlantFormat.cs | 8 ++ 2 files changed, 54 insertions(+), 34 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 5a01e70f..a1317119 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -2182,7 +2182,7 @@ namespace VEPROMS.CSLA.Library public DocVersionInfo MyDocVersion { - get + get { if (_MyDocVersion == null) { @@ -2192,9 +2192,9 @@ namespace VEPROMS.CSLA.Library { if (ActiveParent == null) return null; _MyDocVersion = (ActiveParent as ItemInfo).MyDocVersion; + } } - } - return _MyDocVersion; + return _MyDocVersion; } set { _MyDocVersion = value; } } @@ -2472,7 +2472,7 @@ 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))) @@ -2516,7 +2516,7 @@ namespace VEPROMS.CSLA.Library { _MyTab.CleanText = ((ItemInfo)ActiveParent).MyTab.CleanText; _MyTab.Text = ((ItemInfo)ActiveParent).MyTab.Text; - _MyTab.RNOTabWidthAdjust = ((ItemInfo)ActiveParent).FormatStepData.TabData.RNOAdjustTabSize ?? 0; + _MyTab.RNOTabWidthAdjust = ((ItemInfo)ActiveParent).FormatStepData.TabData.RNOAdjustTabSize??0; if (((ItemInfo)ActiveParent).MyTab.Offset != 0) _MyTab.Offset = ((ItemInfo)ActiveParent).MyTab.Offset; if (((ItemInfo)ActiveParent).FormatStepData.TabData.RNOExcludeMacros) _MyTab.Text = Regex.Replace(_MyTab.Text, "{!.+?}", " "); @@ -2543,11 +2543,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: @@ -2556,7 +2556,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 @@ -2576,7 +2576,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 @@ -2595,7 +2595,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); @@ -2617,7 +2617,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)) { @@ -2647,9 +2647,9 @@ namespace VEPROMS.CSLA.Library //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#", ""); @@ -2658,9 +2658,9 @@ 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. @@ -2684,9 +2684,9 @@ namespace VEPROMS.CSLA.Library 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); + 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; @@ -2695,14 +2695,14 @@ namespace VEPROMS.CSLA.Library tbformat = tbformat.Replace("{numeric}", ordinal.ToString().PadLeft(2) + ".0"); tbformat = tbformat.Substring(0, tbformat.Length - 2); } - 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"); @@ -2711,6 +2711,18 @@ namespace VEPROMS.CSLA.Library cltext = cltext == null ? tbformat.Remove(macroindx, 5) : cltext.Remove(macroindx, 5); cltext = cltext + " "; } + macroindx = tbformat.IndexOf("{!diamond1}"); + if (macroindx > -1) //i found it + { + cltext = cltext == null ? tbformat.Remove(macroindx, 11) : cltext.Remove(macroindx, 11); + cltext = cltext + " "; + } + macroindx = tbformat.IndexOf("{!diamond}"); + if (macroindx > -1) //i found it + { + cltext = cltext == null ? tbformat.Remove(macroindx, 10) : cltext.Remove(macroindx, 10); + cltext = cltext + " "; + } // "{Null}" was introduced so that inheritance in format files could differentiate between an // empty string, and null. And also, so that if a tab was null but it's parent had text in the // tab, don't inherit the parent's tab, use a null. @@ -2718,7 +2730,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); @@ -2740,7 +2752,7 @@ namespace VEPROMS.CSLA.Library _MyHeader.Justify = ContentAlignment.MiddleRight; break; default: - _MyHeader.Justify = ContentAlignment.MiddleCenter; + _MyHeader.Justify = ContentAlignment.MiddleCenter; break; } //_MyHeader.Justify = ContentAlignment.MiddleCenter; @@ -3259,12 +3271,12 @@ namespace VEPROMS.CSLA.Library 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; @@ -3276,7 +3288,7 @@ 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. } @@ -4917,11 +4929,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; } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index 46cbac3c..86328c45 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -2695,6 +2695,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _RNOWidthAlt, "@RNOWidthAlt"); } } + private LazyLoad _RNOWidthAdj; + public string RNOWidthAdj + { + get + { + return LazyLoad(ref _RNOWidthAdj, "@RNOWidthAdj"); + } + } private LazyLoad _HLSWidthOVRD; public int? HLSWidthOVRD {