Preparation to switch to ITextSharp library
Corrected logic to process window size/movement adjustments
This commit is contained in:
parent
1503b3f9cc
commit
1731dbe43b
@ -91,8 +91,8 @@ namespace VG
|
||||
public void UpdatePageInfo(Page pa)
|
||||
{
|
||||
pg.LeftMargin=pa.LeftMargin;
|
||||
pg.portrait=pg.portrait;
|
||||
pg.VertOffset=pg.VertOffset;
|
||||
pg.portrait=pa.portrait; // RHM 20081003 - This had been pg.portrait=pg.portrait
|
||||
pg.VertOffset=pa.VertOffset; // RHM 20081003 - This had been pg.VertOffset=pg.VertOffset
|
||||
}
|
||||
|
||||
public string AddRTFBUI(string origStr, string bold, string underline, string italics)
|
||||
@ -134,14 +134,14 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
float startx = pg.portrait ? (cx + pg.LeftMargin): (pg.VertOffset + cy);
|
||||
float starty = pg.portrait ? (cy + pg.VertOffset): (pg.LeftMargin - cx);
|
||||
float endx = pg.portrait ? (dx + pg.LeftMargin): (pg.VertOffset + dy);
|
||||
float endy = pg.portrait ? (dy + pg.VertOffset): (pg.LeftMargin - dx);
|
||||
Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
c1pdf.DrawLine(pn, ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy));
|
||||
pdf.DrawLine(pn, ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy));
|
||||
}
|
||||
|
||||
}
|
||||
@ -169,7 +169,7 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
|
||||
@ -178,7 +178,7 @@ namespace VG
|
||||
float endx = pg.portrait ? dx: dy;
|
||||
float endy = pg.portrait ? dy: dx;
|
||||
RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy));
|
||||
c1pdf.DrawRectangle(pn,rc);
|
||||
pdf.DrawRectangle(pn,rc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Pen pn = new Pen(Brushes.Black,lnwid);
|
||||
Bitmap bm = new Bitmap(FileName);
|
||||
@ -215,7 +215,7 @@ namespace VG
|
||||
rc.Width = ToPoints((bm.Width*Scale)*4.8f);
|
||||
rc.X = ToPoints(pg.LeftMargin+cx);
|
||||
rc.Y = ToPoints(pg.VertOffset+cy);
|
||||
c1pdf.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale);
|
||||
pdf.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale);
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,10 +242,10 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
c1pdf.DrawEllipse(pn,ToPoints(pg.LeftMargin+cx), ToPoints(pg.VertOffset+cy), ToPoints(dx), ToPoints(dy));
|
||||
pdf.DrawEllipse(pn,ToPoints(pg.LeftMargin+cx), ToPoints(pg.VertOffset+cy), ToPoints(dx), ToPoints(dy));
|
||||
}
|
||||
}
|
||||
|
||||
@ -290,18 +290,18 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Font myfont = new Font(FontName,FontSize);
|
||||
RectangleF rc = new RectangleF();
|
||||
// the returned value from c1 pdf code is already in points,
|
||||
// so need to convert the size.
|
||||
rc.Size = c1pdf.MeasureStringRtf(Text,myfont,500); // TODO: 500 or pagewidth, or what
|
||||
rc.Size = pdf.MeasureStringRtf(Text,myfont,500); // TODO: 500 or pagewidth, or what
|
||||
rc.X = ToPoints(pg.LeftMargin+cx);
|
||||
rc.Y = ToPoints(pg.VertOffset+cy)-FontSize;
|
||||
// add bold, underline & italics for entire object.
|
||||
string rtfout = AddRTFBUI(Text,Bold,Underline,Italics);
|
||||
c1pdf.DrawStringRtf(rtfout,myfont,Brushes.Black,rc);
|
||||
pdf.DrawStringRtf(rtfout,myfont,Brushes.Black,rc);
|
||||
}
|
||||
}
|
||||
public class VG_Arc : VG
|
||||
@ -339,7 +339,7 @@ public class VG_Arc : VG
|
||||
// pg = ipg;
|
||||
// }
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
// Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
#if DEBUG
|
||||
@ -357,7 +357,7 @@ public class VG_Arc : VG
|
||||
// c1pdf.DrawRectangle(pn,rc); //debug
|
||||
|
||||
// c1pdf.DrawArc(new Pen(Color.Black,ToPoints(lnwid)),new RectangleF(stX,stY,rWid,rHgt),startAngle,sweepAngle);
|
||||
c1pdf.DrawArc(pn,rc,startAngle,sweepAngle);
|
||||
pdf.DrawArc(pn,rc,startAngle,sweepAngle);
|
||||
// c1pdf.DrawArc(new Pen(Color.Black, 4),rc,startAngle,sweepAngle);
|
||||
}
|
||||
}
|
||||
|
@ -1161,6 +1161,15 @@ namespace Volian.Controls.Library
|
||||
ExpandChildren(_MyRNOStepItems);
|
||||
ExpandChildren(_MyAfterStepItems);
|
||||
}
|
||||
private string MyPath
|
||||
{
|
||||
get
|
||||
{
|
||||
if(MyItemInfo.MyContent.Type >= 20000)
|
||||
return MyItemInfo.Path.Substring(MyItemInfo.ActiveSection.Path.Length);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Adjust the Location of all items below the current item.
|
||||
/// </summary>
|
||||
@ -1261,8 +1270,7 @@ namespace Volian.Controls.Library
|
||||
get
|
||||
{
|
||||
StepItem tmp = this;
|
||||
// If this item appears before it's parent, and it doesn't have anything below it, return the parent
|
||||
if (tmp.MyNextStepItem == null && FirstSiblingStepItem._MyChildRelation == ChildRelation.Before)
|
||||
if (tmp.MyNextStepItem == null && FirstSiblingStepItem._MyChildRelation == ChildRelation.Before && tmp._MyAfterStepItems == null)
|
||||
return UpOneStepItem;
|
||||
if (Expanded && tmp._MyAfterStepItems != null)// check to see if there is a _After
|
||||
return tmp._MyAfterStepItems[0].TopMostStepItem;// if there is go that way
|
||||
@ -1273,6 +1281,8 @@ namespace Volian.Controls.Library
|
||||
return null;
|
||||
if (tmp.MyExpandingStatus == ExpandingStatus.Expanding || tmp.Moving) // Parent Expanding or Moving - Wait
|
||||
return null;
|
||||
if (tmp.MyNextStepItem == null && tmp.FirstSiblingStepItem._MyChildRelation == ChildRelation.Before)
|
||||
return tmp.UpOneStepItem;
|
||||
StepItem btm = tmp.BottomMostStepItem;
|
||||
if (this != btm)
|
||||
{
|
||||
|
@ -14,21 +14,47 @@ namespace XYPlots
|
||||
/// </summary>
|
||||
public class XYPlot
|
||||
{
|
||||
// private int ConvertToTwips = 1440;
|
||||
private double ConvertToTwips = 4.8;
|
||||
|
||||
#region OldStuff
|
||||
#if OldStuff
|
||||
static long HP3_HPGL_COMPENSATEX = 1016L; /* OK, so you don't believe it */
|
||||
static long HP3_HPGL_COMPENSATEY = 1016L;/* OK, so you don't believe it */
|
||||
private long DotsToPlotterUnitsX(int x)
|
||||
{
|
||||
long retval;
|
||||
retval = (long)((1.0 * x * HP_FudgeX) / 300.0 + .5);
|
||||
return (retval);
|
||||
}
|
||||
private long DotsToPlotterUnitsY(int y)
|
||||
{
|
||||
long retval;
|
||||
retval = (long)((1.0 * y * HP_FudgeY) / 300.0 + .5);
|
||||
return (retval);
|
||||
}
|
||||
private long HP_FudgeX = HP3_HPGL_COMPENSATEX;
|
||||
private long HP_FudgeY = HP3_HPGL_COMPENSATEY;
|
||||
static long PRINTAPLOT_COMPENSATE = 1020L;/* but these resolve differently*/
|
||||
static int MAX_XY_STACK = 8; /* this is max of CIE cursor/font stack */
|
||||
static int DASH = 2;
|
||||
private void Graphics(int flag)
|
||||
{
|
||||
// if(graph_GraphicsStr[flag])
|
||||
// fprintf(stdprn,"%s",graph_GraphicsStr[flag]);
|
||||
}
|
||||
private string GoodOldStringX;
|
||||
private string GoodOldStringY;
|
||||
|
||||
|
||||
#endif
|
||||
#endregion
|
||||
// private int ConvertToTwips = 1440;
|
||||
|
||||
private double ConvertToTwips = 4.8;
|
||||
static int MAX_XY_STACK = 8; /* this is max of CIE cursor/font stack */
|
||||
static int DPI = 1440; //300;
|
||||
static int CWIDEDOTS = 120; //25;
|
||||
static int CHIGHDOTS = 240; //50;
|
||||
|
||||
static int STRAIGHT = 0;
|
||||
static int CURVE = 1;
|
||||
static int DASH = 2;
|
||||
|
||||
static int X = 0;
|
||||
static int Y = 1;
|
||||
@ -50,11 +76,7 @@ namespace XYPlots
|
||||
private int[] SavedY;
|
||||
private int stack;
|
||||
private int HPGLMode;
|
||||
private long HP_FudgeX = HP3_HPGL_COMPENSATEX;
|
||||
private long HP_FudgeY = HP3_HPGL_COMPENSATEY;
|
||||
|
||||
private string GoodOldStringX;
|
||||
private string GoodOldStringY;
|
||||
|
||||
|
||||
public int LinesUsed;
|
||||
@ -181,7 +203,7 @@ namespace XYPlots
|
||||
|
||||
private double atan_deg(double x)
|
||||
{
|
||||
return( Math.Atan(x) * 180.0/PI );
|
||||
return( Math.Atan(x) * 180.0/ PI );
|
||||
}
|
||||
|
||||
private double cos_deg(double x)
|
||||
@ -1448,12 +1470,6 @@ namespace XYPlots
|
||||
return;
|
||||
}
|
||||
|
||||
private void Graphics(int flag)
|
||||
{
|
||||
// if(graph_GraphicsStr[flag])
|
||||
// fprintf(stdprn,"%s",graph_GraphicsStr[flag]);
|
||||
}
|
||||
|
||||
private void SetPenDiameter(int pd)
|
||||
{
|
||||
if ((pd * ConvertToTwips) != CurPenWidth)
|
||||
@ -1522,20 +1538,6 @@ namespace XYPlots
|
||||
ptr = string.Format("+{0}",i.ToString());
|
||||
}
|
||||
|
||||
private long DotsToPlotterUnitsX(int x)
|
||||
{
|
||||
long retval;
|
||||
retval = (long)((1.0*x*HP_FudgeX) / 300.0 + .5);
|
||||
return( retval );
|
||||
}
|
||||
|
||||
private long DotsToPlotterUnitsY(int y)
|
||||
{
|
||||
long retval;
|
||||
retval = (long)((1.0*y*HP_FudgeY) / 300.0 + .5);
|
||||
return( retval );
|
||||
}
|
||||
|
||||
private void MoveRelative(int x, int y)
|
||||
{
|
||||
long xl,yl;
|
||||
@ -2210,8 +2212,8 @@ namespace XYPlots
|
||||
FixBuffIfNeeded();
|
||||
GetScaleInfo();
|
||||
|
||||
C1.C1Pdf.C1PdfDocument c1pdf = new C1.C1Pdf.C1PdfDocument();
|
||||
c1pdf.FontType = C1.C1Pdf.FontTypeEnum.Embedded; // embed fonts
|
||||
C1.C1Pdf.C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();
|
||||
pdf.FontType = C1.C1Pdf.FontTypeEnum.Embedded; // embed fonts
|
||||
|
||||
VG.Page pg = new Page(true,(float)(1440),(float)(1440));
|
||||
|
||||
@ -2271,13 +2273,13 @@ namespace XYPlots
|
||||
}
|
||||
PrevCommand = Command;
|
||||
}
|
||||
Graphics(1);
|
||||
GenerateGrid(pg,c1pdf);
|
||||
DoAxisTitles(pg,c1pdf);
|
||||
DoBoxes(pg,c1pdf);
|
||||
DrawLines(pg,c1pdf);
|
||||
Graphics(0);
|
||||
c1pdf.Save(_ThePDFFile);
|
||||
//Graphics(1);
|
||||
GenerateGrid(pg,pdf);
|
||||
DoAxisTitles(pg,pdf);
|
||||
DoBoxes(pg,pdf);
|
||||
DrawLines(pg,pdf);
|
||||
//Graphics(0);
|
||||
pdf.Save(_ThePDFFile);
|
||||
//c1pdf.Save(PdfFileName);
|
||||
FreeBoxList();
|
||||
FreeLineList();
|
||||
|
Loading…
x
Reference in New Issue
Block a user