C2024-002-Print-Sections

This commit is contained in:
Paul Larsen 2024-02-02 16:02:38 -05:00
parent 293224275d
commit 54441eee06
6 changed files with 51 additions and 40 deletions

View File

@ -59,11 +59,11 @@ namespace VEPROMS
get { return _Automatic; }
set { _Automatic = value; }
}
private int _pntSectID = -1;
public int PntSectID
private int _prtSectID = -1;
public int PrtSectID
{
get { return _pntSectID; }
set { _pntSectID = value; }
get { return _prtSectID; }
set { _prtSectID = value; }
}
@ -775,7 +775,7 @@ namespace VEPROMS
// 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, PntSectID))//;//C2018-009 print PROMS version
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor, PrtSectID))//;//C2018-009 print PROMS version
{
frmStatus.CloseWhenDone = true;
Application.DoEvents();
@ -856,9 +856,9 @@ namespace VEPROMS
// B2016-249 Output Procedure to folder associated with Parent Child
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked,
cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text,
new Point(Left, Bottom - 50), swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, true, tbBlankPage.Text, _MergedPfd, watermarkColor, PntSectID)) // ;//C2018-009 print PROMS version
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
{
frmStatus.PntSectID = PntSectID;
frmStatus.PrtSectID = PrtSectID;
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;
@ -1009,7 +1009,7 @@ namespace VEPROMS
// B2018-124 use text of watermark form drop down list instead of enum value
using (frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, waterMarkText, cbxDebug.Checked, cbxOrPgBrk.Checked,
cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, GetMultiunitPDFPath(), cbd, txbPDFName.Text, new Point(Left, Bottom - 50),
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd, watermarkColor, PntSectID))//; //C2018-009 print PROMS version
swtbtnBlankPgsForDuplex.Value, _AllProcedures || Automatic, Prefix, SaveLinks, RemoveTrailingHardReturnsAndManualPageBreaks, swtbtnPROMSVersion.Value, false, tbBlankPage.Text, _MergedPfd, watermarkColor, PrtSectID))//; //C2018-009 print PROMS version
{
frmStatus.MakePlaceKeeper = swtbtnGeneratePlacekeeper.Value;
frmStatus.MakeContinuousActionSummary = cbxGenerateConActSum.Checked;

View File

@ -91,13 +91,13 @@ namespace VEPROMS
get { return _DidAll; }
set { _DidAll = value; }
}
private int _pntSectID = -1;
public int PntSectID
private int _prtSectID = -1;
public int PrtSectID
{
get { return _pntSectID; }
set { _pntSectID = value; }
get { return _prtSectID; }
set { _prtSectID = value; }
}
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PntSectID = -1)
public frmPDFStatusForm(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, bool openPDF, bool overWrite, string pdfPath, ChangeBarDefinition cbd, string pdfFile, Point newLocation, bool insertBlankPages, bool allOrAuto, string prefix, bool saveLinks, int removeTrailingHardReturnsAndManualPageBreaks, bool showPROMSVer, bool didAll, string blankPageText, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
{
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic
ProcedureInfo MyProcedure = myItem as ProcedureInfo;
@ -122,7 +122,7 @@ namespace VEPROMS
Prefix = prefix;
OpenPDF = openPDF;
DidAll = didAll;
_pntSectID = PntSectID;
_prtSectID = PrtSectID;
InitializeComponent();
@ -283,7 +283,7 @@ namespace VEPROMS
cachePartInfo = PartInfo.CacheList;
}
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PntSectID);
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary, MakeTimeCriticalActionSummary, PrtSectID);
ProfileTimer.Pop(profileDepth);

View File

@ -1196,7 +1196,7 @@ namespace VEPROMS
{
//args.Node.Parent.
SectionInfo si2 = (args.Node as VETreeNode).VEObject as SectionInfo;
int _pntSectID = si2.ItemID;
int _prtSectID = si2.ItemID;
if (si2 == null) return;
@ -1206,7 +1206,7 @@ namespace VEPROMS
using (DlgPrintProcedure prnDlg = new DlgPrintProcedure(si2.MyProcedure))
{
prnDlg.PntSectID = _pntSectID;
prnDlg.PrtSectID = _prtSectID;
prnDlg.SelectedSlave = args.UnitIndex;
prnDlg.MySessionInfo = MySessionInfo;
prnDlg.SetupForProcedure(); // Setup filename

View File

@ -950,6 +950,7 @@ namespace Volian.Controls.Library
SectionConfig sc = si.MyConfig as SectionConfig;
if (!si.IsEnhancedSection && (si.Sections == null || si.Sections.Count == 0 || (meta && sc != null && si.Sections != null && si.Sections.Count > 0 && sc.SubSection_Edit == "Y")))
cm.MenuItems.Add("New Step", new EventHandler(mi_Click));
cm.MenuItems.Add("Print Section", new EventHandler(mi_Click));
}
}
}
@ -967,13 +968,13 @@ namespace Volian.Controls.Library
}
#endregion
//_MyLog.WarnFormat("Context Menu 2 - {0}", GC.GetTotalMemory(true));
#region Print_Section
if (!tn.IsExpanded && tn.VEObject as SectionInfo != null)
{
SectionInfo si = tn.VEObject as SectionInfo;
if (si.IsStepSection) cm.MenuItems.Add("Print Section", new EventHandler(mi_Click));
}
#endregion
//#region Print_Section
//if (!tn.IsExpanded && tn.VEObject as SectionInfo != null)
//{
// SectionInfo si = tn.VEObject as SectionInfo;
// if (si.IsStepSection) cm.MenuItems.Add("Print Section", new EventHandler(mi_Click));
//}
//#endregion
#region Menu_Open
if (!tn.IsExpanded && tn.VEObject as SectionInfo != null)
{

View File

@ -179,11 +179,11 @@ namespace Volian.Print.Library
get { return _PDFFile; }
set { _PDFFile = value; }
}
private int _pntSectID = -1;
public int PntSectID
private int _prtSectID = -1;
public int PrtSectID
{
get { return _pntSectID; }
set { _pntSectID = value; }
get { return _prtSectID; }
set { _prtSectID = value; }
}
private bool _DebugOutput;
public bool DebugOutput
@ -323,7 +323,7 @@ namespace Volian.Print.Library
set { _MergedPdf = value; }
}
public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite,
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor, int PntSectID = -1)
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks, int removeTrailngHardReturnsAndManualPageBreaks, string blankPageText, bool didAll, MergedPdf mergedPdf, string watermarkColor, int PrtSectID = -1)
{
Prefix = prefix; // RHM20150506 Multiline ItemID TextBox
_MyItem = myItem;
@ -348,7 +348,7 @@ namespace Volian.Print.Library
_DidAll = didAll;
_MergeNotIncluded = false;
_MergedPdf = mergedPdf;
_pntSectID = PntSectID;
_prtSectID = PrtSectID;
//_MyReaderHelper.LoadTree(myItem);
}
// Pass 1 PDF Name
@ -368,11 +368,11 @@ namespace Volian.Print.Library
// B2019-152: MergedLandscapePages is a dictionary whose key is the pdf file name & values are all of the page numbers
// in that pdf that should have landscaped page numbers. These are added when the page is finished (onEndPage)
public static Dictionary<string, List<int>> MergedLandscapePages = null;
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary, int PntSectID = -1)
public string Print(string pdfFolder, bool makePlacekeeper, bool makeContinuousActionSummary, bool makeTimeCriticalActionSummary, int PrtSectID = -1)
{
if (_MyItem is ProcedureInfo)
{
_pntSectID = PntSectID;
_prtSectID = PrtSectID;
ProcedureConfig pcfg = (ProcedureConfig)(_MyItem as ProcedureInfo).MyConfig;
if (DidAll && pcfg.Print_NotInMergeAll) // will be merging a pdf, so don't print this procedure if user set that on procedure propertures
{
@ -807,7 +807,7 @@ namespace Volian.Print.Library
int cnt = 0;
foreach (SectionInfo mySection in myProcedure.Sections)
{
if (PntSectID == -1 || (PntSectID > -1 && mySection.ItemID == PntSectID))
if (PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID))
{
if (!mySection.MyDocStyle.IsStepSection && !mySection.IsAutoTOCSection)
{
@ -953,7 +953,7 @@ namespace Volian.Print.Library
}
foreach (SectionInfo mySection in myProcedure.Sections)
{
if(PntSectID == -1 || (PntSectID > -1 && mySection.ItemID == PntSectID) )
if(PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID) )
{
// B2020-115 Calculate maximum available space on a page for figures
vlnParagraph.hMax = ((float)mySection.MyDocStyle.Layout.PageLength);
@ -981,7 +981,7 @@ namespace Volian.Print.Library
hlsItemId = mySection.Steps[0].ItemID;
hlsText = mySection.Steps[0].DisplayText; // save the High level step text for use in the page list
}
cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(mySection, this, hlsText, hlsItemId);
cb.PdfWriter.PageEvent = _MyHelper = new VlnSvgPageHelper(mySection, this, hlsText, hlsItemId, PrtSectID);
_MyHelper.AllowAllWatermarks = AllowAllWatermarks;
_MyHelper.MyPdfWriter = cb.PdfWriter;
_MyHelper.CreatingFoldoutPage = doingFoldout;
@ -1584,7 +1584,7 @@ namespace Volian.Print.Library
bool inGroup = false;
foreach (SectionInfo mySection in ii.Sections)
{
if (PntSectID == -1 || (PntSectID > -1 && mySection.ItemID == PntSectID))
if (PrtSectID == -1 || (PrtSectID > -1 && mySection.ItemID == PrtSectID))
{
sectCnt++;
SectionConfig sc = mySection.MyConfig as SectionConfig;
@ -2355,7 +2355,7 @@ namespace Volian.Print.Library
iTextSharp.text.Rectangle pageSize = PDFPageSize.UsePaperSize(MyItem.ActiveFormat.PlantFormat.FormatData.PDFPageSize.PaperSize); // C2020-002 paper size is now set in the format files
PdfContentByte cb = OpenDoc(ref SupInfoPdfName, pageSize);
if (cb == null) return;
VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0);
VlnSvgPageHelper myPageHelper = new VlnSvgPageHelper(vlnParagraph.MyItemInfo as SectionInfo, this, null, 0, _prtSectID);
cb.PdfWriter.PageEvent = myPageHelper;
myPageHelper.AllowAllWatermarks = AllowAllWatermarks;
myPageHelper.MyPdfWriter = cb.PdfWriter;
@ -2943,7 +2943,7 @@ namespace Volian.Print.Library
if (ii.Sections == null) return; // B2021-067 crash on null reference
foreach (SectionInfo si in ii.Sections)
{
if (MyPromsPrinter.PntSectID == -1 || (MyPromsPrinter.PntSectID > -1 && si.ItemID == MyPromsPrinter.PntSectID))
if (MyPromsPrinter.PrtSectID == -1 || (MyPromsPrinter.PrtSectID > -1 && si.ItemID == MyPromsPrinter.PrtSectID))
{
if (si.IsStepSection)
{

View File

@ -85,6 +85,12 @@ namespace Volian.Print.Library
get { return _TopMessage; }
set { _TopMessage = value; }
}
private int _prtSectID = -1;
public int PrtSectID
{
get { return _prtSectID; }
set { _prtSectID = value; }
}
private List<vlnText> _TopMessageRs=new List<vlnText>(); // Added if there are 2 messages, in AER AND RNO (for BGE)
public List<vlnText> TopMessageRs
{
@ -867,12 +873,15 @@ i = 0;
set
{
_MySection = value;
MySectionTitle = ((_MySection.DisplayNumber ?? string.Empty)==string.Empty ? string.Empty : _MySection.DisplayNumber + " - ") + _MySection.DisplayText;
MySectionTitle = ((_MySection.DisplayNumber ?? string.Empty) == string.Empty ? string.Empty : _MySection.DisplayNumber + " - ") + _MySection.DisplayText;
bool forceLoadSvg = false;
if (value.SectionConfig.Section_Pagination == SectionConfig.SectionPagination.Separate && value.MyDocStyle.ResetFirstPageOnSection)
DidFirstPageDocStyle = false;
if (DidFirstPageDocStyle)
forceLoadSvg = SetDocStyleAndValues(); // this method also gets the SVG (the 'else' part of this)
if (_prtSectID > -1) {
forceLoadSvg = true;
}
Volian.Svg.Library.Svg sectSvg = BuildSvg(_MySection, forceLoadSvg);
if (sectSvg != null) MySvg = sectSvg;
_YTopMargin = null;
@ -1031,9 +1040,10 @@ i = 0;
set { _MyPromsPrinter = value; }
}
private int _MyRomanPage = 1;
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection, PromsPrinter myPromsPrinter, string hlsText, int hlsItemId)
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection, PromsPrinter myPromsPrinter, string hlsText, int hlsItemId, int PrtSectID)
: base()
{
_prtSectID = PrtSectID;
HLSText = hlsText;
HasHLSTextId = hlsItemId;
MyPromsPrinter = myPromsPrinter;