The R Project SVN R

Rev

Rev 34351 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34351 Rev 34487
1
/*
1
/*
2
 *  R : A Computer Langage for Statistical Data Analysis
2
 *  R : A Computer Langage for Statistical Data Analysis
3
 *  Copyright (C) 1998--2003  Guido Masarotto and Brian Ripley
3
 *  Copyright (C) 1998--2003  Guido Masarotto and Brian Ripley
4
 *  Copyright (C) 2004        The R Foundation
4
 *  Copyright (C) 2004        The R Foundation
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
10
 *
10
 *
11
 *  This program is distributed in the hope that it will be useful,
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
14
 *  GNU General Public License for more details.
15
 *
15
 *
16
 *  You should have received a copy of the GNU General Public License
16
 *  You should have received a copy of the GNU General Public License
17
 *  along with this program; if not, write to the Free Software
17
 *  along with this program; if not, write to the Free Software
18
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 */
19
 */
20
 
20
 
21
#include <Graphics.h>
21
#include <Graphics.h>
22
#include <R_ext/Boolean.h>
22
#include <R_ext/Boolean.h>
23
 
23
 
24
enum DeviceKinds {SCREEN=0, PRINTER, METAFILE, PNG, JPEG, BMP};
24
enum DeviceKinds {SCREEN=0, PRINTER, METAFILE, PNG, JPEG, BMP};
25
 
25
 
26
typedef struct {
26
typedef struct {
27
    /* R Graphics Parameters */
27
    /* R Graphics Parameters */
28
    /* local device copy so that we can detect */
28
    /* local device copy so that we can detect */
29
    /* when parameter changes */
29
    /* when parameter changes */
30
    int   col;			   /* Color */
30
    int   col;			   /* Color */
31
    int   bg;			   /* Background */
31
    int   bg;			   /* Background */
32
    int   fontface;		   /* Typeface */
32
    int   fontface;		   /* Typeface */
33
    int   fontsize, basefontsize;  /* Size in points.  fontsize has been adjusted
33
    int   fontsize, basefontsize;  /* Size in points.  fontsize has been adjusted
34
    					for dpi diffs, basefontsize has not */
34
    					for dpi diffs, basefontsize has not */
35
    double fontangle;
35
    double fontangle;
36
 
36
 
37
    /* devga Driver Specific */
37
    /* devga Driver Specific */
38
    /* parameters with copy per devga device */
38
    /* parameters with copy per devga device */
39
 
39
 
40
    enum DeviceKinds kind;
40
    enum DeviceKinds kind;
41
    int   windowWidth;		/* Window width (pixels) */
41
    int   windowWidth;		/* Window width (pixels) */
42
    int   windowHeight;		/* Window height (pixels) */
42
    int   windowHeight;		/* Window height (pixels) */
43
    int   showWidth;		/* device width (pixels) */
43
    int   showWidth;		/* device width (pixels) */
44
    int   showHeight;		/* device height (pixels) */
44
    int   showHeight;		/* device height (pixels) */
45
    int   origWidth, origHeight, xshift, yshift;
45
    int   origWidth, origHeight, xshift, yshift;
46
    Rboolean resize;		/* Window resized */
46
    Rboolean resize;		/* Window resized */
47
    window gawin;		/* Graphics window */
47
    window gawin;		/* Graphics window */
48
  /*FIXME: we should have union for this stuff and
48
  /*FIXME: we should have union for this stuff and
49
    maybe change gawin to canvas*/
49
    maybe change gawin to canvas*/
50
  /* SCREEN section*/
50
  /* SCREEN section*/
51
    popup locpopup, grpopup;
51
    popup locpopup, grpopup;
52
    button  stoploc;
52
    button  stoploc;
53
    menubar mbar, mbarloc, mbarconfirm;
53
    menubar mbar, mbarloc, mbarconfirm;
54
    menu  msubsave;
54
    menu  msubsave;
55
    menuitem mpng, mbmp, mjpeg50, mjpeg75, mjpeg100;
55
    menuitem mpng, mbmp, mjpeg50, mjpeg75, mjpeg100;
56
    menuitem mps, mpdf, mwm, mclpbm, mclpwm, mprint, mclose;
56
    menuitem mps, mpdf, mwm, mclpbm, mclpwm, mprint, mclose;
57
    menuitem mrec, madd, mreplace, mprev, mnext, mclear, msvar, mgvar;
57
    menuitem mrec, madd, mreplace, mprev, mnext, mclear, msvar, mgvar;
58
    menuitem mR, mfit, mfix, grmenustayontop, mnextplot;
58
    menuitem mR, mfit, mfix, grmenustayontop, mnextplot;
59
    Rboolean recording, replaying, needsave;
59
    Rboolean recording, replaying, needsave;
60
    bitmap bm;
60
    bitmap bm;
61
  /* PNG and JPEG section */
61
  /* PNG and JPEG section */
62
    FILE *fp;
62
    FILE *fp;
63
    char filename[512];
63
    char filename[512];
64
    int quality;
64
    int quality;
65
    int npage;
65
    int npage;
66
    double w, h;
66
    double w, h;
67
  /* Used to rescale font size so that bitmap devices have 72dpi */
67
  /* Used to rescale font size so that bitmap devices have 72dpi */
68
    int truedpi, wanteddpi;
68
    int truedpi, wanteddpi;
69
    rgb   fgcolor;		/* Foreground color */
69
    rgb   fgcolor;		/* Foreground color */
70
    rgb   bgcolor;		/* Background color */
70
    rgb   bgcolor;		/* Background color */
71
    rgb   canvascolor;		/* Canvas color */
71
    rgb   canvascolor;		/* Canvas color */
72
    rgb   outcolor;		/* Outside canvas color */
72
    rgb   outcolor;		/* Outside canvas color */
73
    rect  clip;			/* The clipping rectangle */
73
    rect  clip;			/* The clipping rectangle */
74
    Rboolean usefixed;
74
    Rboolean usefixed;
75
    font  fixedfont;
75
    font  fixedfont;
76
    font  font;
76
    font  font;
77
    char fontfamily[50];
77
    char fontfamily[50];
78
 
78
 
79
    Rboolean locator;
79
    Rboolean locator;
80
    Rboolean confirmation;
80
    Rboolean confirmation;
81
    
81
    
82
    int clicked; /* {0,1,2} */
82
    int clicked; /* {0,1,2} */
83
    int	px, py, lty, lwd;
83
    int	px, py, lty, lwd;
84
    int resizing; /* {1,2,3} */
84
    int resizing; /* {1,2,3} */
85
    double rescale_factor;
85
    double rescale_factor;
86
    int fast; /* Use fast fixed-width lines? */
86
    int fast; /* Use fast fixed-width lines? */
87
    unsigned int pngtrans; /* what PNG_TRANS get mapped to */
87
    unsigned int pngtrans; /* what PNG_TRANS get mapped to */
88
    Rboolean buffered;
88
    Rboolean buffered;
89
    int timeafter, timesince;
89
    int timeafter, timesince;
90
    SEXP psenv;
90
    SEXP psenv;
91
    double res_dpi;
91
    double res_dpi;
92
    R_GE_lineend lend;
92
    R_GE_lineend lend;
93
    R_GE_linejoin ljoin;
93
    R_GE_linejoin ljoin;
94
    float lmitre;
94
    float lmitre;
95
    Rboolean enterkey; /* Set true when enter key is hit */
95
    Rboolean enterkey; /* Set true when enter key is hit */
96
    SEXP eventRho;     /* Environment during event handling */
96
    SEXP eventRho;     /* Environment during event handling */
97
    SEXP eventResult;  /* Result of event handler */
97
    SEXP eventResult;  /* Result of event handler */
98
    Rboolean (*newFrameConfirm)();
98
    Rboolean (*newFrameConfirm)();
99
    double lwdscale;   /* scale factor for lwd */
99
    double lwdscale;   /* scale factor for lwd */
-
 
100
    RCNTXT *cntxt;     /* context for unwinding on error */
100
} gadesc;
101
} gadesc;