From 0f99ac59f5700e606c37fec7e758198efc73d4a8 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 8 Feb 2017 20:19:28 +0000 Subject: [PATCH] =?UTF-8?q?F2017-011=20fixed=20logic=20that=20was=20partia?= =?UTF-8?q?lly=20overwriting=20the=20text=20in=20the=20TitleWithTextRight?= =?UTF-8?q?=20step=20type=20(enhanced=20backgrounds)=20Also=20fixed=20the?= =?UTF-8?q?=20positioning=20of=20the=20TitleWithTextRight=20and=20TitleWit?= =?UTF-8?q?hTextBelow=20step=20types=20on=20the=20step=20editor=20for=20en?= =?UTF-8?q?hanced=20backgrounds=20null=20reference=20check=20F2017-013=20?= =?UTF-8?q?=E2=80=93=20added=20logic=20to=20SplitTitle=20to=20handle=20whe?= =?UTF-8?q?n=20the=20page=20list=20item=20containing=20?= =?UTF-8?q?=20also=20has=20text=20(ex:=20)=20on=20the?= =?UTF-8?q?=20same=20line=20and=20we=20need=20to=20split=20all=20of=20that?= =?UTF-8?q?=20text=20onto=20another=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Controls.Library/EditItem.cs | 5 ++- .../Volian.Print.Library/VlnSvgPageHelper.cs | 31 ++++++++++++++----- PROMS/Volian.Print.Library/vlnParagraph.cs | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 0f61b2c5..a1194532 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -2557,10 +2557,13 @@ namespace Volian.Controls.Library // Paul Linn made the request on 6/4/12 to align the Component Description & // Required Position under the Component Number. ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); + // part of F2017-011, for enhanced backgrounds, always align the TitleWithTextRight and TitleWithTextBelow with the parent tab (on the screen) + else if ((MyItemInfo.FormatStepData.Type == "TitleWithTextRight" || MyItemInfo.FormatStepData.Type == "TitleWithTextBelow") && ((MyItemInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds)) // align with parent tab if in background document + ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); else if (MyItemInfo.FormatStepData.Type == "TitleWithTextRight" && (MyItemInfo.Steps == null || MyItemInfo.Steps.Count == 0)) // this code is run for siblings within a HLS (but not last sibling). ItemLocation = new Point(_MyParentEditItem.ItemLocation.X, _MyParentEditItem.Bottom); else if (MyItemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight") - ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + _MyParentEditItem.ItemWidth, _MyParentEditItem.ItemLocation.Y); + ItemLocation = new Point(_MyParentEditItem.ItemLocation.X + _MyParentEditItem.ItemWidth + 10, _MyParentEditItem.ItemLocation.Y); // F2017-011 added 10 to fix positoning of Purpose text on sceen (enhanced backgrounds) else if (MyItemInfo.MyTab.Offset != 0) ContentLocation = new Point(_MyParentEditItem.ContentLocation.X + 10, _MyParentEditItem.Bottom); //ItemLocation = new Point(_MyParentEditItem.ItemLocation.X+10, _MyParentEditItem.Bottom); diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 49623c91..f383b6a7 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -1549,7 +1549,7 @@ namespace Volian.Print.Library else { if (section.ActiveFormat.PlantFormat.FormatData.ProcData.CapitalizeTitle) title = title.ToUpper(); - plstr = SplitTitle(svgGroup, pageItem, title, (int)linelen, token, plstr); //,rowAdj); + plstr = SplitTitle(svgGroup, pageItem, title, (int)linelen, token, plstr, null); //,rowAdj); } break; case "{COVERTITLE1}": @@ -1660,7 +1660,7 @@ namespace Volian.Print.Library string myMsg = section.MyDocStyle.Continue.Top.Message; if (myMsg != null && myMsg != "")stitle = stitle + myMsg; } - plstr = SplitTitle(svgGroup, pageItem, stitle, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr); + plstr = SplitTitle(svgGroup, pageItem, stitle, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumberAndTitleLength); PrintedSectionPage = (int)pageItem.Row - _sectLevelNumTtlDiff; } else @@ -1677,7 +1677,7 @@ namespace Volian.Print.Library { top = top.MyParent; } - plstr = SplitTitle(svgGroup, pageItem, top.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr); + plstr = SplitTitle(svgGroup, pageItem, top.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionNumberAndTitleLength); } else plstr = plstr.Replace(token, ""); @@ -2154,10 +2154,26 @@ namespace Volian.Print.Library } return Math.Max(0, yOffset); } - private string SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr) + private string SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr,int? numAndTitleLen) { - if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, ""); - if (len == null || len == 0 || ItemInfo.StripRtfFormatting(title).Length < len) + bool includePrecedingText = false; + if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, ""); + // F2017-013 - Ginna (RGESAM1) this handles when you have {SECTIONLEVELNUMBER} and {SECTIONLEVELTITLE} on the same line. + // The section number was already replaced in plstr so when determining where to split the title, + // include the section number (and anything before the title) in the calculation of where to split. + // test for the ussage of the SectionNumberAndTitleLength (numAndTitleLen parameter) format variable (use a flag for this logic) + // This logic does not handle any pagelist tokens following the section title. + // "@@" acts like a hanging indent (Calvert) so don't include stuff before the title + // For now, made this explicite with the use of SectionLevelTitle + if ((numAndTitleLen != null && numAndTitleLen > 0) && !plstr.Contains("@@") && (plstr.IndexOf("{SECTIONLEVELTITLE}") > 0)) + { + int idx = plstr.IndexOf(match); + title = plstr.Replace(match, title); // include everthing on this line for splitting + plstr = plstr.Substring(idx); // since title include everthing before {SECTIONLEVELTITLE} plstr needs to be {SECTIONLEVELTITLE} and everything after it + includePrecedingText = true; + } + // check to see if the title needs to wrap + if ((len == null || len == 0 || ItemInfo.StripRtfFormatting(title).Length < len) && (!includePrecedingText || ItemInfo.StripRtfFormatting(title).Length < numAndTitleLen)) { if (match == "{PROCTITLE2}" || match == "[PROCTITLE2]") return plstr.Replace(match, ""); // this would have been done in proctitle1 plstr = plstr.Replace(match, title).Replace("@@",""); @@ -2172,9 +2188,8 @@ namespace Volian.Print.Library DoSpecialSectNumTitle(svgGroup, pageItem, title, len, match, plstr); return ""; // all resolved pagelist items were already added to svgGroup for printing. } - // Otherwise determine how many line to split the text into - List titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len); + ListtitleLines = Volian.Base.Library.RtfTools.SplitText(title,(includePrecedingText)?(int)numAndTitleLen: (int)len); // Adjust y location based on which pagelist token & how many lines. Proctitle1 is adjusted if // there are more than 2 lines (proctitle1 should have it's own y location that is used if there are 1 or 2 lines.) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index d05baaa7..c1b877d4 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -5633,7 +5633,7 @@ namespace Volian.Print.Library float adjwidth = 0; if (itemInfo.IsRNOPart && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthSameAsHighParent && itemInfo.MyParent.IsHigh) Width = adjwidth + MyParent.Width; - else if (itemInfo.MyTab.Position != 0) + else if (itemInfo.MyTab != null && itemInfo.MyTab.Position != 0) Width = adjwidth + MyParent.Width; else if (MyParent.WidthNoLimit != 0) Width = adjwidth + MyParent.WidthNoLimit - tabWidth + (myTab == null ? 0 : myTab.TabAlign);