The R Project SVN R

Rev

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

Rev 27357 Rev 27686
1
/*
1
/*
2
 *
2
 *
3
 *  R : A Computer Language for Statistical Data Analysis
3
 *  R : A Computer Language for Statistical Data Analysis
4
 *  file ga.h
4
 *  file ga.h
5
 *  Copyright (C) 1998--1999  Guido Masarotto
5
 *  Copyright (C) 1998--1999  Guido Masarotto
6
 *
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
10
 *  (at your option) any later version.
11
 *
11
 *
12
 *  This program is distributed in the hope that it will be useful,
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
15
 *  GNU General Public License for more details.
16
 *
16
 *
17
 *  You should have received a copy of the GNU General Public License
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program; if not, write to the Free Software
18
 *  along with this program; if not, write to the Free Software
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 */
20
 */
21
 
21
 
22
/*
22
/*
23
   New declarations.
23
   New declarations.
24
*/
24
*/
25
 
25
 
26
#ifndef __GA__VERSION
26
#ifndef __GA__VERSION
27
#define __GA__VERSION 2.45(1)
27
#define __GA__VERSION 2.45(1)
28
#include "graphapp.h"
28
#include "graphapp.h"
29
 
29
 
30
/* renamed functions */
30
/* renamed functions */
31
void 	gamainloop(void);
31
void 	gamainloop(void);
32
void 	gabeep(void);
32
void 	gabeep(void);
33
 
33
 
34
#define DblClick  	0x0010/* added for buttons.c*/
34
#define DblClick  	0x0010/* added for buttons.c*/
35
 
35
 
36
 
36
 
37
/* windows.c */
37
/* windows.c */
38
#define Border      	0x10100000L
38
#define Border      	0x10100000L
39
void	app_cleanup(void);
39
void	app_cleanup(void);
40
int 	ismdi();
40
int 	ismdi();
41
rect 	screen_coords(control c);
41
rect 	screen_coords(control c);
42
 
42
 
43
/* gmenus.c */
43
/* gmenus.c */
44
typedef struct {
44
typedef struct {
45
    char *nm;
45
    char *nm;
46
    menufn fn;
46
    menufn fn;
47
    menuitem m;
47
    menuitem m;
48
} MenuItem;
48
} MenuItem;
49
 
49
 
50
#define STARTMENU {"#STARTMENU", 0, 0}
50
#define STARTMENU {"#STARTMENU", 0, 0}
51
#define ENDMENU {"#ENDMENU", 0, 0}
51
#define ENDMENU {"#ENDMENU", 0, 0}
52
#define STARTSUBMENU {"#STARTSUBMENU", 0, 0}
52
#define STARTSUBMENU {"#STARTSUBMENU", 0, 0}
53
#define ENDSUBMENU {"#ENDSUBMENU", 0, 0}
53
#define ENDSUBMENU {"#ENDSUBMENU", 0, 0}
54
#define MDIMENU {"#MDIMENU", 0, 0}
54
#define MDIMENU {"#MDIMENU", 0, 0}
55
#define LASTMENUITEM {0, 0, 0}
55
#define LASTMENUITEM {0, 0, 0}
56
menu 	newmdimenu();
56
menu 	newmdimenu();
57
typedef menu popup;
57
typedef menu popup;
58
popup 	newpopup();
58
popup 	newpopup();
59
menubar gmenubar(actionfn fn, MenuItem []);
59
menubar gmenubar(actionfn fn, MenuItem []);
60
popup 	gpopup(actionfn fn, MenuItem []);
60
popup 	gpopup(actionfn fn, MenuItem []);
61
void 	gchangepopup(window w, popup p);
61
void 	gchangepopup(window w, popup p);
62
/* next is limited to current window... */
62
/* next is limited to current window... */
63
void 	gchangemenubar(menubar mb);
63
void 	gchangemenubar(menubar mb);
64
 
64
 
65
/* winalloc.c */
65
/* winalloc.c */
66
#include <stddef.h> /* for size_t */
66
#include <stddef.h> /* for size_t */
67
void 	*winmalloc(size_t size);
67
void 	*winmalloc(size_t size);
68
void  	winfree(void *block);
68
void  	winfree(void *block);
69
void 	*winrealloc(void *block, size_t newsize);
69
void 	*winrealloc(void *block, size_t newsize);
70
char 	*winstrdup(char *s);
70
char 	*winstrdup(char *s);
71
 
71
 
72
/* tooltips.c */
72
/* tooltips.c */
73
int 	addtooltip(control c, char *tp);
73
int 	addtooltip(control c, char *tp);
74
 
74
 
75
/* status.c */
75
/* status.c */
76
int 	addstatusbar();
76
int 	addstatusbar();
77
void 	setstatus(char *text);
77
void 	setstatus(char *text);
78
 
78
 
79
/* dialogs.c */
79
/* dialogs.c */
80
void 	setuserfilter(char *);
80
void 	setuserfilter(char *);
81
void    askchangedir();
81
void    askchangedir();
82
char *	askcdstring(char *question, char *default_string);
82
char *	askcdstring(char *question, char *default_string);
83
char *	askfilesavewithdir(char *title, char *default_name, char *dir);
83
char *	askfilesavewithdir(char *title, char *default_name, char *dir);
84
char *  askfilenames(char *title, char *default_name, int multi,
84
char *  askfilenames(char *title, char *default_name, int multi,
85
			       char *filters, int filterindex, char *strbuf, int bufsize);
85
			       char *filters, int filterindex, char *strbuf, int bufsize);
86
int	    countFilenames(char *strbuf); /* Note that first name is path when there are multiple names */
86
int	    countFilenames(char *strbuf); /* Note that first name is path when there are multiple names */
87
 
87
 
88
/*  rgb.c */
88
/*  rgb.c */
89
rgb     nametorgb(char *colourname);
89
rgb     nametorgb(char *colourname);
90
char *  rgbtoname(rgb in);
90
char *  rgbtoname(rgb in);
91
int     rgbtonum(rgb in);
91
int     rgbtonum(rgb in);
92
rgb     myGetSysColor(int);
92
rgb     myGetSysColor(int);
93
rgb 	dialog_bg();
93
rgb 	dialog_bg();
94
 
94
 
95
 
95
 
96
/* clipboard.c */
96
/* clipboard.c */
97
void    copytoclipboard(drawing src);
97
void    copytoclipboard(drawing src);
98
int     copystringtoclipboard(char *str);
98
int     copystringtoclipboard(char *str);
99
int     getstringfromclipboard(char * str, int n);
99
int     getstringfromclipboard(char * str, int n);
100
int     clipboardhastext();
100
int     clipboardhastext();
101
 
101
 
102
/* gimage.c */
102
/* gimage.c */
103
image  bitmaptoimage(bitmap bm);
103
image  bitmaptoimage(bitmap bm);
104
 
104
 
105
/* printer.c  */
105
/* printer.c  */
106
typedef objptr printer;
106
typedef objptr printer;
107
printer newprinter(double w,  double h, char *name);
107
printer newprinter(double w,  double h, char *name);
108
void    nextpage();
108
void    nextpage();
109
 
109
 
110
/* metafile.c */
110
/* metafile.c */
111
typedef objptr metafile;
111
typedef objptr metafile;
112
metafile newmetafile(char *name, double width, double height);
112
metafile newmetafile(char *name, double width, double height);
113
 
113
 
114
 
114
 
115
/* thread safe and extended  drawing functions (gdraw.c) */
115
/* thread safe and extended  drawing functions (gdraw.c) */
116
#define lSolid 0
116
#define lSolid 0
117
#define lDash  (5 | (4<<4))
117
#define lDash  (5 | (4<<4))
118
#define lShortDash  (3 | (4<<4))
118
#define lShortDash  (3 | (4<<4))
119
#define lLongDash  (8 | (4<<4))
119
#define lLongDash  (8 | (4<<4))
120
#define lDot   (1 | (4<<4))
120
#define lDot   (1 | (4<<4))
121
#define lDashDot (5 | (4<<4) | (1<<8) | (4<<12))
121
#define lDashDot (5 | (4<<4) | (1<<8) | (4<<12))
122
#define lShortDashDot (3 | (4<<4) | (1<<8) | (4<<12))
122
#define lShortDashDot (3 | (4<<4) | (1<<8) | (4<<12))
123
#define lLongDashDot (8 | (4<<4) | (1<<8) | (4<<12))
123
#define lLongDashDot (8 | (4<<4) | (1<<8) | (4<<12))
124
#define lDashDotDot    (5 | (4<<4) | (1<<8) | (3<<12) | (1<<16) | (4<< 20))
124
#define lDashDotDot    (5 | (4<<4) | (1<<8) | (3<<12) | (1<<16) | (4<< 20))
125
#define lShortDashDotDot    (3 | (4<<4) | (1<<8) | (3<<12) | (1<<16) | (4<< 20))
125
#define lShortDashDotDot    (3 | (4<<4) | (1<<8) | (3<<12) | (1<<16) | (4<< 20))
126
#define lLongDashDotDot    (8 | (4<<4) | (1<<8) | (3<<12) | (1<<16) | (4<< 20))
126
#define lLongDashDotDot    (8 | (4<<4) | (1<<8) | (3<<12) | (1<<16) | (4<< 20))
127
 
127
 
128
rect  ggetcliprect(drawing d);
128
rect  ggetcliprect(drawing d);
129
void  gsetcliprect(drawing d, rect r);
129
void  gsetcliprect(drawing d, rect r);
130
void  gbitblt(bitmap db, bitmap sb, point p, rect r);
130
void  gbitblt(bitmap db, bitmap sb, point p, rect r);
131
void  gscroll(drawing d, point dp, rect r);
131
void  gscroll(drawing d, point dp, rect r);
132
void  ginvert(drawing d, rect r);
132
void  ginvert(drawing d, rect r);
133
rgb   ggetpixel(drawing d, point p);
133
rgb   ggetpixel(drawing d, point p);
134
void  gsetpixel(drawing d, point p, rgb c);
134
void  gsetpixel(drawing d, point p, rgb c);
135
void  gdrawline(drawing d, int width, int style, rgb c, point p1, point p2,
135
void  gdrawline(drawing d, int width, int style, rgb c, point p1, point p2,
136
		int fast);
136
		int fast);
137
void  gdrawrect(drawing d, int width, int style, rgb c, rect r, int fast);
137
void  gdrawrect(drawing d, int width, int style, rgb c, rect r, int fast);
138
void  gfillrect(drawing d, rgb fill, rect r);
138
void  gfillrect(drawing d, rgb fill, rect r);
139
void  gdrawellipse(drawing d, int width, rgb border, rect r, int fast);
139
void  gdrawellipse(drawing d, int width, rgb border, rect r, int fast);
140
void  gfillellipse(drawing d, rgb fill, rect r);
140
void  gfillellipse(drawing d, rgb fill, rect r);
141
void  gdrawpolyline(drawing d, int width, int style, rgb c,
141
void  gdrawpolyline(drawing d, int width, int style, rgb c,
142
                    point *p, int n, int closepath, int fast);
142
                    point *p, int n, int closepath, int fast);
143
#define gdrawpolygon(d,w,s,c,p,n,f) gdrawpolyline(d,w,s,c,p,n,1,f)
143
#define gdrawpolygon(d,w,s,c,p,n,f) gdrawpolyline(d,w,s,c,p,n,1,f)
144
void  gfillpolygon(drawing d, rgb fill, point *p, int n);
144
void  gfillpolygon(drawing d, rgb fill, point *p, int n);
145
int   gdrawstr(drawing d, font f, rgb c, point p, char *s);
145
int   gdrawstr(drawing d, font f, rgb c, point p, char *s);
146
void  gdrawstr1(drawing d, font f, rgb c, point p, char *s, double hadj);
146
void  gdrawstr1(drawing d, font f, rgb c, point p, char *s, double hadj);
147
rect  gstrrect(drawing d, font f, char *s);
147
rect  gstrrect(drawing d, font f, char *s);
148
point gstrsize(drawing d, font f, char *s);
148
point gstrsize(drawing d, font f, char *s);
149
int   gstrwidth(drawing d ,font f, char *s);
149
int   gstrwidth(drawing d ,font f, char *s);
150
void  gcharmetric(drawing d, font f, int c, int *ascent, int *descent,
150
void  gcharmetric(drawing d, font f, int c, int *ascent, int *descent,
151
		  int *width);
151
		  int *width);
152
font  gnewfont(drawing d,char *face, int style, int size, double rot);
152
font  gnewfont(drawing d,char *face, int style, int size, double rot);
153
int   ghasfixedwidth(font f);
153
int   ghasfixedwidth(font f);
154
field newfield_no_border(char *text, rect r);
154
field newfield_no_border(char *text, rect r);
155
 
155
 
156
/* pixels */
156
/* pixels */
157
int   devicewidth(drawing dev);
157
int   devicewidth(drawing dev);
158
int   deviceheight(drawing dev);
158
int   deviceheight(drawing dev);
159
/* mm */
159
/* mm */
160
int   devicewidthmm(drawing dev);
160
int   devicewidthmm(drawing dev);
161
int   deviceheightmm(drawing dev);
161
int   deviceheightmm(drawing dev);
162
/* pixels per inch */
162
/* pixels per inch */
163
int   devicepixelsx(drawing dev);
163
int   devicepixelsx(drawing dev);
164
int   devicepixelsy(drawing dev);
164
int   devicepixelsy(drawing dev);
165
 
165
 
166
void BringToTop(window w, int stay);
166
int  	isTopmost(window w);
-
 
167
void 	BringToTop(window w, int stay); /* stay=0 for regular, 1 for topmost, 2 for toggle */
167
 
168
 
168
/* gbuttons.c */
169
/* gbuttons.c */
169
/* horizontal, vertical and control scrollbar */
170
/* horizontal, vertical and control scrollbar */
170
#define HWINSB 0
171
#define HWINSB 0
171
#define VWINSB 1
172
#define VWINSB 1
172
#define CONTROLSB 2
173
#define CONTROLSB 2
173
void 	gchangescrollbar(scrollbar sb, int which, int where, int max,
174
void 	gchangescrollbar(scrollbar sb, int which, int where, int max,
174
			 int pagesize, int disablenoscroll);
175
			 int pagesize, int disablenoscroll);
175
void 	gsetcursor(drawing d, cursor c);
176
void 	gsetcursor(drawing d, cursor c);
176
control newtoolbar(int height);
177
control newtoolbar(int height);
177
button  newtoolbutton(image img, rect r, actionfn fn);
178
button  newtoolbutton(image img, rect r, actionfn fn);
178
void 	scrolltext(textbox c, int lines);
179
void 	scrolltext(textbox c, int lines);
179
int 	ggetkeystate();
180
int 	ggetkeystate();
180
 
181
 
181
/* cursor.c */
182
/* cursor.c */
182
extern cursor CrossCursor;
183
extern cursor CrossCursor;
183
 
184
 
184
/* menus.h */
185
/* menus.h */
185
void 	remove_menu_item(menuitem obj);
186
void 	remove_menu_item(menuitem obj);
186
 
187
 
187
#endif /* __GA__VERSION */
188
#endif /* __GA__VERSION */
188
 
189