If a subsections number included the parent section’s number, don’t prepend the parents tab to the subsection

This commit is contained in:
Kathy Ruffing 2015-02-03 15:39:51 +00:00
parent d0f30dc083
commit 2f326c4c1b

View File

@ -1856,6 +1856,12 @@ namespace VEPROMS.CSLA.Library
string parNumber = par.DisplayNumber;
string myNumber = DisplayNumber;
if (parNumber == null || myNumber == null) return false;
ItemInfo par2 = par.ActiveParent as ItemInfo;
if (par2 != null && par2.IsSection)
{
// check for 6.1 (parent) and 6.1.1.
if (DisplayNumber.StartsWith((ActiveParent as SectionInfo).DisplayNumber.Trim())) return true;
}
if (!parNumber.Trim().EndsWith(".0")) return false;
return (myNumber.Trim().StartsWith(parNumber.Trim().Substring(0, parNumber.Length - 1)));
}
@ -5900,6 +5906,14 @@ namespace VEPROMS.CSLA.Library
if (ch[0] == ' ') ch = DisplayNumber != null && DisplayNumber.TrimStart() != "" ? DisplayNumber.TrimStart().Substring(0, 1) : null;
retStr = ch + ".";
}
else if (Snum == -2) // -2 flags to just use display number as is, don't prepend the parent's number.
{
string tmp = DisplayNumber.Trim();
if (underline)
retStr = @"\ul " + DisplayNumber.Trim() + @"\ul0 ";
else
retStr = DisplayNumber.Trim();
}
else
{
string tmp = DisplayNumber.IndexOf(".") > -1 ? DisplayNumber.Substring(0, DisplayNumber.IndexOf(".")) : DisplayNumber;
@ -5924,6 +5938,12 @@ namespace VEPROMS.CSLA.Library
if (tmpstr == null) return 0;
Int32 x;
if (Int32.TryParse(tmpstr, out x)) return x;
// flag the case where the current section's tab already has prefixed in the parent's tab:
// (without this, BGE's section headers were coming up as 6.1.6.1.1...)
if (IsSection && ActiveParent.IsSection)
{
if (DisplayNumber.StartsWith((ActiveParent as SectionInfo).DisplayNumber.Trim())) return -2;
}
return -1;
}
return (-1);