Merge pull request 'C2023-018 Upgrade: sub-step pagination' (#132) from GenWork into Development

code changes look good to proceed with testing.
This commit is contained in:
2023-10-10 08:22:32 -04:00
5 changed files with 76 additions and 70 deletions

View File

@@ -100,14 +100,16 @@ namespace Volian.Print.Library
return retval;
}
// C2023-015: Pagination on a sub-step added. Do the code if supplemental info or if format supports sub-step pagination
else if ((MyItemInfo.MyDocStyle.SupplementalInformation || MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) && MyItemInfo.IsStep)
// C2023-018: Pagination on sub-step (changed from C2023-015), do this code if on a step... will check for config flags in this code
else if (MyItemInfo.IsStep)
{
// C2023-018: only do the following if in supplemental info, doing checks on cautions/notes off substep
// 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)
if ((MyItemInfo.MyDocStyle.SupplementalInformation && (MyItemInfo.IsCaution || MyItemInfo.IsNote) && MyItemInfo.MyParent.IsSubStep))
{
StepConfig scs = MyItemInfo.MyParent.MyConfig as StepConfig;
// C2023-015: Pagination on a sub-step added on this check
if (MyItemInfo.MyPrevious == null && (scs.Step_PreferredPagebreak || scs.Step_SubStepPagebreak))
// C2023-015: Pagination on a sub-step added on this check, C2023-018: removed substep check since this cannot occur
if (MyItemInfo.MyPrevious == null && scs.Step_PreferredPagebreak)
{
// B2018-103: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
@@ -121,26 +123,35 @@ namespace Volian.Print.Library
}
}
// Now see if there is a preferred page break on this step.
// C2023-018: Added check for sub-step
StepConfig sci = MyItemInfo.MyConfig as StepConfig;
if (sci.Step_PreferredPagebreak || sci.Step_SubStepPagebreak)
{
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.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;
// B2017-228: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
string reason = "Unknown";
if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && this == MyPageHelper.ParaBreaks[0])
// C2023-018: if removing manual page breaks - add to list for permanent removal if selected and do not put a page break
// on the sub-step (do not execute the 'else' code)
if (sci.Step_SubStepPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null &&
!MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID))
MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID);
else
{
MyPageHelper.ParaBreaks.RemoveAt(0);
reason = AddReason("Partial Step - Case 1");
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
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.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;
// B2017-228: The following flags a break within the step. Before returning a '2' (flags break within step), clear it out of the
// ParaBreaks. Without the 'RemoveAt', a page break will occur after this step also.
string reason = "Unknown";
if (MyPageHelper.ParaBreaks != null && MyPageHelper.ParaBreaks.Count > 0 && this == MyPageHelper.ParaBreaks[0])
{
MyPageHelper.ParaBreaks.RemoveAt(0);
reason = AddReason("Partial Step - Case 1");
ShowPageBreak(1, reason, "Yes", YSize, yPageSize, yWithinMargins, ManualPageBreak);
}
return 2;
}
return 2;
}
}
// if the EndForSingle format flag is set to false, then we do not print an End message if the section
@@ -1475,7 +1486,8 @@ namespace Volian.Print.Library
private SortedList<float, vlnParagraph> GetMyPreferredBreaks(StepLevelList myList)
{
// C2023-015: Pagination on a sub-step added. Do the code if supplemental info or if format supports sub-step pagination
if (!MyItemInfo.MyDocStyle.SupplementalInformation && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) return null;
// C2023-018: Remove the supplemental info & alarm check, doing the possible page breaks on sub-steps
//if (!MyItemInfo.MyDocStyle.SupplementalInformation && !MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination) return null;
SortedList<float, vlnParagraph> sdpara = null;
foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest.
{
@@ -1485,9 +1497,17 @@ namespace Volian.Print.Library
StepConfig sci = myPara.MyItemInfo.MyConfig as StepConfig;
if (sci != null && sci.Step_PreferredPagebreak || sci.Step_SubStepPagebreak)
{
if (sdpara == null) sdpara = new SortedList<float, vlnParagraph>();
if (myPara.ChildrenAbove != null && myPara.ChildrenAbove.Count > 0) sdpara.Add(-yLocation, myPara.ChildrenAbove[0]);
else sdpara.Add(-yLocation, myPara);
// C2023-018: if removing manual page breaks - add to list for permanent removal if selected and do not add a possible page break
// on the sub-step (do not execute the 'else' code)
if (sci.Step_SubStepPagebreak && MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks != null &&
!MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Contains(MyItemInfo.ItemID))
MyPageHelper.MyPromsPrinter.RemoveManualPageBreaks.Add(MyItemInfo.ItemID);
else
{
if (sdpara == null) sdpara = new SortedList<float, vlnParagraph>();
if (myPara.ChildrenAbove != null && myPara.ChildrenAbove.Count > 0) sdpara.Add(-yLocation, myPara.ChildrenAbove[0]);
else sdpara.Add(-yLocation, myPara);
}
}
}
}

View File

@@ -2746,6 +2746,7 @@ namespace Volian.Print.Library
{
if (!HasManPagAnnot(ii, "Removed Manual Page Break")) VEPROMS.CSLA.Library.Annotation.MakeAnnotation(itm, AnnotationType.GetByNameOrCreate("Manual Pagination Issues"), null, "Removed Manual Page Break", null);
sc.Step_NewManualPagebreak = false; // reset the flag that was set in the config
if (sc.Step_SubStepPagebreak) sc.Step_SubStepPagebreak = false; // C2023-018: remove substep page break flags
itm.MyContent.Config = sc.ToString();
itm.MyContent.DTS = DateTime.Now;
itm.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;