Debian Codegraph @

debian/external_deps/fetk/sg/src/vgl/vgl_p.h

raw
1 /*
2 * ***************************************************************************
3 * SG = < Socket Graphics >
4 * Copyright (C) 1994-- Michael Holst
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * rcsid="$Id: vgl_p.h,v 1.21 2010/08/12 04:56:25 fetk Exp $"
21 * ***************************************************************************
22 */
23
24 /*
25 * ***************************************************************************
26 * File: vgl_p.h
27 *
28 * Purpose: PRIVATE header.
29 *
30 * Author: Michael Holst and Randy Bank
31 * ***************************************************************************
32 */
33
34 #ifndef _VGL_P_H_
35 #define _VGL_P_H_
36
37 #include <sg/vgl.h>
38 #include "sgcf.h"
39
40 #include <sg/ogl.h>
41 #include <sg/oglps.h>
42
43 /* X11/GLX or Win32/GLW or <OS-type/GL-interface> headers */
44 #if defined(HAVE_X11)
45 # include <X11/keysym.h>
46 # include <X11/IntrinsicP.h>
47 # include <X11/StringDefs.h>
48 # include <X11/Shell.h>
49 # include <X11/Xaw/Form.h>
50 # include <X11/Xaw/Box.h>
51 # include <X11/Xaw/Command.h>
52 # include <GL/glx.h>
53 # include <GL/GLwDrawA.h>
54 # if defined(HAVE_MOTIF)
55 # include <Xm/Xm.h>
56 # include <Xm/Form.h>
57 # include <Xm/PushB.h>
58 # include <Xm/DrawnB.h>
59 # include <Xm/FileSB.h>
60 # include <Xm/Text.h>
61 # include <Xm/RowColumn.h>
62 # endif
63 #elif defined(HAVE_WIN32)
64 # include <windows.h>
65 #elif defined(HAVE_NEXT)
66 # include <AppKit/AppKit.h>
67 # include <AppKit/event.h>
68 # include <GL/osmesa.h>
69 #endif
70
71 /*
72 * ***************************************************************************
73 * Class Vgl: Parameters and datatypes
74 * ***************************************************************************
75 */
76
77 #if defined(HAVE_X11)
78 # define VPTR XtPointer
79 # define VCBPROC XtCallbackProc
80 # define VWIDGET Widget
81 # define VKEY_ESC XK_Escape
82 # define VKEY_QUE XK_question
83
84 # define VKEY_0 XK_0
85 # define VKEY_1 XK_1
86 # define VKEY_2 XK_2
87 # define VKEY_3 XK_3
88 # define VKEY_4 XK_4
89 # define VKEY_5 XK_5
90 # define VKEY_6 XK_6
91 # define VKEY_7 XK_7
92 # define VKEY_8 XK_8
93 # define VKEY_9 XK_9
94
95 # define VKEY_a XK_a
96 # define VKEY_b XK_b
97 # define VKEY_c XK_c
98 # define VKEY_d XK_d
99 # define VKEY_e XK_e
100 # define VKEY_f XK_f
101 # define VKEY_g XK_g
102 # define VKEY_h XK_h
103 # define VKEY_i XK_i
104 # define VKEY_j XK_j
105 # define VKEY_k XK_k
106 # define VKEY_l XK_l
107 # define VKEY_m XK_m
108 # define VKEY_n XK_n
109 # define VKEY_o XK_o
110 # define VKEY_p XK_p
111 # define VKEY_q XK_q
112 # define VKEY_r XK_r
113 # define VKEY_s XK_s
114 # define VKEY_t XK_t
115 # define VKEY_u XK_u
116 # define VKEY_v XK_v
117 # define VKEY_w XK_w
118 # define VKEY_x XK_x
119 # define VKEY_y XK_y
120 # define VKEY_z XK_z
121
122 # define VKEY_A XK_A
123 # define VKEY_B XK_B
124 # define VKEY_C XK_C
125 # define VKEY_D XK_D
126 # define VKEY_E XK_E
127 # define VKEY_F XK_F
128 # define VKEY_G XK_G
129 # define VKEY_H XK_H
130 # define VKEY_I XK_I
131 # define VKEY_J XK_J
132 # define VKEY_K XK_K
133 # define VKEY_L XK_L
134 # define VKEY_M XK_M
135 # define VKEY_N XK_N
136 # define VKEY_O XK_O
137 # define VKEY_P XK_P
138 # define VKEY_Q XK_Q
139 # define VKEY_R XK_R
140 # define VKEY_S XK_S
141 # define VKEY_T XK_T
142 # define VKEY_U XK_U
143 # define VKEY_V XK_V
144 # define VKEY_W XK_W
145 # define VKEY_X XK_X
146 # define VKEY_Y XK_Y
147 # define VKEY_Z XK_Z
148
149 #elif defined(HAVE_WIN32) || defined(HAVE_NEXT)
150 # define VPTR void*
151 # define VCBPROC int
152 # define VWIDGET int*
153 # define VKEY_ESC 0x1B
154 # define VKEY_QUE 0x3f
155
156 # define VKEY_0 '0'
157 # define VKEY_1 '1'
158 # define VKEY_2 '2'
159 # define VKEY_3 '3'
160 # define VKEY_4 '4'
161 # define VKEY_5 '5'
162 # define VKEY_6 '6'
163 # define VKEY_7 '7'
164 # define VKEY_8 '8'
165 # define VKEY_9 '9'
166
167 # define VKEY_a 'a'
168 # define VKEY_b 'b'
169 # define VKEY_c 'c'
170 # define VKEY_d 'd'
171 # define VKEY_e 'e'
172 # define VKEY_f 'f'
173 # define VKEY_g 'g'
174 # define VKEY_h 'h'
175 # define VKEY_i 'i'
176 # define VKEY_j 'j'
177 # define VKEY_k 'k'
178 # define VKEY_l 'l'
179 # define VKEY_m 'm'
180 # define VKEY_n 'n'
181 # define VKEY_o 'o'
182 # define VKEY_p 'p'
183 # define VKEY_q 'q'
184 # define VKEY_r 'r'
185 # define VKEY_s 's'
186 # define VKEY_t 't'
187 # define VKEY_u 'u'
188 # define VKEY_v 'v'
189 # define VKEY_w 'w'
190 # define VKEY_x 'x'
191 # define VKEY_y 'y'
192 # define VKEY_z 'z'
193
194 # define VKEY_A 'A'
195 # define VKEY_B 'B'
196 # define VKEY_C 'C'
197 # define VKEY_D 'D'
198 # define VKEY_E 'E'
199 # define VKEY_F 'F'
200 # define VKEY_G 'G'
201 # define VKEY_H 'H'
202 # define VKEY_I 'I'
203 # define VKEY_J 'J'
204 # define VKEY_K 'K'
205 # define VKEY_L 'L'
206 # define VKEY_M 'M'
207 # define VKEY_N 'N'
208 # define VKEY_O 'O'
209 # define VKEY_P 'P'
210 # define VKEY_Q 'Q'
211 # define VKEY_R 'R'
212 # define VKEY_S 'S'
213 # define VKEY_T 'T'
214 # define VKEY_U 'U'
215 # define VKEY_V 'V'
216 # define VKEY_W 'W'
217 # define VKEY_X 'X'
218 # define VKEY_Y 'Y'
219 # define VKEY_Z 'Z'
220 #endif
221
222 #define NUM_BUTTONS 7
223
224 typedef enum VGLbuttons {
225 VGL_SOCKET = 0, /* socket menu */
226 VGL_SETTINGS = 1, /* settings menu */
227 VGL_LISTS = 2, /* display list menu */
228 VGL_GL2FILE = 3, /* PS/XPM/BH file generation */
229 VGL_FILE2GL = 4, /* BH/OFF/IV/PQR file load */
230 VGL_RESET = 5, /* reset rotator position */
231 VGL_QUIT = 6 /* quit */
232 } VGLbuttons;
233
234 typedef enum VGLsettings {
235 VGL_LIGHT = 0, /* lighting effects */
236 VGL_ORTHO = 1, /* orthographic projection */
237 VGL_FRAME = 2, /* three frames */
238 VGL_BALL = 3, /* quaternion trackball */
239 VGL_BBOX = 4, /* bounding box */
240 VGL_XDR = 5 /* XDR input file format */
241 } VGLsettings;
242
243 VEXTERNC Vgl *theeVgl;
244
245 /*
246 * ***************************************************************************
247 * Class Vgl: Definition
248 * ***************************************************************************
249 */
250
251 typedef struct Vglcore {
252 #if defined(HAVE_X11)
253 Widget topLev;
254 Widget mainForm;
255 Widget plot;
256 Widget psgenMenu;
257 Widget resetMenu;
258 Widget socketMenu;
259 Widget settingsMenu;
260 Widget listMenu;
261 Widget fileSelect;
262 Widget button[NUM_BUTTONS];
263 GLXContext glxCon;
264 XVisualInfo *xVisInf;
265 Display *dpy;
266 Screen *scr;
267 Pixel foregrnd;
268 Pixel backgrnd;
269 Pixel buttonForegrnd;
270 Pixel buttonBackgrnd;
271 int rgbaVis;
272 int cmapIns;
273 int fontHeight;
274 # if defined(HAVE_MOTIF)
275 XmFontList theFont;
276 XmFontListEntry theFontEntry;
277 # endif
278 #elif defined(HAVE_WIN32)
279 HWND topLev;
280 HDC plot;
281 HGLRC glxCon;
282 #elif defined(HAVE_NEXT)
283 NSWindow *topLev;
284 NSBitmapImageRep *plot;
285 OSMesaContext glxCon;
286 NSView *theViu;
287 unsigned char *buf;
288 #endif
289
290 } Vglcore;
291
292 /*
293 * ***************************************************************************
294 * Class Vgl: Inlineable methods
295 * ***************************************************************************
296 */
297 #if !defined(VINLINE_VGL)
298 #else /* if defined(VINLINE_VGL) */
299 #endif /* if !defined(VINLINE_VGL) */
300
301 /*
302 * ***************************************************************************
303 * Class Vgl: Non-inlineable methods (vgl.c)
304 * ***************************************************************************
305 */
306
307 VEXTERNC void Vgl_open(Vgl *thee, int xsize, int ysize, int xpos, int ypos);
308 VEXTERNC void Vgl_quit(Vgl *thee);
309 VEXTERNC void Vgl_swapBuffers(Vgl *thee);
310 VEXTERNC void Vgl_makeCurrent(Vgl *thee);
311 VEXTERNC void Vgl_eventLoop(Vgl *thee);
312 VEXTERNC void Vgl_spin(void *wId, unsigned long *tId);
313 VEXTERNC void Vgl_getPolys(void *wId, unsigned long *tId);
314 VEXTERNC void Vgl_makeColors(Vgl *thee);
315 VEXTERNC void Vgl_makeGeom(Vgl *thee, int key);
316 VEXTERNC void Vgl_unmakeWidgets(Vgl *thee);
317 VEXTERNC void Vgl_makeWidgets(Vgl *thee);
318 VEXTERNC void Vgl_buildListMenu(Vgl *thee);
319 VEXTERNC void Vgl_buildPsgenMenu(Vgl *thee);
320 VEXTERNC void Vgl_buildResetMenu(Vgl *thee);
321 VEXTERNC void Vgl_buildSocketMenu(Vgl *thee);
322 VEXTERNC void Vgl_buildSettingsMenu(Vgl *thee);
323 VEXTERNC void Vgl_fileSelectHandle(Vgl *thee);
324 VEXTERNC void Vgl_prtStat(Vgl *thee);
325 VEXTERNC void Vgl_redraw(Vgl *thee);
326
327 VEXTERNC VCBPROC Vgl_listCallback(VWIDGET w,
328 VPTR cli, VPTR cal);
329 VEXTERNC VCBPROC Vgl_settingsCallback(VWIDGET w,
330 VPTR cli, VPTR cal);
331 VEXTERNC VCBPROC Vgl_fileWriteCallback(VWIDGET w,
332 VPTR cli, VPTR cal);
333 VEXTERNC VCBPROC Vgl_resetCallback(VWIDGET w,
334 VPTR cli, VPTR cal);
335 VEXTERNC VCBPROC Vgl_socketCallBack(VWIDGET w,
336 VPTR cli, VPTR cal);
337 VEXTERNC VCBPROC Vgl_fileReadCallback(VWIDGET w,
338 VPTR cli, VPTR cal);
339
340 #if defined(HAVE_X11)
341 VEXTERNC void Vgl_handler(Widget w,
342 VPTR msg, XEvent *wParam, VPTR lParam);
343 #elif defined(HAVE_WIN32)
344 VEXTERNC WINAPI Vgl_handler(HWND w,
345 UINT msg, DWORD wParam, LONG lParam);
346 #elif defined(HAVE_NEXT)
347 #endif
348
349 #endif /* _VGL_P_H_ */
350