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,6 +448,7 @@ 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);
if(myPara != lastBreak)
return myPara; 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)

View File

@ -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)
@ -2960,6 +2961,7 @@ 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)
@ -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)

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()
{ {