B2017-122: Crash & pagination problems in GEN_SAMGS supplemental information facing page print
This commit is contained in:
@@ -99,14 +99,23 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else if (MyItemInfo.MyDocStyle.SupplementalInformation && MyItemInfo.IsStep)
|
||||
{
|
||||
// if this is the first caution or note from a substep, if the substep has preferred page break, break at the first caution or note:
|
||||
if ((MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyParent.IsSubStep)
|
||||
{
|
||||
StepConfig scs = MyItemInfo.MyParent.MyConfig as StepConfig;
|
||||
if (MyItemInfo.MyPrevious == null && scs.Step_PreferredPagebreak) return 2;
|
||||
}
|
||||
// Now see if there is a preferred page break on this step.
|
||||
StepConfig sci = MyItemInfo.MyConfig as StepConfig;
|
||||
if (sci.Step_PreferredPagebreak)
|
||||
{
|
||||
if (MyItemInfo.IsHigh) return 1;
|
||||
// if this is the top caution/note return 1 also. Cautions always are first, that is why the check does not need to know if on a
|
||||
// caution that there are notes, but check does need if on a note, are there cautions:
|
||||
if (MyItemInfo.IsCaution && MyItemInfo.MyPrevious == null) return 1;
|
||||
if (MyItemInfo.IsNote && (MyItemInfo.MyParent.Cautions == null || MyItemInfo.MyParent.Cautions.Count == 0) && MyItemInfo.MyPrevious == null) return 1;
|
||||
if (MyItemInfo.MyParent.IsHigh && MyItemInfo.IsCaution && MyItemInfo.MyPrevious == null) return 1;
|
||||
if (MyItemInfo.MyParent.IsHigh && MyItemInfo.IsNote && (MyItemInfo.MyParent.Cautions == null || MyItemInfo.MyParent.Cautions.Count == 0) && MyItemInfo.MyPrevious == null) return 1;
|
||||
// if this is a substep that has a preferredpage break, and it has caution/note that is where the page break had to go
|
||||
if (MyItemInfo.IsSubStep && ChildrenAbove != null && ChildrenAbove.Count > 0) return 0;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
@@ -878,7 +887,10 @@ namespace Volian.Print.Library
|
||||
// B2017-109: for supplemental information, if there is a preferred page break, account for it.
|
||||
if (myPreferredBreaks != null && myPreferredBreaks.Count > 0 && myPreferredBreaks.Keys[0] < paraBreak.YOffset)
|
||||
{
|
||||
paraBreak = myPreferredBreaks[myPreferredBreaks.Keys[0]];
|
||||
// B2017-122: don't use preferred break if the last break was before this break
|
||||
vlnParagraph prefBreak = myPreferredBreaks[myPreferredBreaks.Keys[0]];
|
||||
if (lastBreak == null || lastBreak.MyItemInfo.ShortPath.CompareTo(prefBreak.MyItemInfo.ShortPath) == -1)
|
||||
paraBreak = prefBreak;
|
||||
myPreferredBreaks.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
@@ -1205,7 +1217,7 @@ namespace Volian.Print.Library
|
||||
// The following finds all of the preferred page breaks for this step & if found adds them to a
|
||||
// list of the location & the paragraph it is on. This is used so that pagination calculations
|
||||
// occur for steps following the preferred page break rather than starting on the page after
|
||||
// substep with preferred page break (B207-109)
|
||||
// substep with preferred page break (B2017-109)
|
||||
private SortedList<float, vlnParagraph> GetMyPreferredBreaks(StepLevelList myList)
|
||||
{
|
||||
if (!MyItemInfo.MyDocStyle.SupplementalInformation) return null;
|
||||
@@ -1219,7 +1231,8 @@ namespace Volian.Print.Library
|
||||
if (sci != null && sci.Step_PreferredPagebreak)
|
||||
{
|
||||
if (sdpara == null) sdpara = new SortedList<float, vlnParagraph>();
|
||||
sdpara.Add(-yLocation, myPara);
|
||||
if (myPara.ChildrenAbove != null && myPara.ChildrenAbove.Count > 0) sdpara.Add(-yLocation, myPara.ChildrenAbove[0]);
|
||||
else sdpara.Add(-yLocation, myPara);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user