From 146e1fb96851669221383374a59238ba5ca68fa3 Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 25 Jul 2016 15:04:23 +0000 Subject: [PATCH] =?UTF-8?q?New=20Table=20of=20Contents=20flags=20&=20MaxWi?= =?UTF-8?q?dth=20for=20PSIs=20(for=20current=20page)=20Improve=20message?= =?UTF-8?q?=20when=20format=20is=20changed=20and=20not=20certain=20if=20se?= =?UTF-8?q?ction=20type=20is=20valid.=20(part=20of=20B2016-165)=20vcb1:=20?= =?UTF-8?q?Added=20MaxWidthCurPage=20for=20PSI=20text=20widths=20(use=20fo?= =?UTF-8?q?r=20current=20page)=20vcb1:=20Table=20of=20Contents=20values=20?= =?UTF-8?q?for=20subsections=20line=20spacing=20and=20grouping=20section?= =?UTF-8?q?=20numbers=20Table=20of=20Contents=20to=20handle=20single=20spa?= =?UTF-8?q?ce=20subsections=20&=20Grouping=20section=20names=20remove=20gr?= =?UTF-8?q?oup=20title=20Use=20MaxWidthCurPage=20to=20handle=20max=20width?= =?UTF-8?q?,=20but=20don=E2=80=99t=20account=20for=20multiple=20lines=20wh?= =?UTF-8?q?en=20printing=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Formats/fmtall/vcb1all.xml | Bin 79648 -> 79788 bytes .../frmSectionProperties.cs | 4 +-- .../VEPROMS.CSLA.Library/Format/PageStyles.cs | 12 ++++++++ .../Format/PlantFormat.cs | 16 ++++++++++ PROMS/Volian.Print.Library/PromsPrinter.cs | 29 +++++++++++++++--- .../Volian.Print.Library/VlnSvgPageHelper.cs | 5 +-- 6 files changed, 58 insertions(+), 8 deletions(-) diff --git a/PROMS/Formats/fmtall/vcb1all.xml b/PROMS/Formats/fmtall/vcb1all.xml index 922192584eaaddb5e3800229d1581a792bfee5e5..67c54286a36c78ef4782bba5c15dd1a775f78308 100644 GIT binary patch delta 185 zcmZ4Rj%CezmJMfgCoj>Jvkzt{Wk_PMWl&-;1Y!k-5Qcn)GzMpeAcj zF%&TPF(d*-QW-oM@)&}FbTUH;L-F)}Nk-|(6Xe+@FPOwN`GLI7^aBQr4wDnSc{V5L zeVWDV3^cxoApoc~ogsB|;K@ivRH4a%C*Mz=aXJfCbTi|bV7AHoPD)I6(Bqr@ZkOHW ILzm)G09pk%zW@LL delta 61 zcmV-D0K)&Q?*yRk1hC94lcrG)laOK#li(jLvw$u>o0Brj?vuL8YO^xSSOJqV%dnG< T)kd?9&0GbO5Y%q7PSajws{S5q diff --git a/PROMS/VEPROMS User Interface/frmSectionProperties.cs b/PROMS/VEPROMS User Interface/frmSectionProperties.cs index 7f7e6859..013b0b48 100644 --- a/PROMS/VEPROMS User Interface/frmSectionProperties.cs +++ b/PROMS/VEPROMS User Interface/frmSectionProperties.cs @@ -610,8 +610,8 @@ namespace VEPROMS } if (oldSelIndx > newDocStyles.Count) { - string msg = string.Format("The section type that is set is not available in the new format, it was reset to '{0}'. Verify that it is appropriate.", newDocStyles.GetDocStyleItem(0).Name); - MessageBox.Show(msg, "Non-existent section"); + string msg = string.Format("Since the format has been changed, the section type was also changed to '{0}'. Verify that it is appropriate and if not, select a new section type.", newDocStyles.GetDocStyleItem(0).Name); + MessageBox.Show(msg, "Verify section type"); selindx = 0; } } diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PageStyles.cs b/PROMS/VEPROMS.CSLA.Library/Format/PageStyles.cs index 3b14a400..abb144f4 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PageStyles.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PageStyles.cs @@ -133,6 +133,18 @@ namespace VEPROMS.CSLA.Library return (LazyLoad(ref _MaxWidth, "@MaxWidth")); } } + // MaxWidth, above, flagged that, if there was more than 1 line, the topmargin would be adjusted by however + // many lines the PSI item contained (for wst alarms). The MaxWidthCurPage is used when that adjustment + // should not be made, the length of the PSI item is only relevant for the current page. + // (see AdjustTopMarginForMultiLinePageListItems variable and how it is used) + private LazyLoad _MaxWidthCurPage; + public int? MaxWidthCurPage + { + get + { + return (LazyLoad(ref _MaxWidthCurPage, "@MaxWidthCurPage")); + } + } #endregion #region Override ToString public override string ToString() diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index 576ea3f0..186488d3 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -3928,6 +3928,22 @@ namespace VEPROMS.CSLA.Library return (tocProcStepsTitle == null || tocProcStepsTitle == "") ? "" : tocProcStepsTitle; } } + private LazyLoad _TofCLineSpacingSub; + public int? TofCLineSpacingSub + { + get + { + return LazyLoad(ref _TofCLineSpacingSub, "@TofCLineSpacingSub"); + } + } + private LazyLoad _TofCRemoveGrpNameInSects; + public bool TofCRemoveGrpNameInSects + { + get + { + return LazyLoad(ref _TofCRemoveGrpNameInSects, "@TofCRemoveGrpNameInSects"); + } + } private VE_Font _Font; public VE_Font Font { diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 29beabdd..54ff5eab 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -1180,11 +1180,25 @@ namespace Volian.Print.Library yLocation = lastyLocation = 0; rtnval = Rtf2Pdf.TextAt(cb, myparagraphtc, leftMargin + secNumPos, yPageStart - yLocation, w, height, "", yBottomMargin); } - yLocation += (2 * vlnPrintObject.SixLinesPerInch); // new line + int lnaftergroup = ((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 0) > 0) ? 1 : 2; + yLocation += (lnaftergroup * vlnPrintObject.SixLinesPerInch); // new line } // need to do the section number, section title & page number. Page number // has to be put on at end after number of page is known, so use a Template. + bool didGrp = false; string tmptxt = mySection.MyContent.Number == null || mySection.MyContent.Number == "" ? " " : mySection.MyContent.Number; + if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects + && tocGrpHeading.Length > 0 && tmptxt.ToUpper().Contains(tocGrpHeading)) + { + tmptxt = tmptxt.Replace(tocGrpHeading, ""); + didGrp = true; + } + if (tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCRemoveGrpNameInSects + && lastTOCGroupHeading.Length > 0 && tmptxt.ToUpper().Contains(lastTOCGroupHeading)) + { + tmptxt = tmptxt.Replace(lastTOCGroupHeading, ""); + didGrp = true; + } string rtfText = GetRtfToC(tmptxt, tOfC); Paragraph myparagraphn = vlnPrintObject.RtfToParagraph(rtfText); float width = 0; @@ -1254,7 +1268,7 @@ namespace Volian.Print.Library // is put out. retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos + indentOffset, yPageStart - yLocation, numwidth * 1.3F, height, "", yBottomMargin); - float lSpace = (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; + //float lSpace = (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; // adjust ylocation for pagenumber - the ylocation will get reset if the // section title split on 2 lines and the page number needs to be on the 2nd line. @@ -1330,8 +1344,15 @@ namespace Volian.Print.Library else AddTemplateTOCPageCounts(tOfC, yLocation, yPageStartAdj, leftMargin, secPagePos, height, mySection); } - - yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; + //If the format wants single spacing within subsections (2nd level and lower), then need to figure out + // spacing (vcb1 table of contents) + bool dosuby = (((tocSection.ActiveFormat.PlantFormat.FormatData.SectData.AccSectionData.TableOfContentsData.TofCLineSpacingSub ?? 1) > 0) + && (mySection.MyParent.IsSection && ((mySection.Sections != null && mySection.Sections.Count > 0) || (level > 0 && mySection.NextItem != null)))) + || didGrp; + if (dosuby) + yLocation += (float)(tOfC.TofCLineSpacingSub ?? 1) * vlnPrintObject.SixLinesPerInch; + else + yLocation += (float)(tOfC.TofCLineSpacing ?? 1) * vlnPrintObject.SixLinesPerInch; } yLocation = AddSectionToTOC(tocSection, mySection, tOfC, cb, yPageStart, yLocation); } diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index fc7807bc..1a4b44ee 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -2000,10 +2000,11 @@ namespace Volian.Print.Library // defined, see if the text is too wide for a single line (SplitTextMaxWidth). The // AdjustTopMarginForMultLinePageListItem contains the y-adjustment that must be considered // in the TopMargin if the PSI text split onto more than one line. - if ((pageItem.MaxWidth??0)>0) + if ((pageItem.MaxWidth??0)>0 || (pageItem.MaxWidthCurPage??0)>0) { - int locwid = (int)pageItem.MaxWidth; + int locwid = ((pageItem.MaxWidth??0)>0)?(int)pageItem.MaxWidth:(int)pageItem.MaxWidthCurPage; AdjustTopMarginForMultiLinePageListItems = SplitTextMaxWidth(svgGroup, pageItem, val, locwid, token, ref plstr); + if ((pageItem.MaxWidthCurPage ?? 0) > 0) AdjustTopMarginForMultiLinePageListItems = 0; } else plstr = plstr.Replace(token, val);