diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 06ec3291..f4fbb286 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -423,6 +423,7 @@ namespace VEPROMS.CSLA.Library if (itemInfo == null) return; itemInfo.LoadAllAtOnce = true; itemInfo.ActiveParent = itemParent; + itemInfo.MyParent = itemParent as ItemInfo; // itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo; - possible fix for not accessing correct format itemInfo.ActiveSection = sectionInfo; itemInfo.MyProcedure = procInfo; @@ -431,8 +432,16 @@ namespace VEPROMS.CSLA.Library itemInfo.MyContent.LoadNonCachedGrid(); if (itemInfo.MyContent.ContentPartCount > 0) foreach (PartInfo pi in itemInfo.MyContent.ContentParts) + { + ItemInfo il = null; foreach (ItemInfo ii in pi.MyItems) + { SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo); + ii.MyPrevious = il; + //if (il != null) il.NextItem = ii; + il = ii; + } + } } /// /// The following method is used only in print because the 'printed' data is loaded into @@ -496,6 +505,7 @@ namespace VEPROMS.CSLA.Library if (itemInfo == null) return; itemInfo.LoadAllAtOnce = true; itemInfo.ActiveParent = itemParent; + itemInfo.MyParent = itemParent as ItemInfo; // itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo; itemInfo.ActiveSection = sectionInfo; itemInfo.MyDocVersion = docVersionInfo; @@ -525,9 +535,13 @@ namespace VEPROMS.CSLA.Library { foreach (PartInfo pi in itemInfo.MyContent.ContentParts) { + ItemInfo il = null; foreach (ItemInfo ii in pi.MyItems) { SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, tranLookup); + ii.MyPrevious = il; + //if (il != null) il.NextItem = ii; + il = ii; } } } @@ -2011,6 +2025,10 @@ namespace VEPROMS.CSLA.Library } return _MyParent; } + set + { + _MyParent = value; + } } #endregion #region Lookups and More Related diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs index 85c3446c..4d2ccd39 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/ItemInfo.cs @@ -130,6 +130,10 @@ namespace VEPROMS.CSLA.Library if (_MyPrevious == null && _PreviousID != null) _MyPrevious = ItemInfo.Get((int)_PreviousID); return _MyPrevious; } + set + { + _MyPrevious = value; + } } private int _ContentID; public int ContentID diff --git a/PROMS/Volian.Base.Library/DebugPrint.cs b/PROMS/Volian.Base.Library/DebugPrint.cs index 2a89687f..99e98ee1 100644 --- a/PROMS/Volian.Base.Library/DebugPrint.cs +++ b/PROMS/Volian.Base.Library/DebugPrint.cs @@ -93,6 +93,8 @@ namespace Volian.Base.Library { _MyDebugPrint.WriteLine(format, args); } public static void Show() { _MyDebugPrint.Show(); } + public static bool IsOpen + { get { return _MyDebugPrint.IsOpen; } } } public static class DebugText { @@ -107,5 +109,7 @@ namespace Volian.Base.Library { _MyDebugPrint.WriteLine(format, args); } public static void Show() { _MyDebugPrint.Show(); } + public static bool IsOpen + { get { return _MyDebugPrint.IsOpen; } } } } diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 5c4ae0ab..ce6b5aef 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -333,7 +333,7 @@ namespace Volian.Print.Library //_MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination - ItemID = {0}\r\nLocation = '{1}'", MyItemInfo.ItemID, MyItemInfo.ShortPath); _MyLog.ErrorFormat("<<< ERROR >>> Forced Pagination\r\n==>'Forced Pagination',{0},'{1}','{2}'" , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); - DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath); + if(DebugPagination.IsOpen) DebugPagination.WriteLine("=====>,'Yes','Forced Pagination',{0},{1},,{3},'{4}'", MyItemInfo.ItemID, YSize, 0, yLocation, MyItemInfo.ShortPath); retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin); } private void ShowPageBreak(int instance, string message, string breakOrNot, float YSize, float yPageSize, float yWithinMargins, bool manualPageBreak) @@ -341,7 +341,7 @@ namespace Volian.Print.Library if (breakOrNot != "No") { // DebugPagination.WriteLine("{0}", MyItemInfo.DBSequence); //,instance); - DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}", + if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2},'{3}','{4}',{5},{6},{7},{8},{9}", MyPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber - (breakOrNot == "Yes" ? 0 : 1), MyItemInfo.ShortPath, instance, (manualPageBreak ? "Manual " : "") + message, breakOrNot, @@ -417,7 +417,7 @@ namespace Volian.Print.Library //Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release if (paraBreak == null) { - DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}" + if (DebugPagination.IsOpen) DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}" , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath, YSize - yTop, ySpaceOnCurPageSave); _MyLog.ErrorFormat("<<< ERROR >>> Cannot find a place to break\r\n==>'Cannot Find Place to Break',{0},'{1}','{2}'" , MyItemInfo.ItemID, MyItemInfo.MyDocVersion.MyFolder.Name, MyItemInfo.ShortPath); diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 369014a5..b94944cd 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -544,12 +544,12 @@ namespace Volian.Print.Library PrintTextMessage(cb, "No Proms Output", _TextLayer); cb.PdfDocument.NewPage(); // only have 16bit pages left (for DebugMode) //_MyLog.InfoFormat("NewPage 2 {0}", cb.PdfWriter.CurrentPageNumber); - DebugPagination.WriteLine("{0:D6},'{1}'", + if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}'", _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "No PROMS Output"); } } OnStatusChanged(myProcedure.DisplayNumber + " PDF Creation Completed", PromsPrinterStatusType.Progress, progress); - DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber; + if (DebugPagination.IsOpen) DebugPagination.TotalPages += cb.PdfWriter.CurrentPageNumber; CloseDocument(cb, outputFileName); _MyHelper = null; return outputFileName; @@ -632,7 +632,7 @@ namespace Volian.Print.Library float yoff = 0; if (_MyHelper.DidFirstPageDocStyle) yoff = origYoff - (float)mySection.MyDocStyle.Layout.TopMargin; AddImportedPageToLayer(cb.PdfWriter.DirectContent, _MSWordLayer, fgPage, (float)(mySection.MyDocStyle.Layout.MSWordXAdj??0), (float)(mySection.MyDocStyle.Layout.MSWordYAdj??0)+yoff); - DebugPagination.WriteLine("{0:D6},'{1}',{2}", + if(DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}", _MyHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, mySection.ShortPath,pageNumber); } @@ -983,7 +983,7 @@ namespace Volian.Print.Library if (doimport2) {// put the saved foldout page into the PDF AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, fgPage, 0, 0); - DebugPagination.WriteLine("{0:D6},'{1}',{2}", + if (DebugPagination.IsOpen) DebugPagination.WriteLine("{0:D6},'{1}',{2}", myPageHelper.MyPdfContentByte.PdfWriter.CurrentPageNumber, "Foldout", 1); } } diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 89b0bef5..053fe65d 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -666,7 +666,7 @@ namespace Volian.Print.Library private float DrawGrid(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) { //DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.ShortPath, FormattedText); - DebugText.WriteLine("{0},'{1}','{2}','<>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset); + if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<>',{3}", MyItemInfo.ItemID, MyItemInfo.ShortPath, MyItemInfo.MyContent.Text, XOffset); float retval = Rtf2Pdf.GridAt(cb, MyGrid, XOffset, yLocation, Width, 100, DebugInfo, yBottomMargin, !MyItemInfo.FormatStepData.Type.Contains("Borderless")); if (MyGrid.Height > (yTopMargin - yBottomMargin)) { @@ -678,7 +678,7 @@ namespace Volian.Print.Library private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) { - DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); + if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); //Console.WriteLine("{0},{1},'{2}','<>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); float retval = yLocation; // Check if only one line, i.e. "Height < (1.2F * IParagraph.Leading". The Leading can be for six or seven lines per inch, so the 1.2 @@ -788,7 +788,7 @@ namespace Volian.Print.Library get { return string.Format("DebugID = {0}, ID={1} Type={2} TypeName='{3}' StepLevel={4} DBSequence={5} Width={6} Left={7}", - DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset); + DebugId, MyItemInfo.ItemID, MyItemInfo.FormatStepType, MyItemInfo.FormatStepData == null ? "NoStepData" : MyItemInfo.FormatStepData.Type, MyItemInfo.StepLevel, MyItemInfo.DBSequence, Width, XOffset); } } private void ResetDocStyleAndValues(ref float yTopMargin, ref float yBottomMargin) @@ -812,7 +812,7 @@ namespace Volian.Print.Library } } MyPageHelper.DidFirstPageDocStyle = true; - DebugPagination.WriteLine("ResetDocStyleAndValues"); + if (DebugPagination.IsOpen) DebugPagination.WriteLine("ResetDocStyleAndValues"); MyPageHelper.MySection = (SectionInfo)MyItemInfo.MyActiveSection; yTopMargin = _PointsPerPage - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.TopMargin; yBottomMargin = Math.Max(0, yTopMargin - (float)MyItemInfo.MyActiveSection.MyDocStyle.Layout.PageLength); @@ -845,7 +845,7 @@ namespace Volian.Print.Library float yLocalypagestart = yPageStart; // yPageStart is offset into roll; YTopMost is offset of topmost of this paragraph. float yLocation = yPageStart - YTopMost; - DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost); + if(DebugText.IsOpen) DebugText.WriteLine("ToPdf1:{0},'{1}',{2},{3},{4},{5}", MyItemInfo.ItemID, MyItemInfo.ShortPath, XOffset, yLocation, yPageStart, YTopMost); int paginate = Paginate(yLocation, yTopMargin, yBottomMargin); bool firstHighLevelStep = MyItemInfo.IsHigh && (MyItemInfo.MyPrevious == null); bool doSectionTitleContinued = false; // will add " Continued" to the section title if format flag is set