Move the sources to trunk
[opencv] / otherlibs / cvcam / src / unix / dialogs.cpp
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 //  By downloading, copying, installing or using the software you agree to this license.
6 //  If you do not agree to this license, do not download, install,
7 //  copy or use the software.
8 //
9 //
10 //                        Intel License Agreement
11 //                For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000, Intel Corporation, all rights reserved.
14 // Third party copyrights are property of their respective owners.
15 //
16 // Redistribution and use in source and binary forms, with or without modification,
17 // are permitted provided that the following conditions are met:
18 //
19 //   * Redistribution's of source code must retain the above copyright notice,
20 //     this list of conditions and the following disclaimer.
21 //
22 //   * Redistribution's in binary form must reproduce the above copyright notice,
23 //     this list of conditions and the following disclaimer in the documentation
24 //     and/or other materials provided with the distribution.
25 //
26 //   * The name of Intel Corporation may not be used to endorse or promote products
27 //     derived from this software without specific prior written permission.
28 //
29 // This software is provided by the copyright holders and contributors "as is" and
30 // any express or implied warranties, including, but not limited to, the implied
31 // warranties of merchantability and fitness for a particular purpose are disclaimed.
32 // In no event shall the Intel Corporation or contributors be liable for any direct,
33 // indirect, incidental, special, exemplary, or consequential damages
34 // (including, but not limited to, procurement of substitute goods or services;
35 // loss of use, data, or profits; or business interruption) however caused
36 // and on any theory of liability, whether in contract, strict liability,
37 // or tort (including negligence or otherwise) arising in any way out of
38 // the use of this software, even if advised of the possibility of such damage.
39 //
40 //M*/
41
42 #include <tcl.h>
43 #include <tk.h>
44 #include <pthread.h>
45 #include <stdio.h>
46 #include <assert.h>
47 #include "dialogs.h"
48 #include "cvcam.h"
49 #include "cvvidtypes.h"
50 #include <X11/Xlib.h>
51 #include <X11/Intrinsic.h>
52 #include <X11/StringDefs.h>
53 #include <X11/Shell.h>
54 #include <X11/Xaw/Paned.h>
55 #include <X11/Xaw/Scrollbar.h>
56 #include <X11/Xaw/Label.h>
57 #include <X11/Xaw/Toggle.h>
58 #include <stdlib.h>
59 #include "highgui.h"
60 ////////////////////////////////////////////////////////////////////////////////
61 extern Widget cvvTopLevelWidget;
62 static int select_res = 1;
63 static int select_format = 0;
64
65 typedef struct
66 {
67     __u16* value;
68     Widget w;
69 } Tracker;
70
71 typedef struct
72 {
73     int         n;
74     VideoFormat vf;
75     CameraDescription descr;
76     Tracker     br;
77     Tracker     con;
78     Tracker     col;
79     Tracker     hue;
80     int         min_w;
81     int         min_h;
82     int         mid_w;
83     int         mid_h;
84     int         max_w;
85     int         max_h;
86     Widget dialog;
87     Widget paned;
88
89     Widget label_res;
90     Widget paned_res;
91     Widget label_format;
92     Widget paned_format;
93     Widget res_min;
94     Widget res_middle;
95     Widget res_max;
96
97     Widget format_24;
98     Widget format_32;
99     Widget format_yuv420p;
100
101     Widget label_brightness;
102     Widget label_contrast;
103     Widget label_color;
104     Widget label_hue;
105     Widget brightness_w;
106     Widget contrast_w;
107     Widget color_w;
108     Widget hue_w;
109     Widget br_w;
110     Widget con_w;
111     Widget col_w;
112     Widget h_w;
113
114     Widget buttons;
115     Widget b_ok;
116     Widget b_apply;
117     Widget b_cancel;
118 } VideoWidget;
119
120 typedef struct
121 {
122     int         n;
123     CameraDescription descr;
124     int         enable;
125     int         render;
126
127     Widget dialog;
128     Widget label;
129     Widget paned;
130
131     Widget enable_w;
132     Widget render_w;
133
134     Widget buttons;
135     Widget b_ok;
136     Widget b_apply;
137     Widget b_cancel;
138 } CameraWidget;
139
140 static void updatevalues(VideoWidget *vf);
141
142 static void on_apply( Widget w, VideoWidget* data )
143 {
144     cvcamSetProperty(data->n, "set_video_format", &data->vf);
145     XtVaSetValues( w, XtNstate, False, 0 );
146     updatevalues(data);
147 }
148
149 static void on_cancel( Widget w, VideoWidget* data )
150 {
151     XtDestroyWidget( data->dialog );
152     free( data );
153 }
154
155 static void on_ok( Widget w, VideoWidget* data )
156 {
157     on_apply( w, data );
158     on_cancel( w, data );
159 }
160
161 static void on_track( Widget w, Tracker* data, float* percent )
162 {
163     char s[100];
164     __u16 value = (__u16)(*percent * 0xFFFF);
165     *(data->value) = value;
166     sprintf( s, "%d", value );
167     XtVaSetValues( data->w, XtNlabel, s, 0 );
168 }
169
170 static void set_float( Widget w, char* name, float value )
171 {
172     Arg   args[1];
173
174     if (sizeof(float) > sizeof(XtArgVal))
175         XtSetArg(args[0], name, &value);
176     else
177     {
178         union {
179             XtArgVal xt;
180             float   fp;
181         } foo;
182         foo.fp = value;
183         XtSetArg(args[0], name, foo.xt);
184     }
185     XtSetValues(w,args,1);
186 }
187
188 static void on_24( Widget w, VideoWidget* v )
189 {
190     int state = 1;
191     XtVaGetValues( w, XtNstate, &state, 0 );
192     if( !state )
193         return;
194     v->vf.picture.palette = VIDEO_PALETTE_RGB24;
195 }
196
197 static void on_32( Widget w, VideoWidget* v )
198 {
199     int state = 1;
200     XtVaGetValues( w, XtNstate, &state, 0 );
201     if( !state )
202         return;
203     v->vf.picture.palette = VIDEO_PALETTE_RGB32;
204 }
205
206 static void on_yuv420p( Widget w, VideoWidget* v )
207 {
208     int state = 1;
209     XtVaGetValues( w, XtNstate, &state, 0 );
210     if( !state )
211         return;
212     v->vf.picture.palette = VIDEO_PALETTE_YUV420P;
213 }
214
215 static void on_min( Widget w, VideoWidget* v )
216 {
217     int state = 1;
218     XtVaGetValues( w, XtNstate, &state, 0 );
219     if( !state )
220         return;
221     v->vf.width = v->min_w;
222     v->vf.height = v->min_h;
223 }
224
225 static void on_mid( Widget w, VideoWidget* v )
226 {
227     int state = 1;
228     XtVaGetValues( w, XtNstate, &state, 0 );
229     if( !state )
230         return;
231     v->vf.width = v->mid_w;
232     v->vf.height = v->mid_h;
233 }
234
235 static void on_max( Widget w, VideoWidget* v )
236 {
237     int state = 1;
238     XtVaGetValues( w, XtNstate, &state, 0 );
239     if( !state )
240         return;
241     v->vf.width = v->max_w;
242     v->vf.height = v->max_h;
243 }
244
245 static void updatevalues(VideoWidget *vf)
246 {
247     int camera = vf->n;
248     float percent;
249
250     cvcamGetProperty(camera, "set_video_format", &vf->vf);
251     if( vf->vf.width == vf->descr.minwidth )
252         XtVaSetValues( vf->res_min, XtNstate, True, 0 );
253     else if( vf->vf.width == vf->descr.maxwidth )
254         XtVaSetValues( vf->res_max, XtNstate, True, 0 );
255     else
256         XtVaSetValues( vf->res_middle, XtNstate, True, 0 );
257
258     switch( vf->vf.picture.palette )
259     {
260         case VIDEO_PALETTE_RGB24:
261             XtVaSetValues( vf->format_24, XtNstate, True, 0 );
262             break;
263         case VIDEO_PALETTE_RGB32:
264             XtVaSetValues( vf->format_32, XtNstate, True, 0 );
265             break;
266         case VIDEO_PALETTE_YUV420P:
267             XtVaSetValues( vf->format_yuv420p, XtNstate, True, 0 );
268             break;
269         default:
270             XtDestroyWidget( vf->dialog );
271             free( vf );
272             printf( "supported only RGB24, RGB32 & YUV420P formats\n" );
273             return;
274     }
275
276     set_float( vf->br_w, XtNtopOfThumb, (float)vf->vf.picture.brightness / 0xFFFF );
277     percent = (float)vf->vf.picture.brightness / 0xFFFF;
278     vf->br.value = &vf->vf.picture.brightness;
279     on_track(vf->br_w, &vf->br, &percent );
280
281     set_float( vf->con_w, XtNtopOfThumb, (float)vf->vf.picture.contrast / 0xFFFF );
282     percent = (float)vf->vf.picture.contrast / 0xFFFF;
283     vf->con.value = &vf->vf.picture.contrast;
284     on_track(vf->con_w, &vf->con, &percent );
285
286     set_float( vf->col_w, XtNtopOfThumb, (float)vf->vf.picture.colour / 0xFFFF );
287     percent = (float)vf->vf.picture.colour / 0xFFFF;
288     vf->col.value = &vf->vf.picture.colour;
289     on_track(vf->col_w, &vf->col, &percent );
290
291     set_float( vf->h_w, XtNtopOfThumb, (float)vf->vf.picture.hue / 0xFFFF );
292     percent = (float)vf->vf.picture.hue / 0xFFFF;
293     vf->hue.value = &vf->vf.picture.hue;
294     on_track(vf->h_w, &vf->hue, &percent );
295 }
296
297 void icvVideoVideoPPDialog(int camera)
298 {
299
300     char title[100];
301
302     VideoWidget* vf = (VideoWidget*)malloc( sizeof(*vf) );
303     vf->n = camera;
304     cvcamGetProperty(camera, "description", &vf->descr);
305
306     snprintf( title, 100, "%s, %s (%s): Video format", vf->descr.device, vf->descr.DeviceDescription, vf->descr.ChannelDescription );
307 //    snprintf( title, 100, "%d", camera);
308     
309     cvvInitSystem(0, 0);
310     /* Creating main dialog window */
311     vf->dialog = XtVaAppCreateShell( title, "video", topLevelShellWidgetClass,
312                                 XtDisplay( /*(void*)*/cvvTopLevelWidget ),
313                                 XtNminWidth, 10, XtNminHeight, 10,
314                                 XtNinput, 1, 0 );
315     /* Creating main paned window... It will parent for all smaller elements */
316     vf->paned = XtVaCreateManagedWidget( "CvVisual_paned", panedWidgetClass, vf->dialog,
317                                      0 );
318     /* Resolution elements */
319     vf->label_res = XtVaCreateManagedWidget( "resolution", labelWidgetClass, vf->paned,
320                                      XtNshowGrip, False,
321                                      XtNlabel, "camera resolution",
322                                      XtNjustify, XtJustifyCenter, 0 );
323
324     vf->paned_res = XtVaCreateManagedWidget( "resolution_res", panedWidgetClass, vf->paned,
325                                          XtNshowGrip, False,
326                                          XtNorientation, XtorientHorizontal,
327                                          0 );
328     
329     sprintf( title, "%dx%d", vf->descr.minwidth, vf->descr.minheight );
330     vf->res_min = XtVaCreateManagedWidget( "res min", toggleWidgetClass, vf->paned_res,
331                                        XtNlabel, title,
332                                        XtNshowGrip, False,
333                                        XtNradioData, &select_res,
334                                        0 );
335     XtAddCallback( vf->res_min, "callback", (XtCallbackProc)on_min, vf );
336     vf->min_w = vf->descr.minwidth;
337     vf->min_h = vf->descr.minheight;
338
339     vf->res_middle = XtVaCreateManagedWidget( "res middle", toggleWidgetClass, vf->paned_res,
340                                        XtNlabel, "320x240",
341                                        XtNshowGrip, False,
342                                        XtNradioData, &select_res,
343                                        XtNradioGroup, vf->res_min,
344                                        0 );
345     XtAddCallback( vf->res_middle, "callback", (XtCallbackProc)on_mid, vf );
346     vf->mid_w = 320;
347     vf->mid_h = 240;
348
349     sprintf( title, "%dx%d", vf->descr.maxwidth, vf->descr.maxheight );
350     vf->res_max = XtVaCreateManagedWidget( "res max", toggleWidgetClass, vf->paned_res,
351                                        XtNlabel, title,
352                                        XtNshowGrip, False,
353                                        XtNradioData, &select_res,
354                                        XtNradioGroup, vf->res_min,
355                                        0 );
356     XtAddCallback( vf->res_max, "callback", (XtCallbackProc)on_max, vf );
357     vf->max_w = vf->descr.maxwidth;
358     vf->max_h = vf->descr.maxheight;
359
360     /* Video format elements */
361     vf->label_format = XtVaCreateManagedWidget( "format", labelWidgetClass, vf->paned,
362                                      XtNshowGrip, False,
363                                      XtNlabel, "data format",
364                                      XtNjustify, XtJustifyCenter, 0 );
365
366     vf->paned_format = XtVaCreateManagedWidget( "format", panedWidgetClass, vf->paned,
367                                          XtNshowGrip, False,
368                                          XtNorientation, XtorientHorizontal,
369                                          0 );
370
371     vf->format_24 = XtVaCreateManagedWidget( "bpp24", toggleWidgetClass, vf->paned_format,
372                                          XtNlabel, "RGB24",
373                                          XtNshowGrip, False,
374                                          XtNradioData, &select_format,
375                                          0 );
376     XtAddCallback( vf->format_24, "callback", (XtCallbackProc)on_24, vf );
377
378     vf->format_32 = XtVaCreateManagedWidget( "bpp32", toggleWidgetClass, vf->paned_format,
379                                        XtNlabel, "RGB32",
380                                        XtNshowGrip, False,
381                                        XtNradioData, &select_format,
382                                        XtNradioGroup, vf->format_24,
383                                        0 );
384     XtAddCallback( vf->format_32, "callback", (XtCallbackProc)on_32, vf );
385
386     vf->format_yuv420p = XtVaCreateManagedWidget( "yuv420p", toggleWidgetClass, vf->paned_format,
387                                          XtNlabel, "YUV420P",
388                                          XtNshowGrip, False,
389                                          XtNradioData, &select_format,
390                                          XtNradioGroup, vf->format_24,
391                                          0 );
392     XtAddCallback( vf->format_yuv420p, "callback", (XtCallbackProc)on_yuv420p, vf );
393
394     /* Brightness, contrast, color & hue elements */
395     /* brightness */
396     vf->label_brightness = XtVaCreateManagedWidget( "brigthness", labelWidgetClass, vf->paned,
397                                      XtNshowGrip, False,
398                                      XtNlabel, "brigthness",
399                                      XtNjustify, XtJustifyCenter, 0 );
400     vf->brightness_w = XtVaCreateManagedWidget( "brigthness", labelWidgetClass, vf->paned,
401                                      XtNshowGrip, False,
402                                      XtNjustify, XtJustifyCenter, 0 );
403     vf->br.w = vf->brightness_w;
404     vf->br_w = XtVaCreateManagedWidget( "br", scrollbarWidgetClass, vf->paned,
405                                   XtNshowGrip, False,
406                                   XtNorientation, XtorientHorizontal, 0 );
407     XtAddCallback( vf->br_w, "jumpProc", (XtCallbackProc)on_track, &vf->br );
408
409     /* contrast */
410     vf->label_contrast = XtVaCreateManagedWidget( "contrast", labelWidgetClass, vf->paned,
411                                      XtNshowGrip, False,
412                                      XtNlabel, "contrast",
413                                      XtNjustify, XtJustifyCenter, 0 );
414     vf->contrast_w = XtVaCreateManagedWidget( "brigthness", labelWidgetClass, vf->paned,
415                                      XtNshowGrip, False,
416                                      XtNjustify, XtJustifyCenter, 0 );
417     vf->con.w = vf->contrast_w;
418     vf->con_w = XtVaCreateManagedWidget( "con", scrollbarWidgetClass, vf->paned,
419                                   XtNshowGrip, False,
420                                   XtNorientation, XtorientHorizontal, 0 );
421     XtAddCallback( vf->con_w, "jumpProc", (XtCallbackProc)on_track, &vf->con );
422
423     /* colour */
424     vf->label_color = XtVaCreateManagedWidget( "color", labelWidgetClass, vf->paned,
425                                      XtNshowGrip, False,
426                                      XtNlabel, "color",
427                                      XtNjustify, XtJustifyCenter, 0 );
428     vf->color_w = XtVaCreateManagedWidget( "brigthness", labelWidgetClass, vf->paned,
429                                      XtNshowGrip, False,
430                                      XtNjustify, XtJustifyCenter, 0 );
431     vf->col.w = vf->color_w;
432     vf->col_w = XtVaCreateManagedWidget( "col", scrollbarWidgetClass, vf->paned,
433                                   XtNshowGrip, False,
434                                   XtNorientation, XtorientHorizontal, 0 );
435     XtAddCallback( vf->col_w, "jumpProc", (XtCallbackProc)on_track, &vf->col );
436
437     /* hue */
438     vf->label_hue = XtVaCreateManagedWidget( "hue", labelWidgetClass, vf->paned,
439                                      XtNshowGrip, False,
440                                      XtNlabel, "hue",
441                                      XtNjustify, XtJustifyCenter, 0 );
442     vf->hue_w = XtVaCreateManagedWidget( "brigthness", labelWidgetClass, vf->paned,
443                                      XtNshowGrip, False,
444                                      XtNjustify, XtJustifyCenter, 0 );
445     vf->hue.w = vf->hue_w;
446     vf->h_w = XtVaCreateManagedWidget( "h", scrollbarWidgetClass, vf->paned,
447                                   XtNshowGrip, False,
448                                   XtNorientation, XtorientHorizontal, 0 );
449     XtAddCallback( vf->h_w, "jumpProc", (XtCallbackProc)on_track, &vf->hue );
450
451     updatevalues(vf);
452
453     /* Buttons */
454     vf->buttons = XtVaCreateManagedWidget( "buttons", panedWidgetClass, vf->paned,
455                                          XtNshowGrip, False,
456                                          XtNorientation, XtorientHorizontal,
457                                          0 );
458
459     vf->b_ok = XtVaCreateManagedWidget( "b_ok", toggleWidgetClass, vf->buttons,
460                                        XtNlabel, "Ok",
461                                        XtNshowGrip, False,
462                                        XtNstate, False,
463                                        0 );
464     XtAddCallback( vf->b_ok, XtNcallback, (XtCallbackProc)on_ok, (void*)vf );
465
466     vf->b_apply = XtVaCreateManagedWidget( "b_apply", toggleWidgetClass, vf->buttons,
467                                        XtNlabel, "Apply",
468                                        XtNshowGrip, False,
469                                        XtNstate, False,
470                                        0 );
471     XtAddCallback( vf->b_apply, XtNcallback, (XtCallbackProc)on_apply, (void*)vf );
472
473     vf->b_cancel = XtVaCreateManagedWidget( "b_cancel", toggleWidgetClass, vf->buttons,
474                                        XtNlabel, "Cancel",
475                                        XtNshowGrip, False,
476                                        XtNstate, False,
477                                        0 );
478     XtAddCallback( vf->b_cancel, XtNcallback, (XtCallbackProc)on_cancel, (void*)vf );
479     vf->n = camera;
480
481     XtRealizeWidget( vf->dialog );
482
483     {
484         /* fixating window size */
485         int width = 10;
486         int height = 10;
487         XtVaGetValues( vf->dialog, XtNwidth, &width, XtNheight, &height, 0 );
488         XtVaSetValues( vf->dialog, XtNminWidth, width, XtNminHeight, height,
489                                XtNmaxWidth, width, XtNmaxHeight, height, 0 );
490     }
491 }
492
493 ////////////////////////////////////////////////////////////////////////////////
494 static void on_enable( Widget w, CameraWidget* data )
495 {
496     int status = 1;
497     XtVaGetValues( w, XtNstate, &status, 0 );
498     data->enable = status;
499 }
500
501 static void on_render( Widget w, CameraWidget* data )
502 {
503     int status = 1;
504     XtVaGetValues( w, XtNstate, &status, 0 );
505     data->render = status;
506 }
507
508 static void on_cam_apply( Widget w, CameraWidget* data )
509 {
510     cvcamSetProperty( data->n, "enable", &data->enable );
511     cvcamSetProperty( data->n, "render", &data->render );
512     XtVaSetValues( w, XtNstate, False, 0 );
513 }
514
515 static void on_cam_cancel( Widget w, CameraWidget* data )
516 {
517     XtDestroyWidget( data->dialog );
518     free( data );
519 }
520
521 static void on_cam_ok( Widget w, CameraWidget* data )
522 {
523     on_cam_apply( w, data );
524     on_cam_cancel( w, data );
525 }
526
527 void icvVideoCameraPPDialog(int camera)
528 {
529     int    res;
530
531     char title[100];
532
533     CameraWidget* vf = (CameraWidget*)malloc( sizeof(*vf) );
534     cvcamGetProperty(camera, "description", &vf->descr);
535     snprintf( title, 100, "%s, %s (%s): Camera options", vf->descr.device, vf->descr.DeviceDescription, vf->descr.ChannelDescription );
536     
537     cvvInitSystem(0, 0);
538     /* Creating main dialog window */
539     vf->dialog = XtVaAppCreateShell( title, "camera", topLevelShellWidgetClass,
540                                 XtDisplay( cvvTopLevelWidget ),
541                                 XtNminWidth, 10, XtNminHeight, 10,
542                                 XtNinput, 1, 0 );
543     /* Creating main paned window... It will parent for all smaller elements */
544     vf->paned = XtVaCreateManagedWidget( "CvCamera_paned", panedWidgetClass, vf->dialog,
545                                      0 );
546     /* Resolution elements */
547     sprintf( title, "%s on %s", vf->descr.DeviceDescription, vf->descr.device );
548     vf->label = XtVaCreateManagedWidget( "desriprion", labelWidgetClass, vf->paned,
549                                      XtNshowGrip, False,
550                                      XtNlabel, title,
551                                      XtNjustify, XtJustifyCenter, 0 );
552
553     cvcamGetProperty(camera, "enable", &res);
554     vf->enable_w = XtVaCreateManagedWidget( "enable", toggleWidgetClass, vf->paned,
555                                       XtNlabel, "enable",
556                                       XtNshowGrip, False,
557                                       XtNradioData, &select_res,
558                                       XtNstate, res,
559                                       0 );
560     XtAddCallback( vf->enable_w, "callback", (XtCallbackProc)on_enable, vf );
561
562     cvcamGetProperty(camera, "render", &res);
563     vf->render_w = XtVaCreateManagedWidget( "render", toggleWidgetClass, vf->paned,
564                                       XtNlabel, "render",
565                                       XtNshowGrip, False,
566                                       XtNradioData, &select_res,
567                                       XtNstate, res,
568                                       0 );
569     XtAddCallback( vf->render_w, "callback", (XtCallbackProc)on_render, vf );
570
571     /* Buttons */
572     vf->buttons = XtVaCreateManagedWidget( "buttons", panedWidgetClass, vf->paned,
573                                          XtNshowGrip, False,
574                                          XtNorientation, XtorientHorizontal,
575                                          0 );
576
577     vf->b_ok = XtVaCreateManagedWidget( "b_ok", toggleWidgetClass, vf->buttons,
578                                      XtNlabel, "Ok",
579                                      XtNshowGrip, False,
580                                      XtNstate, False,
581                                      0 );
582     XtAddCallback( vf->b_ok, XtNcallback, (XtCallbackProc)on_cam_ok, (void*)vf );
583
584     vf->b_apply = XtVaCreateManagedWidget( "b_apply", toggleWidgetClass, vf->buttons,
585                                        XtNlabel, "Apply",
586                                        XtNshowGrip, False,
587                                        XtNstate, False,
588                                        0 );
589     XtAddCallback( vf->b_apply, XtNcallback, (XtCallbackProc)on_cam_apply, (void*)vf );
590
591     vf->b_cancel = XtVaCreateManagedWidget( "b_cancel", toggleWidgetClass, vf->buttons,
592                                          XtNlabel, "Cancel",
593                                          XtNshowGrip, False,
594                                          XtNstate, False,
595                                          0 );
596     XtAddCallback( vf->b_cancel, XtNcallback, (XtCallbackProc)on_cam_cancel, (void*)vf );
597     XtRealizeWidget( vf->dialog );
598     
599     vf->n = camera;
600
601     {
602         /* fixating window size */
603         int width = 10;
604         int height = 10;
605         XtVaGetValues( vf->dialog, XtNwidth, &width, XtNheight, &height, 0 );
606         XtVaSetValues( vf->dialog, XtNminWidth, width, XtNminHeight, height,
607                                XtNmaxWidth, width, XtNmaxHeight, height, 0 );
608     }
609 }
610