From 447c6ce343e4b75c67806d8e8055e66603b5dc59 Mon Sep 17 00:00:00 2001 From: Kathy Ruffing Date: Tue, 10 Oct 2023 07:05:12 -0400 Subject: [PATCH] C2023-018 Upgrade: sub-step pagination --- .../frmPDFStatusForm.cs | 6 +- .../DisplayTags.Designer.cs | 20 ------ PROMS/Volian.Controls.Library/DisplayTags.cs | 53 ++++++++------- PROMS/Volian.Print.Library/Pagination.cs | 66 ++++++++++++------- PROMS/Volian.Print.Library/PromsPrinter.cs | 1 + 5 files changed, 76 insertions(+), 70 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs index 565a9573..34513d86 100644 --- a/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs +++ b/PROMS/VEPROMS User Interface/frmPDFStatusForm.cs @@ -324,8 +324,10 @@ namespace VEPROMS { if (UserInfo.CanEdit(frmVEPROMS.SMyUserInfo, MyPromsPrinter.MyItem.MyDocVersion)) { - if (FlexibleMessageBox.Show(this, "The procedure PDF file was created by removing certain hard returns,\r\ntrailing spaces, and manual page breaks that could affect the\r\n"+ - "pagination of the procedure.\r\n\r\nAfter reviewing the PDF file, do you want to save the changes made?", + // C2023-018: Clarify message on temporary/permanent removal of returns/spaces & page breaks + if (FlexibleMessageBox.Show(this, "The procedure PDF file was created by temporarily removing certain hard returns,\r\ntrailing spaces, and/or manual page breaks that could affect the pagination\r\n"+ + "of the procedure.\r\n\r\nAfter reviewing the PDF file, do you want to permanently remove the deleted hard returns, \r\nspaces and/or manual page breaks?\r\n\r\n"+ + "An annotation will be added to every location where data has been deleted. The locations \r\ncan be found by performing a Global Search for the \"Manual Pagination Issues\" annotation type.", "Confirm Pagination Changes", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { MyPromsPrinter.SavePaginationFixes(); diff --git a/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs index 5ee57523..f666a8a6 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.Designer.cs @@ -30,7 +30,6 @@ namespace Volian.Controls.Library { this.groupPanelPaginate = new DevComponents.DotNetBar.Controls.GroupPanel(); this.cbPrefPageBreak = new DevComponents.DotNetBar.Controls.CheckBoxX(); - this.cbSubStepPageBreak = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.cbPageBreak = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.cbCAS = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.cmbCheckoff = new DevComponents.DotNetBar.Controls.ComboBoxEx(); @@ -75,7 +74,6 @@ namespace Volian.Controls.Library this.groupPanelPaginate.BackColor = System.Drawing.Color.Transparent; this.groupPanelPaginate.CanvasColor = System.Drawing.SystemColors.Control; this.groupPanelPaginate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelPaginate.Controls.Add(this.cbSubStepPageBreak); this.groupPanelPaginate.Controls.Add(this.cbPrefPageBreak); this.groupPanelPaginate.Controls.Add(this.cbPageBreak); this.groupPanelPaginate.DisabledBackColor = System.Drawing.Color.Empty; @@ -132,23 +130,6 @@ namespace Volian.Controls.Library this.cbPrefPageBreak.Text = "Preferred Page Break (for Sup Info)"; this.cbPrefPageBreak.CheckedChanged += new System.EventHandler(this.cbPrefPageBreak_CheckedChanged); // - // cbSubStepPageBreak - // - this.cbSubStepPageBreak.AutoSize = true; - // - // - // - this.cbSubStepPageBreak.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.cbSubStepPageBreak.Location = new System.Drawing.Point(3, 19); - this.cbSubStepPageBreak.Margin = new System.Windows.Forms.Padding(2); - this.cbSubStepPageBreak.Name = "cbSubStepPageBreak"; - this.cbSubStepPageBreak.Size = new System.Drawing.Size(195, 15); - this.superTooltipTags.SetSuperTooltip(this.cbSubStepPageBreak, new DevComponents.DotNetBar.SuperTooltipInfo("Page Break for Sub-Steps", "", "When set, starts this step at the top of a page.\r\n\r\nkeyboard command: ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); - this.cbSubStepPageBreak.TabIndex = 1; - this.cbSubStepPageBreak.Text = "Substep Page Break"; - this.cbSubStepPageBreak.CheckedChanged += new System.EventHandler(this.cbSubStepPageBreak_CheckedChanged); - // // cbPageBreak // this.cbPageBreak.AutoSize = true; @@ -789,7 +770,6 @@ namespace Volian.Controls.Library private System.Windows.Forms.TrackBar trBarFS; private System.Windows.Forms.Button btnFSrestore; private DevComponents.DotNetBar.Controls.CheckBoxX cbPrefPageBreak; - private DevComponents.DotNetBar.Controls.CheckBoxX cbSubStepPageBreak; private DevComponents.DotNetBar.Controls.CheckBoxX cbIncludeInTOC; private DevComponents.DotNetBar.Controls.CheckBoxX cbTCAS; } diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs index f635de88..fbfa10d2 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.cs @@ -110,7 +110,6 @@ namespace Volian.Controls.Library cmbCheckoff.Enabled = false; cbPageBreak.Enabled = false; cbPrefPageBreak.Enabled = false; - cbSubStepPageBreak.Enabled = false; cbPlaceKeeper.Enabled = false; cbPlaceKeeperCont.Enabled = false; cbIncludeInTOC.Enabled = false; @@ -179,11 +178,12 @@ namespace Volian.Controls.Library public void UpdatePageBreakCheckBox() // for use with shortcut keystroke { StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (CurItemInfo.IsHigh) cbPageBreak.Checked = false; // Page Break is set to false - if (sc != null && CurItemInfo.IsHigh) // otherwise, get data from config - cbPageBreak.Checked = sc.Step_NewManualPagebreak; // High Level Step has a manual page break - else - cbPageBreak.Checked = false; // Page Break is set to false + // C2023-018: if high, check oringinal flag, otherwise check sub-step flag for setting checkbox + cbPageBreak.Checked = false; // Page Break is set to false + if (sc != null && CurItemInfo.IsHigh) // otherwise, get data from config + cbPageBreak.Checked = sc.Step_NewManualPagebreak; // High Level Step has a manual page break + else if (sc != null && !CurItemInfo.IsCautionOrNotePart) + cbPageBreak.Checked = sc.Step_SubStepPagebreak; } public DocVersionInfo Mydvi = null; // this is initialized in vlnTreeComboSetsFillIn() @@ -245,13 +245,23 @@ namespace Volian.Controls.Library groupPanelFigSize.Style.BackColor = Color.Cornsilk; cbPageBreak.Checked = false; // will be set below if HLS & config has it on cbPrefPageBreak.Checked = false; - cbSubStepPageBreak.Checked = false; cbPlaceKeeper.Checked = false; // will be set below if HLS & config has this set cbPlaceKeeperCont.Checked = false; // will be set below if substep & config has this set - cbPageBreak.Enabled = CurItemInfo.IsHigh; + + // C2023-018: upgrade for 2023, allow page break setting on non-HLS under certain conditions as listed here: + // - HLS only (original) + // - Upgrade for sub-steps: Not in supplemental info (original) + // - Upgrade for sub-steps: Not in Enhanced document + // - Upgrade for sub-steps: Only for single column procedure + // - Upgrade for sub-steps: Sequential sub-steps only + // - Upgrade for sub-steps: First level sub-steps only (CurItemInfo.MyParent.IsHigh) + SectionConfig secConfig = (SectionConfig)CurItemInfo.ActiveSection.MyConfig; + bool isSingleColumn = secConfig != null && secConfig.Section_ColumnMode == SectionConfig.SectionColumnMode.One; + bool allowPageBreak = CurItemInfo.IsHigh || (!CurItemInfo.MyDocStyle.SupplementalInformation && !CurItemInfo.IsEnhancedStep + && isSingleColumn && CurItemInfo.IsSequential && CurItemInfo.MyParent.IsHigh); + cbPageBreak.Enabled = allowPageBreak; + cbPrefPageBreak.Visible = cbPrefPageBreak.Enabled = (!CurItemInfo.IsInSupInfo && CurItemInfo.MyDocStyle.SupplementalInformation); - // C2023-015: Pagination on a sub-step - cbSubStepPageBreak.Visible = cbSubStepPageBreak.Enabled = CurItemInfo.IsSubStep && CurItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.AlarmPagination; if (!CurItemInfo.IsFigure && !CurItemInfo.IsRtfRaw) { cbPlaceKeeper.Enabled = (((SectionConfig)CurItemInfo.ActiveSection.MyConfig).Section_Placekeeper == "Y"); @@ -297,7 +307,7 @@ namespace Volian.Controls.Library } else if (sc == null) // if there is no config data ... { - if (CurItemInfo.IsHigh)cbPageBreak.Checked = false; // Page Break is set to false + cbPageBreak.Checked = false; // Page Break is set to false cbCAS.Checked = CurItemInfo.IncludeOnContActSum; // set based on step type format flag cbTCAS.Checked = CurItemInfo.IncludeOnTimeCriticalActionSum; // set based on step type format flag cbPlaceKeeper.Checked = false; @@ -305,10 +315,12 @@ namespace Volian.Controls.Library } else // otherwise, get data from config { + // C2023-018: if high, use original config setting for page break, otherwise you sub-step setting if (CurItemInfo.IsHigh) cbPageBreak.Checked = sc.Step_NewManualPagebreak; // High Level Step has a manual page break + else + cbPageBreak.Checked = sc.Step_SubStepPagebreak; if (cbPrefPageBreak.Enabled) cbPrefPageBreak.Checked = sc.Step_PreferredPagebreak; - if (cbSubStepPageBreak.Enabled) cbSubStepPageBreak.Checked = sc.Step_SubStepPagebreak; cbPlaceKeeper.Checked = (sc.Step_Placekeeper == "Y"); // step text to be included on PlaceKeeper (Calvert Cliffs) cbPlaceKeeperCont.Checked = (sc.Step_Placekeeper == "C"); // step is included on Placekeeper and marked as continuous action (Calvert Cliffs) // set the Continuous Action Summary check box to the saved setting in the config or, if nothing in config, set to format flag setting @@ -547,7 +559,10 @@ namespace Volian.Controls.Library StepConfig sc = CurItemInfo.MyConfig as StepConfig; if (sc == null) return; MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_NewManualPagebreak = cbPageBreak.Checked; + if (CurItemInfo.IsHigh) + sc.Step_NewManualPagebreak = cbPageBreak.Checked; + else // C2023-018: allow for sub-step page breaks + sc.Step_SubStepPagebreak = cbPageBreak.Checked; MyEditItem.ChangeBarForConfigItemChange = true; } private void cbCAS_CheckedChanged(object sender, EventArgs e) @@ -896,18 +911,6 @@ namespace Volian.Controls.Library sc.Step_PreferredPagebreak = cbPrefPageBreak.Checked; MyEditItem.ChangeBarForConfigItemChange = true; } - // C2023-015: Pagination on a sub-step - private void cbSubStepPageBreak_CheckedChanged(object sender, EventArgs e) - { - if (_Initalizing) return; - MyEditItem.SaveContents(); - StepConfig sc = CurItemInfo.MyConfig as StepConfig; - if (sc == null) return; - MyEditItem.ChangeBarForConfigItemChange = false; - sc.Step_SubStepPagebreak = cbSubStepPageBreak.Checked; - MyEditItem.ChangeBarForConfigItemChange = true; - } - //private void txbxAltConActSumText_Leave(object sender, EventArgs e) //{ // // User left Atlernate Continuous Action Text field. If text changed, then prompt diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index e2724e31..db4e331f 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -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 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 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(); - 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(); + if (myPara.ChildrenAbove != null && myPara.ChildrenAbove.Count > 0) sdpara.Add(-yLocation, myPara.ChildrenAbove[0]); + else sdpara.Add(-yLocation, myPara); + } } } } diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 941347ee..321126aa 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -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;