C2024-002-Print-Section

This commit is contained in:
Paul Larsen 2024-01-25 09:18:48 -05:00
parent 9b59810c89
commit 0095b2883b
6 changed files with 278 additions and 197 deletions

View File

@ -59,6 +59,13 @@ namespace VEPROMS
get { return _Automatic; }
set { _Automatic = value; }
}
private int _pntSectID = -1;
public int PntSectID
{
get { return _pntSectID; }
set { _pntSectID = value; }
}
// C2018-033 Used to turn off using the date/time PDF file prefix and suffix when doing batch file autmatic baseline print testing (frmVEPROMS.cs RunAutomatic())
// This is needed so the the automatic baselines can compare results from different runs of PROMS
@ -851,6 +858,7 @@ namespace VEPROMS
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)) // ;//C2018-009 print PROMS version
{
frmStatus.PntSectID = PntSectID;
frmStatus.CloseWhenDone = true;
Application.DoEvents();
frmStatus.CancelStop = true;

View File

@ -91,6 +91,12 @@ namespace VEPROMS
get { return _DidAll; }
set { _DidAll = value; }
}
private int _pntSectID = -1;
public int PntSectID
{
get { return _pntSectID; }
set { _pntSectID = 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)
{
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic

View File

@ -514,6 +514,7 @@ namespace VEPROMS
ItemInfo.ItemDeleted += new ItemInfoEvent(RefreshDisplayHistory);
tv.PrintProcedure += new vlnTreeViewEvent(tv_PrintProcedure);
tv.PrintSection += new vlnTreeViewEvent(tv_PrintSection);
tv.QPrintProcedure += new vlnTreeViewEvent(tv_QPrintProcedure);
tv.PrintAllProcedures += new vlnTreeViewEvent(tv_PrintAllProcedures);
tv.ApproveProcedure += new vlnTreeViewEvent(tv_ApproveProcedure);
@ -1189,6 +1190,45 @@ namespace VEPROMS
}
void tv_PrintSection(object sender, vlnTreeEventArgs args) // Quick Print right click menu on Procedure name.
{
try
{
//args.Node.Parent.
SectionInfo si2 = (args.Node as VETreeNode).VEObject as SectionInfo;
int _pntSectID = si2.ItemID;
if (si2 == null) return;
tc.SaveCurrentEditItem(si2.MyProcedure);
si2.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitIndex;
using (DlgPrintProcedure prnDlg = new DlgPrintProcedure(si2.MyProcedure))
{
prnDlg.PntSectID = _pntSectID;
prnDlg.SelectedSlave = args.UnitIndex;
prnDlg.MySessionInfo = MySessionInfo;
prnDlg.SetupForProcedure(); // Setup filename
prnDlg.QPCreatePDF(); // Create Print report
si2.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
}
}
catch (Exception ex)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("Could not create PDF Print");
sb.AppendLine();
MessageBox.Show(sb.ToString(), "Error when creating PDF Print", MessageBoxButtons.OK, MessageBoxIcon.Warning);
_MyLog.Warn("Failed to create PDF print", ex);
}
}
void tv_CreateContinuousActionSummary(object sender, vlnTreeEventArgs args)
{
DialogResult dr = System.Windows.Forms.DialogResult.Yes;

View File

@ -506,6 +506,11 @@ namespace Volian.Controls.Library
{
if (QPrintProcedure != null) QPrintProcedure(sender, args);
}
public event vlnTreeViewEvent PrintSection;
private void OnPrintSection(object sender, vlnTreeEventArgs args)
{
if (PrintSection != null) PrintSection(sender, args);
}
public event vlnTreeViewEvent PrintAllProcedures;
private void OnPrintAllProcedures(object sender, vlnTreeEventArgs args)
{
@ -962,7 +967,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 Menu_Open
if (!tn.IsExpanded && tn.VEObject as SectionInfo != null)
{
@ -1880,6 +1891,13 @@ namespace Volian.Controls.Library
}
switch (mi.Text)
{
case "Print Section":
VETreeNode tn2 = SelectedNode as VETreeNode;
//ProcedureInfo pi2 = tn2.VEObject as ProcedureInfo;
//SectionInfo sectInfo = tn2.VEObject as SectionInfo;
//OnPrintSection(this, new vlnTreeEventArgs(sectInfo as SectionInfo, null, 0));
OnPrintSection(this, new vlnTreeEventArgs(tn2 as VETreeNode, null, 0));
break;
case "Open":
OpenNode();
break;

View File

@ -179,6 +179,12 @@ namespace Volian.Print.Library
get { return _PDFFile; }
set { _PDFFile = value; }
}
private int _pntSectID = -1;
public int PntSectID
{
get { return _pntSectID; }
set { _pntSectID = value; }
}
private bool _DebugOutput;
public bool DebugOutput
{
@ -941,6 +947,8 @@ namespace Volian.Print.Library
if (clr != null && clr != "") WatermarkOverrideColor = clr.ToUpper().Contains("DEFAULT") ? "BLUE" : clr;
}
foreach (SectionInfo mySection in myProcedure.Sections)
{
if(PntSectID == -1 || (PntSectID > -1 && mySection.ItemID == PntSectID) )
{
// B2020-115 Calculate maximum available space on a page for figures
vlnParagraph.hMax = ((float)mySection.MyDocStyle.Layout.PageLength);
@ -1127,6 +1135,7 @@ namespace Volian.Print.Library
}
_MyHelper.PrintedSectionPage = 0;
}
}
if (_MyHelper != null && _MyHelper.BackgroundFile != null)
{
_MyHelper.MySvg = null;