From 9689726c435c50d63ae02cf95e3c8cb233156e78 Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 24 Feb 2014 17:36:23 +0000 Subject: [PATCH] =?UTF-8?q?Use=20memory=20data=20rather=20than=20database?= =?UTF-8?q?=20for=20finding=20next=20item=20(fixes=20problem=20where=20nex?= =?UTF-8?q?t=20item=20is=20not=20=E2=80=98applicable=E2=80=99=20for=20proc?= =?UTF-8?q?edure=20being=20printed=20Add=20support=20for=20Point=20Beach?= =?UTF-8?q?=20asterisk=20boxes=20(and=20the=20boxes=20bold=20font)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Print.Library/PromsPrinter.cs | 9 +++-- PROMS/Volian.Print.Library/vlnBox.cs | 46 ++++++++++++++++++---- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index a90ec043..3db96201 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -851,14 +851,15 @@ namespace Volian.Print.Library else if(!myItemInfo.MyDocStyle.OptionalSectionContent) PrintTextMessage(cb, "No Section Content", _TextLayer); 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, // 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 { if (sc != null) sp = sc.Section_Pagination; diff --git a/PROMS/Volian.Print.Library/vlnBox.cs b/PROMS/Volian.Print.Library/vlnBox.cs index 776c858d..62767e6e 100644 --- a/PROMS/Volian.Print.Library/vlnBox.cs +++ b/PROMS/Volian.Print.Library/vlnBox.cs @@ -63,6 +63,7 @@ namespace Volian.Print.Library const string BoxAsteriskWithSides1 = " *.* .* .* . . . *.* . .* . . "; // ip2 const string BoxAsteriskWithSides2 = " *. *.*.*. . . *.*. . *. . "; // ip3 const string BoxAsteriskWithSides3 = "*.*.*.*.*.*.*.*.*.*.*.*"; //byr + const string BoxAsteriskWithSides4 = "*.*.*.*.*.*.*.*. .*. . "; // wep2 const string BoxAsteriskTopBottom = "*.*.*. . . .*.*. .*. . "; // fnp const string BoxLineTopBottom = "\x2500.\x2500.\x2500. . . .\x2500.\x2500. .\x2500. . "; // fnp const string BoxAsteriskTopBotton2 = " .*. . . . . . . .*. . "; // Robinson (CPL) @@ -134,7 +135,7 @@ namespace Volian.Print.Library case BoxAsterisk: case BoxAsteriskTopBottom: 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; case BoxLineTopBottom: // fnp note box lineThickness = .6f; @@ -147,8 +148,9 @@ namespace Volian.Print.Library case BoxAsteriskWithSides1: case BoxAsteriskWithSides2: case BoxAsteriskWithSides3: - DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left); - DrawAsteriskSide(cb, yPageStart, yTopMargin, yBottomMargin, top, bottom, left, right); + case BoxAsteriskWithSides4: + DrawAsteriskTopBottom(cb, yPageStart, yTopMargin, yBottomMargin, ref top, ref bottom, left, MyBox.Font); + DrawAsteriskSide(cb, yPageStart, yTopMargin, yBottomMargin, top, bottom, left, right, MyBox.Font); break; default: // For other than thick, thin and double. @@ -168,7 +170,7 @@ namespace Volian.Print.Library 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. // 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); // 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) 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; } - 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. // The vlnBox property, ContainsPageBreak, flags that a break occurred. @@ -280,7 +296,23 @@ namespace Volian.Print.Library 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 - 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: Rtf = GetRtf(MyBox.BXVert, vf);