Use memory data rather than database for finding next item (fixes problem where next item is not ‘applicable’ for procedure being printed

Add support for Point Beach asterisk boxes (and the boxes bold font)
This commit is contained in:
Kathy Ruffing 2014-02-24 17:36:23 +00:00
parent 154dbeabb8
commit 9689726c43
2 changed files with 44 additions and 11 deletions

View File

@ -851,14 +851,15 @@ namespace Volian.Print.Library
else if(!myItemInfo.MyDocStyle.OptionalSectionContent) else if(!myItemInfo.MyDocStyle.OptionalSectionContent)
PrintTextMessage(cb, "No Section Content", _TextLayer); PrintTextMessage(cb, "No Section Content", _TextLayer);
SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default SectionConfig.SectionPagination sp = SectionConfig.SectionPagination.Separate; // always the default
if ( section.NextItemCount > 0) ItemInfo nxtItem = section.GetNextItem();
if (nxtItem != null)
{ {
SectionInfo tmpii = SectionInfo.Get(section.NextItem.ItemID);
// if this section & the next section are not accessory pages, see if there is continuous pagination, // if this section & the next section are not accessory pages, see if there is continuous pagination,
// i.e. no page break between them. // i.e. no page break between them.
if (section.IsStepSection && tmpii.IsStepSection) if (section.IsStepSection && nxtItem.IsStepSection)
{ {
SectionConfig sc = tmpii.SectionConfig; SectionInfo si = nxtItem as SectionInfo;
SectionConfig sc = si.SectionConfig;
try try
{ {
if (sc != null) sp = sc.Section_Pagination; if (sc != null) sp = sc.Section_Pagination;

View File

@ -63,6 +63,7 @@ namespace Volian.Print.Library
const string BoxAsteriskWithSides1 = " *.* .* .* . . . *.* . .* . . "; // ip2 const string BoxAsteriskWithSides1 = " *.* .* .* . . . *.* . .* . . "; // ip2
const string BoxAsteriskWithSides2 = " *. *.*.*. . . *.*. . *. . "; // ip3 const string BoxAsteriskWithSides2 = " *. *.*.*. . . *.*. . *. . "; // ip3
const string BoxAsteriskWithSides3 = "*.*.*.*.*.*.*.*.*.*.*.*"; //byr const string BoxAsteriskWithSides3 = "*.*.*.*.*.*.*.*.*.*.*.*"; //byr
const string BoxAsteriskWithSides4 = "*.*.*.*.*.*.*.*. .*. . "; // wep2
const string BoxAsteriskTopBottom = "*.*.*. . . .*.*. .*. . "; // fnp const string BoxAsteriskTopBottom = "*.*.*. . . .*.*. .*. . "; // fnp
const string BoxLineTopBottom = "\x2500.\x2500.\x2500. . . .\x2500.\x2500. .\x2500. . "; // fnp const string BoxLineTopBottom = "\x2500.\x2500.\x2500. . . .\x2500.\x2500. .\x2500. . "; // fnp
const string BoxAsteriskTopBotton2 = " .*. . . . . . . .*. . "; // Robinson (CPL) const string BoxAsteriskTopBotton2 = " .*. . . . . . . .*. . "; // Robinson (CPL)
@ -134,7 +135,7 @@ namespace Volian.Print.Library
case BoxAsterisk: case BoxAsterisk:
case BoxAsteriskTopBottom: case BoxAsteriskTopBottom:
case BoxAsteriskTopBotton2: case BoxAsteriskTopBotton2:
DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left); DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left, MyBox.Font);
break; break;
case BoxLineTopBottom: // fnp note box case BoxLineTopBottom: // fnp note box
lineThickness = .6f; lineThickness = .6f;
@ -147,8 +148,9 @@ namespace Volian.Print.Library
case BoxAsteriskWithSides1: case BoxAsteriskWithSides1:
case BoxAsteriskWithSides2: case BoxAsteriskWithSides2:
case BoxAsteriskWithSides3: case BoxAsteriskWithSides3:
DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left); case BoxAsteriskWithSides4:
DrawAsteriskSide(cb, yPageStart, yTopMargin, yBottomMargin, top, bottom, left, right); DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left, MyBox.Font);
DrawAsteriskSide(cb, yPageStart, yTopMargin, yBottomMargin, top, bottom, left, right, MyBox.Font);
break; break;
default: default:
// For other than thick, thin and double. // For other than thick, thin and double.
@ -168,7 +170,7 @@ namespace Volian.Print.Library
return yPageStart; return yPageStart;
} }
private void DrawAsteriskTopBottom(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left) private void DrawAsteriskTopBottom(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, ref float top, ref float bottom, float left, VE_Font vef)
{ {
// this box is not drawn, it is a series of asterisks drawn above and below text. // this box is not drawn, it is a series of asterisks drawn above and below text.
// For this box, there are no vertical edges (RGE uses this box type) // For this box, there are no vertical edges (RGE uses this box type)
@ -179,7 +181,21 @@ namespace Volian.Print.Library
bottom = top - (Height * MyPageHelper.YMultiplier); bottom = top - (Height * MyPageHelper.YMultiplier);
// create a new font without any styles such as underline. // create a new font without any styles such as underline.
VE_Font vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, E_Style.None, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI); E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf = null;
bool UseBoxFont = false;
try
{
UseBoxFont = MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox;
}
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
{
}
if (UseBoxFont)
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
else
vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
// To find the length of the line, account for the length of the upper right corner also (BXURC) // To find the length of the line, account for the length of the upper right corner also (BXURC)
int urcLen = MyBox.BXHorz[MyBox.BXHorz.Length - 1] == ' ' && MyBox.BXURC[0] == ' ' ? 1 : MyBox.BXURC.Length; int urcLen = MyBox.BXHorz[MyBox.BXHorz.Length - 1] == ' ' && MyBox.BXURC[0] == ' ' ? 1 : MyBox.BXURC.Length;
@ -258,7 +274,7 @@ namespace Volian.Print.Library
return w; return w;
} }
private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right) private void DrawAsteriskSide(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin, float top, float bottom, float left, float right, VE_Font vef)
{ {
// set the top & bottom of sides. If there is a page break in the middle of box, adjust these. // set the top & bottom of sides. If there is a page break in the middle of box, adjust these.
// The vlnBox property, ContainsPageBreak, flags that a break occurred. // The vlnBox property, ContainsPageBreak, flags that a break occurred.
@ -280,7 +296,23 @@ namespace Volian.Print.Library
if (bottom < yBottomMargin) bottom = yBottomMargin; if (bottom < yBottomMargin) bottom = yBottomMargin;
float height = (SixLinesPerInch * MyPageHelper.YMultiplier) + 4; // just add a little on so that height is a little bigger than character float height = (SixLinesPerInch * MyPageHelper.YMultiplier) + 4; // just add a little on so that height is a little bigger than character
VE_Font vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, E_Style.None, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
// create a new font without any styles such as underline.
E_Style es = ((vef.Style & E_Style.Bold) == E_Style.Bold) ? E_Style.Bold : E_Style.None;
// if the box has a font, use it - otherwise use this item info's font
VE_Font vf = null;
bool UseBoxFont = false;
try
{
UseBoxFont = MyParent.MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.StepSectionPrintData.DiffContActBox;
}
catch // done this way in case one of the format properties is null in the previous statement, UseBoxFont will be false.
{
}
if (UseBoxFont)
vf = new VE_Font(vef.Family, (int)vef.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
else
vf = new VE_Font(MyParent.MyItemInfo.FormatStepData.Font.Family, (int)MyParent.MyItemInfo.FormatStepData.Font.Size, es, (float)MyParent.MyItemInfo.FormatStepData.Font.CPI);
// Left side first: // Left side first:
Rtf = GetRtf(MyBox.BXVert, vf); Rtf = GetRtf(MyBox.BXVert, vf);