Merge /u/jrubio/cdesktopenv/ branch implicit-int into master
[oweals/cde.git] / cde / programs / dtudcfonted / selectx.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* selectx.c 1.23 - Fujitsu source for CDEnext    96/10/30 13:13:45      */
24 /* $XConsortium: selectx.c /main/7 1996/11/08 01:54:18 cde-fuj $ */
25 /*
26  *  (c) Copyright 1995 FUJITSU LIMITED
27  *  This is source code modified by FUJITSU LIMITED under the Joint
28  *  Development Agreement for the CDEnext PST.
29  *  This is unpublished proprietary source code of FUJITSU LIMITED
30  */
31
32
33 #include <string.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <nl_types.h>
37
38 #include<X11/Xlib.h>
39 #include<X11/Xutil.h>
40 #include<X11/Xatom.h>
41
42 #include <Xm/Xm.h>
43 #include <Xm/Form.h>
44 #include <Xm/PushB.h>
45 #include <Xm/Text.h>
46 #include <Xm/TextF.h>
47 #include <Xm/Label.h>
48 #include <Xm/SeparatoG.h>
49 #include <Xm/List.h>
50 #include <Xm/ToggleB.h>
51 #include <Xm/MessageB.h>
52 #include <Xm/RowColumn.h>
53 #include <Xm/Frame.h>
54 #include <Xm/Label.h>
55
56 /*
57  * There is no public header file for this function (only an
58  * internal header XmStringI.h).
59  */
60 extern XtPointer _XmStringUngenerate (XmString string,
61                         XmStringTag tag,
62                         XmTextType tag_type,
63                         XmTextType output_type);
64
65
66 #include "xoakufont.h"
67 #include "selectxlfd.h"
68
69 extern Resource resource ;
70
71 /*
72  * parameters
73  */
74
75 FalFontData fullFontData;
76
77 void    PopupSelectXLFD(Widget top) ;
78 static Widget   CreateSelectXLFD(Widget top) ;
79
80 extern  void    xlfdPopupDialog(Widget w);
81
82 extern  void    ReadCB(Widget w, XtPointer client_data, XtPointer call_data);
83
84
85 Widget  xlfdDialog;
86 static Widget xlfdWform;
87
88 #define CS0 "Codeset 0"
89 #define CS1 "Codeset 1"
90 #define CS2 "Codeset 2"
91 #define CS3 "Codeset 3"
92
93 #define FAL_ERROR_STR resource.falerrmsg[((fal_utyerrno & 0xff) > 25) ? 0 : (fal_utyerrno & 0xff)]
94
95 static Widget   pull1, pull2, pull3, pull4, scrolllist;
96 static int      xlf_count = 0;
97 static XmString *xlf=NULL;
98 static int      udc_count = 0;
99 static Boolean  udc_flag = False;
100 static int      *udc=NULL;
101 static int      udc_val;
102 static int      sty_count = 0;
103 static Boolean  sty_flag = False;
104 static char     **sty=NULL;
105 static char     *sty_val=NULL;
106 static int      wls_count = 0;
107 static Boolean  wls_flag = False;
108 static int      *wls=NULL;
109 static int      wls_val;
110 static int      hls_count = 0;
111 static Boolean  hls_flag = False;
112 static int      *hls=NULL;
113 static int      hls_val;
114 static Widget       *button1=NULL;
115 static Widget       *button2=NULL;
116 static Widget       *button3=NULL;
117 static Widget       *button4=NULL;
118
119 /****************************************************************
120  * callbacks                                                    *
121  ***************************************************************/
122
123 static char *
124 spc(char *str, char ch, int count)
125 {
126     char *p;
127     p = str + strlen(str);
128     for(;count && (str < p);p--) {
129         if (*p == ch)
130             count --;
131     }
132     if (! count)
133         return(p+1);
134     else
135         return(NULL);
136 }
137
138 static void OpenWindowCB(void)
139 {
140     char        *str, *p;
141     XmStringTable       st;
142
143     XtVaGetValues(scrolllist, XmNselectedItems, &st, NULL);
144     if( st == NULL ){
145         fullFontData.xlfdname = NULL;
146         return ;
147     }
148     str = (char *) _XmStringUngenerate(st[0], NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
149
150     p = spc(str, '-', 4);
151     p++;
152
153     if (*p == 'p' || *p == 'P') {
154         fullFontData.xlfdname = (char *)-1;
155         return ;
156     }
157
158     fullFontData.xlfdname = str;
159     if(udc_flag == True)
160         fullFontData.cd_set = udc_val;
161     else
162         fullFontData.cd_set = -1;
163 }
164
165 /**
166  **  contents : "Cancel" button callback
167  ** ------------------------
168  **
169  **
170  **/
171
172 /*ARGSUSED*/
173 static void
174 OpenCancelCB(Widget widget, caddr_t clientData, caddr_t callData)
175 {
176     extern void ForcePopdownDialog();
177     if ( !editPtnW ){
178         exit( 0 );
179     }
180     ForcePopdownDialog(xlfdDialog);
181 }
182
183
184 /*
185 * create selection window view
186 */
187 void
188 PopupSelectXLFD(Widget top)
189 {
190
191     if( xlfdDialog == NULL ){
192         if( (xlfdDialog = CreateSelectXLFD( top )) == NULL ){
193             exit( -1 ) ;
194         }
195     }
196     /* pop up select window */
197     xlfdPopupDialog( xlfdDialog );
198 }
199
200
201 static void
202 create_xlfd(void)
203 {
204         int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
205         FalFontData key;
206         FalFontDataList *fontlist;
207         FalFontData *f;
208         int i;
209
210         if (udc_flag == True) {
211                 key.cd_set = udc_val;
212                 mask |= FAL_FONT_MASK_CODE_SET;
213         }
214         if (sty_flag == True) {
215                 key.style.name = sty_val;
216                 mask |= FAL_FONT_MASK_STYLE_NAME;
217         }
218         if (wls_flag == True) {
219                 key.size.w = wls_val;
220                 mask |= FAL_FONT_MASK_SIZE_W;
221         }
222         if (hls_flag == True) {
223                 key.size.h = hls_val;
224                 mask |= FAL_FONT_MASK_SIZE_H;
225         }
226         xlf_count = 0;
227         if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
228                 return;
229         }
230         if(fontlist->num == 0) {
231                 FalFreeFontList(fontlist);
232                 return;
233         }
234         if (xlf) {
235             for (i=0; i < xlf_count; i++) {
236                 XmStringFree(xlf[i]);
237             }
238             XtFree((char *)xlf);
239         }
240         xlf = (XmString *)XtMalloc(sizeof(XmString) * fontlist->num);
241         for (i=0, f=fontlist->list; i < fontlist->num; i++, f++) {
242             xlf[xlf_count++] = XmStringCreateLocalized(f->xlfdname);
243         }
244         FalFreeFontList(fontlist);
245 }
246
247 static void
248 udc_call(Widget w)
249 {
250         XmString label;
251         char *moji;
252         XtVaGetValues(w, XmNlabelString, &label, NULL);
253         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
254         if(strncmp(moji, "*", 1) == 0) {
255                 udc_flag = False;
256         } else if(strcmp(moji, CS0) == 0) {
257                 udc_val = FAL_FONT_CS0;
258                 udc_flag = True;
259         } else if(strcmp(moji, CS1) == 0) {
260                 udc_val = FAL_FONT_CS1;
261                 udc_flag = True;
262         } else if(strcmp(moji, CS2) == 0) {
263                 udc_val = FAL_FONT_CS2;
264                 udc_flag = True;
265         } else if(strcmp(moji, CS3) == 0) {
266                 udc_val = FAL_FONT_CS3;
267                 udc_flag = True;
268         } else {
269                 udc_flag = False;
270         }
271         XtFree(moji);
272         create_xlfd();
273         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
274 }
275
276 static void
277 sty_call(Widget w)
278 {
279         XmString label;
280         char *moji;
281         if (sty_val) {
282                 XtFree(sty_val);
283                 sty_val = NULL;
284         }
285         XtVaGetValues(w, XmNlabelString, &label, NULL);
286         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
287         if(strncmp(moji, "*", 1) == 0) {
288                 sty_flag = False;
289         }
290         else {
291                 sty_val = XtMalloc(sizeof(char) * (strlen(moji) + 1));
292                 strcpy(sty_val, moji);
293                 sty_flag = True;
294         }
295         XtFree(moji);
296         create_xlfd();
297         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
298 }
299
300 static void
301 wls_call(Widget w)
302 {
303         XmString label;
304         char *moji;
305         XtVaGetValues(w, XmNlabelString, &label, NULL);
306         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
307         if(strncmp(moji, "*", 1) == 0) {
308                 wls_flag = False;
309         }
310         else {
311                 wls_val = atoi(moji);
312                 wls_flag = True;
313         }
314         XmStringFree(label);
315         XtFree(moji);
316         create_xlfd();
317         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
318 }
319
320 static void
321 hls_call(Widget w)
322 {
323         XmString label;
324         char *moji;
325         XtVaGetValues(w, XmNlabelString, &label, NULL);
326         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
327         if(strncmp(moji, "*", 1) == 0) {
328                 hls_flag = False;
329         }
330         else {
331                 hls_val = atoi(moji);
332                 hls_flag = True;
333         }
334         XmStringFree(label);
335         XtFree(moji);
336         create_xlfd();
337         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
338 }
339
340 static void
341 button_set1(void)
342 {
343     int         i, j;
344     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
345     FalFontData key;
346     FalFontDataList *fontlist;
347     FalFontData *f;
348     Boolean found;
349
350     if (sty_flag == True) {
351         key.style.name = sty_val;
352         mask |= FAL_FONT_MASK_STYLE_NAME;
353     }
354     if (wls_flag == True) {
355         key.size.w = wls_val;
356         mask |= FAL_FONT_MASK_SIZE_W;
357     }
358     if (hls_flag == True) {
359         key.size.h = hls_val;
360         mask |= FAL_FONT_MASK_SIZE_H;
361     }
362     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
363         for (j=0; j<udc_count; j++)
364             XtSetSensitive(button1[j], False);
365         return;
366     }
367     if(fontlist->num == 0) {
368         for (j=0; j<udc_count; j++)
369             XtSetSensitive(button1[j], False);
370         FalFreeFontList(fontlist);
371         return;
372     }
373
374     for (j=0; j<udc_count; j++) {
375         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
376             if(udc[j] == f->cd_set) {
377                 found = True;
378                 break;
379             }
380         }
381         if(found == False)
382             XtSetSensitive(button1[j], False);
383         else
384             XtSetSensitive(button1[j], True);
385     }
386     FalFreeFontList(fontlist);
387 }
388
389 static void
390 button_set2(void)
391 {
392     int         i, j;
393     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
394     FalFontData key;
395     FalFontDataList *fontlist;
396     FalFontData *f;
397     Boolean found;
398
399     if (udc_flag == True) {
400         key.cd_set = udc_val;
401         mask |= FAL_FONT_MASK_CODE_SET;
402     }
403     if (wls_flag == True) {
404         key.size.w = wls_val;
405         mask |= FAL_FONT_MASK_SIZE_W;
406     }
407     if (hls_flag == True) {
408         key.size.h = hls_val;
409         mask |= FAL_FONT_MASK_SIZE_H;
410     }
411     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
412         for (j=0; j<sty_count; j++)
413             XtSetSensitive(button2[j], False);
414         return;
415     }
416     if(fontlist->num == 0) {
417         for (j=0; j<sty_count; j++)
418             XtSetSensitive(button2[j], False);
419         FalFreeFontList(fontlist);
420         return;
421     }
422
423     for (j=0; j<sty_count; j++) {
424         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
425             if(strcmp(sty[j], f->style.name) == 0) {
426                 found = True;
427                 break;
428             }
429         }
430         if(found == False)
431             XtSetSensitive(button2[j], False);
432         else
433             XtSetSensitive(button2[j], True);
434     }
435     FalFreeFontList(fontlist);
436 }
437
438 static void
439 button_set3(void)
440 {
441     int         i, j;
442     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
443     FalFontData key;
444     FalFontDataList *fontlist;
445     FalFontData *f;
446     Boolean found;
447
448     if (udc_flag == True) {
449         key.cd_set = udc_val;
450         mask |= FAL_FONT_MASK_CODE_SET;
451     }
452     if (sty_flag == True) {
453         key.style.name = sty_val;
454         mask |= FAL_FONT_MASK_STYLE_NAME;
455     }
456     if (hls_flag == True) {
457         key.size.h = hls_val;
458         mask |= FAL_FONT_MASK_SIZE_H;
459     }
460     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
461         for (j=0; j<wls_count; j++)
462             XtSetSensitive(button3[j], False);
463         return;
464     }
465     if(fontlist->num == 0) {
466         for (j=0; j<wls_count; j++)
467             XtSetSensitive(button3[j], False);
468         FalFreeFontList(fontlist);
469         return;
470     }
471
472     for (j=0; j<wls_count; j++) {
473         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
474             if(wls[j] == f->size.w) {
475                 found = True;
476                 break;
477             }
478         }
479         if(found == False)
480             XtSetSensitive(button3[j], False);
481         else
482             XtSetSensitive(button3[j], True);
483     }
484     FalFreeFontList(fontlist);
485 }
486
487 static void
488 button_set4(void)
489 {
490     int         i, j;
491     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
492     FalFontData key;
493     FalFontDataList *fontlist;
494     FalFontData *f;
495     Boolean found;
496
497     if (udc_flag == True) {
498         key.cd_set = udc_val;
499         mask |= FAL_FONT_MASK_CODE_SET;
500     }
501     if (sty_flag == True) {
502         key.style.name = sty_val;
503         mask |= FAL_FONT_MASK_STYLE_NAME;
504     }
505     if (wls_flag == True) {
506         key.size.w = wls_val;
507         mask |= FAL_FONT_MASK_SIZE_W;
508     }
509     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
510         for (j=0; j<hls_count; j++)
511             XtSetSensitive(button4[j], False);
512         return;
513     }
514     if(fontlist->num == 0) {
515         for (j=0; j<hls_count; j++)
516             XtSetSensitive(button4[j], False);
517         FalFreeFontList(fontlist);
518         return;
519     }
520
521     for (j=0; j<hls_count; j++) {
522         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
523             if(hls[j] == f->size.h) {
524                 found = True;
525                 break;
526             }
527         }
528         if (found == False)
529             XtSetSensitive(button4[j], False);
530         else
531             XtSetSensitive(button4[j], True);
532     }
533     FalFreeFontList(fontlist);
534 }
535
536 void
537 data_sort(int *data, int count)
538 {
539     int *p1, *p2, tmp, i;
540
541     for (; count; count--) {
542         for (i=1, p1=data, p2=data+1; i < count; i++, p1++, p2++) {
543             if( *p1 > *p2) {
544                 tmp = *p2;
545                 *p2 = *p1;
546                 *p1 = tmp;
547             }
548         }
549     }
550 }
551
552
553 static void
554 font_init(void)
555 {
556         FalFontDataList *fontlist;
557         FalFontData     *f;
558         Boolean         found;
559         int             i, j;
560         char            tmp[16];
561         char            err[128];
562         Widget          button;
563         extern void Error_message();
564
565         xlf_count = udc_count = sty_count = wls_count = hls_count = 0;
566         if (FalGetFontList(NULL, FAL_FONT_MASK_DEFINED |
567                         FAL_FONT_MASK_UNDEFINED, &fontlist) == FAL_ERROR) {
568                 strcpy(err, FAL_ERROR_STR);
569                 Error_message((Widget)NULL, err);
570                 return;
571         }
572         if(fontlist->num == 0) {
573                 FalFreeFontList(fontlist);
574                 strcpy(err, resource.mn_no_font);
575                 Error_message((Widget)NULL, err);
576                 return;
577         }
578         udc = (int *)XtMalloc(sizeof(int) * fontlist->num);
579         sty = (char **)XtMalloc(sizeof(char *) * fontlist->num);
580         wls = (int *)XtMalloc(sizeof(int) * fontlist->num);
581         hls = (int *)XtMalloc(sizeof(int) * fontlist->num);
582         for (i=0, f=fontlist->list; i < fontlist->num; i++, f++) {
583             for (j=0,found=False; j<udc_count; j++) {
584                 if(udc[j] == f->cd_set) {
585                         found=True;
586                         break;
587                 }
588             }
589             if (found == False) {
590                 udc[udc_count++] = f->cd_set;
591             }
592             for (j=0,found=False; j<sty_count; j++) {
593                 if(strcmp(sty[j], f->style.name) == 0) {
594                         found=True;
595                         break;
596                 }
597             }
598             if (found == False) {
599                 sty[sty_count] = XtMalloc(sizeof(char) * (strlen(f->style.name) + 1));
600                 strcpy(sty[sty_count++], f->style.name);
601             }
602             if (f->size.w != -1) {
603             for (j=0,found=False; j<wls_count; j++) {
604                 if(wls[j] == f->size.w) {
605                         found=True;
606                         break;
607                 }
608             }
609             if (found == False) {
610                 wls[wls_count++] = f->size.w;
611             }
612             }
613             for (j=0,found=False; j<hls_count; j++) {
614                 if(hls[j] == f->size.h) {
615                         found=True;
616                         break;
617                 }
618             }
619             if (found == False) {
620                 hls[hls_count++] = f->size.h;
621             }
622         }
623         FalFreeFontList(fontlist);
624
625         data_sort(udc, udc_count);
626         data_sort(wls, wls_count);
627         data_sort(hls, hls_count);
628
629         button1 = (Widget *) XtMalloc(sizeof(Widget) * udc_count);
630         button2 = (Widget *) XtMalloc(sizeof(Widget) * sty_count);
631         button3 = (Widget *) XtMalloc(sizeof(Widget) * wls_count);
632         button4 = (Widget *) XtMalloc(sizeof(Widget) * hls_count);
633
634         button = XmCreatePushButton(pull1, "*", NULL, 0);
635         XtManageChild(button);
636         XtAddCallback(button, XmNactivateCallback,
637                                                 (XtCallbackProc)udc_call, NULL);
638         for (i=0; i < udc_count; i++) {
639                 if(udc[i] == FAL_FONT_CS0)
640                         sprintf(tmp, CS0);
641                 else if(udc[i] == FAL_FONT_CS1)
642                         sprintf(tmp, CS1);
643                 else if(udc[i] == FAL_FONT_CS2)
644                         sprintf(tmp, CS2);
645                 else if(udc[i] == FAL_FONT_CS3)
646                         sprintf(tmp, CS3);
647                 else
648                         sprintf(tmp, "Codeset %x?", udc[i]);
649                 button1[i] = XmCreatePushButton(pull1, tmp, NULL, 0);
650                 XtManageChild(button1[i]);
651                 XtAddCallback(button1[i], XmNactivateCallback,
652                                                 (XtCallbackProc)udc_call, NULL);
653         }
654
655         button = XmCreatePushButton(pull2, "*", NULL, 0);
656         XtManageChild(button);
657         XtAddCallback(button, XmNactivateCallback,
658                                                 (XtCallbackProc)sty_call, NULL);
659         for (i=0; i < sty_count; i++) {
660                 button2[i] = XmCreatePushButton(pull2, sty[i], NULL, 0);
661                 XtManageChild(button2[i]);
662                 XtAddCallback(button2[i], XmNactivateCallback,
663                                                 (XtCallbackProc)sty_call, NULL);
664         }
665
666         button = XmCreatePushButton(pull3, "*", NULL, 0);
667         XtManageChild(button);
668         XtAddCallback(button, XmNactivateCallback,
669                                                 (XtCallbackProc)wls_call, NULL);
670         for (i=0; i < wls_count; i++) {
671                 sprintf(tmp, "%d", wls[i]);
672                 button3[i] = XmCreatePushButton(pull3, tmp, NULL, 0);
673                 XtManageChild(button3[i]);
674                 XtAddCallback(button3[i], XmNactivateCallback,
675                                                 (XtCallbackProc)wls_call, NULL);
676         }
677
678         button = XmCreatePushButton(pull4, "*", NULL, 0);
679         XtManageChild(button);
680         XtAddCallback(button, XmNactivateCallback,
681                                                 (XtCallbackProc)hls_call, NULL);
682         for (i=0; i < hls_count; i++) {
683                 sprintf(tmp, "%d", hls[i]);
684                 button4[i] = XmCreatePushButton(pull4, tmp, NULL, 0);
685                 XtManageChild(button4[i]);
686                 XtAddCallback(button4[i], XmNactivateCallback,
687                                                 (XtCallbackProc)hls_call, NULL);
688         }
689 }
690
691
692 static Widget
693 CreateSelectXLFD(Widget top)
694 {
695
696         int             n;
697         Arg             args[16];
698         XmString        xms, xms1 ;
699         Widget          editW ;
700         Widget          frame, row1, label1, row2, cas1, cas2, cas3, cas4;
701         XmString        str;
702         udc_flag = sty_flag = wls_flag = hls_flag = False;
703
704         /*
705         *  create base window
706         */
707         n = 0 ;
708         XtSetArg( args[n], XmNautoUnmanage, False ) ;           n++ ;
709         XtSetArg( args[n], XmNnoResize, True ) ;                n++ ;
710         XtSetArg( args[n], XmNminimizeButtons, True ) ;         n++ ;
711         xms = XmStringCreateLocalized( resource.exec_label ) ;
712         XtSetArg( args[n], XmNokLabelString, xms ) ;            n++ ;
713         xms1 = XmStringCreateLocalized( resource.quit_label) ;
714         XtSetArg( args[n], XmNhelpLabelString, xms1 ) ;         n++ ;
715         XtSetArg( args[n], XmNtitle, resource.l_open_title ) ;  n++ ;
716         editW = XmCreateTemplateDialog( top, "open_dialog", args, n );
717
718         XmStringFree( xms ) ;
719         XmStringFree( xms1 ) ;
720
721         n = 0;
722         pull1 = XmCreatePulldownMenu(toplevel, "pull", args, n);
723         pull2 = XmCreatePulldownMenu(toplevel, "pull", args, n);
724         pull3 = XmCreatePulldownMenu(toplevel, "pull", args, n);
725         pull4 = XmCreatePulldownMenu(toplevel, "pull", args, n);
726
727         n = 0 ;
728         xlfdWform  = XmCreateRowColumn( editW, "BaseForm", args, n );
729         XtManageChild( xlfdWform );
730
731         n = 0;
732         frame = XmCreateFrame( xlfdWform, "frame", args, n);
733         XtManageChild( frame );
734
735         n = 0 ;
736         row1  = XmCreateRowColumn( frame, "row", args, n );
737         XtManageChild( row1 );
738
739         n = 0;
740         str = XmStringCreateLocalized(resource.l_selectitem) ;
741         XtSetArg(args[n], XmNlabelString, str);  n++;
742         label1 = XmCreateLabel( row1, "SelectItems", args, n);
743         XtManageChild( label1 );
744         XmStringFree(str);
745
746         n = 0 ;
747         row2  = XmCreateRowColumn( row1, "row", args, n );
748         XtManageChild( row2 );
749
750         n = 0 ;
751         str = XmStringCreateLocalized(resource.l_codeset) ;
752         XtSetArg(args[n], XmNlabelString, str);  n++;
753         XtSetArg(args[n], XmNsubMenuId, pull1);  n++;
754         cas1  = XmCreateOptionMenu( row2, "CodeSet", args, n );
755         XtManageChild( cas1 );
756         XtAddCallback(XmOptionButtonGadget(cas1), XmNcascadingCallback,
757                                         (XtCallbackProc)button_set1, NULL);
758         XmStringFree(str);
759
760         n = 0 ;
761         str = XmStringCreateLocalized(resource.l_style) ;
762         XtSetArg(args[n], XmNlabelString, str);  n++;
763         XtSetArg(args[n], XmNsubMenuId, pull2);  n++;
764         cas2  = XmCreateOptionMenu( row2, "Style", args, n );
765         XtAddCallback(XmOptionButtonGadget(cas2), XmNcascadingCallback,
766                                         (XtCallbackProc)button_set2, NULL);
767         XtManageChild( cas2 );
768         XmStringFree(str);
769
770         n = 0 ;
771         str = XmStringCreateLocalized(resource.l_width) ;
772         XtSetArg(args[n], XmNlabelString, str);  n++;
773         XtSetArg(args[n], XmNsubMenuId, pull3);  n++;
774         cas3  = XmCreateOptionMenu( row2, "Width", args, n );
775         XtManageChild( cas3 );
776         XtAddCallback(XmOptionButtonGadget(cas3), XmNcascadingCallback,
777                                         (XtCallbackProc)button_set3, NULL);
778         XmStringFree(str);
779
780         n = 0 ;
781         str = XmStringCreateLocalized(resource.l_height) ;
782         XtSetArg(args[n], XmNlabelString, str);  n++;
783         XtSetArg(args[n], XmNsubMenuId, pull4);  n++;
784         cas4  = XmCreateOptionMenu( row2, "Height", args, n );
785         XtManageChild( cas4 );
786         XtAddCallback(XmOptionButtonGadget(cas4), XmNcascadingCallback,
787                                         (XtCallbackProc)button_set4, NULL);
788         XmStringFree(str);
789
790         font_init();
791         create_xlfd();
792
793         n = 0;
794         XtSetArg(args[n], XmNvisibleItemCount, 10) ;    n++ ;
795         XtSetArg(args[n], XmNlistSizePolicy, XmCONSTANT) ;      n++ ;
796         XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC) ;        n++ ;
797         XtSetArg(args[n], XmNselectionPolicy, XmSINGLE_SELECT) ;        n++ ;
798         XtSetArg(args[n], XmNitems, xlf) ;      n++ ;
799         XtSetArg(args[n], XmNitemCount, xlf_count) ;    n++ ;
800         scrolllist = XmCreateScrolledList(xlfdWform, "scrolllist", args, n);
801         XtManageChild(scrolllist);
802
803         /*
804          * Error_Messege
805          */
806
807         XtAddCallback(editW, XmNokCallback, (XtCallbackProc)OpenWindowCB, NULL);
808         XtAddCallback(editW, XmNokCallback, (XtCallbackProc)ReadCB, NULL);
809         XtAddCallback(editW, XmNhelpCallback,
810                                         (XtCallbackProc)OpenCancelCB, NULL);
811
812         return( editW ) ;
813 }