logic for NullBox, Bottom continue message font fix, remove symbols from top continue message step number, line spacing fix, change bar fix, StepTypeColOverride logic, StepTypeWidthOverride logic

This commit is contained in:
John Jenko 2011-11-21 20:52:52 +00:00
parent 056a4a9e04
commit babe5482b2

View File

@ -59,10 +59,13 @@ namespace Volian.Print.Library
{
box = new vlnBox();
box.MyBox = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
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 (box.MyBox != null)
{
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;
}
}
else // Change Box Style
{
@ -95,9 +98,9 @@ namespace Volian.Print.Library
box = null; // if doing boxed steps, only do single sibling at a time.
}
}
if (box != null)
if (box != null && box.MyBox != null)
{
if (box != null) box.Height = yoff - box.YOffset; // new height, with children
box.Height = yoff - box.YOffset; // new height, with children
yoff += 2 * vlnPrintObject.SixLinesPerInch;
}
return yoff;
@ -346,7 +349,7 @@ namespace Volian.Print.Library
Console.WriteLine("**** BOTTOM CONTINUE MESSAGE NOT CODED*****");
break;
}
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
MyPageHelper.BottomMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Bottom.Margin ?? 0, msg_yLocation, docstyle.Continue.Bottom.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
cb.PdfDocument.NewPage();
DebugText.WriteLine("Paginate2");
@ -364,8 +367,8 @@ namespace Volian.Print.Library
{
yPageStart -= 2 * SixLinesPerInch;// Allow two lines for top continue message
if (myMsg.IndexOf(@"%d") > -1)
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanText.Trim(" .".ToCharArray()));
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
myMsg = myMsg.Replace(@"%d", MyItemInfo.MyHLS.MyTab.CleanTextNoSymbols.Trim(" .".ToCharArray()));
MyPageHelper.TopMessage = new vlnText(cb, this, myMsg, myMsg, docstyle.Layout.LeftMargin + XOffsetBox + docstyle.Continue.Top.Margin ?? 0, yTopMargin + 0.1F, docstyle.Continue.Top.Font);// MyItemInfo.ActiveFormat.PlantFormat.FormatData.Font);
}
MyPageHelper.YMultiplier = 1;
break;
@ -872,6 +875,10 @@ namespace Volian.Print.Library
MyPageHelper.MyParagraphs.Add(itemInfo.ItemID, this);
MyItemInfo = itemInfo;
XOffset = xoff;
int extra = (MyItemInfo.FormatStepData == null) ? 0 : MyItemInfo.FormatStepData.StepLayoutData.STExtraSpace ?? 0;
//if (extra > 0)
// Console.WriteLine("here");
yoff += extra;
YTopMost = YOffset = yoff;
vlnTab mytab = null;
bool doSectTab = false;
@ -1148,6 +1155,12 @@ namespace Volian.Print.Library
ChangeBarData cbd = formatInfo.PlantFormat.FormatData.ProcData.ChangeBarData;
float cols = formatInfo.MyStepSectionLayoutData.ColS ?? 0;
float colr = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
// FixedChangeColumn + - Column location for change bars
// 0 - Separate AER and RNO change bars to the right of the text
// -10 to -1 - Change bars on left (specify # of columns from the text)
// <-10 - AER change bars on the left and RNO change bars on the right.
// FixedAERChangeColumn overrides the -5 default setting in chgbar.c, value is converted to a negative by the code
float col = (cbd.AbsoluteFixedChangeColumn) ?
((cbd.FixedAERChangeColumn ?? 0) > 0) ?
(xoff > (cols + colr + COL_WID_ADJ)) ?
@ -1186,7 +1199,14 @@ namespace Volian.Print.Library
float cols = formatInfo.MyStepSectionLayoutData.ColS ?? 0;
int colr = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO);
// if this is a caution or note, put the change bar to the right of the text:
if (paragraph.MyItemInfo.IsCaution || paragraph.MyItemInfo.IsNote && fixedChgCol < -10) return -fixedChgCol;
//if ((paragraph.MyItemInfo.IsCaution || paragraph.MyItemInfo.IsNote) && fixedChgCol < -10) return -fixedChgCol;
if ((fixedChgCol==0))// && paragraph.MyItemInfo.IsCaution || paragraph.MyItemInfo.IsNote)
{
float rightEdge = (paragraph.XOffset + paragraph.Width + 5);
rightEdge-=(float)paragraph.MyItemInfo.MyDocStyle.Layout.LeftMargin;
rightEdge = rightEdge/paragraph.MyItemInfo.FormatStepData.Font.CharsToTwips;
return (int)rightEdge;
}
if (fixedChgCol < -10 || fixedChgCol >= 0)
return ((fixedChgCol > 0) ? fixedChgCol :
(fixedChgCol == 0) ? (int)c + 1 :
@ -1460,45 +1480,100 @@ namespace Volian.Print.Library
}
int typ = ((int)itemInfo.MyContent.Type) % 10000;
int? bxIndx = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex;
float? colOvrd = formatInfo.PlantFormat.FormatData.StepDataList[typ].StepTypeColOverride;
//if (colOvrd != null)
//{
// XOffset = (float)colOvrd -(float)itemInfo.MyDocStyle.Layout.LeftMargin;// 16-bit code subtracted the left margin
// //XOffset += tabWidth;
// //float x = (float)(colOvrd) - (float)itemInfo.MyDocStyle.Layout.LeftMargin;// 16-bit code subtracted the left margin
// //float xoff = x - XOffset;
// //XOffset = x;
// //if (myTab != null) myTab.XOffset += xoff;
// //return;
//}
if (bxIndx != null)
{
Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox;
if (bx == null)
{
//float xoff = 0;
if (colOvrd != null)
{
// 16-bit code subtracted the left margin
//xoff = ((float)colOvrd - (float)itemInfo.MyDocStyle.Layout.LeftMargin) - XOffset;
//XOffset += xoff;
//if (myTab != null) myTab.XOffset += xoff;
//xoff = MyParent.XOffset - myTab.XOffset;
//XOffset += xoff;
XOffset = (float)colOvrd;
if (myTab != null)
{
myTab.XOffset += (MyParent.XOffset - myTab.XOffset);
//myTab.XOffset += xoff;
}
return;
}
else
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox;
}
else
//if (bx != null)
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox;
if (myTab != null) myTab.XOffset = XOffset - tabWidth;
}
else if (itemInfo.IsHigh)
{
float x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
float xoff = x - XOffset;
float x = 0;
float xoff = 0;
if (colOvrd != null)
{
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)colOvrd;
//xoff = (float)colOvrd;
//XOffset += xoff;
//if (myTab != null) myTab.XOffset += xoff;
}
else
{
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
}
//float x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
//float xoff = x - XOffset;
xoff = x - XOffset;
// ColSByLevel will specify the column in which the High Level Step starts with
// respect to the overall level calculation based on sections & meta-sections.
// Only a few of the single column formats use this: WCN1, CAL1, RGEBCK
if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel
&& itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
&& !itemInfo.MyDocStyle.CancelSectTitle
&& !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel))
{
int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel();
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent;
xoff = x - XOffset;
if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList;
if (jstlst.Count > 0)
if (formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.TieTabToLevel
&& itemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles
&& !itemInfo.MyDocStyle.CancelSectTitle
&& !(itemInfo.MyDocStyle.SpecialStepsFoldout && itemInfo.MyDocStyle.UseColSByLevel))
{
float leftJustifyTabSize = jstlst[indxLevel % jstlst.Count].Size ?? 0;
XOffset = myTab.XOffset + leftJustifyTabSize;
int indxLevel = itemInfo.PrintLevel + itemInfo.CurrentSectionLevel();
float colsbylevel = (float)formatInfo.PlantFormat.FormatData.SectData.MetaSectionList[indxLevel % formatInfo.PlantFormat.FormatData.SectData.MetaSectionList.Count].ColSByLevel;
float seclvlindent = colsbylevel - (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS + seclvlindent;
xoff = x - XOffset;
if (myTab != null) myTab.XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + colsbylevel;
LeftJustifyList jstlst = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.LeftJustifyList;
if (jstlst.Count > 0)
{
float leftJustifyTabSize = jstlst[indxLevel % jstlst.Count].Size ?? 0;
XOffset = myTab.XOffset + leftJustifyTabSize;
}
else
XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel;
}
//else
//{
// x = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ColS;
//}
//xoff = x - XOffset;
else
XOffset = myTab.XOffset + (myTab.Text.Length * (float)itemInfo.FormatStepData.Font.CPI) - colsbylevel;
}
else
{
XOffset += xoff;
if (myTab != null) myTab.XOffset += xoff;
}
{
XOffset += xoff;
if (myTab != null) myTab.XOffset += xoff;
}
}
else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh)
{
@ -1540,15 +1615,44 @@ namespace Volian.Print.Library
}
return retval;
}
private static int CurrentSectionLevel(ItemInfo itemInfo)
{
int retval = 0;
SectionInfo si = itemInfo.MyActiveSection as SectionInfo;
if ((si != null && si.TrueSectionNum()) || (itemInfo.ActiveSection.MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_TreatAsTrueSectNum) == E_DocStructStyle.DSS_TreatAsTrueSectNum)
{
ItemInfo sec = itemInfo.MyActiveSection;
while (sec != null && sec.IsSection)
{
SectionConfig sc = sec.MyConfig as SectionConfig;
if (sc != null && sc.SubSection_AutoIndent != "N") retval++;
sec = sec.MyParent as SectionInfo;
}
}
return retval;
}
public void AdjustWidth(ItemInfo itemInfo, int maxRNO, FormatInfo formatInfo, vlnTab myTab)
{
float? widOvrd = itemInfo.FormatStepData == null ? null : itemInfo.FormatStepData.StepTypeWidthOverride;
if (widOvrd != null)
{
Width = (float)widOvrd;
return;
}
float tabWidth = (myTab == null) ? 0 : myTab.Width;
int typ = ((int)itemInfo.MyContent.Type) % 10000;
int? bxIndx = itemInfo.IsStep ? formatInfo.PlantFormat.FormatData.StepDataList[typ].StepLayoutData.STBoxindex : null;
if (bxIndx != null)
{
Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
Width = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth; // add 1 to get it to wrap like 16Bit
if (bx == null)
{
// NOT SURE IF WE NEED TO TEST FOR THE NULLBOX FORMAT FLAG, MAYBE "bx == null" IS THE SAME THING
//if (formatInfo.MyStepSectionLayoutData.NullBox)
Width = (float)formatInfo.MyStepSectionLayoutData.WidT - tabWidth;
}
else
Width = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth; // add 1 to get it to wrap like 16Bit
}
else if (itemInfo.IsHigh)
{