aboutsummaryrefslogtreecommitdiff
path: root/src/graph/view3D/lighting3d.c
blob: b3432c5fe0cc8668bcbd5a7af9154336decdb4be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
/*
  Copyright (C) 1991-2002, The Numerical Algorithms Group Ltd.
  All rights reserved.
  Copyright (C) 2007-2008, Gabriel Dos Reis.
  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are
  met:

      - Redistributions of source code must retain the above copyright
        notice, this list of conditions and the following disclaimer.

      - Redistributions in binary form must reproduce the above copyright
        notice, this list of conditions and the following disclaimer in
        the documentation and/or other materials provided with the
        distribution.

      - Neither the name of The Numerical Algorithms Group Ltd. nor the
        names of its contributors may be used to endorse or promote products
        derived from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#define _LIGHTING3D_C
#include "axiom-c-macros.h"

#include <math.h>
#include <string.h>

#include "light11.bitmap"
#include "light11.mask"


#include "header.h"
#include "static.h"
#include "draw.h"
#include "cpanel.h"
#include "volume.h"

#include "Gfun.H1"
#include "XSpadFill.H1"
#include "all_3d.H1"

#define lightMASK ExposureMask
#define lightCursorForeground lightingTitleColor
#define lightCursorBackground foregroundColor

#define lightFontHeight (lightingFont->max_bounds.ascent+lightingFont->max_bounds.descent)

#define lightingAxesColor  monoColor(52)
#define lightingLabelColor monoColor(12)
#define lightingBoxColor   monoColor(138)
#define lightingLightColor monoColor(7)
#define lightingTitleColor monoColor(69)
#define lightingButtonColor monoColor(140)
#define lightingTransColor monoColor(140)
#define lightingTransArrowColor monoColor(100)
#define lightingTransLabelColor monoColor(207)

#define lightingAxesSize 175
#define lightingAxesX    61
#define lightingAxesY    28

#define lightAxesScale 110      /* the extent of the axes in object space */
#define lightScale 0.63         /* projected scale factor */

#define arrowHead (control->buttonQueue[lightTranslucent].buttonX + 5)
static viewTriple point0 = {0,0,0};


/***************************
 * int makeLightingPanel() *
 ***************************/

int
makeLightingPanel(void)
{

  int i;
  XSetWindowAttributes cwAttrib, controlAttrib;
  XSizeHints sizehint;
  Pixmap lightbits,lightmask;
  XColor foreColor, backColor;

  lightbits = XCreateBitmapFromData(dsply,rtWindow, lightBitmap_bits,
                                    lightBitmap_width,lightBitmap_height);
  lightmask = XCreateBitmapFromData(dsply,rtWindow, lightMask_bits,
                                    lightMask_width,lightMask_height);
  cwAttrib.background_pixel = backgroundColor;
  cwAttrib.border_pixel = foregroundColor;
  cwAttrib.event_mask = lightMASK;
  cwAttrib.colormap = colorMap;
  cwAttrib.override_redirect = overrideManager;
  foreColor.pixel = lightCursorForeground;
  XQueryColor(dsply,colorMap,&foreColor);
  backColor.pixel = lightCursorBackground;
  XQueryColor(dsply,colorMap,&backColor);
  cwAttrib.cursor = XCreatePixmapCursor(dsply,lightbits,lightmask,
                                        &foreColor,&backColor,
                                        lightBitmap_x_hot,lightBitmap_y_hot);
  lightingWindow = XCreateWindow(dsply,control->controlWindow,
                                 -3,-3,controlWidth,controlHeight,3,
                                 CopyFromParent,InputOutput,CopyFromParent,
                                 controlCreateMASK,&cwAttrib);

  sizehint.flags  = USPosition | USSize;
  sizehint.x      = 0;
  sizehint.y      = 0;
  sizehint.width  = controlWidth;
  sizehint.height = controlHeight;
          /*** the None stands for icon pixmap. ***/
  XSetNormalHints(dsply,lightingWindow,&sizehint);
  XSetStandardProperties(dsply,lightingWindow,"Lighting Panel 3D",
                         "Lighting Panel",None,NULL,0,&sizehint);

      /*** lighting axes window ***/
  cwAttrib.event_mask = 0;
  lightingAxes = XCreateWindow(dsply,lightingWindow,
                               lightingAxesX,lightingAxesY,
                               lightingAxesSize,lightingAxesSize,
                               0,CopyFromParent,InputOutput,CopyFromParent,
                               controlCreateMASK,&cwAttrib);

  sizehint.flags  = USPosition | USSize;
  sizehint.x      = lightingAxesX;
  sizehint.y      = lightingAxesY;
  sizehint.width  = lightingAxesSize;
  sizehint.height = lightingAxesSize;
          /*** the None stands for icon pixmap ***/
  XSetNormalHints(dsply,lightingAxes,&sizehint);
  XSetStandardProperties(dsply,lightingAxes,"Lighting Axes","Lighting Axes",
                         None,NULL,0,&sizehint);
  XMapWindow(dsply,lightingAxes);

    /*** draw lighting buttons ***/
  initLightButtons(control->buttonQueue);
/*
  controlAttrib.event_mask = (control->buttonQueue[lightingButtonsStart]).mask;
  (control->buttonQueue[lightingButtonsStart]).self =
                  XCreateWindow(dsply, lightingWindow,
                    (control->buttonQueue[lightingButtonsStart]).buttonX,
                    (control->buttonQueue[lightingButtonsStart]).buttonY,
                    (control->buttonQueue[lightingButtonsStart]).buttonWidth,
                    (control->buttonQueue[lightingButtonsStart]).buttonHeight,
                    0,0,InputOnly,CopyFromParent,
                    buttonCreateMASK,&controlAttrib);
  XMakeAssoc(dsply,table,(control->buttonQueue[lightingButtonsStart]).self,
             &((control->buttonQueue[lightingButtonsStart]).buttonKey));
  XMapWindow(dsply,(control->buttonQueue[lightingButtonsStart]).self);
*/
  for (i=(lightingButtonsStart + 1); i<(lightingButtonsEnd); i++) {
    controlAttrib.event_mask = (control->buttonQueue[i]).mask;
    (control->buttonQueue[i]).self =
                    XCreateWindow(dsply,lightingWindow,
                      (control->buttonQueue[i]).buttonX,
                      (control->buttonQueue[i]).buttonY,
                      (control->buttonQueue[i]).buttonWidth,
                      (control->buttonQueue[i]).buttonHeight,
                      0,0,InputOnly,CopyFromParent,
                      buttonCreateMASK,&controlAttrib);
    XMakeAssoc(dsply,table,(control->buttonQueue[i]).self,
               &((control->buttonQueue[i]).buttonKey));
    XMapWindow(dsply,(control->buttonQueue[i]).self);
  }

     /* assign global direction variables for light projections */
  sinTheta  = sin(-viewport->theta);
  cosTheta  = cos(-viewport->theta);
  sinPhi    = sin(viewport->phi);
  cosPhi    = cos(viewport->phi);

  return(0);

}  /* makeLightingPanel() */

/***************************
 * void drawLightingAxes() *
 ***************************/

void 
drawLightingAxes(void)
{

  XWindowAttributes laInfo;
  int i,xCenter,yCenter;
  float Px0,Py0;
  int vPx0,vPy0,vPx1,vPy1;
  viewTriple pointX,pointY,pointXY,pointXYZ;

  XGetWindowAttributes(dsply,lightingAxes,&laInfo);
  XClearWindow(dsply,lightingAxes);
  xCenter = laInfo.width / 2;
  yCenter = laInfo.height / 2;

  sinTheta = sin(-viewport->theta);
  cosTheta = cos(-viewport->theta);
  sinPhi   = sin(viewport->phi);
  cosPhi   = cos(viewport->phi);

  GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption);
  for (i=0; i < 3; i++) {
    Px0 = proj2PX(axes[i][0],axes[i][1]);
    Py0 = proj2PY(axes[i][0],axes[i][1],axes[i][2]);
    vPx0 =                   Px0 * lightScale + xCenter;
    vPy0 = laInfo.height - (Py0 * lightScale + yCenter);
    Px0 = proj2PX(axes[i][3],axes[i][4]);
    Py0 = proj2PY(axes[i][3],axes[i][4],axes[i][5]);
    vPx1 =                   Px0 * lightScale + xCenter;
    vPy1 = laInfo.height - (Py0 * lightScale + yCenter);
    GDrawLine(lightingGC,lightingAxes,vPx0,vPy0,vPx1,vPy1,Xoption);
  }

  GSetForeground(lightingGC,(float)lightingLabelColor,Xoption);
  for (i=0; i < basicScreen; i++) {
    Px0 = proj2PX(labels[i][0],labels[i][1]);
    Py0 = proj2PY(labels[i][0],labels[i][1],labels[i][2]);
    vPx0 =                   Px0 * lightScale + xCenter;
    vPy0 = laInfo.height - (Py0 * lightScale + yCenter);
    Px0 = proj2PX(labels[i][3],labels[i][4]);
    Py0 = proj2PY(labels[i][3],labels[i][4],labels[i][5]);
    vPx1 =                   Px0 * lightScale + xCenter;
    vPy1 = laInfo.height - (Py0 * lightScale + yCenter);
    GDrawLine(lightingGC,lightingAxes,vPx0,vPy0,vPx1,vPy1,Xoption);
  }

  GSetForeground(lightingGC,(float)lightingBoxColor,Xoption);
  pointX.x = tempLightPointer[0] * lightAxesScale;
  pointX.y = 0;
  pointX.z = 0;

  pointY.x = 0;
  pointY.y = tempLightPointer[1] * lightAxesScale;
  pointY.z = 0;

  pointXY.x = tempLightPointer[0] * lightAxesScale;
  pointXY.y = tempLightPointer[1] * lightAxesScale;
  pointXY.z = 0;

  pointXYZ.x = tempLightPointer[0] * lightAxesScale;
  pointXYZ.y = tempLightPointer[1] * lightAxesScale;
  pointXYZ.z = tempLightPointer[2] * lightAxesScale;

  Px0 = proj2PX(pointXY.x,pointXY.y);
  Py0 = proj2PY(pointXY.x,pointXY.y,pointXY.z);
  vPx0 =                   Px0 * lightScale + xCenter;
  vPy0 = laInfo.height - (Py0 * lightScale + yCenter);

  Px0 = proj2PX(pointX.x,pointX.y);
  Py0 = proj2PY(pointX.x,pointX.y,pointX.z);
  vPx1 =                   Px0 * lightScale + xCenter;
  vPy1 = laInfo.height - (Py0 * lightScale + yCenter);
  GDrawLine(lightingGC,lightingAxes,vPx0,vPy0,vPx1,vPy1,Xoption);

  Px0 = proj2PX(pointY.x,pointY.y);
  Py0 = proj2PY(pointY.x,pointY.y,pointY.z);
  vPx1 =                   Px0 * lightScale + xCenter;
  vPy1 = laInfo.height - (Py0 * lightScale + yCenter);
  GDrawLine(lightingGC,lightingAxes,vPx0,vPy0,vPx1,vPy1,Xoption);

  Px0 = proj2PX(pointXYZ.x,pointXYZ.y);
  Py0 = proj2PY(pointXYZ.x,pointXYZ.y,pointXYZ.z);
  vPx1 =                   Px0 * lightScale + xCenter;
  vPy1 = laInfo.height - (Py0 * lightScale + yCenter);
  GDrawLine(lightingGC,lightingAxes,vPx0,vPy0,vPx1,vPy1,Xoption);

  GSetForeground(lightingGC,(float)lightingLightColor,Xoption);
  Px0 = proj2PX(point0.x,point0.y);
  Py0 = proj2PY(point0.x,point0.y,point0.z);
  vPx0 =                   Px0 * lightScale + xCenter;
  vPy0 = laInfo.height - (Py0 * lightScale + yCenter);
  GDrawLine(lightingGC,lightingAxes,vPx0,vPy0,vPx1,vPy1,Xoption);

}   /* drawLightingAxes */


/******************************
 * void drawLightTransArrow() *
 ******************************/

void 
drawLightTransArrow(void)
{

  int i;
  float f;

  /*** Draw the intensity potentiometer window. ***/
  XClearArea(dsply,lightingWindow,
             (control->buttonQueue[lightTranslucent]).buttonX,
             (control->buttonQueue[lightTranslucent]).buttonY-5,
             (control->buttonQueue[lightTranslucent]).buttonWidth,
             (control->buttonQueue[lightTranslucent]).buttonHeight+10,
             False);
  GDrawLine(controlMessageGC,lightingWindow,
            (control->buttonQueue[lightTranslucent]).buttonX,
            (control->buttonQueue[lightTranslucent]).buttonY,
            (control->buttonQueue[lightTranslucent]).buttonX,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).buttonHeight,Xoption);
  GDrawLine(controlMessageGC,lightingWindow,
            (control->buttonQueue[lightTranslucent]).buttonX + 1,
            (control->buttonQueue[lightTranslucent]).buttonY,
            (control->buttonQueue[lightTranslucent]).buttonX +
            (control->buttonQueue[lightTranslucent]).buttonWidth * 3/10,
            (control->buttonQueue[lightTranslucent]).buttonY,Xoption);
  GDrawLine(controlMessageGC,lightingWindow,
            (control->buttonQueue[lightTranslucent]).buttonX + 1,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).yHalf/2,
            (control->buttonQueue[lightTranslucent]).buttonX +
            (control->buttonQueue[lightTranslucent]).buttonWidth * 2/10,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).yHalf/2,Xoption);
  GDrawLine(controlMessageGC,lightingWindow,
            (control->buttonQueue[lightTranslucent]).buttonX + 1,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).yHalf,
            (control->buttonQueue[lightTranslucent]).buttonX +
            (control->buttonQueue[lightTranslucent]).buttonWidth * 3/10,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).yHalf,Xoption);
  GDrawLine(controlMessageGC,lightingWindow,
            (control->buttonQueue[lightTranslucent]).buttonX + 1,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).buttonHeight*3/4,
            (control->buttonQueue[lightTranslucent]).buttonX +
            (control->buttonQueue[lightTranslucent]).buttonWidth * 2/10,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).buttonHeight*3/4,Xoption);
  GDrawLine(controlMessageGC,lightingWindow,
            (control->buttonQueue[lightTranslucent]).buttonX + 1,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).buttonHeight,
            (control->buttonQueue[lightTranslucent]).buttonX +
            (control->buttonQueue[lightTranslucent]).buttonWidth * 3/10,
            (control->buttonQueue[lightTranslucent]).buttonY +
            (control->buttonQueue[lightTranslucent]).buttonHeight,Xoption);

  /*** Draw the intensity selection arrow ***/
  GSetForeground(lightingGC,(float)lightingTransArrowColor,Xoption);

  f = (control->buttonQueue[lightTranslucent].buttonY +
       control->buttonQueue[lightTranslucent].buttonHeight) -
       (tempLightIntensity *
        control->buttonQueue[lightTranslucent].buttonHeight);
  i = f;
  GDrawLine(lightingGC, lightingWindow, arrowHead + 10, i,
            arrowHead + 22, i + 2, Xoption);
  GDrawLine(lightingGC, lightingWindow, arrowHead + 22, i + 2,
            arrowHead + 22, i - 2, Xoption);
  GDrawLine(lightingGC, lightingWindow, arrowHead + 22, i - 2,
            arrowHead + 10, i, Xoption);

}  /* drawLightTransArrow() */





/****************************
 * void drawLightingPanel() *
 ****************************/

void
drawLightingPanel(void)
{

  char *s;
  int i,strlength;

  /* Draw border lines to separate the lighting window, potentiometers,
     and button regions of the lightng subpanel. */
  GSetForeground(trashGC,(float)foregroundColor,Xoption);
  GSetLineAttributes(trashGC,3,LineSolid,CapButt,JoinMiter,Xoption);
  GDrawLine(trashGC, lightingWindow, 0,  potA, controlWidth, potA, Xoption);

  GSetLineAttributes(trashGC,2,LineSolid,CapButt,JoinMiter,Xoption);
  GDrawLine(trashGC, lightingWindow, 0, lightB, controlWidth, lightB, Xoption);
  GDrawLine(trashGC, lightingWindow, 0, lightPotA, controlWidth,
            lightPotA, Xoption);
  GDrawLine(trashGC, lightingWindow, 0, lightPotB, controlWidth,
            lightPotB, Xoption);
  GDrawLine(trashGC, lightingWindow, lightTransL, lightPotA,
            lightTransL, lightPotB, Xoption);

  writeControlTitle(lightingWindow);
  s = "Lighting Control Panel";
  strlength = strlen(s);
  GSetForeground(anotherGC,(float)lightingTitleColor,Xoption);
  GDrawString(anotherGC, lightingWindow,
              centerX(anotherGC, s, strlength, controlWidth),
              lightB+18, s, strlength, Xoption);

  for (i=lightingButtonsStart; i<(lightingButtonsEnd); i++) {
    switch (i) {
    case lightMove:
      GSetForeground(lightingGC,(float)lightingButtonColor,Xoption);
      GDraw3DButtonOut(lightingGC,lightingWindow,
                     (control->buttonQueue[i]).buttonX,
                     (control->buttonQueue[i]).buttonY,
                     (control->buttonQueue[i]).buttonWidth,
                     (control->buttonQueue[i]).buttonHeight,Xoption);
      GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption);
      GDrawLine(lightingGC,lightingWindow,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY +
                2*(control->buttonQueue[i]).yHalf,Xoption);
      GDrawLine(lightingGC,lightingWindow,
                (control->buttonQueue[i]).buttonX,
                (control->buttonQueue[i]).buttonY +
                (control->buttonQueue[i]).yHalf,
                (control->buttonQueue[i]).buttonX +
                2*(control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY +
                (control->buttonQueue[i]).yHalf,Xoption);
      break;
    case lightMoveXY:
      GSetForeground(lightingGC,(float)lightingButtonColor,Xoption);
      GDraw3DButtonOut(lightingGC,lightingWindow,
                     (control->buttonQueue[i]).buttonX,
                     (control->buttonQueue[i]).buttonY,
                     (control->buttonQueue[i]).buttonWidth,
                     (control->buttonQueue[i]).buttonHeight,Xoption);
      GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption);
      GDrawLine(lightingGC,lightingWindow,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY +
                2*(control->buttonQueue[i]).yHalf,Xoption);
      GDrawLine(lightingGC,lightingWindow,
                (control->buttonQueue[i]).buttonX,
                (control->buttonQueue[i]).buttonY +
                (control->buttonQueue[i]).yHalf,
                (control->buttonQueue[i]).buttonX +
                2*(control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY +
                (control->buttonQueue[i]).yHalf,Xoption);
      break;
    case lightMoveZ:
      GSetForeground(lightingGC,(float)lightingButtonColor,Xoption);
      GDraw3DButtonOut(lightingGC,lightingWindow,
                     (control->buttonQueue[i]).buttonX,
                     (control->buttonQueue[i]).buttonY,
                     (control->buttonQueue[i]).buttonWidth,
                     (control->buttonQueue[i]).buttonHeight,Xoption);
      GSetForeground(lightingGC,(float)monoColor(buttonColor),Xoption);
      GDrawLine(lightingGC,lightingWindow,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf,
                (control->buttonQueue[i]).buttonY +
                2*(control->buttonQueue[i]).yHalf,Xoption);
      GDrawLine(lightingGC,lightingWindow,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf -
                (control->buttonQueue[i]).xHalf/2,
                (control->buttonQueue[i]).buttonY +
                (control->buttonQueue[i]).yHalf,
                (control->buttonQueue[i]).buttonX +
                (control->buttonQueue[i]).xHalf +
                (control->buttonQueue[i]).xHalf/2,
                (control->buttonQueue[i]).buttonY +
                (control->buttonQueue[i]).yHalf,Xoption);
      break;
    case lightTranslucent:
      drawLightTransArrow();
      break;
    default:
      GDraw3DButtonOut(lightingGC,lightingWindow,
                     (control->buttonQueue[i]).buttonX,
                     (control->buttonQueue[i]).buttonY,
                     (control->buttonQueue[i]).buttonWidth,
                     (control->buttonQueue[i]).buttonHeight,Xoption);
      s = (control->buttonQueue[i]).text;
      strlength = strlen(s);
      GSetForeground(trashGC,
                     (float)monoColor((control->buttonQueue[i]).textColor),Xoption);
      GDrawString(trashGC, lightingWindow,
                  (control->buttonQueue[i]).buttonX +
                  centerX(processGC,s,strlength,
                          (control->buttonQueue[i]).buttonWidth),
                  (control->buttonQueue[i]).buttonY +
                  centerY(processGC,(control->buttonQueue[i]).buttonHeight),
                  s,strlen(s),Xoption);
    }  /* switch */
  }  /* for i in control->buttonQueue */

  GSetForeground(lightingGC,(float)monoColor(labelColor),Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightMoveXY].buttonX +
              control->buttonQueue[lightMoveXY].buttonWidth + 3,
              control->buttonQueue[lightMoveXY].buttonY +
              control->buttonQueue[lightMoveXY].yHalf,
              "x",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightMoveXY].buttonX +
              control->buttonQueue[lightMoveXY].xHalf - 2,
              control->buttonQueue[lightMoveXY].buttonY - 4,
              "y",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightMoveZ].buttonX +
              control->buttonQueue[lightMoveZ].xHalf - 2,
              control->buttonQueue[lightMoveZ].buttonY - 4,
              "z",1,Xoption);

  /** Draw the title for the intensity potentiometer. */
  GSetForeground(lightingGC,(float)lightingTransColor,Xoption);

  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY,
              "I",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight,
              "n",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*2,
              "t",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*3,
              "e",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*4,
              "n",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*5,
              "s",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*6,
              "i",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*7,
              "t",1,Xoption);
  GDrawString(lightingGC,lightingWindow,
              control->buttonQueue[lightTranslucent].buttonX +
              control->buttonQueue[lightTranslucent].buttonWidth + 3,
              control->buttonQueue[lightTranslucent].buttonY +
              lightFontHeight*8,
              "y",1,Xoption);
  drawLightingAxes();
  drawLightTransArrow();

}  /* drawLightingPanel */