The R Project SVN R

Rev

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

Rev 14086 Rev 21104
1
/*
1
/*
2
 *  Internal include file
2
 *  Internal include file
3
 *  ---------------------
3
 *  ---------------------
4
 *  GraphApp internal functions (Windows version).
4
 *  GraphApp internal functions (Windows version).
5
 *
5
 *
6
 *  The type objptr is defined in this file to be an
6
 *  The type objptr is defined in this file to be an
7
 *  object pointer. This differs from the normal graphapp.h
7
 *  object pointer. This differs from the normal graphapp.h
8
 *  definition which makes an objptr a pointer to int.
8
 *  definition which makes an objptr a pointer to int.
9
 *  There are a few reasons for this:
9
 *  There are a few reasons for this:
10
 *  1. The graphapp.h file is platform independent,
10
 *  1. The graphapp.h file is platform independent,
11
 *     so making the basic object type an int pointer
11
 *     so making the basic object type an int pointer
12
 *     is platform-neutral.
12
 *     is platform-neutral.
13
 *  2. Thus the object type does not need to be defined in
13
 *  2. Thus the object type does not need to be defined in
14
 *     graphapp.h since this type includes platform-specific
14
 *     graphapp.h since this type includes platform-specific
15
 *     information.
15
 *     information.
16
 *  3. An int pointer facilitates data-hiding. No-one can
16
 *  3. An int pointer facilitates data-hiding. No-one can
17
 *     poke around in the object data structure.
17
 *     poke around in the object data structure.
18
 *  4. Inside the library code we can treat all fonts, windows
18
 *  4. Inside the library code we can treat all fonts, windows
19
 *     controls, cursors, etc as ordinary objects. There is
19
 *     controls, cursors, etc as ordinary objects. There is
20
 *     no need for typecasting, so code size is reduced.
20
 *     no need for typecasting, so code size is reduced.
21
 */
21
 */
22
 
22
 
23
#ifndef _GRAPH_INT_H
23
#ifndef _GRAPH_INT_H
24
#define _GRAPH_INT_H
24
#define _GRAPH_INT_H
25
 
25
 
26
/*
26
/*
27
 *  Set DEBUG to 1 to produce object debugging, otherwise zero.
27
 *  Set DEBUG to 1 to produce object debugging, otherwise zero.
28
 */
28
 */
29
#ifndef DEBUG
29
#ifndef DEBUG
30
#define DEBUG 0
30
#define DEBUG 0
31
#endif
31
#endif
32
 
32
 
33
/*
33
/*
34
 *  If compiling the whole library from graphapp.c, we
34
 *  If compiling the whole library from graphapp.c, we
35
 *  define PROTECTED to be the storage class "static",
35
 *  define PROTECTED to be the storage class "static",
36
 *  hence optimising the library's symbol table by
36
 *  hence optimising the library's symbol table by
37
 *  omitting the internal library function names.
37
 *  omitting the internal library function names.
38
 */
38
 */
39
#ifdef _GRAPHAPP_
39
#ifdef _GRAPHAPP_
40
	#define PROTECTED static
40
	#define PROTECTED static
41
#else
41
#else
42
	#define PROTECTED
42
	#define PROTECTED
43
#endif
43
#endif
44
 
44
 
45
/*
45
/*
46
 *  Type definitions.
46
 *  Type definitions.
47
 */
47
 */
48
 
48
 
49
typedef struct callinfo  callinfo;
49
typedef struct callinfo  callinfo;
50
typedef struct objinfo   objinfo;
50
typedef struct objinfo   objinfo;
51
typedef objinfo *object;
51
typedef objinfo *object;
52
 
52
 
-
 
53
/* in w32api this needs to be before ga.h */
-
 
54
#ifndef __WINDOWS_H     /* prevent multiple includes */
-
 
55
#include <windows.h>
-
 
56
#endif
-
 
57
 
53
#ifndef __GA__VERSION__
58
#ifndef __GA__VERSION__
54
#define objptr object
59
#define objptr object
55
#include "ga.h"
60
#include "ga.h"
56
#endif
61
#endif
57
 
62
 
58
/* extras */
63
/* extras */
59
rect getcliprect(void);
64
rect getcliprect(void);
60
void setcliprect(rect r);
65
void setcliprect(rect r);
61
PROTECTED void updatestatus(char *text);
66
PROTECTED void updatestatus(char *text);
62
PROTECTED font new_font_object();
67
PROTECTED font new_font_object();
63
 
68
 
64
#ifdef __cplusplus
69
#ifdef __cplusplus
65
extern "C" {
70
extern "C" {
66
#endif
71
#endif
67
 
72
 
68
#include <stdio.h>
73
#include <stdio.h>
69
#include <stdlib.h>
74
#include <stdlib.h>
70
#include <string.h>
75
#include <string.h>
71
#include <ctype.h>
76
#include <ctype.h>
72
#include <math.h>
77
#include <math.h>
73
 
78
 
74
#ifndef __WINDOWS_H     /* prevent multiple includes */
-
 
75
#include <windows.h>
-
 
76
#endif
-
 
77
 
79
 
78
#include <commdlg.h>
80
#include <commdlg.h>
79
 
81
 
80
#ifdef __MWERKS__
82
#ifdef __MWERKS__
81
	/* Metrowerks Codewarrior Cross-Platform C/C++ Compiler */
83
	/* Metrowerks Codewarrior Cross-Platform C/C++ Compiler */
82
	#define COMPILER 32
84
	#define COMPILER 32
83
#endif
85
#endif
84
 
86
 
85
#ifdef __MINGW32__
87
#ifdef __MINGW32__
86
     #define COMPILER 32
88
     #define COMPILER 32
87
     #define WINVER 0x0400
89
     #define WINVER 0x0400
88
     #define PASS_ARGS 1
90
     #define PASS_ARGS 1
89
#ifndef WIN32
91
#ifndef WIN32
90
 #define WIN32
92
 #define WIN32
91
#endif
93
#endif
92
#else
94
#else
93
  #define PASS_ARGS	1
95
  #define PASS_ARGS	1
94
#endif
96
#endif
95
 
97
 
96
 
98
 
97
#ifdef _MSC_VER
99
#ifdef _MSC_VER
98
	/* Microsoft Visual C++ Compiler */
100
	/* Microsoft Visual C++ Compiler */
99
	#ifdef WIN32
101
	#ifdef WIN32
100
		#define COMPILER 32
102
		#define COMPILER 32
101
	#else
103
	#else
102
		#define COMPILER 16
104
		#define COMPILER 16
103
	#endif
105
	#endif
104
#endif
106
#endif
105
 
107
 
106
/*
108
/*
107
 *  Set USE_NATIVE_LABELS to 1 for Windows text labels (never necessary).
109
 *  Set USE_NATIVE_LABELS to 1 for Windows text labels (never necessary).
108
 *  Set USE_NATIVE_TOGGLES to 1 for Windows checkboxes and radiobuttons.
110
 *  Set USE_NATIVE_TOGGLES to 1 for Windows checkboxes and radiobuttons.
109
 *  Set USE_NATIVE_BUTTONS to 1 for Windows buttons.
111
 *  Set USE_NATIVE_BUTTONS to 1 for Windows buttons.
110
 */
112
 */
111
 
113
 
112
#define USE_NATIVE_LABELS  0
114
#define USE_NATIVE_LABELS  0
113
#define USE_NATIVE_TOGGLES 1
115
#define USE_NATIVE_TOGGLES 1
114
#define USE_NATIVE_BUTTONS 1
116
#define USE_NATIVE_BUTTONS 1
115
 
117
 
116
#ifdef WINVER
118
#ifdef WINVER
117
  #if (WINVER <= 0x030a)
119
  #if (WINVER <= 0x030a)
118
	#undef  USE_NATIVE_TOGGLES
120
	#undef  USE_NATIVE_TOGGLES
119
	#define USE_NATIVE_TOGGLES 0
121
	#define USE_NATIVE_TOGGLES 0
120
	#undef  USE_NATIVE_BUTTONS
122
	#undef  USE_NATIVE_BUTTONS
121
	#define USE_NATIVE_BUTTONS 0
123
	#define USE_NATIVE_BUTTONS 0
122
  #endif
124
  #endif
123
#endif
125
#endif
124
 
126
 
125
#define USE_NATIVE_CONTROLS (USE_NATIVE_LABELS + USE_NATIVE_BUTTONS + USE_NATIVE_TOGGLES)
127
#define USE_NATIVE_CONTROLS (USE_NATIVE_LABELS + USE_NATIVE_BUTTONS + USE_NATIVE_TOGGLES)
126
 
128
 
127
/*
129
/*
128
 *  Check that certain words are defined.
130
 *  Check that certain words are defined.
129
 */
131
 */
130
#ifdef COMPILER
132
#ifdef COMPILER
131
   #ifndef __MINGW32__
133
   #ifndef __MINGW32__
132
	#ifndef _export
134
	#ifndef _export
133
		#define _export
135
		#define _export
134
	#endif
136
	#endif
135
	#ifndef _argc
137
	#ifndef _argc
136
		#define _argc __argc
138
		#define _argc __argc
137
	#endif
139
	#endif
138
	#ifndef _argv
140
	#ifndef _argv
139
		#define _argv __argv
141
		#define _argv __argv
140
	#endif
142
	#endif
141
  #endif
143
  #endif
142
#endif /* special compiler definitions */
144
#endif /* special compiler definitions */
143
 
145
 
144
/*
146
/*
145
 *  Object types.
147
 *  Object types.
146
 */
148
 */
147
 
149
 
148
	#define BaseObject        0x4000
150
	#define BaseObject        0x4000
149
 
151
 
150
	#define Image8            0x0008
152
	#define Image8            0x0008
151
	#define Image32           0x0020
153
	#define Image32           0x0020
152
 
154
 
153
	#define ControlObject     0x1000
155
	#define ControlObject     0x1000
154
	#define WindowObject      0x1100
156
	#define WindowObject      0x1100
155
	#define BitmapObject      0x0200
157
	#define BitmapObject      0x0200
156
	#define CursorObject      0x0400
158
	#define CursorObject      0x0400
157
	#define FontObject        0x0800
159
	#define FontObject        0x0800
158
 
160
 
159
	#define UserObject        0x1080
161
	#define UserObject        0x1080
160
	#define LabelObject       0x1001
162
	#define LabelObject       0x1001
161
	#define ButtonObject      0x1004
163
	#define ButtonObject      0x1004
162
	#define CheckboxObject    0x1005
164
	#define CheckboxObject    0x1005
163
	#define RadioObject       0x1006
165
	#define RadioObject       0x1006
164
	#define ScrollbarObject   0x1008
166
	#define ScrollbarObject   0x1008
165
	#define FieldObject       0x1011
167
	#define FieldObject       0x1011
166
	#define TextboxObject     0x1012
168
	#define TextboxObject     0x1012
167
	#define ListboxObject     0x1020
169
	#define ListboxObject     0x1020
168
	#define MultilistObject   0x1021
170
	#define MultilistObject   0x1021
169
	#define DroplistObject    0x1022
171
	#define DroplistObject    0x1022
170
	#define DropfieldObject   0x1023
172
	#define DropfieldObject   0x1023
171
	#define ProgressbarObject 0x1024
173
	#define ProgressbarObject 0x1024
172
 
174
 
173
	#define MenubarObject     0x0041
175
	#define MenubarObject     0x0041
174
	#define MenuObject        0x0042
176
	#define MenuObject        0x0042
175
	#define MenuitemObject    0x0048
177
	#define MenuitemObject    0x0048
176
 
178
 
177
	#define RadiogroupObject  0x2006
179
	#define RadiogroupObject  0x2006
178
 
180
 
179
        #define PrinterObject     0x0030
181
        #define PrinterObject     0x0030
180
        #define MetafileObject    0x0050
182
        #define MetafileObject    0x0050
181
 
183
 
182
/*
184
/*
183
 *  Object information structures.
185
 *  Object information structures.
184
 */
186
 */
185
 
187
 
186
struct objinfo
188
struct objinfo
187
{
189
{
188
	int 	kind;	/* what kind of object is it? */
190
	int 	kind;	/* what kind of object is it? */
189
	int 	refcount; /* equals zero after del() */
191
	int 	refcount; /* equals zero after del() */
190
	HANDLE	handle;	/* handle to associated Windows object */
192
	HANDLE	handle;	/* handle to associated Windows object */
191
        object  menubar,popup,toolbar;
193
        object  menubar,popup,toolbar;
192
        char    status[256];
194
        char    status[256];
193
	object	next;	/* next object in the list */
195
	object	next;	/* next object in the list */
194
	object	prev;	/* previous object in the list */
196
	object	prev;	/* previous object in the list */
195
	object	parent;	/* object's parent/container */
197
	object	parent;	/* object's parent/container */
196
	object	child;	/* first born */
198
	object	child;	/* first born */
197
 
199
 
198
	actionfn die;	/* private object destructor */
200
	actionfn die;	/* private object destructor */
199
 
201
 
200
	rect	rect;	/* rectangle size */
202
	rect	rect;	/* rectangle size */
201
	int 	depth;	/* pixel depth */
203
	int 	depth;	/* pixel depth */
202
 
204
 
203
	drawstate drawstate; /* private drawstate */
205
	drawstate drawstate; /* private drawstate */
204
	image	img;	/* associated image */
206
	image	img;	/* associated image */
205
 
207
 
206
	int 	id;	/* a unique id number */
208
	int 	id;	/* a unique id number */
207
	long	state;	/* enabled/visible/armed etc */
209
	long	state;	/* enabled/visible/armed etc */
208
	long	flags;	/* kind of window/child control */
210
	long	flags;	/* kind of window/child control */
209
	void *	data;	/* data supplied by user */
211
	void *	data;	/* data supplied by user */
210
	char *	text;	/* text associated with the object */
212
	char *	text;	/* text associated with the object */
211
	rgb 	fg;	/* foreground colour */
213
	rgb 	fg;	/* foreground colour */
212
	rgb 	bg;	/* background colour */
214
	rgb 	bg;	/* background colour */
213
 
215
 
214
	actionfn action; /* button/checkbox action */
216
	actionfn action; /* button/checkbox action */
215
	intfn 	hit;	/* menuitem/scrollbar action */
217
	intfn 	hit;	/* menuitem/scrollbar action */
216
	int 	value;	/* current argument to hit() */
218
	int 	value;	/* current argument to hit() */
217
	int 	key;	/* menuitem key equivalent */
219
	int 	key;	/* menuitem key equivalent */
218
	int 	shortcut; /* menu shortcut key */
220
	int 	shortcut; /* menu shortcut key */
219
	int 	max;	/* scrollbar maximum value */
221
	int 	max;	/* scrollbar maximum value */
220
	int 	size;	/* scrollbar page size */
222
	int 	size;	/* scrollbar page size */
221
	int 	xmax;	/* scrollbar maximum value */
223
	int 	xmax;	/* scrollbar maximum value */
222
	int 	xsize;	/* scrollbar page size */
224
	int 	xsize;	/* scrollbar page size */
223
 
225
 
224
	callinfo *call;	/* window/control call-backs */
226
	callinfo *call;	/* window/control call-backs */
225
	void *	extra;	/* for extra internal data */
227
	void *	extra;	/* for extra internal data */
226
	WNDPROC	winproc; /* control's normal event handler */
228
	WNDPROC	winproc; /* control's normal event handler */
227
 
229
 
228
	#if USE_NATIVE_CONTROLS
230
	#if USE_NATIVE_CONTROLS
229
	HBRUSH  bgbrush; /* background brush */
231
	HBRUSH  bgbrush; /* background brush */
230
	#endif
232
	#endif
231
  };
233
  };
232
 
234
 
233
struct callinfo
235
struct callinfo
234
{
236
{
235
	actionfn die;		/* user-defined destructor */
237
	actionfn die;		/* user-defined destructor */
236
	actionfn close;		/* window close function */
238
	actionfn close;		/* window close function */
237
 
239
 
238
	drawfn	redraw;		/* draw the window/control */
240
	drawfn	redraw;		/* draw the window/control */
239
	drawfn	resize;		/* window/control was resized */
241
	drawfn	resize;		/* window/control was resized */
240
 
242
 
241
	keyfn	keydown;	/* normal key pressed */
243
	keyfn	keydown;	/* normal key pressed */
242
	keyfn	keyaction;	/* function/arrow key pressed */
244
	keyfn	keyaction;	/* function/arrow key pressed */
243
 
245
 
244
	mousefn	mousedown;	/* mouse button was clicked */
246
	mousefn	mousedown;	/* mouse button was clicked */
245
	mousefn	mouseup;	/* mouse button was released */
247
	mousefn	mouseup;	/* mouse button was released */
246
	mousefn	mousemove;	/* mouse was moved */
248
	mousefn	mousemove;	/* mouse was moved */
247
	mousefn	mousedrag;	/* mouse dragged (button is down) */
249
	mousefn	mousedrag;	/* mouse dragged (button is down) */
248
	mousefn	mouserepeat;	/* mouse-down timer auto repeat */
250
	mousefn	mouserepeat;	/* mouse-down timer auto repeat */
249
 
251
 
250
	dropfn drop;		/* drag-and-drop function */
252
	dropfn drop;		/* drag-and-drop function */
251
  };
253
  };
252
 
254
 
253
 
255
 
254
/*  Useful definitions.  */
256
/*  Useful definitions.  */
255
 
257
 
256
#undef min
258
#undef min
257
#undef max
259
#undef max
258
#define min(a,b) (((a) < (b)) ? (a) : (b))
260
#define min(a,b) (((a) < (b)) ? (a) : (b))
259
#define max(a,b) (((a) > (b)) ? (a) : (b))
261
#define max(a,b) (((a) > (b)) ? (a) : (b))
260
 
262
 
261
#define MinMenuID  0x0100
263
#define MinMenuID  0x0100
262
#define MinChildID 0x6000
264
#define MinChildID 0x6000
263
#define MinDocID   0xE000
265
#define MinDocID   0xE000
264
 
266
 
265
#define sendmessage(a,b,c,d) SendMessage((HWND)(a),(UINT)(b),(WPARAM)c,(LPARAM)d)
267
#define sendmessage(a,b,c,d) SendMessage((HWND)(a),(UINT)(b),(WPARAM)c,(LPARAM)d)
266
 
268
 
267
/*
269
/*
268
 *  Function prototypes.
270
 *  Function prototypes.
269
 */
271
 */
270
 
272
 
271
/* Array memory management. */
273
/* Array memory management. */
272
 
274
 
273
  #define create(type)  ( (type*) memalloc(sizeof(type)) )
275
  #define create(type)  ( (type*) memalloc(sizeof(type)) )
274
  #define array(n,type) ( (type*) memalloc(n*sizeof(type)) )
276
  #define array(n,type) ( (type*) memalloc(n*sizeof(type)) )
275
  #define len(a)        ( memlength((char*)(a))/sizeof((a)[0]) )
277
  #define len(a)        ( memlength((char*)(a))/sizeof((a)[0]) )
276
  #define element(a,i)  ( (((i)<len(a)) && ((i)>=0)) ? (a)[i] : 0 )
278
  #define element(a,i)  ( (((i)<len(a)) && ((i)>=0)) ? (a)[i] : 0 )
277
  #define append(a,e)   ( *(char**)&(a)=memexpand((char*)(a),sizeof((a)[0])),\
279
  #define append(a,e)   ( *(char**)&(a)=memexpand((char*)(a),sizeof((a)[0])),\
278
				(a)[len(a)-1]=(e) )
280
				(a)[len(a)-1]=(e) )
279
  #define join(a,b)     ( *(char**)&(a)=memjoin((char*)(a),(char*)(b)) )
281
  #define join(a,b)     ( *(char**)&(a)=memjoin((char*)(a),(char*)(b)) )
280
  #define discard(a)    ( memfree((char*)(a)), (a)=0 )
282
  #define discard(a)    ( memfree((char*)(a)), (a)=0 )
281
 
283
 
282
  char * memalloc(long size);
284
  char * memalloc(long size);
283
  void   memfree(char *a);
285
  void   memfree(char *a);
284
  long   memlength(char *a);
286
  long   memlength(char *a);
285
  char * memexpand(char *a, long extra);
287
  char * memexpand(char *a, long extra);
286
  char * memjoin(char *a, char *b);
288
  char * memjoin(char *a, char *b);
287
 
289
 
288
/* Module initialisation methods. */
290
/* Module initialisation methods. */
289
 
291
 
290
  PROTECTED void  init_objects(void);
292
  PROTECTED void  init_objects(void);
291
  PROTECTED void  init_events(void);
293
  PROTECTED void  init_events(void);
292
  PROTECTED void  init_contexts(void);
294
  PROTECTED void  init_contexts(void);
293
  PROTECTED void  init_menus(void);
295
  PROTECTED void  init_menus(void);
294
  PROTECTED void  init_fonts(void);
296
  PROTECTED void  init_fonts(void);
295
  PROTECTED void  init_cursors(void);
297
  PROTECTED void  init_cursors(void);
296
 
298
 
297
  PROTECTED window  simple_window(void);
299
  PROTECTED window  simple_window(void);
298
 
300
 
299
/* Module finaliser methods. */
301
/* Module finaliser methods. */
300
 
302
 
301
  PROTECTED void  app_cleanup(void);
303
  PROTECTED void  app_cleanup(void);
302
 
304
 
303
  PROTECTED void  finish_objects(void);
305
  PROTECTED void  finish_objects(void);
304
  PROTECTED void  finish_events(void);
306
  PROTECTED void  finish_events(void);
305
  PROTECTED void  finish_contexts(void);
307
  PROTECTED void  finish_contexts(void);
306
 
308
 
307
/* Object management. */
309
/* Object management. */
308
 
310
 
309
  PROTECTED object  new_object(int kind, HANDLE handle, object parent);
311
  PROTECTED object  new_object(int kind, HANDLE handle, object parent);
310
  PROTECTED object  find_object(HANDLE handle, int id, int key);
312
  PROTECTED object  find_object(HANDLE handle, int id, int key);
311
  PROTECTED void    move_to_front(object obj);
313
  PROTECTED void    move_to_front(object obj);
312
  PROTECTED void    apply_to_list(object first, actionfn fn);
314
  PROTECTED void    apply_to_list(object first, actionfn fn);
313
 
315
 
314
  #define find_by_handle(h) find_object(h, 0, 0)
316
  #define find_by_handle(h) find_object(h, 0, 0)
315
  #define find_by_id(id)    find_object(0, id, 0)
317
  #define find_by_id(id)    find_object(0, id, 0)
316
  #define find_by_key(key)  find_object(0, 0, key)
318
  #define find_by_key(key)  find_object(0, 0, key)
317
 
319
 
318
/* Object refcounts and deletion. */
320
/* Object refcounts and deletion. */
319
 
321
 
320
  PROTECTED void  decrease_refcount(object obj);
322
  PROTECTED void  decrease_refcount(object obj);
321
  PROTECTED void  increase_refcount(object obj);
323
  PROTECTED void  increase_refcount(object obj);
322
  PROTECTED void  protect_object(object obj);
324
  PROTECTED void  protect_object(object obj);
323
  PROTECTED void  deletion_traversal(void);
325
  PROTECTED void  deletion_traversal(void);
324
 
326
 
325
/* Menu event management. */
327
/* Menu event management. */
326
 
328
 
327
  PROTECTED void  adjust_menu(WPARAM wParam);
329
  PROTECTED void  adjust_menu(WPARAM wParam);
328
  PROTECTED void  handle_menu_id(WPARAM wParam);
330
  PROTECTED void  handle_menu_id(WPARAM wParam);
329
  PROTECTED void  handle_menu_key(WPARAM wParam);
331
  PROTECTED void  handle_menu_key(WPARAM wParam);
330
 
332
 
331
/* Control event management. */
333
/* Control event management. */
332
 
334
 
333
  PROTECTED void   handle_control(HWND hwnd, UINT message);
335
  PROTECTED void   handle_control(HWND hwnd, UINT message);
334
  PROTECTED object find_valid_sibling(object obj);
336
  PROTECTED object find_valid_sibling(object obj);
335
 
337
 
336
/* Drawing context management. */
338
/* Drawing context management. */
337
 
339
 
338
  PROTECTED void  add_context(object obj, HDC dc, HGDIOBJ old);
340
  PROTECTED void  add_context(object obj, HDC dc, HGDIOBJ old);
339
  PROTECTED HDC   get_context(object obj);
341
  PROTECTED HDC   get_context(object obj);
340
  PROTECTED void  remove_context(object obj);
342
  PROTECTED void  remove_context(object obj);
341
  PROTECTED void  del_context(object obj);
343
  PROTECTED void  del_context(object obj);
342
  PROTECTED void  del_all_contexts(void);
344
  PROTECTED void  del_all_contexts(void);
343
 
345
 
344
  PROTECTED void  fix_brush(HDC dc, object obj, HBRUSH brush);
346
  PROTECTED void  fix_brush(HDC dc, object obj, HBRUSH brush);
345
 
347
 
346
/* Window private functions. */
348
/* Window private functions. */
347
 
349
 
348
  PROTECTED rect  screen_coords(object obj);
350
  PROTECTED rect  screen_coords(object obj);
349
  PROTECTED void  show_window(object obj);
351
  PROTECTED void  show_window(object obj);
350
  PROTECTED void  hide_window(object obj);
352
  PROTECTED void  hide_window(object obj);
351
 
353
 
352
/* Image private functions. */
354
/* Image private functions. */
353
 
355
 
354
  PROTECTED image   load_gif(char *filename);
356
  PROTECTED image   load_gif(char *filename);
355
  PROTECTED void    save_gif(image img, char *filename);
357
  PROTECTED void    save_gif(image img, char *filename);
356
 
358
 
357
  PROTECTED rgb  get_image_pixel(image img, int x, int y);
359
  PROTECTED rgb  get_image_pixel(image img, int x, int y);
358
  PROTECTED rgb  get_monochrome_pixel(image img, int x, int y);
360
  PROTECTED rgb  get_monochrome_pixel(image img, int x, int y);
359
  PROTECTED rgb  get_grey_pixel(image img, int x, int y);
361
  PROTECTED rgb  get_grey_pixel(image img, int x, int y);
360
 
362
 
361
  PROTECTED int  has_transparent_pixels(image img);
363
  PROTECTED int  has_transparent_pixels(image img);
362
 
364
 
363
/* Debugging functions. */
365
/* Debugging functions. */
364
 
366
 
365
  #if DEBUG
367
  #if DEBUG
366
  PROTECTED void    printimage(FILE *file, image img);
368
  PROTECTED void    printimage(FILE *file, image img);
367
  PROTECTED void    print_object_list(void);
369
  PROTECTED void    print_object_list(void);
368
  #endif
370
  #endif
369
 
371
 
370
/* String functions. */
372
/* String functions. */
371
 
373
 
372
  char * new_string(char *src);
374
  char * new_string(char *src);
373
  void   del_string(char *str);
375
  void   del_string(char *str);
374
  long   string_length(char *s);
376
  long   string_length(char *s);
375
  void   copy_string(char *dest, char *src);
377
  void   copy_string(char *dest, char *src);
376
  int    compare_strings(char *s1, char *s2);
378
  int    compare_strings(char *s1, char *s2);
377
  char * add_strings(char *s1, char *s2);
379
  char * add_strings(char *s1, char *s2);
378
  char * char_to_string(char ch);
380
  char * char_to_string(char ch);
379
  char * int_to_string(long i);
381
  char * int_to_string(long i);
380
  char * float_to_string(float f);
382
  char * float_to_string(float f);
381
 
383
 
382
  PROTECTED int    string_diff(char *s, char *t);
384
  PROTECTED int    string_diff(char *s, char *t);
383
  PROTECTED char * to_dos_string(char *str);
385
  PROTECTED char * to_dos_string(char *str);
384
  PROTECTED char * to_c_string(char *str);
386
  PROTECTED char * to_c_string(char *str);
385
 
387
 
386
/* New functions yet to be placed in the official header file */
388
/* New functions yet to be placed in the official header file */
387
 
389
 
388
 
390
 
389
/*
391
/*
390
 *  Library internal variables.
392
 *  Library internal variables.
391
 */
393
 */
392
 
394
 
393
  extern int    app_initialised;
395
  extern int    app_initialised;
394
  extern char * app_name;
396
  extern char * app_name;
395
 
397
 
396
  extern HANDLE	this_instance;
398
  extern HANDLE	this_instance;
397
  extern HANDLE	prev_instance;
399
  extern HANDLE	prev_instance;
398
 
400
 
399
  long FAR PASCAL _export app_win_proc (HWND, UINT, UINT, LONG);
401
  long FAR PASCAL _export app_win_proc (HWND, UINT, UINT, LONG);
400
  long FAR PASCAL _export app_doc_proc (HWND, UINT, UINT, LONG);
402
  long FAR PASCAL _export app_doc_proc (HWND, UINT, UINT, LONG);
401
  long FAR PASCAL _export app_work_proc (HWND, UINT, UINT, LONG);
403
  long FAR PASCAL _export app_work_proc (HWND, UINT, UINT, LONG);
402
  long FAR PASCAL _export app_control_procedure (HWND, UINT, UINT, LONG);
404
  long FAR PASCAL _export app_control_procedure (HWND, UINT, UINT, LONG);
403
  UINT FAR PASCAL _export app_timer_procedure(HWND, UINT, UINT, DWORD);
405
  UINT FAR PASCAL _export app_timer_procedure(HWND, UINT, UINT, DWORD);
404
  extern WNDPROC	  app_control_proc;
406
  extern WNDPROC	  app_control_proc;
405
 
407
 
406
  extern int 	menus_active;
408
  extern int 	menus_active;
407
  extern int 	active_windows;
409
  extern int 	active_windows;
408
  extern int 	child_id;
410
  extern int 	child_id;
409
 
411
 
410
  extern window  current_window;
412
  extern window  current_window;
411
  extern menubar current_menubar;
413
  extern menubar current_menubar;
412
  extern menu    current_menu;
414
  extern menu    current_menu;
413
 
415
 
414
  extern HACCEL	hAccel;
416
  extern HACCEL	hAccel;
415
  extern HWND	hwndMain;
417
  extern HWND	hwndMain;
416
  extern HWND	hwndClient;
418
  extern HWND	hwndClient;
417
  extern HWND	hwndFrame;
419
  extern HWND	hwndFrame;
418
  extern object MDIFrame;
420
  extern object MDIFrame;
419
  extern object MDIToolbar;
421
  extern object MDIToolbar;
420
  extern HWND   MDIStatus;
422
  extern HWND   MDIStatus;
421
  extern HDC      dc;
423
  extern HDC      dc;
422
  extern HPEN     the_pen;
424
  extern HPEN     the_pen;
423
  extern HBRUSH   the_brush;
425
  extern HBRUSH   the_brush;
424
  extern COLORREF win_rgb;
426
  extern COLORREF win_rgb;
425
 
427
 
426
  extern drawstruct app_drawstate;
428
  extern drawstruct app_drawstate;
427
 
429
 
428
  extern drawstate current;	/* global colour, font &c */
430
  extern drawstate current;	/* global colour, font &c */
429
  extern int 	keystate;	/* state of Shift, Ctrl, Alt */
431
  extern int 	keystate;	/* state of Shift, Ctrl, Alt */
430
 
432
 
431
#ifdef __cplusplus
433
#ifdef __cplusplus
432
}
434
}
433
#endif
435
#endif
434
 
436
 
435
#endif /* GraphApp internal header file */
437
#endif /* GraphApp internal header file */