Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

610987 views
1
/****************************************************************************
2
**
3
*W gapgraph.c XGAP Source Frank Celler
4
**
5
**
6
*Y Copyright 1995-1997, Lehrstuhl D fuer Mathematik, RWTH Aachen, Germany
7
*Y Copyright 1997, Frank Celler, Huerth, Germany
8
*/
9
#include "utils.h"
10
#include "gapgraph.h"
11
12
13
/****************************************************************************
14
**
15
16
*F * * * * * * * * * * * * * * local variables * * * * * * * * * * * * * * *
17
*/
18
19
/****************************************************************************
20
**
21
22
*V GcClear . . . . . . . . . . . . . . . . . . . . . . . used to clear areas
23
*/
24
static GC GcClear;
25
26
27
/****************************************************************************
28
**
29
*V GcColormap . . . . . . . . . . . . . . . . . . . . . standard color map
30
*/
31
static Colormap GcColormap;
32
33
34
/****************************************************************************
35
**
36
*V GcColors . . . . . . . . . . . . . . . . . . . . . . . . . . color array
37
*/
38
static XColor GcColors[C_LAST+1];
39
40
41
/****************************************************************************
42
**
43
44
*F * * * * * * * * * * * * * gap graphic widget * * * * * * * * * * * * * *
45
*/
46
47
48
/****************************************************************************
49
**
50
51
*F GapGraphInitialize( <request>, <new>, <args>, <nums> ) open a new window
52
*/
53
static void GapGraphInitialize ( Widget request, Widget new, ArgList args, Cardinal *nums )
54
{
55
GapGraphicWidget w = (GapGraphicWidget) new;
56
XRectangle rec[1];
57
XGCValues val;
58
Display * dis;
59
static Boolean first = True;
60
61
/* store width and height of our new window */
62
w->gap_graphic.width = request->core.width;
63
w->gap_graphic.height = request->core.height;
64
w->gap_graphic.update = True;
65
66
/* create a new list for the graphic objects */
67
w->gap_graphic.objs = List(0);
68
69
/* create a pixmap the picture */
70
dis = XtDisplay(new);
71
72
/* set display */
73
w->gap_graphic.display = dis;
74
75
/* create a graphic context for this window */
76
val.function = GXcopy;
77
val.plane_mask = AllPlanes;
78
val.foreground = BlackPixel( dis, DefaultScreen(dis) );
79
val.background = WhitePixel( dis, DefaultScreen(dis) );
80
val.line_width = 0;
81
val.line_style = LineSolid;
82
val.cap_style = CapRound;
83
val.fill_style = FillSolid;
84
w->gap_graphic.gc = XCreateGC(
85
dis, DefaultRootWindow(dis),
86
GCFunction | GCPlaneMask | GCForeground
87
| GCBackground | GCLineWidth | GCLineStyle
88
| GCCapStyle | GCFillStyle, &val );
89
90
/* if this is the first initialize the global <GcClear> */
91
if ( first )
92
{
93
first = False;
94
val.function = GXcopy;
95
val.plane_mask = AllPlanes;
96
val.foreground = WhitePixel( dis, DefaultScreen(dis) );
97
val.background = BlackPixel( dis, DefaultScreen(dis) );
98
GcClear = XCreateGC(
99
dis, DefaultRootWindow(dis),
100
GCFunction|GCPlaneMask|GCForeground|GCBackground,
101
&val );
102
GCColorModel(dis);
103
}
104
105
/* our viewport could be large then the window */
106
rec->x = 0;
107
rec->y = 0;
108
rec->width = w->gap_graphic.width;
109
rec->height = w->gap_graphic.height;
110
XSetClipRectangles( dis, w->gap_graphic.gc, 0, 0, rec, 1, YXSorted );
111
}
112
113
114
/****************************************************************************
115
**
116
*F GapGraphDestroy( <w> ) . . . . . . . . . . . . . . . . destroy a window
117
*/
118
static void GapGraphDestroy ( Widget w )
119
{
120
GGFreeGapGraphicObjects(w);
121
}
122
123
124
/****************************************************************************
125
**
126
*F GapGraphResize( <w> ) . . . . . . . . . . . . . . ignore resize requests
127
*/
128
static void GapGraphResize ( Widget w )
129
{
130
GapGraphicWidget gap = (GapGraphicWidget) w;
131
132
gap->core.width = gap->gap_graphic.width;
133
gap->core.height = gap->gap_graphic.height;
134
}
135
136
137
/****************************************************************************
138
**
139
*F GapGraphExpose( <w>, <evt> ) . . . . . . . . . . . . handle an exposure
140
**
141
** The following is defined in "Xlib.h":
142
**
143
** typedef struct {
144
** int type;
145
** unsigned long serial;
146
** Bool send_event;
147
** Display *display;
148
** Window window;
149
** int x, y;
150
** int width, height;
151
** int count;
152
** } XExposeEvent;
153
**
154
**/
155
static void GapGraphExpose ( Widget w, XExposeEvent *evt, Region region )
156
{
157
GapGraphicWidget gap = (GapGraphicWidget) w;
158
TypeList objs = gap->gap_graphic.objs;
159
TypeGapGraphicObject * obj;
160
Int x1, y1, x2, y2;
161
UInt i;
162
163
/* get the rectangle to be exposed */
164
x1 = evt->x; y1 = evt->y;
165
x2 = x1+evt->width-1; y2 = y1+evt->height-1;
166
167
/* clear it */
168
XFillRectangle( gap->gap_graphic.display, XtWindow(gap), GcClear,
169
x1, y1, x2-x1+1, y2-y1+1 );
170
171
/* make a sanity check for the values */
172
if ( x1 < 0 ) x1 = 0;
173
if ( x2 < 0 ) return;
174
if ( y1 < 0 ) y1 = 0;
175
if ( y2 < 0 ) return;
176
if ( gap->gap_graphic.width <= x1 ) return;
177
if ( gap->gap_graphic.width <= x2 ) x2 = gap->gap_graphic.width-1;
178
if ( gap->gap_graphic.height <= y1 ) return;
179
if ( gap->gap_graphic.height <= y2 ) y2 = gap->gap_graphic.height-1;
180
181
/* redraw only objects inside the rectangle */
182
for ( i = 0; i < LEN(objs); i++ )
183
if ( ELM(objs,i) != 0 )
184
{
185
obj = (TypeGapGraphicObject*) ELM(objs,i);
186
if ( obj->x+obj->w < x1
187
|| obj->y+obj->h < y1
188
|| x2 < obj->x
189
|| y2 < obj->y )
190
continue;
191
GGDrawObject( w, (TypeGapGraphicObject*)ELM(objs,i), True );
192
}
193
194
/* flush X11 queue (WHY?) */
195
XFlush( gap->gap_graphic.display );
196
}
197
198
199
/****************************************************************************
200
**
201
*V gapGraphicWidgetClass . . . . . . . . . . . . . . . . widget class record
202
*/
203
GapGraphicClassRec gapGraphicClassRec =
204
{
205
{
206
/* core fields */
207
/* superclass */ (WidgetClass) &widgetClassRec,
208
/* class_name */ "GapGraphic",
209
/* widget_size */ sizeof(GapGraphicRec),
210
/* class_initialize */ NULL,
211
/* class_part_initialize */ NULL,
212
/* class_inited */ FALSE,
213
/* initialize */ GapGraphInitialize,
214
/* initialize_hook */ NULL,
215
/* realize */ XtInheritRealize,
216
/* actions */ NULL,
217
/* num_actions */ 0,
218
/* resources */ NULL,
219
/* num_resources */ 0,
220
/* xrm_class */ NULLQUARK,
221
/* compress_motion */ TRUE,
222
/* compress_exposure */ TRUE,
223
/* compress_enterleave */ TRUE,
224
/* visible_interest */ FALSE,
225
/* destroy */ GapGraphDestroy,
226
/* resize */ XtInheritResize,
227
/* FIXME: Dirty Hack by Max, replaced: GapGraphResize,
228
I absolutely do *not* know what that means! */
229
/* expose */ (XtExposeProc)GapGraphExpose,
230
/* set_values */ NULL,
231
/* set_values_hook */ NULL,
232
/* set_values_almost */ XtInheritSetValuesAlmost,
233
/* get_values_hook */ NULL,
234
/* accept_focus */ NULL,
235
/* version */ XtVersion,
236
/* callback_private */ NULL,
237
/* tm_table */ NULL,
238
/* query_geometry */ XtInheritQueryGeometry,
239
/* display_accelerator */ XtInheritDisplayAccelerator,
240
/* extension */ NULL
241
},
242
243
{
244
/* template fields */
245
/* dummy */ 0
246
}
247
};
248
249
WidgetClass gapGraphicWidgetClass = (WidgetClass)&gapGraphicClassRec;
250
251
252
/****************************************************************************
253
**
254
255
*F * * * * * * * * * * * * * color model functions * * * * * * * * * * * * *
256
*/
257
258
259
/****************************************************************************
260
**
261
262
*F GCColorModel( <dis> ) . . . . . . . . . . . . return the color model used
263
**
264
** The following is defined in "Xlib.h":
265
**
266
** typedef struct {
267
** XExtData *ext_data;
268
** VisualID visualid;
269
** #if defined(__cplusplus) || defined(c_plusplus)
270
** int c_class;
271
** #else
272
** int class;
273
** #endif
274
** unsigned long red_mask, green_mask, blue_mask;
275
** int bits_per_rgb;
276
** int map_entries;
277
** } Visual;
278
*/
279
static Short gcColorModel = -1;
280
281
static String ColorName[C_LAST+1] = {
282
"black", "white", "light grey", "dim grey", "red", "blue", "green"
283
};
284
285
Int GCColorModel ( Display *dis )
286
{
287
Int diff, a;
288
Short i;
289
XColor c, d;
290
int cm; /* as defined in 'Visual' */
291
292
if ( gcColorModel == -1 )
293
{
294
cm = DefaultVisual( dis, DefaultScreen(dis) )->class;
295
GcColormap = DefaultColormap( dis, DefaultScreen(dis) );
296
297
/* reset colors */
298
XAllocNamedColor( dis, GcColormap, "black", &c, &d );
299
for ( i = 0; i <= C_LAST; i++ )
300
GcColors[i] = c;
301
302
/* allocate black and white */
303
for ( i = 0; i <= 1; i++ )
304
{
305
XAllocNamedColor( dis, GcColormap, ColorName[i], &c, &d );
306
GcColors[i] = c;
307
}
308
gcColorModel = CM_BW;
309
310
/* allocate gray */
311
diff = 0;
312
for ( i = 2; i <= C_LAST_GRAY; i++ )
313
{
314
XAllocNamedColor( dis, GcColormap, ColorName[i], &c, &d );
315
GcColors[i] = c;
316
a = (c.red+c.green+c.blue)-(d.red+c.green+c.blue);
317
if ( a < 0 ) diff -= a; else diff += a;
318
if ( c.red+c.green+c.blue == 0 )
319
diff = 65536;
320
}
321
if ( diff < 300 )
322
gcColorModel = CM_GRAY;
323
324
/* allocate color */
325
if ( cm != StaticGray && cm != GrayScale )
326
{
327
diff = 0;
328
for ( i = C_LAST_GRAY+1; i <= C_LAST; i++ )
329
{
330
XAllocNamedColor( dis, GcColormap, ColorName[i], &c, &d );
331
a = (c.red+c.green+c.blue)-(d.red+c.green+c.blue);
332
if ( a < 0 ) diff -= a; else diff += a;
333
GcColors[i] = c;
334
if ( c.red+c.green+c.blue == 0 )
335
diff = 65536;
336
}
337
if ( diff < 300 )
338
gcColorModel = (gcColorModel==CM_GRAY)?CM_COLOR5:CM_COLOR3;
339
}
340
}
341
return gcColorModel;
342
}
343
344
345
/****************************************************************************
346
**
347
*F GCSetColorModel( <dis>, <mod> ) . . . . . . . . . . . . . set color model
348
*/
349
void GCSetColorModel ( Display *dis, Int mod, String colors )
350
{
351
Int e[10];
352
Int i, j; /* loop variables */
353
Int p;
354
Int s[10];
355
String ptr; /* pointer into <tmp> */
356
String tmp; /* start of split <colors> */
357
XColor c, d; /* allocated color */
358
359
if ( gcColorModel != -1 )
360
return;
361
GcColormap = DefaultColormap( dis, DefaultScreen(dis) );
362
363
/* reset colors */
364
XAllocNamedColor( dis, GcColormap, "black", &c, &d );
365
for ( i = 0; i <= C_LAST; i++ )
366
GcColors[i] = c;
367
368
/* set color names */
369
if ( strcmp( colors, "default" ) )
370
{
371
tmp = XtMalloc(strlen(colors)+1);
372
strcpy( tmp, colors );
373
for ( i = 0, ptr = tmp; i <= C_LAST && *ptr; i++ )
374
{
375
if ( *ptr == ',' )
376
ptr++;
377
else
378
{
379
ColorName[i] = ptr;
380
while ( *ptr && *ptr != ',' )
381
ptr++;
382
if ( *ptr )
383
*ptr++ = 0;
384
}
385
}
386
}
387
388
/* find ranges for color names */
389
p = 0;
390
switch ( mod )
391
{
392
case CM_BW:
393
s[p] = 0; e[p++] = 1;
394
break;
395
case CM_GRAY:
396
s[p] = 0; e[p++] = C_LAST_GRAY;
397
break;
398
case CM_COLOR3:
399
s[p] = 0; e[p++] = 1;
400
s[p] = C_LAST_GRAY+1; e[p++] = C_LAST;
401
break;
402
case CM_COLOR5:
403
s[p] = 0; e[p++] = C_LAST;
404
break;
405
default:
406
s[p] = 0; e[p++] = 1;
407
mod = CM_BW;
408
break;
409
}
410
411
/* set color model */
412
gcColorModel = mod;
413
414
/* allocate colors */
415
for ( i = 0; i < p; i++ )
416
for ( j = s[i]; j <= e[i]; j++ )
417
{
418
XAllocNamedColor( dis, GcColormap, ColorName[j], &c, &d );
419
GcColors[j] = c;
420
}
421
}
422
423
424
/****************************************************************************
425
**
426
427
*F * * * * * * * * * * * gap graphic widget functions * * * * * * * * * * *
428
*/
429
430
431
/****************************************************************************
432
**
433
434
*F GGDrawObject( <w>, <obj>, <flag> ) . . . . . . . . . . . draw an object
435
*/
436
void GGDrawObject ( Widget w, TypeGapGraphicObject *obj, Boolean flag )
437
{
438
GapGraphicWidget gap = (GapGraphicWidget) w;
439
GC gc;
440
441
if ( flag )
442
{
443
gc = gap->gap_graphic.gc;
444
XSetForeground( gap->gap_graphic.display, gc,
445
GcColors[obj->color].pixel );
446
}
447
else
448
gc = GcClear;
449
switch ( obj->type )
450
{
451
case T_LINE:
452
XSetLineAttributes( gap->gap_graphic.display, gc,
453
obj->desc.line.w, LineSolid,
454
CapButt, JoinRound );
455
XDrawLine( gap->gap_graphic.display, XtWindow(gap), gc,
456
obj->desc.line.x1, obj->desc.line.y1,
457
obj->desc.line.x2, obj->desc.line.y2 );
458
break;
459
460
case T_CIRCLE:
461
XSetLineAttributes( gap->gap_graphic.display, gc,
462
obj->desc.circle.w, LineSolid,
463
CapButt, JoinRound );
464
XDrawArc( gap->gap_graphic.display, XtWindow(gap), gc,
465
obj->desc.circle.x, obj->desc.circle.y,
466
obj->desc.circle.r, obj->desc.circle.r,
467
0, 360*64 );
468
break;
469
470
case T_DISC:
471
XFillArc( gap->gap_graphic.display, XtWindow(gap), gc,
472
obj->desc.disc.x, obj->desc.disc.y,
473
obj->desc.disc.r, obj->desc.disc.r,
474
0, 360*64 );
475
break;
476
477
case T_RECT:
478
XSetLineAttributes( gap->gap_graphic.display, gc,
479
obj->desc.rect.w, LineSolid,
480
CapButt, JoinRound );
481
XDrawRectangle( gap->gap_graphic.display, XtWindow(gap), gc,
482
obj->desc.rect.x1,
483
obj->desc.rect.y1,
484
obj->desc.rect.x2-obj->desc.rect.x1,
485
obj->desc.rect.y2-obj->desc.rect.y1 );
486
break;
487
488
case T_BOX:
489
XFillRectangle( gap->gap_graphic.display, XtWindow(gap), gc,
490
obj->desc.rect.x1,
491
obj->desc.rect.y1,
492
obj->desc.rect.x2-obj->desc.rect.x1+1,
493
obj->desc.rect.y2-obj->desc.rect.y1+1 );
494
break;
495
496
case T_TEXT:
497
XSetFont( gap->gap_graphic.display, gc,
498
obj->desc.text.font );
499
XDrawString( gap->gap_graphic.display, XtWindow(gap), gc,
500
obj->desc.text.x, obj->desc.text.y,
501
obj->desc.text.str, obj->desc.text.len );
502
break;
503
}
504
}
505
506
507
/****************************************************************************
508
**
509
*F GGAddObject( <w>, <obj> ) . . . . . . . . . . add to widget and draw it
510
*/
511
Int GGAddObject ( Widget w, TypeGapGraphicObject *obj )
512
{
513
GapGraphicWidget gap = (GapGraphicWidget) w;
514
TypeList objs = gap->gap_graphic.objs;
515
Int i;
516
517
/* draw object */
518
GGDrawObject( w, obj, True );
519
520
/* find free position in object list */
521
for ( i = 0; i < LEN(objs); i++ )
522
if ( ELM(objs,i) == 0 )
523
break;
524
525
/* add element to the next free position */
526
if ( i < LEN(objs) )
527
ELM(objs,i) = (Pointer) obj;
528
else
529
AddList( objs, (Pointer) obj );
530
531
/* and return the position number as object id */
532
return i;
533
}
534
535
536
/****************************************************************************
537
**
538
*F GGFreeObject( <obj> ) . . . . . . . . . . . . free memory used by <obj>
539
*/
540
void GGFreeObject ( TypeGapGraphicObject *obj )
541
{
542
switch ( obj->type )
543
{
544
case T_LINE:
545
case T_CIRCLE:
546
case T_DISC:
547
break;
548
case T_TEXT:
549
XtFree(obj->desc.text.str);
550
break;
551
}
552
XtFree((char*)obj);
553
}
554
555
556
/****************************************************************************
557
**
558
*F GGRemoveObject( <w>, <pos> ) . . . . . . . . . . remove and undraw <obj>
559
*/
560
Boolean GGRemoveObject ( Widget w, Int pos )
561
{
562
GapGraphicWidget gap = (GapGraphicWidget) w;
563
TypeList objs = gap->gap_graphic.objs;
564
TypeGapGraphicObject * obj;
565
XExposeEvent evt;
566
567
/* find graphic object and clear entry */
568
if ( ( obj = (TypeGapGraphicObject*) ELM(objs,pos) ) == 0 )
569
return True;
570
ELM(objs,pos) = 0;
571
572
/* update this region */
573
if ( gap->gap_graphic.fast_update )
574
{
575
if ( -1==gap->gap_graphic.lx || obj->x<gap->gap_graphic.lx )
576
gap->gap_graphic.lx = obj->x;
577
if ( -1==gap->gap_graphic.ly || obj->y<gap->gap_graphic.ly )
578
gap->gap_graphic.ly = obj->y;
579
if ( -1==gap->gap_graphic.hx || gap->gap_graphic.hx<=obj->x+obj->w )
580
gap->gap_graphic.hx = obj->x+obj->w+1;
581
if ( -1==gap->gap_graphic.hy || gap->gap_graphic.hy<=obj->y+obj->h )
582
gap->gap_graphic.hy = obj->y+obj->h+1;
583
GGDrawObject( w, obj, False );
584
}
585
else if ( gap->gap_graphic.update )
586
{
587
evt.x = obj->x;
588
evt.y = obj->y;
589
evt.width = obj->w;
590
evt.height = obj->h;
591
GapGraphExpose( w, &evt, 0 );
592
}
593
else
594
{
595
if ( -1==gap->gap_graphic.lx || obj->x<gap->gap_graphic.lx )
596
gap->gap_graphic.lx = obj->x;
597
if ( -1==gap->gap_graphic.ly || obj->y<gap->gap_graphic.ly )
598
gap->gap_graphic.ly = obj->y;
599
if ( -1==gap->gap_graphic.hx || gap->gap_graphic.hx<=obj->x+obj->w )
600
gap->gap_graphic.hx = obj->x+obj->w+1;
601
if ( -1==gap->gap_graphic.hy || gap->gap_graphic.hy<=obj->y+obj->h )
602
gap->gap_graphic.hy = obj->y+obj->h+1;
603
}
604
605
/* free memory and return that we did something */
606
GGFreeObject(obj);
607
return False;
608
}
609
610
611
/****************************************************************************
612
**
613
*F GGStartRemove( <w> ) . . . . . . . . . . . . start a sequence of removes
614
*/
615
void GGStartRemove ( Widget w )
616
{
617
GapGraphicWidget gap = (GapGraphicWidget) w;
618
619
gap->gap_graphic.update = False;
620
gap->gap_graphic.lx = -1;
621
gap->gap_graphic.hx = -1;
622
gap->gap_graphic.ly = -1;
623
gap->gap_graphic.hy = -1;
624
}
625
626
627
/****************************************************************************
628
**
629
*F GGStopRemove( <w> ) . . . stop a sequence of removes and update window
630
*/
631
void GGStopRemove ( Widget w )
632
{
633
GapGraphicWidget gap = (GapGraphicWidget) w;
634
XExposeEvent evt;
635
636
gap->gap_graphic.update = True;
637
evt.x = gap->gap_graphic.lx;
638
evt.y = gap->gap_graphic.ly;
639
evt.width = gap->gap_graphic.hx - gap->gap_graphic.lx + 1;
640
evt.height = gap->gap_graphic.hy - gap->gap_graphic.ly + 1;
641
GapGraphExpose( w, &evt, 0 );
642
}
643
644
645
/****************************************************************************
646
**
647
*F GGFastUpdate( <w>, <flag> ) . . . . . . . . . . . en/disable fast update
648
*/
649
void GGFastUpdate ( Widget w, Boolean flag )
650
{
651
GapGraphicWidget gap = (GapGraphicWidget) w;
652
XExposeEvent evt;
653
654
if ( gap->gap_graphic.fast_update == flag || !gap->gap_graphic.update )
655
return;
656
gap->gap_graphic.fast_update = flag;
657
if ( !flag )
658
{
659
evt.x = gap->gap_graphic.lx;
660
evt.y = gap->gap_graphic.ly;
661
evt.width = gap->gap_graphic.hx - gap->gap_graphic.lx + 1;
662
evt.height = gap->gap_graphic.hy - gap->gap_graphic.ly + 1;
663
GapGraphExpose( w, &evt, 0 );
664
}
665
else
666
{
667
gap->gap_graphic.lx = -1;
668
gap->gap_graphic.hx = -1;
669
gap->gap_graphic.ly = -1;
670
gap->gap_graphic.hy = -1;
671
}
672
673
}
674
675
676
/****************************************************************************
677
**
678
*F GGFreeAllObjects( <w> ) . . . . . remove and undraw all window objects
679
*/
680
void GGFreeAllObjects ( Widget w )
681
{
682
GapGraphicWidget gap = (GapGraphicWidget) w;
683
TypeList objs = gap->gap_graphic.objs;
684
Int i;
685
686
for ( i = 0; i < LEN(objs); i++ )
687
if ( ELM(objs,i) != 0 )
688
GGFreeObject(ELM(objs,i));
689
XFillRectangle( gap->gap_graphic.display, XtWindow(gap), GcClear,
690
0, 0, gap->gap_graphic.width, gap->gap_graphic.height );
691
LEN(objs) = 0;
692
}
693
694
695
/****************************************************************************
696
**
697
*F GGFreeGapGraphicObjects( <w> ) free all objects/list associated with <w>
698
*/
699
void GGFreeGapGraphicObjects ( Widget w )
700
{
701
GapGraphicWidget gap = (GapGraphicWidget) w;
702
TypeList objs = gap->gap_graphic.objs;
703
704
if ( objs == 0 )
705
return;
706
GGFreeAllObjects(w);
707
XtFree((char*)(objs->ptr));
708
XtFree((char*)(objs));
709
gap->gap_graphic.objs = 0;
710
}
711
712
713
/****************************************************************************
714
**
715
*F GGResize( <w> ) . . . . . . . . . . . . . . . . . . . . . . resize <w>
716
*/
717
void GGResize ( Widget w, Int width, Int height )
718
{
719
GapGraphicWidget gap = (GapGraphicWidget) w;
720
XtWidgetGeometry req;
721
XRectangle rec[1];
722
723
/* enter new dimensions */
724
req.width = gap->gap_graphic.width = width;
725
req.height = gap->gap_graphic.height = height;
726
req.request_mode = CWWidth | CWHeight;
727
728
/* and make request, ignore the result */
729
XtMakeGeometryRequest( w, &req, 0 );
730
XtResizeWidget( w, (Dimension) width, (Dimension) height, 0 );
731
gap->gap_graphic.width = gap->core.width = width;
732
gap->gap_graphic.height = gap->core.height = height;
733
734
/* and set new clipping */
735
rec->x = 0;
736
rec->y = 0;
737
rec->width = gap->gap_graphic.width;
738
rec->height = gap->gap_graphic.height;
739
XSetClipRectangles(XtDisplay(w),gap->gap_graphic.gc,0,0,rec,1,YXSorted);
740
}
741
742
743
/****************************************************************************
744
**
745
746
*E gapgraph.c . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
747
*/
748
749
750