From ba04116c02b29925d79988a5cbeedcf39f9a7eeb Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 29 May 2013 15:01:17 +0000 Subject: [PATCH] Various improvements for IP2 and IP3 --- PROMS/Volian.Print.Library/vlnParagraph.cs | 48 ++++++++++++++-------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index a4e22e25..5923b2dd 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -49,7 +49,9 @@ namespace Volian.Print.Library if (childItemInfo.Notes != null && (childItemInfo.IsCaution || childItemInfo.IsNote)) yoff = Add(cb, childItemInfo.Notes, xoff, yoff, yoffRight, rnoLevel, maxRNO, formatInfo); int? bxIndx = childItemInfo.FormatStepData==null?-1:childItemInfo.FormatStepData.StepLayoutData.STBoxindex; - if (!childItemInfo.IsHigh && (bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt))) + bool boxHLS = false; + + if ((bxIndx != -1 && (bxIndex != bxIndx || childItemInfo.FormatStepData.BoxIt))) { if (childItemInfo.FormatStepData.BoxIt) // this is a boxed HLS { @@ -64,6 +66,7 @@ namespace Volian.Print.Library } else if (bxIndex == null) // First boxed step { + if (childItemInfo.IsHigh) boxHLS = true; box = new vlnBox(); box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; if (box.MyBox != null) @@ -71,29 +74,29 @@ namespace Volian.Print.Library box.YOffset = yoff; int ln = 1; // a format flag determines whether there is a space before the note/caution. if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; - yoff += ln * vlnPrintObject.SixLinesPerInch; + if (boxHLS && !childItemInfo.HasCautionOrNote) yoff += ln * vlnPrintObject.SixLinesPerInch; } } else // Change Box Style { if (bxIndx != null) { - if (box != null) box.Height = yoff - box.YOffset; // new height, with children - box = new vlnBox(); - box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; - int ln = 1; // a format flag determines whether there is a space before the note/caution. - if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; - if (childItemInfo.MixCautionNotesDiffType()) ln += 2; - box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); - yoff += ln * vlnPrintObject.SixLinesPerInch; - } + if (box != null) box.Height = yoff - box.YOffset; // new height, with children + box = new vlnBox(); + box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx]; + int ln = 1; // a format flag determines whether there is a space before the note/caution. + if (childItemInfo.FormatStepData.OneLineBeforeTab) ln++; + if (childItemInfo.MixCautionNotesDiffType()) ln += 2; + box.YOffset = yoff + ((ln - 1) * vlnPrintObject.SixLinesPerInch); + yoff += ln * vlnPrintObject.SixLinesPerInch; + } } bxIndex = bxIndx; } if (childItemInfo is SectionInfo) formatInfo = (childItemInfo as SectionInfo).LocalFormat ?? formatInfo; if (rnoLevel < maxRNO && childItemInfo.RNOs != null) yoff = Math.Max(yoff, yoffRight); - vlnParagraph para = new vlnParagraph(Parent, cb, childItemInfo, xoff, yoff, rnoLevel, maxRNO, formatInfo, null, null); + if (box != null && box.MyParent == null) { box.MyParent = para; @@ -110,6 +113,13 @@ namespace Volian.Print.Library box.Height = yoff - box.YOffset - (1.1F * vlnPrintObject.SixLinesPerInch); box = null; // if doing boxed steps, only do single sibling at a time. } + if (boxHLS) + { + box.YOffset = para.YTop; + box.Height = para.YBottomMost - para.YTop - (1.1F * vlnPrintObject.SixLinesPerInch); + box = null; + } + boxHLS = false; lastChild = childItemInfo; } if (box != null && box.MyBox != null) @@ -1064,6 +1074,7 @@ namespace Volian.Print.Library } AdjustWidth(itemInfo, maxRNO, formatInfo, mytab); AdjustXOffsetForTab(itemInfo, maxRNO, formatInfo, mytab, xMetaAdj); + if (itemInfo.MyHeader != null && itemInfo.MyHeader.Text != null && !doSectTab) yoff += SetHeader(this, cb, itemInfo, formatInfo); float yoffLeft = yoff; @@ -1115,10 +1126,12 @@ namespace Volian.Print.Library vlnText myAsterisk = new vlnText(cb, this, "*", "*", mytab.XOffset - 24, YOffset+4, astFont); PartsLeft.Add(myAsterisk); } - if (itemInfo.IsRNOPart) + if (itemInfo.IsRNOPart && rnoLevel > maxRNO) { - // there may be other places that double space, but this supports it for RNOs (the DoubleRNOspace flag) - if (rnoLevel > maxRNO && itemInfo.FormatStepData.DoubleSpace) yoff = YOffset = yoff + SixLinesPerInch; + // the DoubleSpace & SpaceDouble flags seem redundant. The 2nd line was added for foldout + // line spacing for IP2 foldouts (one example can be found in E-1) + if (itemInfo.FormatStepData.DoubleSpace && itemInfo.FormatStepData.SpaceDouble) yoff = YOffset = yoff + SixLinesPerInch; + if (!itemInfo.FormatStepData.SpaceDouble && itemInfo.MyParent.IsHigh) yoff = YOffset = yoff - SixLinesPerInch; } AddMacros(itemInfo, mytab); if (mytab != null) @@ -1200,7 +1213,7 @@ namespace Volian.Print.Library { Rtf = GetRtf(itemInfo, prefix, suffix); // Need the following with some modifications for WCNCKL format: - if (Rtf.Contains("{Backspace}")) + while (Rtf.Contains("{Backspace}")) { XOffset -= 25; Width += 24; @@ -1333,7 +1346,8 @@ namespace Volian.Print.Library yoff = Math.Max(yoff, yOffRight); // TODO - use RNOSepAfterAER flag too: string tmpRnoSepStr = formatInfo.MyStepSectionPrintData.RNOSepString; - if (rnoLevel < maxRNO && itemInfo.RNOs != null && tmpRnoSepStr != null) + float tmpRnoSepLen = formatInfo.MyStepSectionPrintData.RNOSepLineLength??0; + if (rnoLevel < maxRNO && itemInfo.RNOs != null && (tmpRnoSepStr != null || tmpRnoSepLen != 0)) { vlnParagraph rno = ChildrenRight[0]; vlnParagraph bottomChild = BottomChild;