Change a Property name (Prefix) to (PathPrefix)

Added generic Properties (Prefix and Suffix) for vlnParagraph
Changed Rtf to be lazy-loaded using new method BuildRtf
This commit is contained in:
Rich 2014-09-05 14:29:20 +00:00
parent 4531a04db1
commit 8261a6bb55
2 changed files with 54 additions and 24 deletions

View File

@ -1129,7 +1129,7 @@ namespace Volian.Print.Library
float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin; float yTopMargin = _PointsPerPage - (float)myItemInfo.MyDocStyle.Layout.TopMargin;
// the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3. // the following line was modified to comment out the - 2 * SixLinesPerInch. this fixed a pagination problem with WCN EMG E-3.
float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch); float yBottomMargin = Math.Max(0, yTopMargin - (float)myItemInfo.MyDocStyle.Layout.PageLength); // - 2 * vlnPrintObject.SixLinesPerInch);
vlnParagraph.Prefix = myItemInfo.Path; vlnParagraph.PathPrefix = myItemInfo.Path;
Rtf2Pdf.PdfDebug = true; Rtf2Pdf.PdfDebug = true;
Rtf2Pdf.Offset = new PointF(0, 2.5F); Rtf2Pdf.Offset = new PointF(0, 2.5F);
_MyHelper.ChangeBarDefinition = MyChangeBarDefinition; _MyHelper.ChangeBarDefinition = MyChangeBarDefinition;

View File

@ -1826,8 +1826,23 @@ namespace Volian.Print.Library
get { return _PrefixSpecialCharacter; } get { return _PrefixSpecialCharacter; }
set { _PrefixSpecialCharacter = value; } set { _PrefixSpecialCharacter = value; }
} }
private string _Prefix;
public string Prefix
{
get { return _Prefix; }
set { _Prefix = value; }
}
private string _Suffix;
public string Suffix
{
get { return _Suffix; }
set { _Suffix = value; }
}
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent) public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent)
{ {
Prefix = prefix;
Suffix = suffix;
MyItemInfo = itemInfo;
// do some 'setup' for Calvert Alarms: // do some 'setup' for Calvert Alarms:
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm) if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
{ {
@ -1864,7 +1879,6 @@ namespace Volian.Print.Library
if (MyTopRNO != null) MyTopRNO.LastRNO = this; if (MyTopRNO != null) MyTopRNO.LastRNO = this;
} }
MyContentByte = cb; MyContentByte = cb;
MyItemInfo = itemInfo;
if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID)) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this); if (!MyPageHelper.MyParagraphs.ContainsKey(itemInfo.ItemID)) MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
// if this a continuous subsection, refresh the style. // if this a continuous subsection, refresh the style.
@ -2335,23 +2349,8 @@ namespace Volian.Print.Library
//if (itemInfo.IsSection) //if (itemInfo.IsSection)
// Rtf = GetRtf(itemInfo, prefix, " (Continued)"); // Rtf = GetRtf(itemInfo, prefix, " (Continued)");
//else //else
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && itemInfo.IsCaution1 && // The following line may not be necessary RTF is lazyloaded
itemInfo.MyContent.Text.StartsWith(@"\u") && !itemInfo.MyContent.Text.StartsWith(@"\u160?")) // BuildRtf();
{
Rtf = GetRtf(itemInfo, " " + (prefix ?? ""), suffix);
PrefixSpecialCharacter = true;
}
else
{
Rtf = GetRtf(itemInfo, prefix, suffix);
}
// Need the following with some modifications for WCNCKL format:
if (Rtf.Contains("{Backspace}"))
{
XOffset -= 25;
Width += 24;
Rtf = Rtf.Replace("{Backspace}", "");
}
if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate) if (itemInfo.IsStep && itemInfo.MyHLS != null && itemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{ {
if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab if (itemInfo.FormatStepData.StepLayoutData.AlignWithParentTab
@ -2647,7 +2646,38 @@ namespace Volian.Print.Library
if (savCheckListBottomMost != 0) YBottomMost = Math.Max(savCheckListBottomMost, YBottomMost); if (savCheckListBottomMost != 0) YBottomMost = Math.Max(savCheckListBottomMost, YBottomMost);
if (XOffsetCenter != null) XOffset = (float)XOffsetCenter; if (XOffsetCenter != null) XOffset = (float)XOffsetCenter;
} }
public override string Rtf
{
get
{
if(_Rtf == null)BuildRtf();
return _Rtf;
}
set { _Rtf = value; }
}
private void BuildRtf()
{
if (_Rtf == null)
{
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm && MyItemInfo.IsCaution1 &&
MyItemInfo.MyContent.Text.StartsWith(@"\u") && !MyItemInfo.MyContent.Text.StartsWith(@"\u160?"))
{
Rtf = GetRtf(MyItemInfo, " " + (Prefix ?? ""), Suffix);
PrefixSpecialCharacter = true;
}
else
{
Rtf = GetRtf(MyItemInfo, Prefix, Suffix);
}
// Need the following with some modifications for WCNCKL format:
if (Rtf.Contains("{Backspace}"))
{
XOffset -= 25;
Width += 24;
Rtf = Rtf.Replace("{Backspace}", "");
}
}
}
// for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This // for Calvert (BGE) alarms, some step text is kept on the same line as its parent. This
// is flagged by the -1 row in the template definition. // is flagged by the -1 row in the template definition.
private bool KeepOnParentLine(ItemInfo itemInfo) private bool KeepOnParentLine(ItemInfo itemInfo)
@ -3282,11 +3312,11 @@ namespace Volian.Print.Library
get { return _MyTopRNO; } get { return _MyTopRNO; }
set { _MyTopRNO = value; } set { _MyTopRNO = value; }
} }
private static string _Prefix = ""; private static string _PathPrefix = "";
public static string Prefix public static string PathPrefix
{ {
get { return vlnParagraph._Prefix; } get { return vlnParagraph._PathPrefix; }
set { vlnParagraph._Prefix = value; } set { vlnParagraph._PathPrefix = value; }
} }
protected float _YBottomMost; // Bottom of the paragraph including the children protected float _YBottomMost; // Bottom of the paragraph including the children
public float YBottomMost public float YBottomMost