Keep headers with related text
Break a page if the item will not fit on the current page Created ToString method for vlnParagraph Created ToString method for ParagraphLocation Changed Between logic for overlap to exclude exact match
This commit is contained in:
parent
548ac7fea9
commit
17d0839e6c
@ -42,9 +42,11 @@ namespace Volian.Print.Library
|
|||||||
bool ManualPageBreak = false;
|
bool ManualPageBreak = false;
|
||||||
float yEndMsg = !MyItemInfo.IsSection && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
|
float yEndMsg = !MyItemInfo.IsSection && MyItemInfo.MyHLS.NextItem == null && (MyItemInfo.MyDocStyle.End.Message ?? "") != "" ? 2 * SixLinesPerInch : 0;
|
||||||
float yWithinMargins = CalculateYLocation(yLocation, yTopMargin) - yBottomMargin; // -SixLinesPerInch;
|
float yWithinMargins = CalculateYLocation(yLocation, yTopMargin) - yBottomMargin; // -SixLinesPerInch;
|
||||||
|
bool isFirstChild = MyItemInfo.MyPrevious == null;
|
||||||
|
bool nearTheTop = (yWithinMargins < yPageSize) && (yWithinMargins > (yPageSize - 5 * SixLinesPerInch));
|
||||||
// if step is breaking over a number of pages, determine if the current step is the
|
// if step is breaking over a number of pages, determine if the current step is the
|
||||||
// location of a pagebreak.
|
// location of a pagebreak.
|
||||||
if (MyItemInfo.ItemID == 54 || MyItemInfo.ItemID == 54) Console.WriteLine("here");
|
if (MyItemInfo.ItemID == 23383 || MyItemInfo.ItemID == 23384) Console.WriteLine("here");
|
||||||
if (MyPageHelper.ParaBreaks.Count > 0)
|
if (MyPageHelper.ParaBreaks.Count > 0)
|
||||||
{
|
{
|
||||||
if (this == MyPageHelper.ParaBreaks[0] || this.YTopMost > MyPageHelper.ParaBreaks[0].YTopMost)
|
if (this == MyPageHelper.ParaBreaks[0] || this.YTopMost > MyPageHelper.ParaBreaks[0].YTopMost)
|
||||||
@ -97,10 +99,8 @@ namespace Volian.Print.Library
|
|||||||
//while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0];
|
//while (firstStepChild.MyItemInfo.IsSection && firstStepChild.ChildrenBelow.Count > 0) firstStepChild = firstStepChild.ChildrenBelow[0];
|
||||||
while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh)) firstStepChild = firstStepChild.ChildrenBelow[0];
|
while (firstStepChild.ChildrenBelow.Count > 0 && (firstStepChild.MyItemInfo.IsSection || firstStepChild.MyItemInfo.IsHigh)) firstStepChild = firstStepChild.ChildrenBelow[0];
|
||||||
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
|
float ySizeIncludingFirstStep = firstStepChild.YSize + (firstStepChild.YTopMost - YTopMost);
|
||||||
bool isFirstSection = MyItemInfo.MyPrevious == null;
|
|
||||||
bool nearTheTop = yWithinMargins > (yPageSize - 5 * SixLinesPerInch);
|
|
||||||
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > yWithinMargins;
|
bool firstSubstepExceedsSpaceAvailable = ySizeIncludingFirstStep > yWithinMargins;
|
||||||
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstSection)
|
if (KeepStepsOnPage && firstSubstepExceedsSpaceAvailable && !isFirstChild)
|
||||||
KeepStepsOnPage = false;
|
KeepStepsOnPage = false;
|
||||||
if (!KeepStepsOnPage && ySizeIncludingFirst > (yLocation - yBottomMargin))
|
if (!KeepStepsOnPage && ySizeIncludingFirst > (yLocation - yBottomMargin))
|
||||||
{
|
{
|
||||||
@ -136,6 +136,7 @@ namespace Volian.Print.Library
|
|||||||
float yExtra2 = (SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0;
|
float yExtra2 = (SixLinesPerInch - MyItemInfo.MyDocStyle.Layout.FooterLength) ?? 0;
|
||||||
if (KeepStepsOnPage && ySizeIncludingFirst > yWithinMargins)
|
if (KeepStepsOnPage && ySizeIncludingFirst > yWithinMargins)
|
||||||
KeepStepsOnPage = false;
|
KeepStepsOnPage = false;
|
||||||
|
bool KeepWithHeader = isFirstChild && nearTheTop;
|
||||||
if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + yExtra) // Don't Paginate if there is enough room, will fit on page
|
if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + yExtra) // Don't Paginate if there is enough room, will fit on page
|
||||||
//if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page
|
//if (!ManualPageBreak && mySize + yEndMsg <= yWithinMargins + SixLinesPerInch) // Don't Paginate if there is enough room, will fit on page
|
||||||
{
|
{
|
||||||
@ -147,7 +148,7 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
// YSize includes a blank line after the step which we don't want to include in the page break test, thus the
|
// YSize includes a blank line after the step which we don't want to include in the page break test, thus the
|
||||||
// YSize - SixLinesPerInch:
|
// YSize - SixLinesPerInch:
|
||||||
if (!KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSize) // if the entire step can fit on one page, do a page break
|
if (!KeepWithHeader && !KeepStepsOnPage && YSize - SixLinesPerInch + yEndMsg <= yPageSize) // if the entire step can fit on one page, do a page break
|
||||||
{
|
{
|
||||||
// Don't want extra line before step
|
// Don't want extra line before step
|
||||||
//Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
//Console.WriteLine("'PageBreak',2,'Yes','HLS will fit on 1 Page',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||||
@ -171,8 +172,8 @@ namespace Volian.Print.Library
|
|||||||
if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch;
|
if (_Match16BitPagination) myFirstPieceSize += 2 * SixLinesPerInch;
|
||||||
// TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20.
|
// TODO: Put this line back to case 0, i.e. previous line. This fixes a 16-bit vs 32-bit pagination diff in EO30 Step 20.
|
||||||
//float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit
|
//float myFirstPieceSize = GetFirstPieceSize() + 2 * SixLinesPerInch; //Case 10 - this is to match 16bit
|
||||||
if (!ManualPageBreak && ((MyItemInfo.ActiveFormat.MyStepSectionLayoutData.SpecialPageBreakFlag && yWithinMargins > yPageSize / 2 &&
|
if (KeepWithHeader ||( !ManualPageBreak && ((MyItemInfo.ActiveFormat.MyStepSectionLayoutData.SpecialPageBreakFlag && yWithinMargins > yPageSize / 2 &&
|
||||||
myFirstPieceSize < yWithinMargins) || KeepStepsOnPage))
|
myFirstPieceSize < yWithinMargins) || KeepStepsOnPage)))
|
||||||
{
|
{
|
||||||
//Console.WriteLine("'PageBreak',4,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
//Console.WriteLine("'PageBreak',4,'No','HLS will have to split anyway',{0},{1},{2}, {3}, {4},'{5}'", MyItemInfo.ItemID, YSize, yPageSize, yWithinMargins, (int)(100 * yWithinMargins / yPageSize), MyItemInfo.ShortPath);
|
||||||
if(firstStep == "Yes")
|
if(firstStep == "Yes")
|
||||||
@ -291,6 +292,7 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation
|
foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation
|
||||||
{
|
{
|
||||||
|
vlnParagraph myPara = myList[stepLevel][yLocation];
|
||||||
// The top of this step will fit onto page (-yLocation < yWithinMargins)
|
// The top of this step will fit onto page (-yLocation < yWithinMargins)
|
||||||
if (-yLocation <= yUpperLimit) // Fix for OFN-RJ-23
|
if (-yLocation <= yUpperLimit) // Fix for OFN-RJ-23
|
||||||
//if (-yLocation < yUpperLimit) // Before
|
//if (-yLocation < yUpperLimit) // Before
|
||||||
@ -301,13 +303,14 @@ namespace Volian.Print.Library
|
|||||||
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
|
//if (myList[stepLevel][yLocation].MyItemInfo.ItemID == 4312) Console.WriteLine("rno");
|
||||||
// The top of this step is more than 1/2 way down the page
|
// The top of this step is more than 1/2 way down the page
|
||||||
if ((-yLocation + yStart) >= yLowerLimit)
|
if ((-yLocation + yStart) >= yLowerLimit)
|
||||||
{
|
return myPara;
|
||||||
return myList[stepLevel][yLocation];
|
// If this item will not fit on the current page, put a page break
|
||||||
}
|
if (myPara.YBottom - myPara.YTop > (yUpperLimit - (-yLocation + yStart)))
|
||||||
|
return myPara;
|
||||||
// if is a caution or note & parent is a substep and entire substep doesn't fit, break.
|
// if is a caution or note & parent is a substep and entire substep doesn't fit, break.
|
||||||
if ((myList[stepLevel][yLocation].MyItemInfo.IsNote || myList[stepLevel][yLocation].MyItemInfo.IsCaution) &&
|
if ((myPara.MyItemInfo.IsNote || myPara.MyItemInfo.IsCaution) &&
|
||||||
!myList[stepLevel][yLocation].MyParent.MyItemInfo.IsHigh &&
|
!myPara.MyParent.MyItemInfo.IsHigh &&
|
||||||
myList[stepLevel][yLocation].MyParent.YSize > (yUpperLimit + yLocation))
|
myPara.MyParent.YSize > (yUpperLimit + yLocation))
|
||||||
{
|
{
|
||||||
return myList[stepLevel][yLocation];
|
return myList[stepLevel][yLocation];
|
||||||
}
|
}
|
||||||
|
@ -119,6 +119,10 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
public partial class vlnParagraph : vlnPrintObject
|
public partial class vlnParagraph : vlnPrintObject
|
||||||
{
|
{
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("{0} - {1} - '{2}'", this.YTop, this.YSize, this.MyItemInfo.ShortPath);
|
||||||
|
}
|
||||||
private vlnTable _MyGrid;
|
private vlnTable _MyGrid;
|
||||||
public vlnTable MyGrid
|
public vlnTable MyGrid
|
||||||
{
|
{
|
||||||
@ -2144,6 +2148,10 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
public class ParagraphLocation
|
public class ParagraphLocation
|
||||||
{
|
{
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("{0} - {1} - '{2}'", this.StepLevel, this.YTop, this.MyParagraph.MyItemInfo.ShortPath);
|
||||||
|
}
|
||||||
private float _YTop;
|
private float _YTop;
|
||||||
public float YTop
|
public float YTop
|
||||||
{
|
{
|
||||||
@ -2184,7 +2192,7 @@ namespace Volian.Print.Library
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public static bool Between(float x, float lower, float higher)
|
public static bool Between(float x, float lower, float higher)
|
||||||
{ return x >= lower && x <= higher; }
|
{ return x > lower && x < higher; }
|
||||||
public bool Overlap(ParagraphLocation otherParagraphLocation)
|
public bool Overlap(ParagraphLocation otherParagraphLocation)
|
||||||
{
|
{
|
||||||
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user