C2024-003-Print-Sub-Section

This commit is contained in:
2024-02-22 16:54:56 -05:00
parent 77d31a4a99
commit dcfdf5f852
7 changed files with 978 additions and 879 deletions

View File

@@ -18,14 +18,14 @@ namespace VEPROMS
{
public bool SaveLinks
{
get
{
get
{
return swtbtnPDFLinks.Value;
}
}
public int RemoveTrailingHardReturnsAndManualPageBreaks
{
get
get
{
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save.
// return values: 0=None; 1=Trailing; 2=ManualPgBrk; 3=Both.
@@ -33,7 +33,7 @@ namespace VEPROMS
if (!cbxRemoveManualPgBrk.Checked && !cbxRemoveTrailing.Checked) return 0;
if (!cbxRemoveManualPgBrk.Checked && cbxRemoveTrailing.Checked) return 1;
if (cbxRemoveManualPgBrk.Checked && !cbxRemoveTrailing.Checked) return 2;
return 3;
return 3;
}
}
private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
@@ -59,8 +59,8 @@ namespace VEPROMS
get { return _Automatic; }
set { _Automatic = value; }
}
private int _prtSectID = -1;
public int PrtSectID
private int[] _prtSectID = new int[] { -1, -1, 0 };
public int[] PrtSectID
{
get { return _prtSectID; }
set { _prtSectID = value; }
@@ -73,8 +73,8 @@ namespace VEPROMS
public bool AllowDateTimePrefixSuffix
{
get { return _AllowDateTimePrefixSuffix; }
set
{
set
{
_AllowDateTimePrefixSuffix = value;
swtbtnPDFdtPrefixSuffix.Value = swtbtnPDFdtPrefixSuffix.Enabled = _AllowDateTimePrefixSuffix;
}
@@ -86,7 +86,7 @@ namespace VEPROMS
{
cbxDebugPagination.Checked = true;
cbxDebugText.Checked = true;
cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares
cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares
_IncludeWordSecTextInMetafile = true;
Application.DoEvents();
string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
@@ -101,7 +101,7 @@ namespace VEPROMS
cbxDebug.Checked = false;
else if (parameter.ToUpper() == "/NM")
cbxMetaFile.Checked = false; // C2018-004 turn off create meta file for baseline compares
else if (parameter.ToUpper() == "/NW")
else if (parameter.ToUpper() == "/NW")
_IncludeWordSecTextInMetafile = false; // C2018-023 turn off putting Word attachment text in the meta file for baseline compares
}
CreatePDFs();
@@ -143,10 +143,11 @@ namespace VEPROMS
}
public string PDFPath
{
get {// B2018-069 Revert to Temporary for Baseline testing
get
{// B2018-069 Revert to Temporary for Baseline testing
if (PromsPrinter.BaselineTesting)
return VlnSettings.TemporaryFolder;
return txbPDFLocation.Text;
return txbPDFLocation.Text;
}
set { txbPDFLocation.Text = value; }
}
@@ -190,7 +191,7 @@ namespace VEPROMS
if (_MyProcedure != null && _MyProcedure.ProcHasSupInfoData)
{
swtbtnBlankPgsForDuplex.Enabled = false;
tbBlankPage.Enabled = true; // C2019-004: Allow user to define duplex blank page text (similar changes throughout file are not commented)
tbBlankPage.Enabled = true; // C2019-004: Allow user to define duplex blank page text (similar changes throughout file are not commented)
}
btnCreatePDF.Text = "Create PDFs";
HandleDocVersionSettings();
@@ -235,7 +236,7 @@ namespace VEPROMS
gpnlDebug.Visible = Volian.Base.Library.VlnSettings.DebugMode;
swtbtnGeneratePlacekeeper.Value = false;
cbxGenerateConActSum.Checked = false;
swtbtnGeneratePlacekeeper.Visible = lblGeneratePlacekeeper.Visible = oneProcedure &&
swtbtnGeneratePlacekeeper.Visible = lblGeneratePlacekeeper.Visible = oneProcedure &&
((MyProcedure.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoPlacekeeper) == E_PurchaseOptions.AutoPlacekeeper);
// C2021-062 make visable the check box to assign rev number for all procedures being printed
// also make visable the Rev Num entry field.
@@ -280,7 +281,7 @@ namespace VEPROMS
expPrnSetting.Expanded = swtbtnBlankPgsForDuplex.Value || swtbtnChgBar.Value || swtbtnGeneratePlacekeeper.Value || swtbtnPDFLinks.Value || swtbtnPROMSVersion.Value || swtbtnWaterMark.Value || swtbtnPDFdtPrefixSuffix.Value;
}
public DlgPrintProcedure(ProcedureInfo pi, bool automatic) // RHM20150506 Multiline ItemID TextBox
{
{
InitializeComponent();
Automatic = automatic;
_AllProcedures = false;
@@ -309,7 +310,7 @@ namespace VEPROMS
{
base.OnActivated(e);
if (Owner != null)
Location = new Point(Owner.Left + Owner.Width / 2 - Width / 2, Owner.Top + Owner.Height/2 - Height/2);
Location = new Point(Owner.Left + Owner.Width / 2 - Width / 2, Owner.Top + Owner.Height / 2 - Height / 2);
}
private void HandleDocVersionSettings()
{
@@ -323,10 +324,10 @@ namespace VEPROMS
// if the default setting is 'SelectBeforePrinting', expand the Additional Print Settings panel
if (_DocVersionConfig.Print_ChangeBar == PrintChangeBar.SelectBeforePrinting)
{
swtbtnChgBar.Value = false;
cbxOvrrideDefChgBars.Checked = false;
expPrnSetting.Expanded = true;
}
swtbtnChgBar.Value = false;
cbxOvrrideDefChgBars.Checked = false;
expPrnSetting.Expanded = true;
}
}
private void GetDocVersionSettings()
@@ -341,14 +342,14 @@ namespace VEPROMS
cbxOpenAfterCreate2.Checked = _DocVersionConfig.Print_AlwaysViewPDFAfterCreate;
// Changebars on/off
if (_DocVersionConfig.Print_ChangeBar == PrintChangeBar.Without)
swtbtnChgBar.Value = false;
swtbtnChgBar.Value = false;
else
swtbtnChgBar.Value = true;
swtbtnChgBar.Value = true;
// Watermark on/off
if (_DocVersionConfig.Print_Watermark == PrintWatermark.None)
swtbtnWaterMark.Value = false;
swtbtnWaterMark.Value = false;
else
swtbtnWaterMark.Value = true;
swtbtnWaterMark.Value = true;
// Auto Duplexing on/off - Auto duplex was used only by Point Beach formats These buttons were removed from the dialog
// There was not print coding to support this format flag
@@ -373,7 +374,7 @@ namespace VEPROMS
// default to using OriginalPageBreaks (16bit page breaks) if App.config is set
// to true:
//cbxOrPgBrk.Visible = VlnSettings.OriginalPageBreak && VlnSettings.DebugMode;
cbxOrPgBrk.Visible = false; //per Harry
cbxOrPgBrk.Visible = false; //per Harry
cbxOrPgBrk.Checked = false;
}
@@ -410,7 +411,7 @@ namespace VEPROMS
private Timer _MyTimer;
public void SetupForProcedure() // RHM20150506 Multiline ItemID TextBox
{
if(_DocVersionInfo == null)this.Text = "Create PDF for " + ProcNum;
if (_DocVersionInfo == null) this.Text = "Create PDF for " + ProcNum;
// get list of previous pdf files
// if no previous pdf file, then get path from frmVersionProperties
// dlgSelectFile.InitialDirectory = pdf path from frmVersionProperties
@@ -419,20 +420,20 @@ namespace VEPROMS
//txbPDFLocation.Text = _PDFPath;
BuildPDFFileName();
ProcedureConfig pc = _MyProcedure.MyConfig as ProcedureConfig;
if(SelectedSlave > 0) pc.SelectedSlave = SelectedSlave;
if (SelectedSlave > 0) pc.SelectedSlave = SelectedSlave;
if (pc != null)
{
//C2021-062 use the save rev number for all procedures if set, or just use the rev number in the current procedure config
RevNum = (_NewRevForAllProcs == null) ? pc.Print_Rev : _NewRevForAllProcs;
RevDate = pc.Print_RevDate; //== null || pc.Print_RevDate=="" ? DateTime.Today : Convert.ToDateTime(pc.Print_RevDate);
ReviewDate = pc.Print_ReviewDate; // == null ? DateTime.Today : Convert.ToDateTime(pc.Print_ReviewDate);
//Now check the format flags to determine if/how the Rev string should be parsed.
// This will covert the old way (16-bit) of setting a RevDate (appending it to the RevNumber)
// to the new way saving the RevNumber and RevDate in there own config fields
//Now check the format flags to determine if/how the Rev string should be parsed.
// This will covert the old way (16-bit) of setting a RevDate (appending it to the RevNumber)
// to the new way saving the RevNumber and RevDate in there own config fields
if ((_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.DoRevDate && RevNum.Contains("/"))
|| (_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && RevNum.Contains("\\")))
|| (_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash && RevNum.Contains("\\")))
{
int indx = RevNum.IndexOf(_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/');
int indx = RevNum.IndexOf(_MyProcedure.ActiveFormat.PlantFormat.FormatData.PrintData.RevDateWithForwardSlash ? '\\' : '/');
pc.Print_RevDate = RevDate = RevNum.Substring(indx + 1);
pc.Print_Rev = RevNum = RevNum.Substring(0, indx);
// save the RevNumber and RevDate to the procedure's config.
@@ -529,9 +530,9 @@ namespace VEPROMS
PDFDTSuffix dtSuf = _DocVersionConfig.Print_PDFdtFileSuffix;
if (dtPre != PDFDTPrefix.None) PDFFilePrefix = ""; // incase user entered prefix text but then selected a date/time (in working draft properties)
if (dtSuf != PDFDTSuffix.None) PDFFileSuffix = ""; // incase user entered suffix text but then selected a date/time (in working draft properties)
// B2020-062 control the toggle of date/time prefix/suffix on pdf file name
// disable the date/time Prefix/Suffix switch if no date/time was selected
// This switch is does not affect the use of it if the user typed in text for prefix/suffix
// B2020-062 control the toggle of date/time prefix/suffix on pdf file name
// disable the date/time Prefix/Suffix switch if no date/time was selected
// This switch is does not affect the use of it if the user typed in text for prefix/suffix
if (!AllowDateTimePrefixSuffix || (dtPre == PDFDTPrefix.None && dtSuf == PDFDTSuffix.None))
{
swtbtnPDFdtPrefixSuffix.Value = false;
@@ -564,7 +565,7 @@ namespace VEPROMS
private void SetupPrefixSuffixSwitch()
{
if (_CreateButtonClicked) return; // B2020-062 control the toggle of date/time prefix/suffix on pdf file name
// note that MyProcedure must be set before calling this because BuildPDFFileName() will be called when the swbtnPDFPrefixSuffix is set
// note that MyProcedure must be set before calling this because BuildPDFFileName() will be called when the swbtnPDFPrefixSuffix is set
string PDFFilePrefix = _DocVersionConfig.Print_PDFFilePrefix;
string PDFFileSuffix = _DocVersionConfig.Print_PDFFileSuffix;
PDFDTPrefix dtPre = _DocVersionConfig.Print_PDFdtFilePrefix;
@@ -607,7 +608,7 @@ namespace VEPROMS
private void swtbtnWaterMark_ValueChanged(object sender, EventArgs e)
{
if (!swtbtnWaterMark.Value) // C2021-019: make both invisible
if (!swtbtnWaterMark.Value) // C2021-019: make both invisible
{
cbxWaterMark.Visible = swtbtnWaterMark.Value;
lblWaterMarkOvrd.Visible = swtbtnWaterMark.Value;
@@ -634,7 +635,7 @@ namespace VEPROMS
if (!Directory.Exists(PDFPath))
{
string msg = string.Format("'{0}' does not exist. \n\nCreate it?", PDFPath);
DialogResult dr= MessageBox.Show(msg, "Folder Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
DialogResult dr = MessageBox.Show(msg, "Folder Not Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
try
@@ -668,7 +669,7 @@ namespace VEPROMS
public ProcedureInfo MyProcedure
{
get { return _MyProcedure; }
set
set
{
_MyProcedure = value;
// if procedure has supplemental information, the automatially check the add blank pages for duplex printing
@@ -723,18 +724,18 @@ namespace VEPROMS
// B2019-128: The combo box list did not include the 'None' option so the selected value was not the correct watermark (had to add 1 to the selected index)
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None"; // C2021-019
string watermarkColor = "Blue"; // this is the default watermark color
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
ChangeBarDefinition cbd = DetermineChangeBarSettings();
int n = _DocVersionInfo.Procedures.Count;
int i = 0;
pbPDFsStatus.Maximum = n;
pbPDFsStatus.Visible = true;
VlnSvgPageHelper.CountInApplProcs = 1; // B2021-127: BNPPalr - Auto set of serial #, skip Front Matter as per PAL 11/1/21 (set to 1 not 0)
VlnSvgPageHelper.CountInApplProcs = 1; // B2021-127: BNPPalr - Auto set of serial #, skip Front Matter as per PAL 11/1/21 (set to 1 not 0)
this.Text = string.Format("Processing {0}", _DocVersionInfo.MyFolder.Name);
foreach (ProcedureInfo myProc in _DocVersionInfo.Procedures)
{
string locpdfname = null; // get pdf file name for later merge code
string locpdfname = null; // get pdf file name for later merge code
MyProcedure = myProc;
// C2021-019: Override Watermark Text, 'waterMarkText' will have whatever watermark text should be printed
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
@@ -772,7 +773,7 @@ namespace VEPROMS
string myPDFPath = GetMultiunitPDFPath();
_MergedPdfPath = myPDFPath; // If Slave, need its subdirectory/unit path for merging
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
// B2021-102 put in the using for better memory management
// B2021-102 put in the using for better memory management
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, myPDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor, PrtSectID))//;//C2018-009 print PROMS version
@@ -871,7 +872,7 @@ namespace VEPROMS
}
}
pbPDFsStatus.Visible = false;
if(!Automatic)
if (!Automatic)
ShowDebugFiles();
ProfileTimer.Pop(profileDepth);
ProfileTimer.ShowTimerTable();
@@ -943,7 +944,7 @@ namespace VEPROMS
if (cbxDebugText.Checked)
Volian.Base.Library.DebugText.Show();
if (cbxMetaFile.Checked)// C2018-004 create meta file for baseline compares
Volian.Base.Library.BaselineMetaFile.Show(); // baseline
Volian.Base.Library.BaselineMetaFile.Show(); // baseline
}
public void CreatePDF() // RHM20150506 Multiline ItemID TextBox
{
@@ -958,9 +959,9 @@ namespace VEPROMS
return;
}
MyProcedure.SelectedChildToPrint = SelectedSlave; // B2023-035 for BNPP Alarms save the number of the child selected to print
// B2021-127: BNPPalr - Auto set of serial #, skip Front Matter as per PAL 11/1/21 (set to 1 not 0)
// Only do if set has applicability, printing an individual procedure, need to determine
// applicability count.
// B2021-127: BNPPalr - Auto set of serial #, skip Front Matter as per PAL 11/1/21 (set to 1 not 0)
// Only do if set has applicability, printing an individual procedure, need to determine
// applicability count.
if (MyProcedure.MyDocVersion.MultiUnitCount > 1)
{
VlnSvgPageHelper.CountInApplProcs = 1;
@@ -977,12 +978,12 @@ namespace VEPROMS
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
// B2019-044 don't print the watermark if the watermark switch on the print dialog is turned off
cbxWaterMark.Visible = true;
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None" ; // B2018-124 use text of watermark form drop down list instead of enum value
string waterMarkText = (swtbtnWaterMark.Value) ? cbxWaterMark.Text : "None"; // B2018-124 use text of watermark form drop down list instead of enum value
string watermarkColor = "Blue"; // this is the default watermark color
frmPDFStatusForm.SetUnitWatermark(MyProcedure, ref waterMarkText, ref watermarkColor); //C2022-004 Unit Designator Watermark
ProcedureConfig procConfig = MyProcedure.MyConfig as ProcedureConfig;
string waterMarkTextOverride = "";
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
if (procConfig != null) waterMarkTextOverride = procConfig.GetValue("PSI", "WATERMARKOVERRIDE"); // C2021-019: override watermark text
if (swtbtnWaterMark.Value && waterMarkTextOverride != null && waterMarkTextOverride != "") waterMarkText = waterMarkTextOverride;
// Determine change bar settings. First get from config & then see if override from dialog.
// Also check that format allows override.
@@ -1199,7 +1200,7 @@ namespace VEPROMS
grpDateSelector.Text = "Select Revision Date";
grpDateSelector.Visible = calDateSelector.Visible = true;
//C2021-007 position the calendar to the current RevDate or if no RevDate, position to today's date
DateTime initSelDate =(txbDate.Text != null && txbDate.Text.Length != 0)? Convert.ToDateTime(txbDate.Text) : DateTime.Today;
DateTime initSelDate = (txbDate.Text != null && txbDate.Text.Length != 0) ? Convert.ToDateTime(txbDate.Text) : DateTime.Today;
calDateSelector.DisplayMonth = calDateSelector.SelectedDate = initSelDate;
}
@@ -1298,11 +1299,11 @@ namespace VEPROMS
}
private void expPrnSetting_ExpandedChanging(object sender, DevComponents.DotNetBar.ExpandedChangeEventArgs e)
{
if (expPrnSetting.Expanded)
{
if (expPrnSetting.Expanded)
//this.Size = new Size(this.Size.Width+(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
//else
this.Size = new Size(this.Size.Width-(expPrnSetting.Size.Width-expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
//else
this.Size = new Size(this.Size.Width - (expPrnSetting.Size.Width - expPrnSetting.TitlePanel.Size.Height), this.Size.Height);
//Refresh();
}
@@ -1334,12 +1335,12 @@ namespace VEPROMS
{
DateTime dtStart = DateTime.Now;
_MergedPfd = new MergedPdf(PDFPath, _DocVersionInfo);
PromsPrinter.MergedLandscapePages = null; // B2019-152: MergedLandscapePages has data set when creating separate pdfs (DoCreatePDF)
DoCreatePDF(); // create indivitual pdfs
PromsPrinter.MergedLandscapePages = null; // B2019-152: MergedLandscapePages has data set when creating separate pdfs (DoCreatePDF)
DoCreatePDF(); // create indivitual pdfs
if (_MergedPdfPath != null && _MergedPdfPath != PDFPath) PDFPath = _MergedPfd.Folder = _MergedPdfPath;
// C2021-063 pass in whether to generate Alarm Point List text when a merge is done
if (!_MergedPfd.DoTheMerge(PromsPrinter.MergedLandscapePages,cbxAlmPtTxt.Checked)) return; // merge them together.
// if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done
if (!_MergedPfd.DoTheMerge(PromsPrinter.MergedLandscapePages, cbxAlmPtTxt.Checked)) return; // merge them together.
// if the property to show the file after printing is set (on the version dialog), display it. Otherwise do a dialog to let user know it's done
if (_DocVersionConfig.Print_MergedPdfsViewAfter)
{
if (_MergedPfd.MergedPdfs != null && _MergedPfd.MergedPdfs.Count > 0)