Adjust HLS width (checklist header) and DocStyle:page length for pagination

Display message box after formats/genmacs are copied
Improve checklist pagination
Improve checklist pagination & right checklist box line alignment
This commit is contained in:
Kathy Ruffing 2014-09-24 14:47:36 +00:00
parent 2c6eeee66c
commit 881cbe5bdd
4 changed files with 48 additions and 14 deletions

Binary file not shown.

View File

@ -124,6 +124,7 @@ namespace Formats
fio = new FileInfo(destGenmacallPath + fi.Name);
if (fio.Exists && fio.IsReadOnly) fio.IsReadOnly = false;
}
MessageBox.Show("Formats Copied.");
}
private void buttonX2_Click(object sender, EventArgs e)

View File

@ -101,9 +101,12 @@ namespace Volian.Print.Library
float mySize = YSize * MyPageHelper.YMultiplier;
vlnParagraph firstChild = ChildrenBelow.Count > 0 ? ChildrenBelow[0] : null;
// Steps that have the smart template (the WCNCKL format for example), always include two children.
if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate && ChildrenBelow.Count > 1)
firstChild = ChildrenBelow[1];
if (firstChild != null && firstChild.MyItemInfo != null && !firstChild.MyItemInfo.IsNumbered) // If not numbered get the last child
if (MyItemInfo.IsHigh && MyItemInfo.FormatStepData.UseSmartTemplate) //
{
if (ChildrenBelow.Count > 1)
firstChild = ChildrenBelow[1];
}
else if (firstChild != null && firstChild.MyItemInfo != null && !firstChild.MyItemInfo.IsNumbered) // If not numbered get the last child
firstChild = firstChild.MyParent.ChildrenBelow[firstChild.MyParent.ChildrenBelow.Count - 1];
float ySizeIncludingFirst = firstChild == null ? YSize : firstChild.YSize + (firstChild.YTopMost - YTopMost);
bool KeepStepsOnPage = MyItemInfo.ActiveFormat.MyStepSectionLayoutData.KeepStepsOnPage;
@ -490,7 +493,17 @@ namespace Volian.Print.Library
// OR there are page breaks for HLS/cautions/notes remaining, typically for backgrounds (PageBreakOnStepList.Count > 0)
vlnParagraph paraBreak = null;
float accountForCalvertAlarmConditionResponseFooter = 0;
//if (MyItemInfo.InList(122358,122610,125485,125613)) Console.WriteLine("here");
// The following code determines space required by the Checklist header (Wolf Creek) if a break occurs
// Their 2 HLS that define the checklists have 'UseSmartTemplate'.
float accountForSmartTemplateHeader = 0;
if (MyItemInfo.FormatStepData.UseSmartTemplate)
{
if (((MyItemInfo.MyDocStyle.End.Message ?? "") == "") || MyItemInfo.MyHLS.GetNextItem() != null)
ySpaceOnCurPage += SixLinesPerInch;
accountForSmartTemplateHeader = Height - (2 * SixLinesPerInch);
}
while (((YSize - yTop) > (ySpaceOnCurPage - accountForCalvertAlarmConditionResponseFooter)) || PageBreakOnStepList.Count > 0)
{
float ySpaceOnCurPageSave = ySpaceOnCurPage;
@ -500,8 +513,8 @@ namespace Volian.Print.Library
myList, lastBreak, yPageSize - (myTopMsgSpace + SixLinesPerInch) - myBottomMsgSpace,
myBottomMsgSpace,MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[40].ContinueOnly);
//Console.WriteLine("Break at {0}", paraBreak.MyItemInfo.ShortPath);//Comment Out before release
if (lastBreak != null && lastBreak.MyItemInfo.InList(80091))
Console.WriteLine("After 80091 {0}",paraBreak.ToString());
//if (lastBreak != null && lastBreak.MyItemInfo.InList(80091, 1985))
// Console.WriteLine("After 80091 {0}",paraBreak.ToString());
if (paraBreak == null)
{
if (DebugPagination.IsOpen) DebugPagination.WriteLine("<<< ERROR >>> Cannot find a place to break ==>,{0},'{1}','{2}',{3},{4}"
@ -666,6 +679,8 @@ namespace Volian.Print.Library
yTop = yTopNew;
MyPageHelper.ParaBreaks.Add(paraBreak);
ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line.
ySpaceOnCurPage -= accountForSmartTemplateHeader;
//ySpaceOnCurPage = yPageSize - (myTopMsgSpace + SixLinesPerInch); // Allow for continue message and blank line.
//if (paraBreak.YTopMost != paraBreak.YVeryTop && MyPageHelper.TopMessage == null && MyPageHelper.BottomMessage == null)
// ySpaceOnCurPage = yPageSize;

View File

@ -694,7 +694,7 @@ namespace Volian.Print.Library
doHorizCnt++;
}
// put out the right side piece
Rtf2Pdf.TextAt(cb, rightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - 6, yloc, lWidth, 100, null, yBottomMargin);
Rtf2Pdf.TextAt(cb, rightLine, float.Parse(vertPos[cntVertPos - 1]) + (float)ii.MyDocStyle.Layout.LeftMargin - csize, yloc, lWidth, 100, null, yBottomMargin);
}
// Now handle middle parts of the table. For whatever sub level we're at, draw the cross character
// and the horizontal. This is case where the component number may have multiple descriptions,positions, etc. associated
@ -774,6 +774,12 @@ namespace Volian.Print.Library
IParagraph.Chunks.RemoveAt(0);
}
}
// if printing checklist header, adjust ypagestart & ylocation so that won't get forced pagination (pagination is already ok)
if (PrintHeader)
{
yPageStart = yTopMargin + YVeryTop;
yLocation = yPageStart - YOffset; // yLocation is physical location from bottom of page.
}
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}",YSize/SixLinesPerInch), yBottomMargin);
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed.
@ -781,6 +787,12 @@ namespace Volian.Print.Library
}
return retval;
}
private bool _PrintHeader = false;
public bool PrintHeader
{
get { return _PrintHeader; }
set { _PrintHeader = value; }
}
private static List<string> myAttributes = new List<string>();
private static void AddAttribute(string attr)
{
@ -913,6 +925,7 @@ namespace Volian.Print.Library
}
}
private static bool DoSubs = true; // flag whether to print substeps (don't if doing continued checklist header)
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
bool doThreeContinues = false;
@ -1116,11 +1129,16 @@ namespace Volian.Print.Library
yPageStart += (3 * SixLinesPerInch);
}
// Now check if this is a template type step & if so, add the HLS's prefix/suffix to it.
// Since the entire checklist HLS (checklist table header) is printed as part of the
// continue, create a new paragraph to handle pagination and printing.
if (MyItemInfo.MyHLS != null && MyItemInfo.MyHLS.FormatStepData.UseSmartTemplate)
{
vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, 0, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0);
float mytmpfloat = smartPara.ParagraphToPdf(cb, smartPara.Height, yTopMargin, yBottomMargin); // .ToPdf(cb, 0, yTopMargin, yBottomMargin);
DoSubs = false;
vlnParagraph smartPara = new vlnParagraph(MyParent.MyParent, cb, MyItemInfo.MyHLS, MyParent.XOffset, yPageStart, 0, 0, MyParent.MyItemInfo.ActiveFormat, null, " (Continued)", 0);
smartPara.PrintHeader = true;
float mytmpfloat = smartPara.ParagraphToPdf(cb, yPageStart, yTopMargin, yBottomMargin);
yPageStart -= smartPara.Height;
DoSubs = true;
}
if (addExtraLines) yPageStart -= (2 * SixLinesPerInch);
if (MyItemInfo.IsRNOPart && MyItemInfo.FormatStepData.DoubleSpace && MyItemInfo.FormatStepData.SpaceDouble) yPageStart += SixLinesPerInch;
@ -2076,7 +2094,7 @@ namespace Volian.Print.Library
float yoffLeft = yoff;
if (ChildrenAbove != null)
ChildrenAbove.StepDesignator = null; //reset StepDesignator
if (itemInfo.Cautions != null && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || itemInfo.Cautions[0].FormatStepData.Type != "Caution1") && !(itemInfo.IsCaution || itemInfo.IsNote))
if (DoSubs && itemInfo.Cautions != null && (!itemInfo.ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || itemInfo.Cautions[0].FormatStepData.Type != "Caution1") && !(itemInfo.IsCaution || itemInfo.IsNote))
{
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
@ -2091,7 +2109,7 @@ namespace Volian.Print.Library
yoff = ChildrenAbove.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
}
}
if (itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote))
if (DoSubs && itemInfo.Notes != null && !(itemInfo.IsCaution || itemInfo.IsNote))
{
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.Dev_Format)
{
@ -2509,7 +2527,7 @@ namespace Volian.Print.Library
}
float yOffRight = yoff;
float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
if (rnoLevel < maxRNO && itemInfo.RNOs != null)
if (DoSubs && rnoLevel < maxRNO && itemInfo.RNOs != null)
{
yOffRight = ChildrenRight.Add(cb, itemInfo.RNOs, XOffset + RnoOffset, YTop, YTop, rnoLevel + 1, maxRNO, formatInfo);
if (ChildrenRight[0].ChildrenAbove.Count > 0)
@ -2530,7 +2548,7 @@ namespace Volian.Print.Library
// Need code to determine if the table will overlap the Right Column if it does then
// use YOffRight rather than yoff
if (itemInfo.Tables != null)
if (DoSubs && itemInfo.Tables != null)
{
bool aerTableOrFigure = itemInfo.Tables[0].FormatStepData.Type.Contains("AER");
// get the first table & see if it is borderless. If borderless, 16bit code removed a
@ -2609,7 +2627,7 @@ namespace Volian.Print.Library
yoff = ChildrenBelow.Add(cb, itemInfo.Cautions, xoff, yoff, yoff, rnoLevel, maxRNO, formatInfo);
savCheckListBottomMost = yoff;
}
if (itemInfo.Steps != null && printsteps)
if (DoSubs && itemInfo.Steps != null && printsteps)
{
if (itemInfo.FormatStepData == null || itemInfo.FormatStepData.Type != "TitleWithTextRight")
if(rnoBefore)