From 7bc0e8846e404086ec0d7c935469c2e2a01ee905 Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 1 Jul 2013 17:41:04 +0000 Subject: [PATCH] Added Property yVeryBottom Changed the format of the Verical Ruler in the Debug PDF Layer to start at the top margin and extend to the bottom margin. Partial fix of the logic to display an XY Plot. --- .../Volian.Print.Library/VlnSvgPageHelper.cs | 12 ++- PROMS/Volian.Print.Library/vlnParagraph.cs | 82 ++++++++++++------- PROMS/XYPlots/frmXYPlot.cs | 2 + 3 files changed, 62 insertions(+), 34 deletions(-) diff --git a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs index 9822fe69..d4f78fd7 100644 --- a/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs +++ b/PROMS/Volian.Print.Library/VlnSvgPageHelper.cs @@ -182,13 +182,15 @@ namespace Volian.Print.Library private void DrawRuler(PdfContentByte cb) { if (DebugLayer == null) return; + Layout layout = MySection.MyDocStyle.Layout; cb.SaveState(); cb.BeginLayer(DebugLayer); float x = (cb.PdfWriter.PageSize.Left + cb.PdfWriter.PageSize.Right) / 2; cb.SetLineWidth(.1F); cb.SetColorStroke(new Color(System.Drawing.Color.CornflowerBlue)); - float yTop = 648; - float yBottom = 48; + float yTop = (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin); + float yBottom = (float)(cb.PdfWriter.PageSize.Height - (layout.TopMargin + layout.PageLength)); + Console.WriteLine("'{0}',{1},{2}", MySection.MyDocStyle.Name, yTop, yBottom); cb.MoveTo(x, yTop); cb.LineTo(x, yBottom); int i = 0; @@ -197,9 +199,11 @@ namespace Volian.Print.Library float w = 10; if (i % 10 == 0) w = 30; else if (i % 5 == 0) w = 20; + cb.SetLineWidth(w / 30); i++; cb.MoveTo(x - w, y); cb.LineTo(x, y); + cb.Stroke(); } i = 0; for (float y = yTop; y >= yBottom; y -= 10.1F) @@ -207,11 +211,13 @@ namespace Volian.Print.Library float w = 10; if (i % 10 == 0) w = 30; else if (i % 5 == 0) w = 20; + cb.SetLineWidth(w / 30); i++; cb.MoveTo(x + w, y-1); cb.LineTo(x, y-1); + cb.Stroke(); } - Layout layout = MySection.MyDocStyle.Layout; + cb.SetLineWidth(.1F); cb.Rectangle((float)layout.LeftMargin, (float)(cb.PdfWriter.PageSize.Height - layout.TopMargin), (float)layout.PageWidth - (float)layout.LeftMargin, (float)-layout.PageLength); float yRuler = 612; cb.MoveTo(0, yRuler); diff --git a/PROMS/Volian.Print.Library/vlnParagraph.cs b/PROMS/Volian.Print.Library/vlnParagraph.cs index 81c07d28..4f38c4a5 100644 --- a/PROMS/Volian.Print.Library/vlnParagraph.cs +++ b/PROMS/Volian.Print.Library/vlnParagraph.cs @@ -82,22 +82,22 @@ namespace Volian.Print.Library { if (bxIndx != null) { - if (box != null) - { - box.Height = yoff - box.YOffset; // new height, with children + if (box != null) + { + 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))) yoff += vlnPrintObject.SixLinesPerInch * 2; - } - 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; } + 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; } @@ -905,6 +905,26 @@ namespace Volian.Print.Library return bottom; } } + public float YVeryBottom + { + get + { + float bottom = YOffset + Height; + if (ChildrenBelow != null) + foreach (vlnParagraph child in ChildrenBelow) + bottom = Math.Max(child.YVeryBottom, bottom); + if (ChildrenLeft != null) + foreach (vlnParagraph child in ChildrenLeft) + bottom = Math.Max(child.YVeryBottom, bottom); + if (ChildrenRight != null) + foreach (vlnParagraph child in ChildrenRight) + bottom = Math.Max(child.YVeryBottom, bottom); + if (PartsBelow != null) + foreach (vlnPrintObject part in PartsBelow) + bottom = Math.Max(part.YBottom, bottom); + return bottom; + } + } public float YBottomText { get @@ -1377,28 +1397,28 @@ namespace Volian.Print.Library // checkoff - this was added for shearon harris: if (!(co.NotOnEmpty && itemInfo.MyContent.Text.Replace(@"\u160?"," ").TrimEnd() == "")) { - float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; - // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of - // spaces in the tab. - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) - { - if (mytab != null) - xloc_co = mytab.XOffset; - else - xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. - } + float xloc_co = (float)itemInfo.MyDocStyle.Layout.LeftMargin; + // if the format has 'SkipSpaces', look at the tab, and back up the macros to the number of + // spaces in the tab. + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.SkipSpaces) + { + if (mytab != null) + xloc_co = mytab.XOffset; else - { - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) - xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; - if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != null) - { - float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation; - xloc_co = XOffset + (relX > 0 ? Width : 0) + relX; - } - } - PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); + xloc_co = XOffset; //there's no tab - put checkoff at step's xoff. Macro should back up from step's x. } + else + { + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation != null) + xloc_co += (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.XLocation; + if (formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation != null) + { + float relX = (float)formatInfo.PlantFormat.FormatData.ProcData.CheckOffData.RelXLocation; + xloc_co = XOffset + (relX > 0 ? Width : 0) + relX; + } + } + PartsRight.Add(new vlnMacro(xloc_co, yForCheckoff, co.Macro)); + } } float yOffRight = yoff; float RnoOffset = ToInt(formatInfo.MyStepSectionLayoutData.ColRTable, maxRNO); diff --git a/PROMS/XYPlots/frmXYPlot.cs b/PROMS/XYPlots/frmXYPlot.cs index 76b5463b..a98497ab 100644 --- a/PROMS/XYPlots/frmXYPlot.cs +++ b/PROMS/XYPlots/frmXYPlot.cs @@ -21,6 +21,8 @@ namespace XYPlots public frmXYPlot(string title,string xyPlot) { InitializeComponent(); + int pstart = xyPlot.IndexOf("<