Logic for UnderlineTerminate, Ginna Backgrounds and McGuire’s: Caution and Notes, section title print, and line spacing
Added logic for UnderlineTerminate
This commit is contained in:
parent
a2f1fb0640
commit
d46f6ec495
@ -50,6 +50,16 @@ namespace Volian.Print.Library
|
||||
get { return _StepDesignatorFont; }
|
||||
set { _StepDesignatorFont = value; }
|
||||
}
|
||||
|
||||
public bool IsEnhancedBackgroundFormat(ItemInfo itminfo)
|
||||
{
|
||||
return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds);
|
||||
}
|
||||
public bool IsEnhancedDeviationFormat(ItemInfo itminfo)
|
||||
{
|
||||
return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations);
|
||||
}
|
||||
|
||||
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo)
|
||||
{
|
||||
int? bxIndex = null;
|
||||
@ -63,6 +73,14 @@ namespace Volian.Print.Library
|
||||
foreach (ItemInfo iChildItemInfo in itemInfoList)
|
||||
{
|
||||
ItemInfo childItemInfo = iChildItemInfo;
|
||||
int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
|
||||
|
||||
// if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution
|
||||
if (((bxIndx ?? -1) == -1) && (childItemInfo.IsCaution || childItemInfo.IsNote) && !childItemInfo.IsInRNO &&
|
||||
!childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Dev_Format &&
|
||||
!IsEnhancedBackgroundFormat(childItemInfo) && !IsEnhancedDeviationFormat(childItemInfo))
|
||||
xoff += (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT;
|
||||
|
||||
// if in a ComponentTableFormat (FNP sub format 1, component list), column headers are defined
|
||||
// by the first level of children. The data for the column is the child of the column header.
|
||||
// Sometimes the column will not have data, the following handles that case. Also, use
|
||||
@ -101,7 +119,7 @@ namespace Volian.Print.Library
|
||||
yoff = Add(cb, childItemInfo.Cautions, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
|
||||
if (childItemInfo.Notes != null && (childItemInfo.IsCaution || childItemInfo.IsNote))
|
||||
yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo);
|
||||
int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
|
||||
//int? bxIndx = childItemInfo.FormatStepData == null ? -1 : childItemInfo.FormatStepData.StepLayoutData.STBoxindex;
|
||||
bool boxHLS = false;
|
||||
|
||||
if ((bxIndx ?? -1) != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt || childItemInfo.MyHeader != null))
|
||||
@ -1356,7 +1374,7 @@ namespace Volian.Print.Library
|
||||
if (doprint && itemInfo.IsSection && !itemInfo.MyDocStyle.CancelSectTitle && itemInfo.MyTab.Text.ToUpper() != "FOLDOUT")
|
||||
{
|
||||
doSectTab = true;
|
||||
if (itemInfo.IsStepSection && formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Just == "PSLeft")
|
||||
if (itemInfo.IsStepSection && formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Just.Contains("PSLeft"))
|
||||
{
|
||||
float offset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
|
||||
if (formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos != null)
|
||||
@ -1367,7 +1385,8 @@ namespace Volian.Print.Library
|
||||
// see if this metasection, walking up the tree, has its header printed,
|
||||
// if so, indent for it.
|
||||
SectionConfig sch1 = iilvl.MyConfig as SectionConfig;
|
||||
if (sch1.Section_PrintHdr == "Y" || MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) MetaLevel++;
|
||||
if (sch1.Section_PrintHdr == "Y" || MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
|
||||
MetaLevel++;
|
||||
iilvl = iilvl.MyParent;
|
||||
}
|
||||
MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1;
|
||||
@ -1488,19 +1507,37 @@ namespace Volian.Print.Library
|
||||
// If the format has that extra space should be put out before the step, then
|
||||
// handle this by using the 'PartsAbove' structure. By using the parts above, the extra
|
||||
// space above will be done regardless of where page breaks fall.
|
||||
float addExtraSpace = (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0;
|
||||
float addExtraSpace = 0;
|
||||
if (MyItemInfo.MyParent != null && MyItemInfo.MyParent.FormatStepData != null &&
|
||||
MyItemInfo.MyParent.FormatStepData.Type != "TitleWithTextRight")
|
||||
addExtraSpace = (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0;
|
||||
// If a high level step, the 16bit code uses the value of the extra space
|
||||
// from the high level step format regardless of what type of high level step it is:
|
||||
// Added check for UseSTExtraRealValue, if set, we want to use what is set for the specific step type
|
||||
if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.UseSTExtraRealValue && MyItemInfo.IsHigh)
|
||||
// Added check for CustomSpacing (was also in 16-bit logic)
|
||||
if (!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.UseSTExtraRealValue &&
|
||||
!MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing &&
|
||||
MyItemInfo.IsHigh)
|
||||
addExtraSpace = MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[2].StepLayoutData.STExtraSpace ?? 0;
|
||||
// If CustomSpacing flag is true
|
||||
// then use the STExtraSpace from the step type called "Default" (index number 25)
|
||||
//if (YOffset != 0 && MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.CustomSpacing)
|
||||
if (YOffset != 0 && MyItemInfo.IsSection && MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing)
|
||||
addExtraSpace = (float)MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[25].StepLayoutData.STExtraSpace;
|
||||
if (YOffset != 0 && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.ThreeBlanksAbove)
|
||||
addExtraSpace = 24; // already has one blank line above, added two more
|
||||
//if (YOffset != 0 && MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace > 0)
|
||||
// addExtraSpace = (float)MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace;
|
||||
// if this plant has the AlwaysUseExtraLines and there are notes/cautions above the hls, don't add in the
|
||||
// extra space:
|
||||
if (itemInfo.IsHigh && (itemInfo.Cautions != null || itemInfo.Notes != null))
|
||||
{
|
||||
if ((itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.AlwaysUseExtraLines) || (itemInfo.Notes != null && itemInfo.Notes[0].FormatStepData.AlwaysUseExtraLines)) addExtraSpace = 0;
|
||||
if ((itemInfo.Cautions != null && itemInfo.Cautions[0].FormatStepData.AlwaysUseExtraLines) || (itemInfo.Notes != null && itemInfo.Notes[0].FormatStepData.AlwaysUseExtraLines))
|
||||
addExtraSpace = 0;
|
||||
}
|
||||
if (addExtraSpace > 0) this.PartsAbove.Add(new vlnText(cb, this, " ", " ", 0, yoff, MyItemInfo.FormatStepData.Font));
|
||||
if (addExtraSpace > 0 && MyItemInfo.FormatStepData != null && !MyItemInfo.ActiveFormat.MyStepSectionLayoutData.CustomSpacing)
|
||||
this.PartsAbove.Add(new vlnText(cb, this, " ", " ", 0, yoff, MyItemInfo.FormatStepData.Font));
|
||||
|
||||
yoff += addExtraSpace;
|
||||
|
||||
YTop = yoff;
|
||||
@ -1537,7 +1574,8 @@ namespace Volian.Print.Library
|
||||
}
|
||||
// For background formats, HLS's or Caution or any Notes have tab on line and then text
|
||||
// on line below (with space in between)
|
||||
if (IsBackgroundStep() && itemInfo.MyTab.AltPrintTab.Trim() != "") yoff = YOffset = yoff + (2 * SixLinesPerInch);
|
||||
if (IsBackgroundStep() && itemInfo.MyTab.AltPrintTab.Trim() != "")
|
||||
yoff = YOffset = yoff + (2 * SixLinesPerInch);
|
||||
|
||||
float yForCheckoff = yoff; //0; - default checkoff row is same as FIRST line of text
|
||||
// if dropCheckoff is true, then the checkoff is place on the same of row as the LAST line of text
|
||||
@ -1702,7 +1740,14 @@ namespace Volian.Print.Library
|
||||
}
|
||||
if (doprint && !UseTemplateKeepOnCurLine(itemInfo))
|
||||
{
|
||||
float tyoff = yoff;
|
||||
if (itemInfo.Steps != null)
|
||||
{
|
||||
if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight")
|
||||
tyoff = ChildrenRight.Add(cb, itemInfo.Steps, XOffset + 72, yoff, yoff, rnoLevel, maxRNO, formatInfo);
|
||||
}
|
||||
yoff += Height;
|
||||
yoff = Math.Max(yoff, tyoff);
|
||||
yoff += AdjustForBlankLines();
|
||||
if (dropCheckoff)
|
||||
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
|
||||
@ -1776,11 +1821,18 @@ namespace Volian.Print.Library
|
||||
SectionConfig sc = itemInfo.MyConfig as SectionConfig;
|
||||
if (sc != null && sc.SubSection_Edit != "Y") printsteps = false;
|
||||
}
|
||||
if (itemInfo.Steps != null && printsteps) yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo);
|
||||
if (itemInfo.Steps != null && printsteps)
|
||||
{
|
||||
if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight")
|
||||
yoff = ChildrenBelow.Add(cb, itemInfo.Steps, XOffset, yoff, yOffRight, rnoLevel, maxRNO, formatInfo);
|
||||
}
|
||||
if (itemInfo.Sections != null) yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
|
||||
if (itemInfo.Procedures != null) yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
|
||||
// Don't add the RNO to print if doing backgrounds. That piece of data is part of the pagelist item.
|
||||
if (rnoLevel >= maxRNO && itemInfo.RNOs != null && !itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat) yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo);
|
||||
if (rnoLevel >= maxRNO && itemInfo.RNOs != null &&
|
||||
!itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.WolfCreekBackgroundFormat &&
|
||||
!itemInfo.RNOs[0].FormatStepData.InPageList)
|
||||
yoff = ChildrenBelow.Add(cb, itemInfo.RNOs, XOffset, yoff, yoff, rnoLevel + 1, maxRNO, formatInfo);
|
||||
yoff = Math.Max(yoff, yOffRight);
|
||||
// TODO - use RNOSepAfterAER flag too:
|
||||
string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString;
|
||||
@ -2052,6 +2104,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
private float AdjustForBlankLines()
|
||||
{
|
||||
if (MyParent != null && MyParent.MyItemInfo.FormatStepData != null && MyParent.MyItemInfo.FormatStepData.Type == "TitleWithTextRight") return 0;
|
||||
if (MyItemInfo.MyDocStyle.SpecialStepsFoldout) return 0;
|
||||
if (MyItemInfo.FormatStepData != null && MyItemInfo.FormatStepData.Prefix != null && MyItemInfo.FormatStepData.Suffix != null && MyItemInfo.FormatStepData.UseSmartTemplate) return 0;
|
||||
int everyNLines = MyItemInfo.FormatStepData == null ? 1 : MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1;
|
||||
@ -2239,7 +2292,22 @@ namespace Volian.Print.Library
|
||||
if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
|
||||
_RtfSB.Append(_MyItemInfo.FormatStepData.Suffix.Replace("{ulnone}",@"\ulnone "));
|
||||
_RtfSB.Append("}");
|
||||
return _RtfSB.ToString();
|
||||
string rtf = _RtfSB.ToString();
|
||||
UnderlineTerminateList utl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.UnderlineTerminateList;
|
||||
if (utl != null && myFont.Underline)
|
||||
{
|
||||
foreach (UnderlineTerminate ut in utl)
|
||||
{
|
||||
if (rtf.Contains(ut.Text))
|
||||
{
|
||||
int indxC = rtf.IndexOf(ut.Text);
|
||||
rtf = rtf.Substring(0, indxC) + @"\ulnone " + rtf.Substring(indxC);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rtf;
|
||||
}
|
||||
private float _XOffsetBox = 0;
|
||||
public float XOffsetBox
|
||||
@ -2511,12 +2579,36 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextBelow")
|
||||
{
|
||||
if ((colOvrd??0) != 0)
|
||||
XOffset = (float)colOvrd;
|
||||
else
|
||||
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
|
||||
return;
|
||||
}
|
||||
else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow")
|
||||
{
|
||||
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (itemInfo.FormatStepData.Font.CharsToTwips * 2);
|
||||
float childindent = itemInfo.MyParent.FormatStepData.ChildIndent??0;
|
||||
if (myTab != null)
|
||||
{
|
||||
float delta = childindent + MyParent.XOffset - myTab.XOffset;
|
||||
myTab.XOffset += delta;
|
||||
XOffset += delta;
|
||||
}
|
||||
else
|
||||
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + childindent;//(itemInfo.FormatStepData.Font.CharsToTwips * 2);
|
||||
return;
|
||||
}
|
||||
else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight")
|
||||
{
|
||||
if ((colOvrd??0) != 0)
|
||||
XOffset = (float)colOvrd;
|
||||
else
|
||||
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
|
||||
return;
|
||||
}
|
||||
else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextRight")
|
||||
{
|
||||
XOffset = MyParent.MyParent.XOffset;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,9 @@ namespace Volian.Print.Library
|
||||
int sep = origTab.IndexOfAny(". ".ToCharArray());
|
||||
origTab = @"\ul " + origTab.Substring(0, sep-1) + @"\ulnone" + origTab.Substring(sep-1);
|
||||
}
|
||||
|
||||
UnderlineTerminateList utl = myparent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.UnderlineTerminateList;
|
||||
|
||||
// if this tab is underlined, the underlining should not underline the ':'. Check for "NOTE:"
|
||||
// or "CAUTION:", i.e. only underline up to ':'
|
||||
if (myparent.MyItemInfo.IsStep && ((myparent.MyItemInfo.FormatStepData.AlwaysTab || myparent.MyItemInfo.MyPrevious == null)
|
||||
@ -208,6 +211,22 @@ namespace Volian.Print.Library
|
||||
int indxC = origTab.IndexOf(":");
|
||||
origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone" + origTab.Substring(indxC);
|
||||
}
|
||||
else if (utl != null && ((vFont.Style & E_Style.Underline) > 0))
|
||||
{
|
||||
foreach (UnderlineTerminate ut in utl)
|
||||
{
|
||||
if (origTab.Contains(ut.Text))
|
||||
{
|
||||
FontStyle style = FontStyle.Regular;
|
||||
if ((vFont.Style & E_Style.Bold) > 0) style |= FontStyle.Bold;
|
||||
if ((vFont.Style & E_Style.Italics) > 0) style |= FontStyle.Italic;
|
||||
vFont.WindowsFont = new System.Drawing.Font(vFont.Family, (float)vFont.Size, style);
|
||||
int indxC = origTab.IndexOf(ut.Text);
|
||||
origTab = @"\ul " + origTab.Substring(0, indxC) + @"\ulnone " + origTab.Substring(indxC);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Rtf = GetRtf(origTab, vFont);
|
||||
Rtf = Rtf.Replace("\u0394", @"\f1\u916?\f0 "); // delta 0x0394
|
||||
if (ScriptCaution)
|
||||
|
Loading…
x
Reference in New Issue
Block a user