Revised code to assure setpoint ro's were underlined and non-setpoint ro's were not underlined during printing

Revised code to assure ro's in grids are not colored red during printing
Added code to override Height property of vlnPrintObject class in vlnBox class
Added code to utilize BoxLeftAdj property
Removed blank lines and previous debug code
Added code to assure spaces between note and caution boxes are added when separate box format flag is used
Added code to implement %c token in continue message of Byron/Braidwood formats
Added code to utilize BoxLeftAdj property
Added code to correct underline termination issue involving reference objects and transitions
Changed Height property to virtual to allow overriding in inherited classes
This commit is contained in:
Rich 2014-01-17 16:12:20 +00:00
parent 7793bd2397
commit 750c8df895
5 changed files with 38 additions and 15 deletions

View File

@ -1179,10 +1179,11 @@ namespace Volian.Controls.Library
afterRO = Regex.Replace(afterRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); // Remove Comments
// Underline all ROs, values and Units
if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo)
if (isSetpoint && _MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo)
{
// TO DO: Need to check if step text is already underlined
rtnstr = @"\ul " + rtnstr + @"\ulnone ";
if ((_MyItemInfo.FormatStepData.Font.Style & E_Style.Underline) == 0)
rtnstr = @"\ul " + rtnstr + @"\ulnone ";
}
// UpcaseAllRoUnits - Uppercases ALL ROs units everywhere.
@ -1195,7 +1196,7 @@ namespace Volian.Controls.Library
// Caps ROs anywhere if no lower case text follows
// and an upper case letter immediately precedes the RO.
if (isSetpoint && _MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapSPIfLastLower &&
!Regex.IsMatch(afterRO, @".*(?<!\\)[a-z].*") && char.IsUpper(LastAlpha(beforeRO)))
{

View File

@ -183,6 +183,11 @@ namespace Volian.Print.Library
float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1];
string str = MyFlexGrid.GetCellRTFString(r, c) ?? string.Empty;
if (str.Contains(@"\cf"))
{
str = System.Text.RegularExpressions.Regex.Replace(str, @"\\cf[0-9]\\", @"\");
str = System.Text.RegularExpressions.Regex.Replace(str, @"\\cf[0-9] ", @"");
}
DisplayText dt = new DisplayText(MyFlexGrid.GetMyItemInfo(), str, false);
str = dt.StartText;
using (StepRTB myRTB = new StepRTB())

View File

@ -28,6 +28,16 @@ namespace Volian.Print.Library
}
// the following two fields are used if 'boxed' step, thus
// no 'Box' was defined in format file.
public override float Height
{
get
{
if (_Height == 0)
_Height = GetParagraphHeight(MyContentByte, IParagraph, Width);
return _Height;
}
set { _Height = value; }
}
public string DefBox = null;
public float DefEnd = 0;
@ -69,7 +79,12 @@ namespace Volian.Print.Library
float top = CalculateYOffset(yPageStart, yTopMargin) - (7*MyPageHelper.YMultiplier);
float bottom = top - (Height * MyPageHelper.YMultiplier);
float left = (float)((MyBox.Start ?? 0) + MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin);
float myBoxLeftAdj = 0;
if (MyParent.MyItemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
myBoxLeftAdj = float.Parse(MyParent.MyItemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
left += myBoxLeftAdj;
float right = (float)MyParent.MyItemInfo.MyDocStyle.Layout.LeftMargin + (float)(MyBox.End ?? DefEnd);
right += myBoxLeftAdj;
iTextSharp.text.Color boxColor = new iTextSharp.text.Color(PrintOverride.OverrideBoxColor(System.Drawing.Color.Black));
cb.SetColorStroke(boxColor);
_MyPageHelper.MyGaps.Add(top, top - Height);

View File

@ -129,7 +129,6 @@ namespace Volian.Print.Library
// into the box code. Without this check, none of the box code is run. This caused a problem
// for VCS where two different type notes where not getting separate boxes.
bool doSeparateBoxHdrChg = false;
if (childItemInfo.ItemID == 50 || childItemInfo.ItemID == 53) Console.WriteLine("jcb");
if (childItemInfo.MyPrevious != null && childItemInfo.MyHeader != null && childItemInfo.MyPrevious.MyHeader != null
&& childItemInfo.MyHeader.CleanText != childItemInfo.MyPrevious.MyHeader.CleanText) doSeparateBoxHdrChg = true;
@ -174,7 +173,7 @@ namespace Volian.Print.Library
box.Height = yoff - box.YOffset; // new height, with children
if (childItemInfo.MyHeader != null && childItemInfo.MyPrevious != null
&& ((childItemInfo.MyPrevious.IsCaution && childItemInfo.IsCaution) ||
(childItemInfo.MyPrevious.IsNote && childItemInfo.IsNote)))
(childItemInfo.MyPrevious.IsNote && childItemInfo.IsNote) || childItemInfo.FormatStepData.SeparateBox))
yoff += vlnPrintObject.SixLinesPerInch * 2;
}
box = new vlnBox();
@ -208,7 +207,6 @@ namespace Volian.Print.Library
// if doing the component list (FNP), keep track of the bottom most columns' data
// so this can be returned after the row is done.
tableBottomMost = Math.Max(tableBottomMost, para.YBottomMost);
if (box != null && box.MyParent == null)
{
box.MyParent = para;
@ -255,7 +253,6 @@ namespace Volian.Print.Library
// after the last child substep when doing a Component table row (FNP Component Lists), set the value
// of the yoff to be the bottom most line in the table.
if (didComponentTableRow) yoff = tableBottomMost;
return yoff;
}
public float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
@ -962,6 +959,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.CleanTextNoSymbols.Trim(" .".ToCharArray()));
if (myMsg.IndexOf(@"%c") > -1)
myMsg = myMsg.Replace(@"%c", " ");
if (!PageBreakOnStep)
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);
else
@ -1340,6 +1339,8 @@ namespace Volian.Print.Library
}
public vlnParagraph(vlnParagraph parent, PdfContentByte cb, ItemInfo itemInfo, float xoff, float yoff, int rnoLevel, int maxRNO, FormatInfo formatInfo, string prefix, string suffix, float yoffRightParent)
{
if (itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj != null)
_MyBoxLeftAdj = float.Parse(itemInfo.ActiveFormat.MyStepSectionLayoutData.BoxLeftAdj);
ShowSectionTitles = formatInfo.PlantFormat.FormatData.SectData.StepSectionData.StepSectionLayoutData.ShowSectionTitles || itemInfo.MyDocStyle.ShowSectionTitles;
if (itemInfo.IsSection && itemInfo.ActiveSection.DisplayText.ToUpper().Contains("<NO TITLE>") && !itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.PrintNoTitle) ShowSectionTitles = false;
@ -2385,11 +2386,11 @@ namespace Volian.Print.Library
{
foreach (UnderlineTerminate ut in utl)
{
if (rtf.Contains(ut.Text))
MatchCollection mc = Regex.Matches(rtf, "(?<!Link|ReferencedObject|Transition|TransitionRange)" + ut.Text);
if (mc.Count > 0)
{
int indxC = rtf.IndexOf(ut.Text);
rtf = rtf.Substring(0, indxC) + @"\ulnone " + rtf.Substring(indxC);
break;
Match m = mc[mc.Count - 1];
rtf = rtf.Substring(0, m.Index) + @"\ulnone " + rtf.Substring(m.Index);
}
}
}
@ -2402,6 +2403,7 @@ namespace Volian.Print.Library
get { return _XOffsetBox; }
set { _XOffsetBox = value; }
}
private float _MyBoxLeftAdj = 0;
private float SetHeader(vlnParagraph para, PdfContentByte cb, ItemInfo itemInfo, FormatInfo formatInfo)
{
float xoff = (float)itemInfo.MyDocStyle.Layout.LeftMargin;
@ -2419,7 +2421,7 @@ namespace Volian.Print.Library
if (bx.TabPos > 0)
xoff += (float)bx.TabPos; // xoff starts as left margin
else
xoff += (float)((bx.TxtStart + XOffsetBox + (bx.TxtWidth / 2)) - (hdrWidth / 2)); // xoff starts as left margin
xoff += (float)((bx.TxtStart + _MyBoxLeftAdj + XOffsetBox + (bx.TxtWidth / 2)) - (hdrWidth / 2)); // xoff starts as left margin
}
else if (formatInfo.MyStepSectionLayoutData.Separator.Location > 0)
xoff = XOffset + AdjustToCharPosition((float)((para.Width - hdrWidth) / formatInfo.MyStepSectionLayoutData.Separator.Location), itemInfo.MyHeader.MyFont.CPI);
@ -2428,7 +2430,7 @@ namespace Volian.Print.Library
}
else
xoff = XOffset; // XOffset has left margin included
vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff, YOffset, itemInfo.MyHeader.MyFont);
vlnHeader myHeader = new vlnHeader(this, cb, itemInfo.MyHeader.Text, itemInfo.MyHeader.CleanText.TrimStart(" ".ToCharArray()), xoff + _MyBoxLeftAdj, YOffset, itemInfo.MyHeader.MyFont);
PartsAbove.Add(myHeader);
return myHeader.Height + (!MyItemInfo.MyDocStyle.SpecialStepsFoldout || (MyItemInfo.MyDocStyle.ExtraLineHeader && (MyItemInfo.IsCaution || MyItemInfo.IsNote)) ? MyItemInfo.FormatStepData.SpaceIn ? SixLinesPerInch : 0 : 0);
}
@ -2794,7 +2796,7 @@ namespace Volian.Print.Library
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + tabWidth + XOffsetBox;
}
else
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + tabWidth + XOffsetBox;
XOffset = (float)itemInfo.MyDocStyle.Layout.LeftMargin + (float)bx.TxtStart + _MyBoxLeftAdj + tabWidth + XOffsetBox;
if (myTab != null) myTab.XOffset = XOffset - tabWidth;
}
//else if (itemInfo.IsRNOPart && !((ItemInfo)itemInfo.ActiveParent).IsHigh)

View File

@ -97,7 +97,7 @@ namespace Volian.Print.Library
set { _Width = value; }
}
protected float _Height;
public float Height
public virtual float Height
{
get
{