Keep pagination code from going into an infinite loop.

Properly handle a Null WidthOverride.
Properly handle a note or caution on a section.
Remove returns from lists of data points.
This commit is contained in:
Rich 2013-12-16 20:13:51 +00:00
parent 8a6e1c1996
commit 768890116c
3 changed files with 124 additions and 114 deletions

View File

@ -378,6 +378,7 @@ namespace Volian.Print.Library
while (((YSize - yTop) > ySpaceOnCurPage) || PageBreakOnStepList.Count > 0) while (((YSize - yTop) > ySpaceOnCurPage) || PageBreakOnStepList.Count > 0)
{ {
ySpaceOnCurPage -= myBottomMsgSpace; ySpaceOnCurPage -= myBottomMsgSpace;
vlnParagraph lastBreak = paraBreak;
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace); paraBreak = FindPageBreak(yStart, ySpaceOnCurPage, yLowerLimit, myList, paraBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace);
if (paraBreak == null) if (paraBreak == null)
{ {
@ -385,6 +386,10 @@ namespace Volian.Print.Library
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath);
break; break;
} }
if (lastBreak == paraBreak)
{
throw (new Exception(string.Format("Pagination Infinite Loop {0}",lastBreak.MyItemInfo.ShortPath)));
}
//paraBreak.ShowPageBreak(999, paraBreak.MyItemInfo.ShortPath, "Yes",paraBreak.YTop, paraBreak.YSize, paraBreak.Height, false); //paraBreak.ShowPageBreak(999, paraBreak.MyItemInfo.ShortPath, "Yes",paraBreak.YTop, paraBreak.YSize, paraBreak.Height, false);
//_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'" //_MyLog.InfoFormat("Place to break\r\n==>'Place to Break',{0},'{1}','{2}'"
//, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath); //, paraBreak.MyItemInfo.ItemID, paraBreak.MyItemInfo.MyDocVersion.MyFolder.Name, paraBreak.MyItemInfo.ShortPath);
@ -443,7 +448,8 @@ namespace Volian.Print.Library
&& myPara.ChildrenRight[0].YSize <= fullPage && myPara.ChildrenRight[0].YSize > spaceOnPage) && myPara.ChildrenRight[0].YSize <= fullPage && myPara.ChildrenRight[0].YSize > spaceOnPage)
{ {
//_MyLog.WarnFormat("\r\nMyParaBreak {0},{1},{2},{3},{4}", myPara, myPara.YSize, yUpperLimit, myPara.ChildrenRight[0].YSize, spaceOnPage); //_MyLog.WarnFormat("\r\nMyParaBreak {0},{1},{2},{3},{4}", myPara, myPara.YSize, yUpperLimit, myPara.ChildrenRight[0].YSize, spaceOnPage);
return myPara; if(myPara != lastBreak)
return myPara;
} }
// The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12) // The following lines were added for Comanche Peak ECA-0.1A.SProcedure Steps.S17 (Printed as Step 12)
vlnParagraph myParent = myPara.MyParent; vlnParagraph myParent = myPara.MyParent;

View File

@ -53,11 +53,11 @@ namespace Volian.Print.Library
public bool IsEnhancedBackgroundFormat(ItemInfo itminfo) public bool IsEnhancedBackgroundFormat(ItemInfo itminfo)
{ {
return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds); return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds);
} }
public bool IsEnhancedDeviationFormat(ItemInfo itminfo) public bool IsEnhancedDeviationFormat(ItemInfo itminfo)
{ {
return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations); 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) public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo)
@ -79,10 +79,10 @@ namespace Volian.Print.Library
// if the Caution or Note is not boxed, then use ColT to set the starting column of the Note or Caution // 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 && if (((bxIndx ?? -1) == -1) && (childItemInfo.IsCaution || childItemInfo.IsNote) && !childItemInfo.IsInRNO &&
!childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Dev_Format && !childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.Dev_Format &&
!IsEnhancedBackgroundFormat(childItemInfo) && !IsEnhancedDeviationFormat(childItemInfo)) !IsEnhancedBackgroundFormat(childItemInfo) && !IsEnhancedDeviationFormat(childItemInfo))
//xoff += (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT; //xoff += (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT;
xoff = xoffBase + (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT; xoff = xoffBase + (float)childItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColT;
// if in a ComponentTableFormat (FNP sub format 1, component list), column headers are defined // 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. // by the first level of children. The data for the column is the child of the column header.
@ -362,7 +362,7 @@ namespace Volian.Print.Library
// && !MyItemInfo.MyDocStyle.SpecialStepsFoldout // && !MyItemInfo.MyDocStyle.SpecialStepsFoldout
// && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections) // && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseMetaSections)
// && // &&
if (sch != null && sch.Section_PrintHdr != "Y") doprint = false; if (sch != null && sch.Section_PrintHdr != "Y") doprint = false;
} }
if (MyItemInfo.MyContent.MyGrid != null) if (MyItemInfo.MyContent.MyGrid != null)
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
@ -370,7 +370,7 @@ namespace Volian.Print.Library
if (doprint) retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation); if (doprint) retval = DrawText(cb, ref yPageStart, yTopMargin, yBottomMargin, ref yLocation);
if (MyItemInfo.IsHigh) if (MyItemInfo.IsHigh)
{ {
MyPageHelper.PageBookmarks.Add(MyItemInfo, (MyItemInfo.MyTab == null)?"":MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText, MyPageHelper.PageBookmarks.Add(MyItemInfo, (MyItemInfo.MyTab == null) ? "" : MyItemInfo.MyTab.CleanText + " " + MyItemInfo.DisplayText,
new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch)); new PdfDestination(PdfDestination.FITBH, yLocation + YVeryTop - YTopMost + SixLinesPerInch));
} }
} }
@ -434,7 +434,7 @@ namespace Volian.Print.Library
// just list the headers and the prefix can be 'empty'. // just list the headers and the prefix can be 'empty'.
if (ii.FormatStepData.Font.FontIsProportional()) if (ii.FormatStepData.Font.FontIsProportional())
{ {
float yLocVertLine = yLocation + (lpi/2); float yLocVertLine = yLocation + (lpi / 2);
// Prefix, i.e. Top line: // Prefix, i.e. Top line:
Paragraph topLeftLine = new Paragraph(bx.BXULC, iSymblFont); Paragraph topLeftLine = new Paragraph(bx.BXULC, iSymblFont);
Rtf2Pdf.TextAt(cb, topLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, topLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin);
@ -463,7 +463,7 @@ namespace Volian.Print.Library
//countLine = (int)(this.Height / lpi); //countLine = (int)(this.Height / lpi);
Paragraph sideLeftLine = new Paragraph(bx.BXMLS, iSymblFont); Paragraph sideLeftLine = new Paragraph(bx.BXMLS, iSymblFont);
Rtf2Pdf.TextAt(cb, sideLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, sideLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin);
Rtf2Pdf.TextAt(cb, sideLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine-(2*lpi), lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, sideLeftLine, float.Parse(vertPos[0]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - (2 * lpi), lWidth, 100, null, yBottomMargin);
Paragraph sideRightLine = new Paragraph(bx.BXMRS, iSymblFont); Paragraph sideRightLine = new Paragraph(bx.BXMRS, iSymblFont);
Rtf2Pdf.TextAt(cb, sideRightLine, float.Parse(vertPos[6]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, sideRightLine, float.Parse(vertPos[6]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin);
Rtf2Pdf.TextAt(cb, sideRightLine, float.Parse(vertPos[6]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - (2 * lpi), lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, sideRightLine, float.Parse(vertPos[6]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine - (2 * lpi), lWidth, 100, null, yBottomMargin);
@ -479,7 +479,7 @@ namespace Volian.Print.Library
// now do the vertical bar between header words and the column header words. // now do the vertical bar between header words and the column header words.
yLocVertLine -= lpi; yLocVertLine -= lpi;
string [] colHdrs = _MyItemInfo.FormatStepData.Suffix.Substring(_MyItemInfo.FormatStepData.Suffix.IndexOf(";")+1).Split(",".ToCharArray()); string[] colHdrs = _MyItemInfo.FormatStepData.Suffix.Substring(_MyItemInfo.FormatStepData.Suffix.IndexOf(";") + 1).Split(",".ToCharArray());
iTextSharp.text.Font iHdrFont = Volian.Svg.Library.VolianPdf.GetFont(_MyItemInfo.FormatStepData.Font.WindowsFont); iTextSharp.text.Font iHdrFont = Volian.Svg.Library.VolianPdf.GetFont(_MyItemInfo.FormatStepData.Font.WindowsFont);
iHdrFont.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); iHdrFont.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
@ -491,7 +491,7 @@ namespace Volian.Print.Library
// do vertical line: // do vertical line:
Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, paraVertLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yLocVertLine, lWidth, 100, null, yBottomMargin);
// do the column header text - center it: // do the column header text - center it:
if (i<colHdrs.Length) if (i < colHdrs.Length)
{ {
Paragraph parColHdr = new Paragraph(colHdrs[i], iHdrFont); Paragraph parColHdr = new Paragraph(colHdrs[i], iHdrFont);
// find the center point of column header and subtract 1/2 width of the text to locate the text. // find the center point of column header and subtract 1/2 width of the text to locate the text.
@ -602,7 +602,7 @@ namespace Volian.Print.Library
float ylocs = yPageStart - this.YBottomMost + 15; float ylocs = yPageStart - this.YBottomMost + 15;
for (int i = sublev; i < cntVertPos - 1; i++) for (int i = sublev; i < cntVertPos - 1; i++)
{ {
float hPos = float.Parse(vertPos[i])+csize; float hPos = float.Parse(vertPos[i]) + csize;
Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin); Rtf2Pdf.TextAt(cb, leftLine, float.Parse(vertPos[i]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, ylocs, lWidth, 100, null, yBottomMargin);
while (hPos < float.Parse(vertPos[i + 1])) while (hPos < float.Parse(vertPos[i + 1]))
{ {
@ -625,7 +625,7 @@ namespace Volian.Print.Library
if (MyGrid.Height > (yTopMargin - yBottomMargin)) if (MyGrid.Height > (yTopMargin - yBottomMargin))
{ {
_MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4}" _MyLog.ErrorFormat("<<< ERROR >>> Table is too big to fit on page, expect pagination problems\r\n==>'Table Too Big',{0},'{1}','{2}',{3},{4}"
, MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, MyGrid.Height,(yTopMargin - yBottomMargin)); , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, MyGrid.Height, (yTopMargin - yBottomMargin));
} }
return retval; return retval;
} }
@ -651,14 +651,14 @@ namespace Volian.Print.Library
} }
return retval; return retval;
} }
private static List<string> myAttributes =new List<string>(); private static List<string> myAttributes = new List<string>();
private static void AddAttribute(string attr) private static void AddAttribute(string attr)
{ {
if (myAttributes.Contains(attr)) if (myAttributes.Contains(attr))
return; return;
//Console.WriteLine("Attribute = \"{0}\"", attr); //Console.WriteLine("Attribute = \"{0}\"", attr);
myAttributes.Add(attr); myAttributes.Add(attr);
} }
private void CheckAttributes(System.Collections.Hashtable attributes) private void CheckAttributes(System.Collections.Hashtable attributes)
{ {
foreach (string attr in attributes.Keys) foreach (string attr in attributes.Keys)
@ -683,8 +683,8 @@ namespace Volian.Print.Library
CheckAttributes(chk.Attributes); CheckAttributes(chk.Attributes);
if (chk.Font.BaseFont != null && chk.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD")) if (chk.Font.BaseFont != null && chk.Font.BaseFont.PostscriptFontName.ToUpper().Contains("BOLD"))
{ {
prefix += "\xD5"; prefix += "\xD5";
suffix = "\xD6" + suffix; suffix = "\xD6" + suffix;
} }
if (chk.Attributes.ContainsKey("SUBSUPSCRIPT")) if (chk.Attributes.ContainsKey("SUBSUPSCRIPT"))
{ {
@ -742,7 +742,7 @@ namespace Volian.Print.Library
get get
{ {
return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}", return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}",
DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData==null?"NoStepData":MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset); DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset);
} }
} }
private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin) private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin)
@ -899,7 +899,7 @@ namespace Volian.Print.Library
break; break;
} }
if (!PageBreakOnStep) if (!PageBreakOnStep)
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
} }
if (PageBreakOnStep) MyPageHelper.BottomMessage = null; if (PageBreakOnStep) MyPageHelper.BottomMessage = null;
cb.PdfDocument.NewPage(); cb.PdfDocument.NewPage();
@ -933,7 +933,7 @@ namespace Volian.Print.Library
// If there is a box, adjust the yTopMost to include it. // If there is a box, adjust the yTopMost to include it.
float yTopMost = YTopMost; float yTopMost = YTopMost;
//if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop); //if (YVeryTop < yTopMost) Console.WriteLine("{0},{1},{2}", MyItemInfo.DBSequence, yTopMost, YVeryTop);
yTopMost = Math.Min(yTopMost,YVeryTop); yTopMost = Math.Min(yTopMost, YVeryTop);
yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch; yPageStart = yTopMargin + yTopMost;// -2 * SixLinesPerInch;
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart); DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
if (EmptyTopMostPart) yPageStart += SixLinesPerInch; if (EmptyTopMostPart) yPageStart += SixLinesPerInch;
@ -944,7 +944,7 @@ namespace Volian.Print.Library
if (myMsg.IndexOf(@"%d") > -1) if (myMsg.IndexOf(@"%d") > -1)
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray())); myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()));
if (!PageBreakOnStep) if (!PageBreakOnStep)
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font); MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
else else
MyPageHelper.TopMessage = null; MyPageHelper.TopMessage = null;
} }
@ -1068,8 +1068,8 @@ namespace Volian.Print.Library
if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", MyItemInfo.ActiveSection.DisplayNumber); if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", MyItemInfo.ActiveSection.DisplayNumber);
//jcb code //jcb code
if(myMsg.Contains("%-8s")) if (myMsg.Contains("%-8s"))
myMsg = myMsg.Replace("%-8s",MyItemInfo.MyProcedure.DisplayNumber.PadRight(8)); myMsg = myMsg.Replace("%-8s", MyItemInfo.MyProcedure.DisplayNumber.PadRight(8));
//end jb code //end jb code
// center the message. // center the message.
float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin; float wtpm = (float)docstyle.Layout.PageWidth - (float)docstyle.Layout.LeftMargin;
@ -1109,7 +1109,7 @@ namespace Volian.Print.Library
{ {
get get
{ {
if (ChildrenAbove.Count>0) return ChildrenAbove[0].TopMostChild; if (ChildrenAbove.Count > 0) return ChildrenAbove[0].TopMostChild;
return this; return this;
} }
} }
@ -1150,8 +1150,8 @@ namespace Volian.Print.Library
if (_YVeryTop == -1) if (_YVeryTop == -1)
{ {
_YVeryTop = YTop; _YVeryTop = YTop;
_YVeryTop = VeryTop(PartsAbove,_YVeryTop); _YVeryTop = VeryTop(PartsAbove, _YVeryTop);
_YVeryTop = VeryTop(PartsContainer,_YVeryTop); _YVeryTop = VeryTop(PartsContainer, _YVeryTop);
} }
return _YVeryTop; return _YVeryTop;
} }
@ -1228,7 +1228,7 @@ namespace Volian.Print.Library
} }
if (ChildrenRight != null && ChildrenRight.Count > 0) if (ChildrenRight != null && ChildrenRight.Count > 0)
{ {
foreach(vlnParagraph paraRight in ChildrenRight) foreach (vlnParagraph paraRight in ChildrenRight)
{ {
vlnParagraph paraRightLast = paraRight.GetFirstPieceLastPart(); vlnParagraph paraRightLast = paraRight.GetFirstPieceLastPart();
if (paraRightLast.YBottom > para.YBottom) if (paraRightLast.YBottom > para.YBottom)
@ -1249,10 +1249,10 @@ namespace Volian.Print.Library
// the original list because list items cannot be removed in a // the original list because list items cannot be removed in a
// 'foreach'. // 'foreach'.
List<int> CleanupListStepLevel = new List<int>(); List<int> CleanupListStepLevel = new List<int>();
foreach(int stepLevel in myList.Keys) foreach (int stepLevel in myList.Keys)
{ {
List<float> CleanupListYLocation = new List<float>(); List<float> CleanupListYLocation = new List<float>();
SortedList<float, float> AdjustYLocation = new SortedList<float,float>(); SortedList<float, float> AdjustYLocation = new SortedList<float, float>();
foreach (float yLocation in myList[stepLevel].Keys) foreach (float yLocation in myList[stepLevel].Keys)
{ {
if (-yLocation <= yTop) if (-yLocation <= yTop)
@ -1271,7 +1271,7 @@ namespace Volian.Print.Library
// from the beginning of the step. // from the beginning of the step.
// Note that yLocation is negative to have items in descending // Note that yLocation is negative to have items in descending
// order so that adding yTop decrements their values. // order so that adding yTop decrements their values.
myList[stepLevel].Add(yTop-yLocation, para); myList[stepLevel].Add(yTop - yLocation, para);
} }
if (myList[stepLevel].Count == 0) if (myList[stepLevel].Count == 0)
CleanupListStepLevel.Add(stepLevel); CleanupListStepLevel.Add(stepLevel);
@ -1412,7 +1412,7 @@ namespace Volian.Print.Library
} }
MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1; MetaLevel = MetaLevel <= 2 ? 1 : MetaLevel - 1;
if (MetaLevel == 1) if (MetaLevel == 1)
offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos; offset += (float)formatInfo.PlantFormat.FormatData.SectData.SectionNumber.Pos;
else else
{ {
xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel; xMetaAdj = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[0].ColSByLevel;
@ -1435,7 +1435,7 @@ namespace Volian.Print.Library
if (itemInfo.MyTab.AltPrintTab != null) if (itemInfo.MyTab.AltPrintTab != null)
mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); mytab = new vlnTab(cb, this, itemInfo.MyTab.AltPrintTab, itemInfo.MyTab.AltPrintTab, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
else else
mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, itemInfo.MyTab.CleanText, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline); mytab = new vlnTab(cb, this, itemInfo.MyTab.Text, itemInfo.MyTab.CleanText, localXOffset, yoff, itemInfo.MyTab.MyFont, doSectTab, StepRTB.MySymbolFontName, itemInfo.MyTab.RemovedStyleUnderline);
PartsLeft.Add(mytab); PartsLeft.Add(mytab);
if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro); if (mytab.MyMacro != null) PartsLeft.Add(mytab.MyMacro);
} }
@ -1458,7 +1458,7 @@ namespace Volian.Print.Library
Width -= (float)itemInfo.ActiveFormat.MyStepSectionLayoutData.SingleColumnRNOIndent; Width -= (float)itemInfo.ActiveFormat.MyStepSectionLayoutData.SingleColumnRNOIndent;
offset -= Width; offset -= Width;
float inc = offset - XOffset; float inc = offset - XOffset;
if(mytab != null) if (mytab != null)
mytab.XOffset += inc;// +(itemInfo.MyParent.IsHigh ? 6.8f : 0); mytab.XOffset += inc;// +(itemInfo.MyParent.IsHigh ? 6.8f : 0);
XOffset += inc; XOffset += inc;
adjustAgain = false; adjustAgain = false;
@ -1484,8 +1484,8 @@ namespace Volian.Print.Library
if (adjusttab != 0) Width += (mytab.Width); if (adjusttab != 0) Width += (mytab.Width);
} }
} }
if(adjustAgain) if (adjustAgain)
AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj);
if (UseTemplateWidthOrXOff(itemInfo)) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + GetWidthOrStartFromTemplate(itemInfo, itemInfo.ActiveFormat, false); if (UseTemplateWidthOrXOff(itemInfo)) XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + GetWidthOrStartFromTemplate(itemInfo, itemInfo.ActiveFormat, false);
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);
@ -1518,8 +1518,8 @@ namespace Volian.Print.Library
if (ChildrenAbove.StepDesignator != null) if (ChildrenAbove.StepDesignator != null)
{ {
string pref = ChildrenAbove.StepDesignator; string pref = ChildrenAbove.StepDesignator;
float colOvrd = (float)(ChildrenAbove.StepDesignatorColumn??0); float colOvrd = (float)(ChildrenAbove.StepDesignatorColumn ?? 0);
float xPref = (colOvrd > 0)? colOvrd : mytab.XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI)); float xPref = (colOvrd > 0) ? colOvrd : mytab.XOffset - (pref.Length * (72 / (float)_MyItemInfo.FormatStepData.Font.CPI));
PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, ChildrenAbove.StepDesignatorFont)); PartsLeft.Add(new vlnText(cb, this, pref, pref, xPref, yoff, ChildrenAbove.StepDesignatorFont));
ChildrenAbove.StepDesignator = null; ChildrenAbove.StepDesignator = null;
ChildrenAbove.StepDesignatorColumn = null; ChildrenAbove.StepDesignatorColumn = null;
@ -1586,7 +1586,7 @@ namespace Volian.Print.Library
// the '-24' in x-direction & '+4' in y-direction was used for the SHE format to get the continuous // the '-24' in x-direction & '+4' in y-direction was used for the SHE format to get the continuous
// HLS's asterisk to match 16bit. The font size was set at 16 to make it match also: // HLS's asterisk to match 16bit. The font size was set at 16 to make it match also:
VE_Font astFont = new VE_Font(MyItemInfo.FormatStepData.TabData.Font.Family, 16, E_Style.Bold, 10); VE_Font astFont = new VE_Font(MyItemInfo.FormatStepData.TabData.Font.Family, 16, E_Style.Bold, 10);
vlnText myAsterisk = new vlnText(cb, this, "*", "*", mytab.XOffset - 24, YOffset+4, astFont); vlnText myAsterisk = new vlnText(cb, this, "*", "*", mytab.XOffset - 24, YOffset + 4, astFont);
PartsLeft.Add(myAsterisk); PartsLeft.Add(myAsterisk);
} }
if (itemInfo.IsRNOPart && rnoLevel > maxRNO) if (itemInfo.IsRNOPart && rnoLevel > maxRNO)
@ -1791,7 +1791,7 @@ namespace Volian.Print.Library
{ {
// if this item's content is empty, and the flag is set to 'notonempty', don't print out the // if this item's content is empty, and the flag is set to 'notonempty', don't print out the
// checkoff - this was added for shearon harris: // checkoff - this was added for shearon harris:
if (!(co.NotOnEmpty && itemInfo.MyContent.Text.Replace(@"\u160?"," ").TrimEnd() == "")) if (!(co.NotOnEmpty && itemInfo.MyContent.Text.Replace(@"\u160?", " ").TrimEnd() == ""))
{ {
float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
// if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of
@ -1867,7 +1867,7 @@ namespace Volian.Print.Library
yoff = Math.Max(yoff, yOffRight); yoff = Math.Max(yoff, yOffRight);
// TODO - use RNOSepAfterAER flag too: // TODO - use RNOSepAfterAER flag too:
string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString; string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString;
float tmpRnoSepLen = formatInfo.MyStepSectionPrintData.RNOSepLineLength??0; float tmpRnoSepLen = formatInfo.MyStepSectionPrintData.RNOSepLineLength ?? 0;
if (rnoLevel < maxRNO && itemInfo.RNOs != null && (tmpRnoSepStr != null || tmpRnoSepLen != 0)) if (rnoLevel < maxRNO && itemInfo.RNOs != null && (tmpRnoSepStr != null || tmpRnoSepLen != 0))
{ {
vlnParagraph rno = ChildrenRight[0]; vlnParagraph rno = ChildrenRight[0];
@ -1967,7 +1967,7 @@ namespace Volian.Print.Library
} }
} }
else else
mySubSectionInfo = (mySectionInfo.Sections == null)?null:mySectionInfo.Sections[0]; mySubSectionInfo = (mySectionInfo.Sections == null) ? null : mySectionInfo.Sections[0];
if (mySectionInfo == mySubSectionInfo) mySubSectionInfo = null; if (mySectionInfo == mySubSectionInfo) mySubSectionInfo = null;
@ -1983,11 +1983,11 @@ namespace Volian.Print.Library
SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID); SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID);
int sindx = si.CheckOffHeadingIndex(); int sindx = si.CheckOffHeadingIndex();
SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID); SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID);
int subindx = subi==null?-1:subi.CheckOffHeadingIndex(); int subindx = subi == null ? -1 : subi.CheckOffHeadingIndex();
// if there is no subsections & the main section doesn't use a header OR // if there is no subsections & the main section doesn't use a header OR
// if there is a subsection, & it does not use a header... Return. // if there is a subsection, & it does not use a header... Return.
if ((subi==null&&sindx < 1) || (subi!=null&&subindx<1)) return; if ((subi == null && sindx < 1) || (subi != null && subindx < 1)) return;
// figure out location now: // figure out location now:
// if step, it uses pagelist logic to locate it (this is a page break condition). // if step, it uses pagelist logic to locate it (this is a page break condition).
@ -2008,7 +2008,7 @@ namespace Volian.Print.Library
} }
// grab the string from the format, depending on whether it should get it from the section or subsection. // grab the string from the format, depending on whether it should get it from the section or subsection.
string cohead = (mySubSectionInfo!=null)?mySubSectionInfo.SectionCheckOffHeader:mySectionInfo.SectionCheckOffHeader; string cohead = (mySubSectionInfo != null) ? mySubSectionInfo.SectionCheckOffHeader : mySectionInfo.SectionCheckOffHeader;
if (cohead == "" || cohead == null) return; if (cohead == "" || cohead == null) return;
// PageListCheckOffHeader is an svgtext - but really we only need the x/y location for this (pagelist support) // PageListCheckOffHeader is an svgtext - but really we only need the x/y location for this (pagelist support)
@ -2112,7 +2112,7 @@ namespace Volian.Print.Library
// the amount of difference from a 10 CPI to a 12 CPI font. See comment above. // the amount of difference from a 10 CPI to a 12 CPI font. See comment above.
float posAdjust = (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0); float posAdjust = (float)(itemInfo.FormatStepData.StepPrintData.PosAdjust ?? 0);
if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null && if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.StepPrintData != null &&
posAdjust>0) posAdjust > 0)
{ {
if (Width < hls1.Width - posAdjust) if (Width < hls1.Width - posAdjust)
XOffset += posAdjust; XOffset += posAdjust;
@ -2137,7 +2137,7 @@ namespace Volian.Print.Library
{ {
if (MyParent != null && MyParent.MyItemInfo.FormatStepData != null && MyParent.MyItemInfo.FormatStepData.Type == "TitleWithTextRight") return 0; if (MyParent != null && MyParent.MyItemInfo.FormatStepData != null && MyParent.MyItemInfo.FormatStepData.Type == "TitleWithTextRight") return 0;
if (MyItemInfo.MyDocStyle.SpecialStepsFoldout) 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; 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; int everyNLines = MyItemInfo.FormatStepData == null ? 1 : MyItemInfo.FormatStepData.StepLayoutData.EveryNLines ?? 1;
if (everyNLines == -99) return 0; if (everyNLines == -99) return 0;
if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch; if (MyItemInfo.Ordinal % everyNLines == 0 || MyItemInfo.NextItem == null) return SixLinesPerInch;
@ -2185,11 +2185,11 @@ namespace Volian.Print.Library
ChangeBarData cbd = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData; ChangeBarData cbd = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData;
float cols = formatInfo.MyStepSectionLayoutData.ColS ?? 0; float cols = formatInfo.MyStepSectionLayoutData.ColS ?? 0;
float colr = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); float colr = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
// FixedChangeColumn + - Column location for change bars // FixedChangeColumn + - Column location for change bars
// 0 - Separate AER and RNO change bars to the right of the text // 0 - Separate AER and RNO change bars to the right of the text
// -10 to -1 - Change bars on left (specify # of columns from the text) // -10 to -1 - Change bars on left (specify # of columns from the text)
// <-10 - AER change bars on the left and RNO change bars on the right. // <-10 - AER change bars on the left and RNO change bars on the right.
// FixedAERChangeColumn overrides the -5 default setting in chgbar.c, value is converted to a negative by the code // FixedAERChangeColumn overrides the -5 default setting in chgbar.c, value is converted to a negative by the code
float col = (cbd.AbsoluteFixedChangeColumn) ? float col = (cbd.AbsoluteFixedChangeColumn) ?
((cbd.FixedAERChangeColumn ?? 0) > 0) ? ((cbd.FixedAERChangeColumn ?? 0) > 0) ?
@ -2220,7 +2220,7 @@ namespace Volian.Print.Library
|| (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && lRev.Contains("\\"))) || (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && lRev.Contains("\\")))
{ {
int indx = lRev.IndexOf(itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate ? '/' : '\\'); int indx = lRev.IndexOf(itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate ? '/' : '\\');
cbMess = lRev.Substring(0, indx>-1?indx:lRev.Length); cbMess = lRev.Substring(0, indx > -1 ? indx : lRev.Length);
} }
else else
cbMess = lRev; cbMess = lRev;
@ -2246,7 +2246,7 @@ namespace Volian.Print.Library
Box bxCautNote = null; // used for notes and cautions in the Prairie Island Alarms format Box bxCautNote = null; // used for notes and cautions in the Prairie Island Alarms format
if (MyItemInfo.IsCaution || MyItemInfo.IsNote) if (MyItemInfo.IsCaution || MyItemInfo.IsNote)
{ {
// Temporary fix for change bars on Notes and Cautions where the FixedChgCol < -10 // Temporary fix for change bars on Notes and Cautions where the FixedChgCol < -10
tmpc = (float)formatInfo.MyStepSectionLayoutData.ColT + (float)formatInfo.MyStepSectionLayoutData.WidT; // end position of Caution / Note tmpc = (float)formatInfo.MyStepSectionLayoutData.ColT + (float)formatInfo.MyStepSectionLayoutData.WidT; // end position of Caution / Note
int typ = (int)(MyItemInfo.MyContent.Type % 10000); int typ = (int)(MyItemInfo.MyContent.Type % 10000);
int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex; int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex;
@ -2321,7 +2321,7 @@ namespace Volian.Print.Library
_RtfSB.Append(AddFontTable(myFont)); _RtfSB.Append(AddFontTable(myFont));
_RtfSB.Append(vlntxt.StartText); _RtfSB.Append(vlntxt.StartText);
if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "") if (_MyItemInfo.IsStep && !itemInfo.FormatStepData.UseSmartTemplate && _MyItemInfo.FormatStepData.Suffix != null && _MyItemInfo.FormatStepData.Suffix != "")
_RtfSB.Append(_MyItemInfo.FormatStepData.Suffix.Replace("{ulnone}",@"\ulnone ")); _RtfSB.Append(_MyItemInfo.FormatStepData.Suffix.Replace("{ulnone}", @"\ulnone "));
_RtfSB.Append("}"); _RtfSB.Append("}");
string rtf = _RtfSB.ToString(); string rtf = _RtfSB.ToString();
UnderlineTerminateList utl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.UnderlineTerminateList; UnderlineTerminateList utl = MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.UnderlineTerminateList;
@ -2374,7 +2374,7 @@ namespace Volian.Print.Library
xoff = XOffset; // XOffset has left margin included xoff = XOffset; // XOffset has left margin included
vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff, YOffset, itemInfo.MyHeader.MyFont); vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff, YOffset, itemInfo.MyHeader.MyFont);
PartsAbove.Add(myHeader); PartsAbove.Add(myHeader);
return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader&&(MyItemInfo.IsCaution||MyItemInfo.IsNote)) ? SixLinesPerInch : 0); return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? SixLinesPerInch : 0);
} }
private float AdjustToCharPosition(float position, float? CPI) private float AdjustToCharPosition(float position, float? CPI)
{ {
@ -2587,7 +2587,7 @@ namespace Volian.Print.Library
iilvl = iilvl.MyParent; iilvl = iilvl.MyParent;
} }
level = level <= 2 ? 1 : level - 1; level = level <= 2 ? 1 : level - 1;
if (level==1) if (level == 1)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos); XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (level * (float)formatInfo.PlantFormat.FormatData.SectData.SectionHeader.Pos);
else else
{ {
@ -2604,13 +2604,13 @@ namespace Volian.Print.Library
if (IsBackgroundStep()) if (IsBackgroundStep())
{ {
if (myTab != null ) myTab.XOffset = XOffset; if (myTab != null) myTab.XOffset = XOffset;
XOffset += (itemInfo.FormatStepData.Font.CharsToTwips * 2); // indent 2 characters for background steps XOffset += (itemInfo.FormatStepData.Font.CharsToTwips * 2); // indent 2 characters for background steps
return; return;
} }
else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextBelow") else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextBelow")
{ {
if ((colOvrd??0) != 0) if ((colOvrd ?? 0) != 0)
XOffset = (float)colOvrd; XOffset = (float)colOvrd;
else else
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
@ -2618,7 +2618,7 @@ namespace Volian.Print.Library
} }
else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow") else if (itemInfo.MyParent.FormatStepData != null && itemInfo.MyParent.FormatStepData.Type == "TitleWithTextBelow")
{ {
float childindent = itemInfo.MyParent.FormatStepData.ChildIndent??0; float childindent = itemInfo.MyParent.FormatStepData.ChildIndent ?? 0;
if (myTab != null) if (myTab != null)
{ {
float delta = childindent + MyParent.XOffset - myTab.XOffset; float delta = childindent + MyParent.XOffset - myTab.XOffset;
@ -2631,7 +2631,7 @@ namespace Volian.Print.Library
} }
else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight") else if (itemInfo.FormatStepData != null && itemInfo.FormatStepData.Type == "TitleWithTextRight")
{ {
if ((colOvrd??0) != 0) if ((colOvrd ?? 0) != 0)
XOffset = (float)colOvrd; XOffset = (float)colOvrd;
else else
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin; XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
@ -2647,7 +2647,7 @@ namespace Volian.Print.Library
{ {
float x = 0; float x = 0;
float xoff = 0; float xoff = 0;
if ((colOvrd??0)!=0) if ((colOvrd ?? 0) != 0)
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd; x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd;
else else
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS; x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
@ -2663,7 +2663,7 @@ namespace Volian.Print.Library
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel; 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; float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent; float adjCols = (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent;
float xtabcol = adjCols - ((myTab==null||myTab.Text==null)?0:(myTab.Text.Length * 7.2f)); float xtabcol = adjCols - ((myTab == null || myTab.Text == null) ? 0 : (myTab.Text.Length * 7.2f));
if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol; if (indxLevel > 1 && myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + xtabcol;
else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel; else if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
if (myTab != null) if (myTab != null)
@ -2823,7 +2823,8 @@ namespace Volian.Print.Library
if (itemInfo.IsStep && itemInfo.MyHLS != null && UseTemplateWidthOrXOff(itemInfo) && (xwid = GetWidthOrStartFromTemplate(itemInfo, formatInfo, true)) > 0) if (itemInfo.IsStep && itemInfo.MyHLS != null && UseTemplateWidthOrXOff(itemInfo) && (xwid = GetWidthOrStartFromTemplate(itemInfo, formatInfo, true)) > 0)
widOvrd = xwid; widOvrd = xwid;
else else
widOvrd = itemInfo.FormatStepData == null ? null : (float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO); widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride == null ? null :
(float?)ToInt(itemInfo.FormatStepData.WidthOverride, maxRNO);
//widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride; //widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.WidthOverride;
// Don't adjust the RNO width if in single column mode: // Don't adjust the RNO width if in single column mode:
if (itemInfo.IsRNOPart && itemInfo.MyParent.IsHigh && itemInfo.MyActiveSection.ColumnMode != 0 && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt != null) if (itemInfo.IsRNOPart && itemInfo.MyParent.IsHigh && itemInfo.MyActiveSection.ColumnMode != 0 && itemInfo.ActiveFormat.MyStepSectionLayoutData.RNOWidthAlt != null)
@ -2833,7 +2834,7 @@ namespace Volian.Print.Library
if (ovrd > 0) if (ovrd > 0)
widOvrd = ovrd; // + 6; // Change bars on RNO column (signoff line) would not line up with 16-bit without this - NSP Alarms widOvrd = ovrd; // + 6; // Change bars on RNO column (signoff line) would not line up with 16-bit without this - NSP Alarms
} }
if ((widOvrd??0) != 0) if ((widOvrd ?? 0) != 0)
{ {
Width = (float)widOvrd; Width = (float)widOvrd;
// if there's a box, we may need to do an adjustment on the width, if the tab data was changed // if there's a box, we may need to do an adjustment on the width, if the tab data was changed
@ -2912,7 +2913,7 @@ namespace Volian.Print.Library
Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT; Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT;
XOffset += mycolT; // adjust caution/note text position XOffset += mycolT; // adjust caution/note text position
if (PartsLeft != null)// adjust tab position if (PartsLeft != null)// adjust tab position
foreach(vlnPrintObject vpo in PartsLeft) foreach (vlnPrintObject vpo in PartsLeft)
vpo.XOffset += mycolT; vpo.XOffset += mycolT;
} }
else if (itemInfo.IsSection) else if (itemInfo.IsSection)
@ -2960,11 +2961,12 @@ namespace Volian.Print.Library
private bool UseTemplateWidthOrXOff(ItemInfo itemInfo) private bool UseTemplateWidthOrXOff(ItemInfo itemInfo)
{ {
if (!itemInfo.IsStep) return false; if (!itemInfo.IsStep) return false;
if (itemInfo.MyHLS == null) return false;
if (itemInfo.MyHLS.FormatStepData.UseSmartTemplate) return false; if (itemInfo.MyHLS.FormatStepData.UseSmartTemplate) return false;
if (!itemInfo.MyDocStyle.ComponentList) return false; if (!itemInfo.MyDocStyle.ComponentList) return false;
if (itemInfo.MyHLS.FormatStepData.UseOldTemplate) if (itemInfo.MyHLS.FormatStepData.UseOldTemplate)
{ {
ItemInfo useForTemplate = itemInfo.IsHigh?itemInfo:itemInfo.MyParent; ItemInfo useForTemplate = itemInfo.IsHigh ? itemInfo : itemInfo.MyParent;
int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx(); int topIndx = useForTemplate.GetSmartTemplateTopLevelIndx();
int tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type); int tpIndx = useForTemplate.GetSmartTemplateIndex(topIndx, (int)useForTemplate.MyContent.Type);
if (tpIndx > -1) return true; if (tpIndx > -1) return true;
@ -3002,7 +3004,7 @@ namespace Volian.Print.Library
// -1 below code, +1 for '.' and -2 for standard wid of tab // -1 below code, +1 for '.' and -2 for standard wid of tab
// standard wid of this tab is 2 (ex: '1.') // standard wid of this tab is 2 (ex: '1.')
// so adjust width if longer than normal // so adjust width if longer than normal
return (float)(sectTab.Length - 1) * 72/(float)MyItemInfo.FormatStepData.Font.CPI; return (float)(sectTab.Length - 1) * 72 / (float)MyItemInfo.FormatStepData.Font.CPI;
} }
private bool HasCheckOffHeading(ItemInfo itemInfo, FormatInfo formatInfo) private bool HasCheckOffHeading(ItemInfo itemInfo, FormatInfo formatInfo)
{ {
@ -3036,7 +3038,8 @@ namespace Volian.Print.Library
/// </summary> /// </summary>
public class StepLevelList : SortedDictionary<int, SortedDictionary<float, vlnParagraph>> public class StepLevelList : SortedDictionary<int, SortedDictionary<float, vlnParagraph>>
{ {
public StepLevelList() : base() public StepLevelList()
: base()
{ {
} }
public void Add(int stepLevel, float yLocation, vlnParagraph para) public void Add(int stepLevel, float yLocation, vlnParagraph para)
@ -3060,7 +3063,7 @@ namespace Volian.Print.Library
ParagraphLocation foundOverlap = FindOverlap(myParagraph); ParagraphLocation foundOverlap = FindOverlap(myParagraph);
if (foundOverlap == null) if (foundOverlap == null)
{ {
this.Add(new ParagraphLocation(yTopMost,myParagraph)); this.Add(new ParagraphLocation(yTopMost, myParagraph));
return; return;
} }
ParagraphLocation doubleOverlap = FindOverlap(foundOverlap); ParagraphLocation doubleOverlap = FindOverlap(foundOverlap);
@ -3096,12 +3099,12 @@ namespace Volian.Print.Library
if (KeepStepsOnPage && paraLoc.MyParagraph.MyItemInfo.MyContent.Type == 20001) if (KeepStepsOnPage && paraLoc.MyParagraph.MyItemInfo.MyContent.Type == 20001)
{ {
if (DontBreakHere(paraLoc)) if (DontBreakHere(paraLoc))
//if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null) // First substep //if (paraLoc.MyParagraph.MyItemInfo.MyPrevious == null) // First substep
level = 0; level = 0;
else else
level = 1; level = 1;
} }
myList.Add(level , paraLoc.YTop, paraLoc.MyParagraph); myList.Add(level, paraLoc.YTop, paraLoc.MyParagraph);
} }
return myList; return myList;
} }
@ -3149,9 +3152,9 @@ namespace Volian.Print.Library
get { return _MyParagraph; } get { return _MyParagraph; }
set { _MyParagraph = value; } set { _MyParagraph = value; }
} }
public ParagraphLocation(float yTopMost,vlnParagraph myParagraph) public ParagraphLocation(float yTopMost, vlnParagraph myParagraph)
{ {
MyParagraph =myParagraph; MyParagraph = myParagraph;
YTop = myParagraph.YVeryTop - yTopMost; YTop = myParagraph.YVeryTop - yTopMost;
YBottom = myParagraph.YBottom - yTopMost; YBottom = myParagraph.YBottom - yTopMost;
StepLevel = myParagraph.MyItemInfo.StepLevel; StepLevel = myParagraph.MyItemInfo.StepLevel;
@ -3160,8 +3163,8 @@ namespace Volian.Print.Library
{ {
if (Between(otherParagraph.YTop, YTop, YBottom)) return true; if (Between(otherParagraph.YTop, YTop, YBottom)) return true;
if (Between(otherParagraph.YBottom, YTop, YBottom)) return true; if (Between(otherParagraph.YBottom, YTop, YBottom)) return true;
if(Between(YTop,otherParagraph.YVeryTop,otherParagraph.YBottom)) return true; if (Between(YTop, otherParagraph.YVeryTop, otherParagraph.YBottom)) return true;
if(Between(YBottom,otherParagraph.YVeryTop,otherParagraph.YBottom)) return true; if (Between(YBottom, otherParagraph.YVeryTop, otherParagraph.YBottom)) return true;
return false; return false;
} }
public static bool Between(float x, float lower, float higher) public static bool Between(float x, float lower, float higher)
@ -3170,8 +3173,8 @@ namespace Volian.Print.Library
{ {
if (Between(otherParagraphLocation.YTop, YTop, YBottom)) return true; // The top is within the other if (Between(otherParagraphLocation.YTop, YTop, YBottom)) return true; // The top is within the other
if (Between(otherParagraphLocation.YBottom, YTop, YBottom)) return true; // The bottom is within the other if (Between(otherParagraphLocation.YBottom, YTop, YBottom)) return true; // The bottom is within the other
if(Between(YTop,otherParagraphLocation.YTop,otherParagraphLocation.YBottom)) return true; // the other top is within this one if (Between(YTop, otherParagraphLocation.YTop, otherParagraphLocation.YBottom)) return true; // the other top is within this one
if(Between(YBottom,otherParagraphLocation.YTop,otherParagraphLocation.YBottom)) return true;// I believe this is unnecessary if (Between(YBottom, otherParagraphLocation.YTop, otherParagraphLocation.YBottom)) return true;// I believe this is unnecessary
return false; return false;
} }
public void Merge(vlnParagraph otherParagraph) public void Merge(vlnParagraph otherParagraph)

View File

@ -499,6 +499,7 @@ namespace XYPlots
Buff = Buff.Substring(0, Buff.Length - 2) + " \r\n\0x00"; // needs to end with null Buff = Buff.Substring(0, Buff.Length - 2) + " \r\n\0x00"; // needs to end with null
else if (Buff.EndsWith(">")) // doesn't end with return chars... else if (Buff.EndsWith(">")) // doesn't end with return chars...
Buff = Buff.Substring(0, Buff.Length - 1) + " \r\n\0x00"; // needs to end with null Buff = Buff.Substring(0, Buff.Length - 1) + " \r\n\0x00"; // needs to end with null
Buff = Regex.Replace(Buff, @"([0-9])\r\n([0-9])", "$1 $2");
} }
private void CloseGraph() private void CloseGraph()
{ {