Preparation to switch to ITextSharp library

Corrected logic to process window size/movement adjustments
This commit is contained in:
Rich
2009-02-06 15:52:27 +00:00
parent 1503b3f9cc
commit 1731dbe43b
3 changed files with 68 additions and 56 deletions

View File

@@ -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();