Print Library, Svg Library, Utils Library, XYPlots

This commit is contained in:
2026-07-24 13:36:46 -04:00
parent 06c3136566
commit f67d37801a
68 changed files with 12173 additions and 16618 deletions
+27 -76
View File
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library;
@@ -10,45 +8,26 @@ namespace Volian.Print.Library
{
public class vlnChangeBarMessage
{
private float _ParentX;
public float ParentX
{
get { return _ParentX; }
set { _ParentX = value; }
}
private string _Message;
public string Message
{
get { return _Message; }
set { _Message = value; }
}
private static int _UniqueMessageId = 0;
public float ParentX { get; set; }
public string Message { get; set; }
private static int _UniqueMessageId = 0;
public static int UniqueMessageId
{
get { return vlnChangeBarMessage._UniqueMessageId++; }
set { vlnChangeBarMessage._UniqueMessageId = value; }
get { return _UniqueMessageId++; }
set { _UniqueMessageId = value; }
}
private int _MessageId = UniqueMessageId;
public int MessageId
public int MessageId { get; set; } = UniqueMessageId;
public vlnChangeBarMessage(float parentx, string msg)
{
get { return _MessageId; }
set { _MessageId = value; }
}
public vlnChangeBarMessage(float parentx, string msg)
{
_ParentX = parentx;
_Message = msg;
ParentX = parentx;
Message = msg;
}
}
public partial class vlnChangeBar : vlnPrintObject
{
private bool _HasChangeBar;
public bool HasChangeBar
{
get { return _HasChangeBar; }
set { _HasChangeBar = value; }
}
protected float _YChangeBarBottom;
public bool HasChangeBar { get; set; }
protected float _YChangeBarBottom;
public float YChangeBarBottom
{
get
@@ -62,36 +41,15 @@ namespace Volian.Print.Library
_Height = _YOffset - _YChangeBarBottom;
}
}
private SortedDictionary<float, vlnChangeBarMessage> _Messages;
public SortedDictionary<float, vlnChangeBarMessage> Messages
{
get { return _Messages; }
set { _Messages = value; }
}
private int _MessageAlignment;
public int MessageAlignment
{
get { return _MessageAlignment; }
set { _MessageAlignment = value; }
}
private float _YExtendLine = 4.75F;
public float YExtendLine
{
get { return _YExtendLine; }
set {_YExtendLine = value; }
}
public float YChangeBarBottomExtend
{
get {return YChangeBarBottom - YExtendLine; }
}
private bool _BottomIsTable = false;
public bool BottomIsTable
{
get { return _BottomIsTable; }
set { _BottomIsTable = value; }
}
private bool _IsRev;
private bool _MsgAtTop; // flags that message should be drawn at top of change bar
public SortedDictionary<float, vlnChangeBarMessage> Messages { get; set; }
public int MessageAlignment { get; set; }
public float YExtendLine { get; set; } = 4.75F;
public float YChangeBarBottomExtend => YChangeBarBottom - YExtendLine;
public bool BottomIsTable { get; set; } = false;
private readonly bool _IsRev;
private readonly bool _MsgAtTop; // flags that message should be drawn at top of change bar
public vlnChangeBar(PdfContentByte cb, vlnParagraph parent, float xoff, float yoff, int msgAlignment, bool isRev, bool msgAtTop)
{
// for grids, a y adjustment is made to match 16bit output, see the variable 'GridTopAdjust'. Take this
@@ -113,7 +71,7 @@ namespace Volian.Print.Library
{
// see if any of children don't have changebar
if ((vpo as vlnRNOSeparator).ExtendChangeBar)
_YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier;
YExtendLine = (vpo.Height + vpo.YOffset - ((scale * parent.Height) + parent.YOffset)) * MyPageHelper.YMultiplier;
}
}
foreach (vlnPrintObject vph in parent.PartsAbove)
@@ -152,13 +110,10 @@ namespace Volian.Print.Library
}
}
}
_MessageAlignment = msgAlignment;
MessageAlignment = msgAlignment;
}
public override string ToString()
{
return string.Format("vlnChangeBar: X={0} Y={1} H={2} B={3} ID={4}", XOffset, YOffset, Height, YChangeBarBottom, MyParent.MyItemInfo.ItemID);
}
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
public override string ToString() => string.Format("vlnChangeBar: X={0} Y={1} H={2} B={3} ID={4}", XOffset, YOffset, Height, YChangeBarBottom, MyParent.MyItemInfo.ItemID);
public override float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin)
{
float? topMost = null;
cb.SaveState();
@@ -170,12 +125,10 @@ namespace Volian.Print.Library
// calculate a new starting position for the change bar
if (_MyParent is vlnParagraph)
{
vlnParagraph pgh = _MyParent as vlnParagraph;
topMost = cb.PdfWriter.PageSize.Height - yPageStart;
}
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer);
PdfLayer textLayer = !(cb.PdfWriter.PageEvent is VlnSvgPageHelper _MyPageHelper) ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer);
float yAdj = -3.75F; //0.5F;
float xAdj = 3F;
//cb.SetColorStroke(Color.GREEN);
@@ -226,8 +179,6 @@ namespace Volian.Print.Library
// follow through in fixing an Out of Window Handles bug, use new function to see if
// we can retrieve the font from a dictionary instead a doing a New and using another
// window handle B21017-117
//iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(new System.Drawing.Font("Letter Gothic", 10F)):
// Volian.Svg.Library.VolianPdf.GetFont(new System.Drawing.Font("Letter Gothic", 5.5F));
iTextSharp.text.Font iFont = _IsRev? Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 10F)):
Volian.Svg.Library.VolianPdf.GetFont(VE_Font.GetWinSysFont("Letter Gothic", 5.5F));