diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs index 002c92ab..444e09b9 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.Designer.cs @@ -655,6 +655,9 @@ namespace VEPROMS this.Text = ""; this.cbScrunch.Width = this.cbScrunch.Height; this.cbScrunch.Visible = false; + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Initialize scrunch check box to checked + this.cbScrunch.Checked = true; // // btnNext // diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 1ef86021..d193b704 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -1753,7 +1753,9 @@ namespace VEPROMS } // RHM20150507 Table Scrunch - private TableScrunching _DefaultScrunchingRules = TableScrunching.Phase1 | TableScrunching.Phase5 | TableScrunching.Phase2 | TableScrunching.Phase3 | TableScrunching.Phase4 | TableScrunching.Phase5 | TableScrunching.Phase6 | TableScrunching.Phase7 | TableScrunching.Phase8; + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Set default Scrunching flags + private TableScrunching _DefaultScrunchingRules = TableScrunching.AllPhases; void btnPrint1_Click(object sender, EventArgs e) { string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray()); diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index 42119968..5d269cf6 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -200,7 +200,7 @@ namespace Volian.Print.Library //_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12); //if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment); //if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] ); - float extra=(TooBig < SpaceAvailable)?(SpaceAvailable - TooBig) / HContents.Length:0; + float extra = (_TooBig < SpaceAvailable) ? (SpaceAvailable - _TooBig) / HContents.Length:0; for (int r = 0; r < RowTop.Length - 1; r++) RowTop[r + 1] = RowTop[r] + HContents[r] + extra; //if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] ); @@ -393,7 +393,11 @@ namespace Volian.Print.Library for (int c = 0; c < MyFlexGrid.Cols.Count; c++) { CellRange cr = MyFlexGrid.GetMergedRange(r, c); - if (cr.r1 == r && cr.c1 == c) + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Tables not being scrunched properly + // Merged cells should be adjusted based upon the bottom most cell of the range + MyTable.HContents[r] = 12; + if (cr.r2 == r && cr.c1 == c)// Use last Row { float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1]; float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1]; @@ -488,6 +492,11 @@ namespace Volian.Print.Library //if(ShowDetails) Console.WriteLine("{0}\t{1}\t{2}",r,c, hContent/12); if (cr.r1 == cr.r2) hMax = Math.Max(hMax, hContent); + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Tables not being scrunched properly + // Merged cells should be adjusted based upon the bottom most cell of the range + else if(cr.r2 == r) + hMax = Math.Max(hMax, hContent- MyTable.HContents[r-1]); else hMax = Math.Max(hMax, hContent - (cr.r2 - cr.r1) * _SixLinesPerInch); if (hContent > h) @@ -506,6 +515,7 @@ namespace Volian.Print.Library } } } + } // B2017-105 if a symbol character was set to a bigger font size, then the positioning of the larger symbol character was printing too high on the line @@ -1268,9 +1278,17 @@ namespace Volian.Print.Library if (mult != 1F) adjustTextLocation=1; } myColumnText1.SetSimpleColumn(1 + left + x, top - y - h , left + x + w - 2, 1 + top - y - hAdjust - adjustTextLocation); // 2 == Default Padding - if (ShowDetails) Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t\"{9}\"" - , r1, c1, hAdjust, adjustTextLocation, y, h, top, 1 + top - y - hAdjust - adjustTextLocation, - _MyPageHelper.YMultiplier, MyPara.Content.Substring(0, Math.Min(20, MyPara.Content.Length))); + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Added Header to debug output + if (ShowDetails) + { + if(FirstTime) + Console.WriteLine("\"r1\"\t\"c1\"\t\"hAdjust\"\t\"adjustTextLocation\"\t\"y\"\t\"h\"\t\"top\"\t\"1 + top - y - hAdjust - adjustTextLocation\"\t\""+ + "_MyPageHelper.YMultiplier\"\t\"Text\""); + Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t\"{9}\"" + , r1, c1, hAdjust, adjustTextLocation, y, h, top, 1 + top - y - hAdjust - adjustTextLocation, + _MyPageHelper.YMultiplier, ShowText(MyPara.Content.Substring(0, Math.Min(20, MyPara.Content.Length)))); + } MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier; vlnCells.FixHyphens(MyPara, MyTable); vlnCells.FixBackslashes(MyPara, MyTable); @@ -1289,10 +1307,39 @@ namespace Volian.Print.Library float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch myColumnText1.Go(); float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch - if(ShowDetails)Console.WriteLine("ToPDF posBefore,posAfter,difference={0},{1},{2},{3}", - posBefore, posAfter, posBefore - posAfter,w); + // B2018-033 Removed debug printout + //if(ShowDetails)Console.WriteLine("ToPDF posBefore,posAfter,difference={0},{1},{2},{3}", + // posBefore, posAfter, posBefore - posAfter,w); myColumnText.Canvas.RestoreState(); } + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Added Header to debug output + private static bool _FirstTime = true; + public static bool FirstTime + { + get + { + bool retval = _FirstTime; + _FirstTime = false; + return retval; + } + set { _FirstTime = value; } + } + + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Added Header to debug output + private string ShowText(string str) + { + StringBuilder sb = new StringBuilder(); + foreach (char c in str) + { + if(c<32 || c>126) + sb.Append(string.Format("[{0:X}]", (int) c)); + else + sb.Append(c); + } + return sb.ToString(); + } private static float _SixLinesPerInch = 12; // twips public bool IsRangeStyleNull = false; private TextAlignEnum? _TextAlign = null; diff --git a/PROMS/Volian.Print.Library/Pagination.cs b/PROMS/Volian.Print.Library/Pagination.cs index 8ec8e274..fae4a6f0 100644 --- a/PROMS/Volian.Print.Library/Pagination.cs +++ b/PROMS/Volian.Print.Library/Pagination.cs @@ -922,7 +922,12 @@ namespace Volian.Print.Library myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); // B2017-109: for supplemental information, if there is a preferred page break, account for it. - if (myPreferredBreaks != null && myPreferredBreaks.Count > 0 && myPreferredBreaks.Keys[0] < paraBreak.YOffset) + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Break after table if it's the only item left and there is enough space + if (paraBreak != null && paraBreak.MyGrid != null && ItemsLeft(myList) == 1 && + ((YSize - yTop) <= (paraBreak.MyGrid.SpaceAvailable + ySpaceOnCurPage - (accountForCalvertAlarmConditionResponseFooter + yEndMsg)))) + break; + if (myPreferredBreaks != null && myPreferredBreaks.Count > 0 && myPreferredBreaks.Keys[0] < paraBreak.YOffset) { // B2017-122: don't use preferred break if the last break was before this break vlnParagraph prefBreak = myPreferredBreaks[myPreferredBreaks.Keys[0]]; @@ -1268,7 +1273,16 @@ namespace Volian.Print.Library paraBreak.PageBreakReason = "Rest of Step fits at 6 LPI"; ProfileTimer.Pop(profileDepth); } - + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Howany items are left to be printed. + private int ItemsLeft(StepLevelList myList) + { + int retval = 0; + foreach (int stepLevel in myList.Keys) // loop thru StepLevels, starting with lowest. + foreach (float yLocation in myList[stepLevel].Keys) // loop thru yLocation + retval++; + return retval; + } // The following finds all of the preferred page breaks for this step & if found adds them to a // list of the location & the paragraph it is on. This is used so that pagination calculations // occur for steps following the preferred page break rather than starting on the page after @@ -1419,6 +1433,10 @@ namespace Volian.Print.Library else if (-yLocation > -yLocationMin2 && -yLocation <= yUpperLimit) // New location is larger and new location is less than limit { //minBuff.AppendLine(string.Format("NEW2B >>>>> '{0}',{1},{2}", myPara.MyItemInfo.ShortPath, -yLocation, yUpperLimit)); + // B2018-033 VCS SAG-6 Steps 3 and 9 and SACRG1 Step 13 + // Break at next step if going to break at table and there is room for scrunched table + if (myPara.MyGrid != null && minPara != null && -yLocationMin <= (yUpperLimit + myPara.MyGrid.SpaceAvailable)) + return minPara; yLocationMin2 = yLocation; minPara2 = myPara; } @@ -1466,7 +1484,6 @@ namespace Volian.Print.Library // so that minPara2 is used. if (minPara != null && minPara2 != null && ((minPara2.MyItemInfo.IsCautionPart && minPara.MyItemInfo.IsCaution) || (minPara2.MyItemInfo.IsNotePart && minPara.MyItemInfo.IsNote)) && minPara.MyItemInfo.FirstSibling.ItemID == minPara2.MyItemInfo.ItemID) minPara = null; - //if (minPara != null) DebugPagination.WriteLine("### 111111 {0}", minPara); //if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2); return minPara ?? minPara2; diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index c6cd05f3..9ddc48da 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -574,7 +574,7 @@ namespace Volian.Print.Library } if (MyItemInfo.MyContent.MyGrid != null) { - int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid"); + int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawGrid"); // RHM20150507 Include Footer retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float)MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch if (MyItemInfo.IsInSupInfo) _yPageStartForSupInfo = (float)MyPageHelper.BottomContent - SixLinesPerInch; @@ -894,10 +894,12 @@ namespace Volian.Print.Library //if (MyItemInfo.InList(11019,11024,111026)) // RHM20150507 Table Scrunch // Console.WriteLine("here"); float heightBefore = MyGrid.Height + 4 * MyPageHelper.YMultiplier; - if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase1) && heightBefore > (yLocation - yBottomMargin)) + // B2018-033 Account for bottom continue message when seeing if a scrunched table will fit + float ySizeBtmCtnMess = GetBottomContinueMessageSize(MyItemInfo.MyDocStyle); + if (Rtf2Pdf.GetTableScrunchingStatus(TableScrunching.Phase1) && heightBefore > (yLocation - (yBottomMargin + ySizeBtmCtnMess))) { //MyGrid.TooBig = (MyItemInfo.MyDocStyle.Layout.FooterLength ?? 0) + SixLinesPerInch + MyGrid.Height - (yLocation - yBottomMargin); - MyGrid.TooBig = SixLinesPerInch + MyGrid.Height * MyPageHelper.YMultiplier - (yLocation - yBottomMargin); + MyGrid.TooBig = SixLinesPerInch + MyGrid.Height * MyPageHelper.YMultiplier - (yLocation - yBottomMargin - ySizeBtmCtnMess); float heightAfter = MyGrid.Height + 4 * MyPageHelper.YMultiplier; MyPageHelper.TableAdjustment += (heightBefore - heightAfter); if (heightAfter < (yLocation - yBottomMargin))