Added handler for Byron / Braidwood PageList tokens {TITLE&UNIT} and {SPLITEOPNUM}

Fixed the logic that leaves gaps in the Grid for Text Blocks and Boxes.  If the Text Blocks or the Boxes are outside the range of the plot.
This commit is contained in:
Rich 2013-10-23 18:18:09 +00:00
parent 2b49417673
commit 24dfe73886
2 changed files with 49 additions and 3 deletions

View File

@ -1040,6 +1040,28 @@ namespace Volian.Print.Library
float coverlinelen = ((ctlen == 0) ? (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength : ctlen) * (float)pageItem.Font.CPI / 12;
plstr = SplitCoverTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)coverlinelen, token, plstr);//, rowAdj);
break;
case "{TITLE&UNIT}":
case "[TITLE&UNIT]":
tlen = (token.Contains("COVERPROCTITLE"))?(int)section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength : (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength;
linelen = tlen * (float)pageItem.Font.CPI / 12;
plstr = SplitTitleAndUnit(svgGroup, pageItem, section.MyProcedure.MyContent.Text.ToUpper(), (int)linelen, token, plstr); //,rowAdj);
break;
case "{SPLITEOPNUM}":
case "[SPLITEOPNUM]":
string eopnum1 = section.MyProcedure.MyContent.Number;
string unitnum1 = MySection.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber;
string unitname1 = MySection.MyDocVersion.DocVersionConfig.Unit_Name;
if (unitnum1.Length > 0)
{
if (unitnum1.Contains("#"))
eopnum1 = unitnum1.Replace("#", eopnum1);
if (unitnum1.Contains("!"))
eopnum1 = unitnum1.Replace("!", unitname1);
if (eopnum1 == string.Empty)
eopnum1 = section.MyProcedure.MyContent.Number;
}
plstr = SplitEOPNumber(svgGroup, pageItem, eopnum1, token, plstr);
break;
case "{EOPNUM}":
case "[EOPNUM]":
case "{PREDELIMEOPNUM}":
@ -1204,7 +1226,6 @@ namespace Volian.Print.Library
break;
}
}
private static void AddImage(SvgGroup svgGroup, float x, float y, float w, float h, string figure)
{
svgGroup.Add(new SvgImage(new System.Drawing.PointF(x, y), new System.Drawing.SizeF(w, h),
@ -1253,7 +1274,31 @@ namespace Volian.Print.Library
}
return plstr;
}
private string SplitTitleAndUnit(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string token, string plstr)
{
List<string> titleLines = SplitText(title, (int)len);
// Add a separate line with the Unit Number
titleLines.Add("UNIT " + MySection.MyDocVersion.DocVersionConfig.Unit_Number);
// Adjust y location based on which pagelist token & how many lines.
float yOffset = (-6 * (titleLines.Count - 1));
foreach (string line in titleLines)
{
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset));
yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12);
}
return plstr.Replace(token, "");
}
private string SplitEOPNumber(SvgGroup svgGroup, PageItem pageItem, string eopnum, string token, string plstr)
{
string[] eopnums = eopnum.Split(" ".ToCharArray());
float yOffset = (-6 * (eopnums.Length - 1));
foreach (string line in eopnums)
{
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset));
yOffset += (float)((pageItem.Font.Size > 14) ? pageItem.Font.Size : 12);
}
return plstr.Replace(token, "");
}
//private string symblsStr = "\u25CF\u0394"; // string of possible symbol character in a tab
//// add symbol characters as needed
//// "\u25CF" - solid bullet

View File

@ -1624,7 +1624,8 @@ namespace XYPlots
cptr = AllBoxes[BoxesIdx];
if (cptr.BoxMinimum.xyValue[flag] <= ptval &&
cptr.BoxMaximum.xyValue[flag] >= ptval)
if(cptr.BoxMinimum.xyValue[1-flag] > 0)// Don't include box if it is outside of the range of the grid.
if(cptr.BoxMinimum.xyValue[1-flag] > 0 &&
cptr.BoxMaximum.xyValue[1 - flag] < printerunits[1-flag])// Don't include box if it is outside of the range of the grid.
AddBoxToActiveList(cptr);
BoxesIdx++;
}