Made Status Change available to other print objects

Update status when moving through a section with subsections
Update status when moving through a section with subsections
GetSectionInfo use local value rather than using the cache
Used SectionInfo property HasStepCheckOffs to turn-on CheckOff header and narrow text width.
This commit is contained in:
Rich 2014-11-05 14:36:17 +00:00
parent 2d7c25d2d2
commit b89af73735
3 changed files with 48 additions and 36 deletions

View File

@ -81,18 +81,19 @@ namespace Volian.Print.Library
Before, Before,
BuildStep, BuildStep,
Progress, Progress,
ProgressSetup ProgressSetup,
LoadVlnParagraph
} }
public class PromsPrinter public class PromsPrinter
{ {
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public event PromsPrinterStatusEvent StatusChanged; public event PromsPrinterStatusEvent StatusChanged;
private void OnStatusChanged(object sender, PromsPrintStatusArgs args) internal void OnStatusChanged(object sender, PromsPrintStatusArgs args)
{ {
if (StatusChanged != null) if (StatusChanged != null)
StatusChanged(sender, args); StatusChanged(sender, args);
} }
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type) internal void OnStatusChanged(string myStatus, PromsPrinterStatusType type)
{ {
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type)); OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
} }
@ -100,7 +101,7 @@ namespace Volian.Print.Library
{ {
OnStatusChanged(this, new PromsPrintStatusArgs(msg, PromsPrinterStatusType.General)); OnStatusChanged(this, new PromsPrintStatusArgs(msg, PromsPrinterStatusType.General));
} }
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress) internal void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress)
{ {
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress)); OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress));
} }
@ -1188,7 +1189,7 @@ namespace Volian.Print.Library
else else
_MyHelper.IsLandscape = false; _MyHelper.IsLandscape = false;
_MyHelper.ChangeBarDefinition = MyChangeBarDefinition; _MyHelper.ChangeBarDefinition = MyChangeBarDefinition;
vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true); vlnParagraph myParagraph = new vlnParagraph(null, cb, myItemInfo, (float)myItemInfo.MyDocStyle.Layout.LeftMargin, _NoBreakYOffset, 0, myItemInfo.ColumnMode, myItemInfo.ActiveFormat, null, null, 0,true,this);
float localYPageStart = 0; float localYPageStart = 0;
float yPageStart = yTopMargin; float yPageStart = yTopMargin;
if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0) if (myItemInfo.HasChildren || myItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)

View File

@ -1692,10 +1692,11 @@ namespace Volian.Print.Library
case "{INITIALS}": case "{INITIALS}":
// For Calvert: if this section has checkoffs turned on, put out this pagelist item: // For Calvert: if this section has checkoffs turned on, put out this pagelist item:
// Get SectionInfos to access specific section config items... // Get SectionInfos to access specific section config items...
SectionInfo si = SectionInfo.Get(MySection.ItemID); //SectionInfo si = SectionInfo.Get(MySection.ItemID);
SectionInfo si = MySection.GetSectionInfo();
SectionConfig sectCfg = si.MyConfig as SectionConfig; SectionConfig sectCfg = si.MyConfig as SectionConfig;
int sc = sectCfg.Section_CheckoffListSelection; int sc = sectCfg.Section_CheckoffListSelection;
if (sc < 2) plstr = plstr.Replace(token, ""); if (sc < 2 && !si.HasStepCheckOffs) plstr = plstr.Replace(token, "");
else plstr = plstr.Replace(token, "INITIALS"); else plstr = plstr.Replace(token, "INITIALS");
break; break;
case "{REVUNIT}": case "{REVUNIT}":

View File

@ -59,8 +59,11 @@ namespace Volian.Print.Library
{ {
return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations); return ((itminfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations);
} }
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo) public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo)
{
return Add(cb, itemInfoList, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo, null);
}
public float Add(PdfContentByte cb, ItemInfoList itemInfoList, float xoff, float yoff, float yoffRight, int rnoLevel, int maxRNO, FormatInfo formatInfo, PromsPrinter pp)
{ {
bool bxHlsDraw = false; bool bxHlsDraw = false;
int? bxIndex = null; int? bxIndex = null;
@ -75,9 +78,11 @@ namespace Volian.Print.Library
int maxRnoSav = maxRNO; int maxRnoSav = maxRNO;
foreach (ItemInfo iChildItemInfo in itemInfoList) foreach (ItemInfo iChildItemInfo in itemInfoList)
{ {
if(pp != null) pp.OnStatusChanged((iChildItemInfo.DisplayNumber ?? "") == "" ? iChildItemInfo.DisplayText : iChildItemInfo.DisplayNumber, PromsPrinterStatusType.LoadVlnParagraph);
if (iChildItemInfo.IsNote && iChildItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.NotesToFootnotes) if (iChildItemInfo.IsNote && iChildItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.NotesToFootnotes)
{ {
vlnParagraph para = new vlnParagraph(Parent, cb, iChildItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true); vlnParagraph para = new vlnParagraph(Parent, cb, iChildItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight, true, iChildItemInfo.IsSection ? pp :null);
continue; // don't add it, vlnParagraph adds this item to the footnote vlntext list in ToPdf. continue; // don't add it, vlnParagraph adds this item to the footnote vlntext list in ToPdf.
} }
maxRNO = maxRnoSav; maxRNO = maxRnoSav;
@ -279,7 +284,7 @@ namespace Volian.Print.Library
box = null; box = null;
yoff += 1 * vlnPrintObject.SixLinesPerInch; yoff += 1 * vlnPrintObject.SixLinesPerInch;
} }
vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true); vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null, yoffRight,true,null);
// if doing the component list (FNP), keep track of the bottom most columns' data // if doing the component list (FNP), keep track of the bottom most columns' data
// so this can be returned after the row is done. // so this can be returned after the row is done.
@ -1014,7 +1019,8 @@ namespace Volian.Print.Library
{ {
PdfReader tmp = null; PdfReader tmp = null;
string tmpstr = null; string tmpstr = null;
SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID); //SectionInfo si = SectionInfo.Get(MyItemInfo.ItemID);
SectionInfo si = MyItemInfo.GetSectionInfo();
cb.PdfDocument.NewPage(); cb.PdfDocument.NewPage();
//_MyLog.InfoFormat("NewPage 9 {0}", cb.PdfWriter.CurrentPageNumber); //_MyLog.InfoFormat("NewPage 9 {0}", cb.PdfWriter.CurrentPageNumber);
MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr); MyPageHelper.MyPromsPrinter.CreateWordDocPdf(cb, si, ref tmp, ref tmpstr);
@ -1244,7 +1250,7 @@ namespace Volian.Print.Library
if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate) if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{ {
DoSubs = false; DoSubs = false;
vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0,false); vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0,false,null);
smartPara.PrintHeader = true; smartPara.PrintHeader = true;
float mytmpfloat = smartPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin); float mytmpfloat = smartPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart -= smartPara.Height; yPageStart -= smartPara.Height;
@ -1332,7 +1338,7 @@ namespace Volian.Print.Library
secContinueXoff = fndTopSect.XOffset; secContinueXoff = fndTopSect.XOffset;
} }
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false); sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false,null);
if (sectContPara.PartsLeft.Count > 0) if (sectContPara.PartsLeft.Count > 0)
{ {
vlnTab vt = sectContPara.MyTab; vlnTab vt = sectContPara.MyTab;
@ -1359,7 +1365,7 @@ namespace Volian.Print.Library
} }
else else
{ {
sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false); sectContPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.ActiveSection, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, (contMsg == null || contMsg == "") ? " (Continued)" : contMsg, 0, false,null);
float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin); float mytmpfloat = sectContPara.ParagraphToPdf(cb, yTopMargin, yTopMargin, yBottomMargin);
if (sectContPara.SectionContinuePrinted) if (sectContPara.SectionContinuePrinted)
yPageStart -= sectContPara.Height + SixLinesPerInch; yPageStart -= sectContPara.Height + SixLinesPerInch;
@ -2092,7 +2098,7 @@ namespace Volian.Print.Library
return (float)(MyItemInfo.MyDocStyle.Layout.PageLength - MyItemInfo.MyDocStyle.Layout.TopMargin - MyItemInfo.MyDocStyle.Layout.FooterLength); return (float)(MyItemInfo.MyDocStyle.Layout.PageLength - MyItemInfo.MyDocStyle.Layout.TopMargin - MyItemInfo.MyDocStyle.Layout.FooterLength);
} }
} }
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren) public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent, bool loadChildren, PromsPrinter pp)
{ {
Prefix = prefix; Prefix = prefix;
Suffix = suffix; Suffix = suffix;
@ -2923,7 +2929,7 @@ namespace Volian.Print.Library
} }
if (itemInfo.Sections != null) if (itemInfo.Sections != null)
if (loadChildren) if (loadChildren)
yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); yoff = ChildrenBelow.Add(cb, itemInfo.Sections, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo, pp);
if (itemInfo.Procedures != null) if (itemInfo.Procedures != null)
if (loadChildren) if (loadChildren)
yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo); yoff = ChildrenBelow.Add(cb, itemInfo.Procedures, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
@ -3071,7 +3077,8 @@ namespace Volian.Print.Library
// See if this section has a checkoffheading index - this value, if set is stored in the config field. // See if this section has a checkoffheading index - this value, if set is stored in the config field.
// -1 flags no entries in the format's CheckOffHeaderList & 0 flags the first // -1 flags no entries in the format's CheckOffHeaderList & 0 flags the first
// entry which is always '{NO HEADING}'. So only continue if it's greater than 0. // entry which is always '{NO HEADING}'. So only continue if it's greater than 0.
SectionInfo si = SectionInfo.Get(itemInfo.ItemID); // sometimes the itemInfo isn't a section info //SectionInfo si = SectionInfo.Get(itemInfo.ItemID); // sometimes the itemInfo isn't a section info
SectionInfo si = itemInfo.GetSectionInfo(); // sometimes the itemInfo isn't a section info
int sindx = si.CheckOffHeadingIndex(); int sindx = si.CheckOffHeadingIndex();
// If there is a checkoff header for this section, see if this section has subsections. // If there is a checkoff header for this section, see if this section has subsections.
@ -3132,9 +3139,11 @@ namespace Volian.Print.Library
// If subsections and starts at top of page, (on top of page, use pagelist code in VlnSvgPageHelper) // If subsections and starts at top of page, (on top of page, use pagelist code in VlnSvgPageHelper)
// Get SectionInfos to access specific section config items... // Get SectionInfos to access specific section config items...
SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID); //SectionInfo si = SectionInfo.Get(mySectionInfo.ItemID);
SectionInfo si = mySectionInfo.GetSectionInfo();
int sindx = si.CheckOffHeadingIndex(); int sindx = si.CheckOffHeadingIndex();
SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID); //SectionInfo subi = mySubSectionInfo == null ? null : SectionInfo.Get(mySubSectionInfo.ItemID);
SectionInfo subi = mySubSectionInfo == null ? null : mySubSectionInfo.GetSectionInfo();
int subindx = subi == null ? -1 : subi.CheckOffHeadingIndex(); int subindx = subi == null ? -1 : subi.CheckOffHeadingIndex();
// if there is no subsections & the main section doesn't use a header OR // if there is no subsections & the main section doesn't use a header OR
@ -4233,10 +4242,11 @@ namespace Volian.Print.Library
if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert) if (itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
{ {
// For Calvert STP/OP: see if this section has checkoffs by looking in the section config: // For Calvert STP/OP: see if this section has checkoffs by looking in the section config:
SectionInfo si = SectionInfo.Get(itemInfo.ActiveSection.ItemID); //SectionInfo si= SectionInfo.Get(itemInfo.ActiveSection.ItemID);
SectionInfo si = itemInfo.ActiveSection.GetSectionInfo();
SectionConfig sectCfg = si.MyConfig as SectionConfig; SectionConfig sectCfg = si.MyConfig as SectionConfig;
int sc = sectCfg.Section_CheckoffListSelection; int sc = sectCfg.Section_CheckoffListSelection;
ChkOff = (sc >= 2); ChkOff = (sc >= 2) || si.HasStepCheckOffs;
} }
if (ChkOff) if (ChkOff)
{ {