B2017-122: Crash & pagination problems in GEN_SAMGS supplemental information facing page print

This commit is contained in:
Kathy Ruffing 2017-06-16 13:41:29 +00:00
parent 8ec9d416ff
commit f96f11aa34
2 changed files with 123 additions and 78 deletions

View File

@ -99,14 +99,23 @@ namespace Volian.Print.Library
} }
else if (MyItemInfo.MyDocStyle.SupplementalInformation && MyItemInfo.IsStep) 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; StepConfig sci = MyItemInfo.MyConfig as StepConfig;
if (sci.Step_PreferredPagebreak) if (sci.Step_PreferredPagebreak)
{ {
if (MyItemInfo.IsHigh) return 1; 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 // 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: // 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.MyParent.IsHigh && 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.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; 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. // 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) 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); 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 // 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 // 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 // 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) private SortedList<float, vlnParagraph> GetMyPreferredBreaks(StepLevelList myList)
{ {
if (!MyItemInfo.MyDocStyle.SupplementalInformation) return null; if (!MyItemInfo.MyDocStyle.SupplementalInformation) return null;
@ -1219,7 +1231,8 @@ namespace Volian.Print.Library
if (sci != null && sci.Step_PreferredPagebreak) if (sci != null && sci.Step_PreferredPagebreak)
{ {
if (sdpara == null) sdpara = new SortedList<float, vlnParagraph>(); 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);
} }
} }
} }

View File

@ -2058,6 +2058,15 @@ namespace Volian.Print.Library
if (MyItemInfo.IsHigh && MyPageHelper.NotesToFootNotesHLS.ContainsKey(MyItemInfo.ItemID)) AddFootNote(cb); if (MyItemInfo.IsHigh && MyPageHelper.NotesToFootNotesHLS.ContainsKey(MyItemInfo.ItemID)) AddFootNote(cb);
yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); yPageStart = ChildrenAbove.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
// B2017-122: if doing supinfo pagebreaks, if there should be a break on a step (not hls) that has a caution/note do it here:
if (!MyItemInfo.IsHigh && ChildrenAbove != null && ChildrenAbove.Count > 0 && MyPromsPrinter.SupInfoPrintType == E_SupInfoPrintType.DoPageBreaks && MyPromsPrinter.NeedSupInfoBreak && MyItemInfo.SupInfos != null && MyItemInfo.SupInfos.Count > 0)
{
// 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();
if (supInfoSect.StepSectPageBreaksForSupInfo.Contains(aboveSupinfoId)) aboveSupinfoId = -1;
supInfoSect.StepSectPageBreaksForSupInfo.Add(MyItemInfo.SupInfos[0].ItemID);
MyPromsPrinter.NeedSupInfoBreak = false;
}
yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin); yPageStart = ChildrenLeft.ToPdf(cb, yPageStart, ref yTopMargin, ref yBottomMargin);
// Handle the PageBreakOnStep flag for a HLS. This will put out the page break right before // Handle the PageBreakOnStep flag for a HLS. This will put out the page break right before
@ -2211,6 +2220,14 @@ namespace Volian.Print.Library
id = GetIdThatHasSupInfoItemsSibNext(sib, startid); id = GetIdThatHasSupInfoItemsSibNext(sib, startid);
if (id != -1) return id; if (id != -1) return id;
// B2017-122: if this is a note or caution off substep, check if substep has supinfo:
if ((ii.IsNote || ii.IsCaution) && !ii.MyParent.IsHigh)
{
if (ii.MyParent.SupInfos != null && ii.MyParent.SupInfos.Count > 0) return ii.MyParent.SupInfos[0].ItemID;
int sbfromNC = GetSubThatHasSupInfoItems(ii.MyParent, startid);
if (sbfromNC != -1) return sbfromNC;
}
// 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, // 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. // and if so, return the id.
ItemInfo par = ii.MyParent; ItemInfo par = ii.MyParent;
@ -2264,7 +2281,6 @@ namespace Volian.Print.Library
} }
private int GetSubThatHasSupInfoItems(ItemInfo ii, int startid) private int GetSubThatHasSupInfoItems(ItemInfo ii, int startid)
{ {
if (ii is StepInfo && ((ii as StepInfo).MyConfig as StepConfig).Step_PreferredPagebreak && ii.ItemID != startid) return -1;
if (ii.MyContent.ContentParts != null) if (ii.MyContent.ContentParts != null)
{ {
foreach (PartInfo pi in ii.MyContent.ContentParts) foreach (PartInfo pi in ii.MyContent.ContentParts)
@ -3655,6 +3671,8 @@ namespace Volian.Print.Library
int profileDepth2 = ProfileTimer.Push(">>>> Before vlnParagraph.Figure"); int profileDepth2 = ProfileTimer.Push(">>>> Before vlnParagraph.Figure");
string erMsg = null; string erMsg = null;
if (itemInfo.MyContent.Text != null) // ro image if (itemInfo.MyContent.Text != null) // ro image
{
if (itemInfo.MyContent.Text != "") // also check for text, there is an RO image then:
{ {
ProcedureInfo proc = itemInfo.MyProcedure; ProcedureInfo proc = itemInfo.MyProcedure;
DocVersionInfo dvi = proc.MyDocVersion; DocVersionInfo dvi = proc.MyDocVersion;
@ -3738,6 +3756,7 @@ namespace Volian.Print.Library
} }
} }
if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font); if (erMsg != null) Rtf = GetRtf(erMsg, itemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo); CalculateXOffsetGridOrFigure(itemInfo, maxRNO, formatInfo);
} }
else else
@ -5981,7 +6000,20 @@ namespace Volian.Print.Library
// so text doesn't print out of right border. // so text doesn't print out of right border.
// B2017-027: Added a check for column mode - we only want to do this if in single column mode // B2017-027: Added a check for column mode - we only want to do this if in single column mode
if (!MyItemInfo.MyParent.IsHigh && MyTab != null && MyTab.YOffset == YOffset && MyItemInfo.MyActiveSection.ColumnMode == 0) if (!MyItemInfo.MyParent.IsHigh && MyTab != null && MyTab.YOffset == YOffset && MyItemInfo.MyActiveSection.ColumnMode == 0)
{
// B2017-xxx if this is a caution/note off of a substep in the supinfo column, need to look up for its supinfo part, not
// its HLS.
if (MyItemInfo.IsInSupInfo)
{
vlnParagraph supinfopart = this;
while (supinfopart.MyParent != null && !supinfopart.MyItemInfo.IsSupInfoPart) supinfopart = supinfopart.MyParent;
XOffset = supinfopart.XOffset;
MyTab.XOffset = XOffset - MyTab.Width - 10;
Width = supinfopart.Width;
}
else
Width = MyHighLevelParagraph.Width - MyTab.Width - (MyTab.XOffset - MyHighLevelParagraph.XOffset) - 6; Width = MyHighLevelParagraph.Width - MyTab.Width - (MyTab.XOffset - MyHighLevelParagraph.XOffset) - 6;
}
else else
Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT; Width = (float)formatInfo.MyStepSectionLayoutData.WidT - 6 - mycolT;
} }