added check for null MacroDef

additional checks for checkoffs and logic support or NSP script Cautions with bullets
fixed pagelist processing issue when pagelist row has more than one token
support for NSP script Cautions
fixed problem where the END message was not printing for NSP (the Y location was negative – off the page)
This commit is contained in:
John Jenko 2011-12-07 14:04:53 +00:00
parent b48e39be12
commit f7cb594d76
5 changed files with 172 additions and 70 deletions

View File

@ -561,6 +561,11 @@ namespace Volian.Print.Library
MatchCollection matches = regexFindToken.Matches(pageItem.Token); MatchCollection matches = regexFindToken.Matches(pageItem.Token);
if (matches.Count>0) if (matches.Count>0)
{ {
string plstr = "";
// When a pagelist line (row) has more than one token that is resolved to text, each resolved token text was place on top
// of each other. Use a temporary string (plstr) to process the pagelist tokens for each pagelist line (row) before adding
// it to the svgGroup.
plstr = pageItem.Token;
foreach (Match match in matches) foreach (Match match in matches)
{ {
string token = match.Value; string token = match.Value;
@ -569,9 +574,11 @@ namespace Volian.Print.Library
{ {
case "{!atom}": case "{!atom}":
// Add an Atom Figure to the SVG // Add an Atom Figure to the SVG
plstr = plstr.Replace(token, "");
AddImage(svgGroup,160.5f, 170.5f,288f, 323f,"atom.bmp"); AddImage(svgGroup,160.5f, 170.5f,288f, 323f,"atom.bmp");
break; break;
case "{!cpllogo}": case "{!cpllogo}":
plstr = plstr.Replace(token, "");
AddImage(svgGroup, 10f, 10f, 78.7f, 29.8f, "cpllogo.bmp"); AddImage(svgGroup, 10f, 10f, 78.7f, 29.8f, "cpllogo.bmp");
break; break;
//case "{!domlogo}": //case "{!domlogo}":
@ -594,6 +601,7 @@ namespace Volian.Print.Library
case "{BOX7}": case "{BOX7}":
case "{BOX8}": case "{BOX8}":
case "{BOX9}": case "{BOX9}":
plstr = plstr.Replace(token, "");
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token))); svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token)));
break; break;
case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns
@ -605,6 +613,7 @@ namespace Volian.Print.Library
else if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Two) else if (_MySection.SectionConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.Two)
box = "2"; box = "2";
box = "{BOX" + box + "}"; box = "{BOX" + box + "}";
plstr = plstr.Replace(token, "");
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box))); svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box)));
break; break;
case "{DRAFTPAGE}": case "{DRAFTPAGE}":
@ -627,14 +636,14 @@ namespace Volian.Print.Library
case "{PROCTITLE2}": case "{PROCTITLE2}":
case "{COVERPROCTITLE}": case "{COVERPROCTITLE}":
float linelen = (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength * (float)pageItem.Font.CPI / 12; float linelen = (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength * (float)pageItem.Font.CPI / 12;
SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text.ToUpper(), (int)linelen, token); //,rowAdj); plstr = SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text.ToUpper(), (int)linelen, token, plstr); //,rowAdj);
//SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token); //SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token);
break; break;
case "{COVERTITLE1}": case "{COVERTITLE1}":
case "{COVERTITLE2}": case "{COVERTITLE2}":
int ctlen = section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength??0; int ctlen = section.ActiveFormat.PlantFormat.FormatData.ProcData.CoverTitleLength??0;
float coverlinelen = ((ctlen == 0) ? (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength : ctlen) * (float)pageItem.Font.CPI / 12; float coverlinelen = ((ctlen == 0) ? (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength : ctlen) * (float)pageItem.Font.CPI / 12;
SplitCoverTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)coverlinelen, token);//, rowAdj); plstr = SplitCoverTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)coverlinelen, token, plstr);//, rowAdj);
//SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token); //SplitTitle(svgGroup, pageItem, section.MyProcedure.MyContent.Text, (int)section.ActiveFormat.PlantFormat.FormatData.ProcData.TitleLength, token);
break; break;
case "{EOPNUM}": case "{EOPNUM}":
@ -642,18 +651,21 @@ namespace Volian.Print.Library
string unitnum = MySection.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber; string unitnum = MySection.MyDocVersion.DocVersionConfig.Unit_ProcedureNumber;
if (unitnum.Length > 0) if (unitnum.Length > 0)
eopnum = unitnum.Replace("#", eopnum); eopnum = unitnum.Replace("#", eopnum);
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, eopnum))); plstr = plstr.Replace(token, eopnum);
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, eopnum)));
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.MyProcedure.MyContent.Number))); //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.MyProcedure.MyContent.Number)));
break; break;
case "{SECTIONLEVELTITLE}": case "{SECTIONLEVELTITLE}":
SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token); plstr = SplitTitle(svgGroup, pageItem, section.DisplayText, section.ActiveFormat.PlantFormat.FormatData.SectData.SectionTitleLength, token, plstr);
svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText)); //svgGroup.Add(PageItemToSvgText(pageItem, section.DisplayText));
break; break;
case "{SECTIONLEVELNUMBER}": case "{SECTIONLEVELNUMBER}":
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,section.DisplayNumber))); plstr = plstr.Replace(token, section.DisplayNumber);
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, section.DisplayNumber)));
break; break;
case "{UNITTEXT}": case "{UNITTEXT}":
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,MySection.MyDocVersion.DocVersionConfig.Unit_Text))); plstr = plstr.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text);
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, MySection.MyDocVersion.DocVersionConfig.Unit_Text)));
break; break;
case "{CHKOFFHEADING}": case "{CHKOFFHEADING}":
int sindx = section.CheckOffHeadingIndex(); int sindx = section.CheckOffHeadingIndex();
@ -661,6 +673,7 @@ namespace Volian.Print.Library
// which is always '{NO HEADING}". // which is always '{NO HEADING}".
if (sindx > 0) if (sindx > 0)
{ {
plstr = plstr.Replace(token, "");
svgGroup.Add(PageItemToSvgText(pageItem, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font)); svgGroup.Add(PageItemToSvgText(pageItem, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].CheckOffHeading, section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font));
} }
break; break;
@ -673,7 +686,8 @@ namespace Volian.Print.Library
{ {
int indx = token.IndexOf("-"); int indx = token.IndexOf("-");
string val = procConfig.GetValue("PSI", token.Substring(4,token.Length-5)); string val = procConfig.GetValue("PSI", token.Substring(4,token.Length-5));
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token,val))); plstr = plstr.Replace(token, val);
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token.Replace(token, val)));
} }
} }
else if (token.Contains(@"PS=")) else if (token.Contains(@"PS="))
@ -683,7 +697,7 @@ namespace Volian.Print.Library
{ {
int indx = token.IndexOf("="); int indx = token.IndexOf("=");
int qindx = token.IndexOf("?", indx); int qindx = token.IndexOf("?", indx);
string pstok = token.Substring(indx + 1, qindx-indx-1); string pstok = token.Substring(indx + 1, qindx - indx - 1);
string val = procConfig.GetValue("PSI", pstok); string val = procConfig.GetValue("PSI", pstok);
int bindx = token.IndexOf("|", indx); int bindx = token.IndexOf("|", indx);
if (val == "Y") if (val == "Y")
@ -693,7 +707,9 @@ namespace Volian.Print.Library
int eindx = token.IndexOf("}", bindx); int eindx = token.IndexOf("}", bindx);
val = token.Substring(bindx + 1, eindx - bindx - 1); val = token.Substring(bindx + 1, eindx - bindx - 1);
} }
if (val != null && val != "")svgGroup.Add(PageItemToSvgText(pageItem, val)); if (val != null && val != "")
plstr = plstr.Replace(token, val);
//if (val != null && val != "") svgGroup.Add(PageItemToSvgText(pageItem, val));
} }
} }
//else if (token.Contains(@"{DRV:Lpi ")) //else if (token.Contains(@"{DRV:Lpi "))
@ -706,16 +722,20 @@ namespace Volian.Print.Library
// PrevRow = (float)pageItem.Row; // PrevRow = (float)pageItem.Row;
//} //}
else else
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token)); {
if (plstr != "")
svgGroup.Add(PageItemToSvgText(pageItem, plstr));
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token));
}
//_MyLog.InfoFormat("Token not processed {0}", token); //_MyLog.InfoFormat("Token not processed {0}", token);
break; break;
} }
} } // end foreach matches
if (plstr != "")
svgGroup.Add(PageItemToSvgText(pageItem, plstr));
} }
else else
{
svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token)); svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token));
}
} }
// Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way
// to do that was to add a "{PAGE}" token to every page that is flagged as not to be printed. // to do that was to add a "{PAGE}" token to every page that is flagged as not to be printed.
@ -729,14 +749,16 @@ namespace Volian.Print.Library
svgGroup.Add(new SvgImage(new System.Drawing.PointF(x, y), new System.Drawing.SizeF(w, h), svgGroup.Add(new SvgImage(new System.Drawing.PointF(x, y), new System.Drawing.SizeF(w, h),
System.Windows.Forms.Application.StartupPath + @"\Resources\" + figure)); System.Windows.Forms.Application.StartupPath + @"\Resources\" + figure));
} }
private void SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match) private string SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr)
//private void SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match)
{ {
if (match == "{PROCTITLE2}") return; if (match == "{PROCTITLE2}") return plstr;
if (len == null || ItemInfo.StripRtfFormatting(title).Length < len) if (len == 0 || ItemInfo.StripRtfFormatting(title).Length < len)
{ {
if (match == "{PROCTITLE2}") return; // this would have been done in proctitle1 if (match == "{PROCTITLE2}") return plstr; // this would have been done in proctitle1
svgGroup.Add(PageItemToSvgText(pageItem, title)); plstr = plstr.Replace(match, title);
return; //svgGroup.Add(PageItemToSvgText(pageItem, title));
return plstr;
} }
// Otherwise determine how many line to split the text into // Otherwise determine how many line to split the text into
List<string> titleLines = SplitText(title, (int)len); List<string> titleLines = SplitText(title, (int)len);
@ -745,27 +767,35 @@ namespace Volian.Print.Library
// move down 6. // move down 6.
int adj = pageItem.Token.Contains("1") || pageItem.Token.Contains("2") ? 0 : -6; int adj = pageItem.Token.Contains("1") || pageItem.Token.Contains("2") ? 0 : -6;
float yOffset = adj * (titleLines.Count - 1); float yOffset = adj * (titleLines.Count - 1);
int cnt = 0;
foreach (string line in titleLines) foreach (string line in titleLines)
{ {
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); cnt++;
if (cnt == 1)
plstr = plstr.Replace(match, line);
else
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset));
yOffset += 12; yOffset += 12;
} }
return plstr;
} }
private void SplitCoverTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match) private string SplitCoverTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match, string plstr)
//private void SplitCoverTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match)
{ {
if (len == null || ItemInfo.StripRtfFormatting(title).Length < len) if (len == null || ItemInfo.StripRtfFormatting(title).Length < len)
{ {
if (match == "{COVERTITLE2}") return; // this would have been done in COVERTITLE1 if (match == "{COVERTITLE2}") return plstr; // this would have been done in COVERTITLE1
svgGroup.Add(PageItemToSvgText(pageItem, title)); plstr = plstr.Replace(match, title);
return; //svgGroup.Add(PageItemToSvgText(pageItem, title));
return plstr;
} }
// Otherwise determine how many line to split the text into // Otherwise determine how many line to split the text into
List<string> titleLines = SplitText(title, (int)len); List<string> titleLines = SplitText(title, (int)len);
if (match == "{COVERTITLE1}") if (match == "{COVERTITLE1}")
{ {
svgGroup.Add(PageItemToSvgText(pageItem, titleLines[0])); plstr = plstr.Replace(match, titleLines[0]);
return; //svgGroup.Add(PageItemToSvgText(pageItem, titleLines[0]));
return plstr;
} }
// if the token was proctitle, dont' adjust. If the token was PROCTITLE1/2 then // if the token was proctitle, dont' adjust. If the token was PROCTITLE1/2 then
// move down 6. // move down 6.
@ -780,6 +810,7 @@ namespace Volian.Print.Library
svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset)); svgGroup.Add(PageItemToSvgText(pageItem, line, yOffset));
yOffset += 12; yOffset += 12;
} }
return plstr;
} }
private List<string> SplitText(string text, int len) private List<string> SplitText(string text, int len)
{ {

View File

@ -34,7 +34,7 @@ namespace Volian.Print.Library
MyContentByte = cb; MyContentByte = cb;
System.Drawing.Color push = PrintOverride.SvgColor; System.Drawing.Color push = PrintOverride.SvgColor;
PrintOverride.SvgColor = PrintOverride.TextColor == System.Drawing.Color.Empty ? System.Drawing.Color.Black : PrintOverride.TextColor; PrintOverride.SvgColor = PrintOverride.TextColor == System.Drawing.Color.Empty ? System.Drawing.Color.Black : PrintOverride.TextColor;
if (MyPageHelper != null && MyPageHelper.MySvg != null) if (MyPageHelper != null && MyPageHelper.MySvg != null && MacroDef != null)
{ {
// PageList items are located with respect to the left margin, macros are not. // PageList items are located with respect to the left margin, macros are not.
MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset - MyPageHelper.MySvg.LeftMargin, yLocation, cb); MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset - MyPageHelper.MySvg.LeftMargin, yLocation, cb);

View File

@ -919,6 +919,13 @@ namespace Volian.Print.Library
if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab)
yoff += SetHeader(this, cb, itemInfo, formatInfo); yoff += SetHeader(this, cb, itemInfo, formatInfo);
YOffset = yoff; YOffset = yoff;
if (mytab != null && mytab.SeparateBullet)
{
string identB = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
vlnText myBullet = new vlnText(cb, this, identB, identB, XOffset - 12, YOffset, MyItemInfo.FormatStepData.TabData.Bullet.Font);
myBullet.Rtf = myBullet.Rtf.Replace("\u25CF", @"\f1\u9679?\f0 ");
PartsLeft.Add(myBullet);
}
if (itemInfo.IsRNOPart) if (itemInfo.IsRNOPart)
{ {
// there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag) // there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag)
@ -1005,7 +1012,10 @@ namespace Volian.Print.Library
CheckOff co = itemInfo.GetCheckOffStep(); CheckOff co = itemInfo.GetCheckOffStep();
if (co != null) if (co != null)
{ {
float xloc_co = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation + (float)itemInfo.MyDocStyle.Layout.LeftMargin; //float xloc_co = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation + (float)itemInfo.MyDocStyle.Layout.LeftMargin;
float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null)
xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation;
PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro));
} }
float yOffRight = yoff; float yOffRight = yoff;
@ -1493,10 +1503,15 @@ namespace Volian.Print.Library
//if (myTab != null) myTab.XOffset += xoff; //if (myTab != null) myTab.XOffset += xoff;
//xoff = MyParent.XOffset - myTab.XOffset; //xoff = MyParent.XOffset - myTab.XOffset;
//XOffset += xoff; //XOffset += xoff;
float tabOffset = (myTab == null?0: myTab.XOffset) - XOffset;
XOffset = (float)colOvrd; XOffset = (float)colOvrd;
if (myTab != null) if (myTab != null)
{ {
myTab.XOffset += (MyParent.XOffset - myTab.XOffset); //myTab.XOffset += (MyParent.XOffset - myTab.XOffset);
myTab.XOffset = XOffset + tabOffset;
//if (myTab.ScriptCaution)
// myTab.XOffset += 10.8F;
//myTab.XOffset += xoff; //myTab.XOffset += xoff;
} }
return; return;
@ -1642,30 +1657,34 @@ namespace Volian.Print.Library
float CheckOffAdj = 0; float CheckOffAdj = 0;
if (itemInfo.MyDocStyle.UseCheckOffs) if (itemInfo.MyDocStyle.UseCheckOffs)
{ {
CheckOffAdj = -(float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffAdjustment; if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffAdjustment != null)
if (!HasCheckOffHeading(itemInfo, formatInfo)) CheckOffAdj = -(float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffAdjustment;
if (!HasCheckOffHeading(itemInfo, formatInfo) && CheckOffAdj < 0)
CheckOffAdj += (float)(9 * 7.2); // 9 is the size of the SIGNOFF adjustment CheckOffAdj += (float)(9 * 7.2); // 9 is the size of the SIGNOFF adjustment
} }
float adjwidth = CheckOffAdj; float adjwidth = CheckOffAdj;
SectData sd = formatInfo.PlantFormat.FormatData.SectData; SectData sd = formatInfo.PlantFormat.FormatData.SectData;
if (sd.StepSectionData.StepSectionLayoutData.TieTabToLevel && sd.UseMetaSections) if (sd.UseMetaSections)
{ {
if (itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles if (sd.StepSectionData.StepSectionLayoutData.TieTabToLevel)
&& !itemInfo.MyDocStyle.CancelSectTitle
&& !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel))
{ {
int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel(); if (itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
adjwidth += formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].WidSAdjByLevel ?? 0; ; && !itemInfo.MyDocStyle.CancelSectTitle
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; && !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel))
float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; {
adjwidth -= seclvlindent; int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel();
adjwidth -= AdjustForSectionLevelTab(); adjwidth += formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].WidSAdjByLevel ?? 0; ;
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
adjwidth -= seclvlindent;
adjwidth -= AdjustForSectionLevelTab();
}
}
else
{
if (formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count > 0)
adjwidth += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[itemInfo.PrintLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
} }
}
else
{
if (formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count > 0)
adjwidth += (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[itemInfo.PrintLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
} }
Width = ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO); Width = ToInt(formatInfo.MyStepSectionLayoutData.WidSTablePrint, maxRNO);

View File

@ -96,8 +96,23 @@ namespace Volian.Print.Library
//float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size); //float w = iFont.BaseFont.GetWidthPointKerned(Text.Replace("\u25CF","@"), (float)vefont.Size);
return w; return w;
} }
bool _ScriptCaution = false;
public bool ScriptCaution
{
get { return _ScriptCaution; }
set { _ScriptCaution = value; }
}
bool _SeparateBullet = false;
public bool SeparateBullet
{
get { return _SeparateBullet; }
set { _SeparateBullet = value; }
}
public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName) public vlnTab(PdfContentByte cb, vlnParagraph myparent, string origTab, string cleanTab, float xoffset, float yoffset, VE_Font vFont, bool doSectTab, string symblFontName)
{ {
ScriptCaution = (origTab.Contains("Caution") && vFont.Family == "VolianScript");
MyContentByte = cb; MyContentByte = cb;
MyParent = myparent; MyParent = myparent;
YOffset = yoffset; YOffset = yoffset;
@ -105,10 +120,20 @@ namespace Volian.Print.Library
MyFont = vFont; MyFont = vFont;
float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName); float CCCs = GetTextWidth(MyFont, "CCCCCCCCCC", symblFontName);
float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName); float IIIs = GetTextWidth(MyFont, "iiiiiiiiii", symblFontName);
if (CCCs != IIIs) if (ScriptCaution)
{
Text = origTab.Replace("Caution ", "\uF043\uF061\uF069\uF06E\uF06F\uF074\uF075\uF020\uF020");
Width = 90;
}
else if ((myparent.MyItemInfo.FormatStepData.TabData.IdentWidth ?? 0) > 0)
Width = (float)myparent.MyItemInfo.FormatStepData.TabData.IdentWidth;
else if (CCCs != IIIs)
Width = Text.Length * 6; //proportial font (7 chars * 6) Width = Text.Length * 6; //proportial font (7 chars * 6)
else else
Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName);//MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length); Width = GetTextWidth(MyFont, (Text != null ? Text : origTab), symblFontName);//MyFont.CharsToTwips * (Text != null ? Text.Length : origTab.Length);
if (myparent.MyItemInfo.FormatStepData.TabData.Bullet.Separate)
if (myparent.MyItemInfo.MyPrevious != null || myparent.MyItemInfo.NextItem != null)
SeparateBullet = true;
//if (MyParent.MyItemInfo.ItemID == 108)//120) //if (MyParent.MyItemInfo.ItemID == 108)//120)
// Console.WriteLine("here"); // Console.WriteLine("here");
if (origTab.Contains(@"{!")) if (origTab.Contains(@"{!"))
@ -128,28 +153,52 @@ namespace Volian.Print.Library
Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length); Width = GetTextWidth(MyFont, (cleanTab != null ? cleanTab : origTab), symblFontName);//MyFont.CharsToTwips * (cleanTab != null ? cleanTab.Length : origTab.Length);
} }
Rtf = GetRtf(origTab, vFont); Rtf = GetRtf(origTab, vFont);
if (Rtf.Contains("Caution") && vFont.Family == "VolianScript") Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
if (ScriptCaution)
{
Rtf = GetRtf("\u25CFCaution ", vFont);
Rtf = Rtf.Replace("\u25CF", @"\f1\fs20 \u9679?\f0\par\f0\fs64 "); // bullet 25CF // jsj- force bullet size (is different than tab text)
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
Rtf = Rtf.Replace("Caution ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
else
{
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.NextItem == null)
Rtf = Rtf.Replace(@"\u9679?", "");
Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
}
}
else
{
if (SeparateBullet)
Rtf = Rtf.Replace("\u25CF", "");
else
Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); // bullet 25CF // jsj- add space after \f0
//Rtf = Rtf.Replace("\u25CF", @"\f1\fs18\b0\i0 \u9679?\f0 "); // bullet 25CF // jsj- add space after \f0
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
{
//if (scriptCaution)
// Rtf = Rtf.Replace("CAUTION ", @"\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?\u61472?");
Rtf = Rtf.Replace("Caution:", " ");
Rtf = Rtf.Replace("Note:", " ");
Rtf = Rtf.Replace("CAUTION:", " ");
Rtf = Rtf.Replace("NOTE:", " ");
Rtf = Rtf.Replace("Caution", " ");
Rtf = Rtf.Replace("Note", " ");
Rtf = Rtf.Replace("CAUTION", " ");
Rtf = Rtf.Replace("NOTE", " ");
}
}
if (ScriptCaution && Rtf.Contains("Caution"))
{ {
// NSP script caution // NSP script caution
iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 24, 0, iTextSharp.text.Color.BLACK); iTextSharp.text.Font myfont = pdf.GetFont(vFont.Family, 28, 0, iTextSharp.text.Color.BLACK);
if (myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text if (!myfont.BaseFont.CharExists(0x43)) // Capital 'C' exists as text
Rtf = Rtf; // no change necessary {
else // Capital 'C' exists as Symbol //VE_Font vf = new VE_Font("VolianScript", 28, E_Style.Italics, 12);
//Rtf = Rtf.Replace("Caution", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?"); // Capital 'C' exists as Symbol
Rtf = Rtf.Replace("Caution", @"\u61507?a\u61557?t\u61545?o\u61550?"); Rtf = Rtf.Replace("Caution ", @"\u61507?\u61537?\u61557?\u61556?\u61545?\u61551?\u61550?\u61472?\u61472?");
} }
Rtf = Rtf.Replace("\u25CF", @"\f1\u9679?\f0 "); // bullet 25CF // jsj- add space after \f0
Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
if (myparent.MyItemInfo.FormatStepData != null && !myparent.MyItemInfo.FormatStepData.AlwaysTab && myparent.MyItemInfo.MyPrevious != null)
{
Rtf = Rtf.Replace("Caution:", " ");
Rtf = Rtf.Replace("Note:", " ");
Rtf = Rtf.Replace("CAUTION:", " ");
Rtf = Rtf.Replace("NOTE:", " ");
Rtf = Rtf.Replace("Caution", " ");
Rtf = Rtf.Replace("Note", " ");
Rtf = Rtf.Replace("CAUTION", " ");
Rtf = Rtf.Replace("NOTE", " ");
} }

View File

@ -42,8 +42,11 @@ namespace Volian.Print.Library
} }
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin) public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{ {
// The END message was not printing for NSP. The yLocation was getting set to a negative number, thus printing off the page.
// Found that the YOffset, cacluated when the bottom message was created, is really the actual location, at least in this case.
float yLocation = CalculateYOffset(yPageStart, yTopMargin); float yLocation = CalculateYOffset(yPageStart, yTopMargin);
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, YOffset, Width, 100, "", yBottomMargin); if (yLocation < 0) yLocation = YOffset;
Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, "", yBottomMargin);
return yPageStart; return yPageStart;
} }
} }