F2017-011 fixed logic that was partially overwriting the text in the TitleWithTextRight step type (enhanced backgrounds) Also fixed the positioning of the TitleWithTextRight and TitleWithTextBelow step types on the step editor for enhanced backgrounds

null reference check
F2017-013 – added logic to SplitTitle to handle when the page list item containing <SectionLevelTitle> also has text (ex: <SectionLevelNumber>) on the same line and we need to split all of that text onto another line
This commit is contained in:
John Jenko 2017-02-08 20:19:28 +00:00
parent d88c2fa54b
commit 0f99ac59f5
3 changed files with 28 additions and 10 deletions

View File

@ -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);

View File

@ -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<string> titleLines = Volian.Base.Library.RtfTools.SplitText(title, (int)len);
List<string>titleLines = 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.)

View File

@ -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);