B2018-033 - Set the default scrunching settings.

B2018-033 - Set the scrunching check box to checked by default
B2018-033 - Base table scrunching on the last row of a range rather than the first row of a range
B2018-033 - Added debug for table scrunching.
B2018-033 - Fix pagination to account for table scrunching
This commit is contained in:
Rich 2018-03-02 18:57:57 +00:00
parent 09aa4e4ab0
commit 75124cd7e4
5 changed files with 85 additions and 14 deletions

View File

@ -655,6 +655,9 @@ namespace VEPROMS
this.Text = ""; this.Text = "";
this.cbScrunch.Width = this.cbScrunch.Height; this.cbScrunch.Width = this.cbScrunch.Height;
this.cbScrunch.Visible = false; 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 // btnNext
// //

View File

@ -1753,7 +1753,9 @@ namespace VEPROMS
} }
// RHM20150507 Table Scrunch // 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) void btnPrint1_Click(object sender, EventArgs e)
{ {
string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray()); string[] ids = txtSearch.Text.Split("\r\n ".ToCharArray());

View File

@ -200,7 +200,7 @@ namespace Volian.Print.Library
//_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12); //_Adjustment = Math.Min(1F, (_TooBig / (RowTop.Length - 1)) / 12);
//if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment); //if (ShowDetails) Console.WriteLine("TooBig\t{0}\t{1}", value, _Adjustment);
//if(ShowDetails) Console.WriteLine("Before RowTop={0}", RowTop[RowTop.Length-1] ); //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++) for (int r = 0; r < RowTop.Length - 1; r++)
RowTop[r + 1] = RowTop[r] + HContents[r] + extra; RowTop[r + 1] = RowTop[r] + HContents[r] + extra;
//if(ShowDetails) Console.WriteLine("After RowTop={0}", RowTop[RowTop.Length-1] ); //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++) for (int c = 0; c < MyFlexGrid.Cols.Count; c++)
{ {
CellRange cr = MyFlexGrid.GetMergedRange(r, 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 w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1]; 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(ShowDetails) Console.WriteLine("{0}\t{1}\t{2}",r,c, hContent/12);
if (cr.r1 == cr.r2) if (cr.r1 == cr.r2)
hMax = Math.Max(hMax, hContent); 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 else
hMax = Math.Max(hMax, hContent - (cr.r2 - cr.r1) * _SixLinesPerInch); hMax = Math.Max(hMax, hContent - (cr.r2 - cr.r1) * _SixLinesPerInch);
if (hContent > h) 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 // 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; 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 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}\"" // 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, , r1, c1, hAdjust, adjustTextLocation, y, h, top, 1 + top - y - hAdjust - adjustTextLocation,
_MyPageHelper.YMultiplier, MyPara.Content.Substring(0, Math.Min(20, MyPara.Content.Length))); _MyPageHelper.YMultiplier, ShowText(MyPara.Content.Substring(0, Math.Min(20, MyPara.Content.Length))));
}
MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier; MyPara.MultipliedLeading *= _MyPageHelper.YMultiplier;
vlnCells.FixHyphens(MyPara, MyTable); vlnCells.FixHyphens(MyPara, MyTable);
vlnCells.FixBackslashes(MyPara, MyTable); vlnCells.FixBackslashes(MyPara, MyTable);
@ -1289,10 +1307,39 @@ namespace Volian.Print.Library
float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch float posBefore = myColumnText1.YLine; // RHM20150429 - Table Scrunch
myColumnText1.Go(); myColumnText1.Go();
float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch float posAfter = myColumnText1.YLine; // RHM20150429 - Table Scrunch
if(ShowDetails)Console.WriteLine("ToPDF posBefore,posAfter,difference={0},{1},{2},{3}", // B2018-033 Removed debug printout
posBefore, posAfter, posBefore - posAfter,w); //if(ShowDetails)Console.WriteLine("ToPDF posBefore,posAfter,difference={0},{1},{2},{3}",
// posBefore, posAfter, posBefore - posAfter,w);
myColumnText.Canvas.RestoreState(); 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 private static float _SixLinesPerInch = 12; // twips
public bool IsRangeStyleNull = false; public bool IsRangeStyleNull = false;
private TextAlignEnum? _TextAlign = null; private TextAlignEnum? _TextAlign = null;

View File

@ -922,6 +922,11 @@ namespace Volian.Print.Library
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace, myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly); myBottomMsgSpace, MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
// B2017-109: for supplemental information, if there is a preferred page break, account for it. // B2017-109: for supplemental information, if there is a preferred page break, account for it.
// 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) 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 // B2017-122: don't use preferred break if the last break was before this break
@ -1268,7 +1273,16 @@ namespace Volian.Print.Library
paraBreak.PageBreakReason = "Rest of Step fits at 6 LPI"; paraBreak.PageBreakReason = "Rest of Step fits at 6 LPI";
ProfileTimer.Pop(profileDepth); 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 // 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 // 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 // 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 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)); //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; yLocationMin2 = yLocation;
minPara2 = myPara; minPara2 = myPara;
} }
@ -1466,7 +1484,6 @@ namespace Volian.Print.Library
// so that minPara2 is used. // so that minPara2 is used.
if (minPara != null && minPara2 != null && ((minPara2.MyItemInfo.IsCautionPart && minPara.MyItemInfo.IsCaution) || (minPara2.MyItemInfo.IsNotePart && minPara.MyItemInfo.IsNote)) 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; && minPara.MyItemInfo.FirstSibling.ItemID == minPara2.MyItemInfo.ItemID) minPara = null;
//if (minPara != null) DebugPagination.WriteLine("### 111111 {0}", minPara); //if (minPara != null) DebugPagination.WriteLine("### 111111 {0}", minPara);
//if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2); //if(minPara2 != null) DebugPagination.WriteLine("### n222222 {0}", minPara2);
return minPara ?? minPara2; return minPara ?? minPara2;

View File

@ -574,7 +574,7 @@ namespace Volian.Print.Library
} }
if (MyItemInfo.MyContent.MyGrid != null) if (MyItemInfo.MyContent.MyGrid != null)
{ {
int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawDrid"); int profileDepth = ProfileTimer.Push(">>>> vlnParagraph.DrawGrid");
// RHM20150507 Include Footer // RHM20150507 Include Footer
retval = DrawGrid(cb, ref yPageStart, yTopMargin, yBottomMargin + (float)MyItemInfo.MyDocStyle.Layout.FooterLength, ref yLocation); // RHM20150429 - Table Scrunch 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; 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 //if (MyItemInfo.InList(11019,11024,111026)) // RHM20150507 Table Scrunch
// Console.WriteLine("here"); // Console.WriteLine("here");
float heightBefore = MyGrid.Height + 4 * MyPageHelper.YMultiplier; 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 = (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; float heightAfter = MyGrid.Height + 4 * MyPageHelper.YMultiplier;
MyPageHelper.TableAdjustment += (heightBefore - heightAfter); MyPageHelper.TableAdjustment += (heightBefore - heightAfter);
if (heightAfter < (yLocation - yBottomMargin)) if (heightAfter < (yLocation - yBottomMargin))