B2017-109: Supplemental Information preferred page breaks causes incorrect pagination of following substeps
This commit is contained in:
@@ -99,7 +99,6 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
else if (MyItemInfo.MyDocStyle.SupplementalInformation && MyItemInfo.IsStep)
|
else if (MyItemInfo.MyDocStyle.SupplementalInformation && MyItemInfo.IsStep)
|
||||||
{
|
{
|
||||||
//if (MyItemInfo.IsHigh && MyItemInfo.MyPrevious == null) return 1; // appears we don't need this line any more Forced Pagination on OR substep Ginna SAG-8 Step 1 jsj/RHM 05-19-2017
|
|
||||||
StepConfig sci = MyItemInfo.MyConfig as StepConfig;
|
StepConfig sci = MyItemInfo.MyConfig as StepConfig;
|
||||||
if (sci.Step_PreferredPagebreak)
|
if (sci.Step_PreferredPagebreak)
|
||||||
{
|
{
|
||||||
@@ -765,6 +764,7 @@ namespace Volian.Print.Library
|
|||||||
ParagraphLocations myLocations = new ParagraphLocations();
|
ParagraphLocations myLocations = new ParagraphLocations();
|
||||||
BuildLocationList(YTopMost, myLocations);
|
BuildLocationList(YTopMost, myLocations);
|
||||||
StepLevelList myList = myLocations.BuildStepLevelList(KeepStepsOnPage);
|
StepLevelList myList = myLocations.BuildStepLevelList(KeepStepsOnPage);
|
||||||
|
SortedList<float, vlnParagraph> myPreferredBreaks = GetMyPreferredBreaks(myList);
|
||||||
// Find Break Locations in the list based upon StepLevel and yLocation
|
// Find Break Locations in the list based upon StepLevel and yLocation
|
||||||
float yTop = 0;
|
float yTop = 0;
|
||||||
float yLowerLimit = (yPageSize - 2 * SixLinesPerInch) / 2;
|
float yLowerLimit = (yPageSize - 2 * SixLinesPerInch) / 2;
|
||||||
@@ -871,9 +871,17 @@ namespace Volian.Print.Library
|
|||||||
if (PageBreakOnStepList.Count > 0 && (PageBreakOnStepList[0].YTop - (lastBreak == null ? 0 : lastBreak.YTop) <= ySpaceOnCurPage))
|
if (PageBreakOnStepList.Count > 0 && (PageBreakOnStepList[0].YTop - (lastBreak == null ? 0 : lastBreak.YTop) <= ySpaceOnCurPage))
|
||||||
paraBreak = PageBreakOnStepList[0];
|
paraBreak = PageBreakOnStepList[0];
|
||||||
else
|
else
|
||||||
|
{
|
||||||
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter - yAccountForBottomMsg, yLowerLimit,
|
paraBreak = FindPageBreak(yStart, ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter - yAccountForBottomMsg, yLowerLimit,
|
||||||
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
|
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
|
||||||
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
|
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
|
||||||
|
// 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]];
|
||||||
|
myPreferredBreaks.RemoveAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
yAccountForBottomMsg = 0;
|
yAccountForBottomMsg = 0;
|
||||||
// Do Not Remove: The following is used for debug - useful place to debug
|
// Do Not Remove: The following is used for debug - useful place to debug
|
||||||
//if (paraBreak.MyItemInfo.InList(207, 211, 214, 219, 221, 216, 197)) Console.WriteLine("BUILD2: Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
|
//if (paraBreak.MyItemInfo.InList(207, 211, 214, 219, 221, 216, 197)) Console.WriteLine("BUILD2: Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
|
||||||
@@ -1194,6 +1202,30 @@ namespace Volian.Print.Library
|
|||||||
ProfileTimer.Pop(profileDepth);
|
ProfileTimer.Pop(profileDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
private SortedList<float, vlnParagraph> GetMyPreferredBreaks(StepLevelList myList)
|
||||||
|
{
|
||||||
|
if (!MyItemInfo.MyDocStyle.SupplementalInformation) return null;
|
||||||
|
SortedList<float, vlnParagraph> sdpara = null;
|
||||||
|
foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest.
|
||||||
|
{
|
||||||
|
foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation
|
||||||
|
{
|
||||||
|
vlnParagraph myPara = myList[stepLevel][yLocation];
|
||||||
|
StepConfig sci = myPara.MyItemInfo.MyConfig as StepConfig;
|
||||||
|
if (sci != null && sci.Step_PreferredPagebreak)
|
||||||
|
{
|
||||||
|
if (sdpara == null) sdpara = new SortedList<float, vlnParagraph>();
|
||||||
|
sdpara.Add(-yLocation, myPara);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sdpara;
|
||||||
|
}
|
||||||
|
|
||||||
private float GetBottomContinueMessageSize(DocStyle docstyle)
|
private float GetBottomContinueMessageSize(DocStyle docstyle)
|
||||||
{
|
{
|
||||||
float myBottomMsgSpace = 0;
|
float myBottomMsgSpace = 0;
|
||||||
|
@@ -1552,7 +1552,6 @@ namespace Volian.Print.Library
|
|||||||
// if this has a caution/note with supinfo, that is id that needs to go in pagination list, unless it is in there.
|
// if this has a caution/note with supinfo, that is id that needs to go in pagination list, unless it is in there.
|
||||||
int aboveSupinfoId = ChildrenAboveHaveSupInfo();
|
int aboveSupinfoId = ChildrenAboveHaveSupInfo();
|
||||||
if (supInfoSect.StepSectPageBreaksForSupInfo.Contains(aboveSupinfoId)) aboveSupinfoId = -1;
|
if (supInfoSect.StepSectPageBreaksForSupInfo.Contains(aboveSupinfoId)) aboveSupinfoId = -1;
|
||||||
supInfoSect.StepSectPageBreaks.Add(aboveSupinfoId!=-1?ItemInfo.Get(aboveSupinfoId).MyParent.ItemID:MyItemInfo.ItemID);
|
|
||||||
supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId!=-1?aboveSupinfoId:MyItemInfo.SupInfos[0].ItemID);
|
supInfoSect.StepSectPageBreaksForSupInfo.Add(aboveSupinfoId!=-1?aboveSupinfoId:MyItemInfo.SupInfos[0].ItemID);
|
||||||
MyPromsPrinter.NeedSupInfoBreak = false;
|
MyPromsPrinter.NeedSupInfoBreak = false;
|
||||||
}
|
}
|
||||||
@@ -2185,35 +2184,66 @@ namespace Volian.Print.Library
|
|||||||
private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid)
|
private int GetIdThatHasSupInfoItems(ItemInfo ii, int startid)
|
||||||
{
|
{
|
||||||
if (ii == null) return -1;
|
if (ii == null) return -1;
|
||||||
|
// if this item has supinfo, return its id
|
||||||
if (ii.SupInfos != null && ii.SupInfos.Count > 0) return ii.SupInfos[0].ItemID;
|
if (ii.SupInfos != null && ii.SupInfos.Count > 0) return ii.SupInfos[0].ItemID;
|
||||||
|
|
||||||
|
// see if any substeps of this item have supinfo, and if so, return the substep's id
|
||||||
int id = GetSubThatHasSupInfoItems(ii, startid);
|
int id = GetSubThatHasSupInfoItems(ii, startid);
|
||||||
if (id != -1) return id;
|
if (id != -1) return id;
|
||||||
|
|
||||||
|
// Now go to the next item, check if it or any of its substeps have supinfo, and if so, return the id
|
||||||
ItemInfo sib = ii.NextItem;
|
ItemInfo sib = ii.NextItem;
|
||||||
while (sib != null)
|
id = GetIdThatHasSupInfoItemsSibNext(sib, startid);
|
||||||
|
if (id != -1) return id;
|
||||||
|
|
||||||
|
// Go to the parent, and find its next and check if it or any of its substeps or next steps or any of their substeps have supinfo,
|
||||||
|
// and if so, return the id.
|
||||||
|
ItemInfo par = ii.MyParent;
|
||||||
|
if (!par.IsSection && par.NextItems != null && par.NextItems.Count > 0)
|
||||||
|
{
|
||||||
|
par = par.NextItem;
|
||||||
|
while (par != null && !par.IsSection)
|
||||||
|
{
|
||||||
|
id = GetIdThatHasSupInfoItemsSibNext(par, startid);
|
||||||
|
if (id != -1) return id;
|
||||||
|
par = par.MyParent;
|
||||||
|
if (!par.IsSection && par.NextItems != null && par.NextItems.Count > 0) par = par.NextItem;
|
||||||
|
else return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GetIdThatHasSupInfoItemsSibNext(ItemInfo ii, int startid)
|
||||||
|
{
|
||||||
|
int id = -1;
|
||||||
|
while (ii != null)
|
||||||
{
|
{
|
||||||
SectionInfo supInfoSect = ii.MyActiveSection as SectionInfo;
|
SectionInfo supInfoSect = ii.MyActiveSection as SectionInfo;
|
||||||
if (supInfoSect.StepSectPageBreaks.Contains(sib.ItemID)) return -1;
|
// if there is a pagebreak on this step section step, quit looking for supinfos. The
|
||||||
if (sib.SupInfos != null && sib.SupInfos.Count > 0)
|
// break has to occur here.
|
||||||
|
if (supInfoSect.StepSectPageBreaks.Contains(ii.ItemID)) return -1;
|
||||||
|
if (ii.SupInfos != null && ii.SupInfos.Count > 0)
|
||||||
{
|
{
|
||||||
// check if this is in the list of page breaks for supinfos, if not it may have one of its cautions/notes rather than its id:
|
// check if this is in the list of page breaks for supinfos, if not it may have one of its cautions/notes rather than its id:
|
||||||
if (!supInfoSect.StepSectPageBreaksForSupInfo.Contains(sib.SupInfos[0].ItemID))
|
if (!supInfoSect.StepSectPageBreaksForSupInfo.Contains(ii.SupInfos[0].ItemID))
|
||||||
{
|
{
|
||||||
if (sib.Cautions != null)
|
if (ii.Cautions != null)
|
||||||
{
|
{
|
||||||
foreach (ItemInfo caution in sib.Cautions)
|
foreach (ItemInfo caution in ii.Cautions)
|
||||||
if (caution.SupInfos != null && caution.SupInfos.Count > 0 && supInfoSect.StepSectPageBreaksForSupInfo.Contains(caution.SupInfos[0].ItemID)) return caution.SupInfos[0].ItemID;
|
if (caution.SupInfos != null && caution.SupInfos.Count > 0 && supInfoSect.StepSectPageBreaksForSupInfo.Contains(caution.SupInfos[0].ItemID)) return caution.SupInfos[0].ItemID;
|
||||||
}
|
}
|
||||||
if (sib.Notes != null)
|
if (ii.Notes != null)
|
||||||
{
|
{
|
||||||
foreach (ItemInfo note in sib.Notes)
|
foreach (ItemInfo note in ii.Notes)
|
||||||
if (note.SupInfos != null && note.SupInfos.Count > 0 && supInfoSect.StepSectPageBreaksForSupInfo.Contains(note.SupInfos[0].ItemID)) return note.SupInfos[0].ItemID;
|
if (note.SupInfos != null && note.SupInfos.Count > 0 && supInfoSect.StepSectPageBreaksForSupInfo.Contains(note.SupInfos[0].ItemID)) return note.SupInfos[0].ItemID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sib.SupInfos[0].ItemID;
|
return ii.SupInfos[0].ItemID;
|
||||||
}
|
}
|
||||||
id = GetSubThatHasSupInfoItems(sib, startid);
|
id = GetSubThatHasSupInfoItems(ii, startid);
|
||||||
if (id != -1) return id;
|
if (id != -1) return id;
|
||||||
sib = sib.NextItem;
|
ii = ii.NextItem;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user