util/dttypes: remove register keyword
[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() ;
78 static Widget   CreateSelectXLFD() ;
79
80 extern  void    xlfdPopupDialog() ;
81 extern  int     GetListsOfItems() ;
82
83 extern  void    ReadCB();
84
85
86 Widget  xlfdDialog;
87 static Widget xlfdWform;
88
89 #define CS0 "Codeset 0"
90 #define CS1 "Codeset 1"
91 #define CS2 "Codeset 2"
92 #define CS3 "Codeset 3"
93
94 #define FAL_ERROR_STR resource.falerrmsg[((fal_utyerrno & 0xff) > 25) ? 0 : (fal_utyerrno & 0xff)]
95
96 static Widget   pull1, pull2, pull3, pull4, scrolllist;
97 static int      xlf_count = 0;
98 static XmString *xlf=NULL;
99 static int      udc_count = 0;
100 static Boolean  udc_flag = False;
101 static int      *udc=NULL;
102 static int      udc_val;
103 static int      sty_count = 0;
104 static Boolean  sty_flag = False;
105 static char     **sty=NULL;
106 static char     *sty_val=NULL;
107 static int      wls_count = 0;
108 static Boolean  wls_flag = False;
109 static int      *wls=NULL;
110 static int      wls_val;
111 static int      hls_count = 0;
112 static Boolean  hls_flag = False;
113 static int      *hls=NULL;
114 static int      hls_val;
115 static Widget       *button1=NULL;
116 static Widget       *button2=NULL;
117 static Widget       *button3=NULL;
118 static Widget       *button4=NULL;
119
120 /****************************************************************
121  * callbacks                                                    *
122  ***************************************************************/
123
124 static char *
125 spc(str, ch, count)
126 char *  str;
127 char    ch;
128 int     count;
129 {
130     char *p;
131     p = str + strlen(str);
132     for(;count && (str < p);p--) {
133         if (*p == ch)
134             count --;
135     }
136     if (! count)
137         return(p+1);
138     else
139         return(NULL);
140 }
141
142 static void OpenWindowCB()
143 {
144     char        *str, *p;
145     XmStringTable       st;
146
147     XtVaGetValues(scrolllist, XmNselectedItems, &st, NULL);
148     if( st == NULL ){
149         fullFontData.xlfdname = NULL;
150         return ;
151     }
152     str = (char *) _XmStringUngenerate(st[0], NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
153
154     p = spc(str, '-', 4);
155     p++;
156
157     if (*p == 'p' || *p == 'P') {
158         fullFontData.xlfdname = (char *)-1;
159         return ;
160     }
161
162     fullFontData.xlfdname = str;
163     if(udc_flag == True)
164         fullFontData.cd_set = udc_val;
165     else
166         fullFontData.cd_set = -1;
167 }
168
169 /**
170  **  contents : "Cancel" button callback 
171  ** ------------------------
172  **  
173  ** 
174  **/
175
176 /*ARGSUSED*/
177 static void
178 OpenCancelCB( widget, clientData, callData )
179 Widget          widget;
180 caddr_t         clientData;
181 caddr_t         callData;
182 {
183     extern void ForcePopdownDialog();
184     if ( !editPtnW ){
185         exit( 0 );
186     }
187     ForcePopdownDialog(xlfdDialog);
188 }
189
190
191 /*
192 * create selection window view
193 */
194 void
195 PopupSelectXLFD( top )
196 Widget  top ;
197 {
198
199     if( xlfdDialog == NULL ){
200         if( (xlfdDialog = CreateSelectXLFD( top )) == NULL ){
201             exit( -1 ) ;
202         }
203     }
204     /* pop up select window */
205     xlfdPopupDialog( xlfdDialog );
206 }
207
208
209 static void
210 create_xlfd()
211 {
212         int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
213         FalFontData key;
214         FalFontDataList *fontlist;
215         FalFontData *f;
216         int i;
217
218         if (udc_flag == True) {
219                 key.cd_set = udc_val;
220                 mask |= FAL_FONT_MASK_CODE_SET;
221         }
222         if (sty_flag == True) {
223                 key.style.name = sty_val;
224                 mask |= FAL_FONT_MASK_STYLE_NAME;
225         }
226         if (wls_flag == True) {
227                 key.size.w = wls_val;
228                 mask |= FAL_FONT_MASK_SIZE_W;
229         }
230         if (hls_flag == True) {
231                 key.size.h = hls_val;
232                 mask |= FAL_FONT_MASK_SIZE_H;
233         }
234         xlf_count = 0;
235         if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
236                 return;
237         }
238         if(fontlist->num == 0) {
239                 FalFreeFontList(fontlist);
240                 return;
241         }
242         if (xlf) {
243             for (i=0; i < xlf_count; i++) {
244                 XmStringFree(xlf[i]);
245             }
246             XtFree((char *)xlf);
247         }
248         xlf = (XmString *)XtMalloc(sizeof(XmString) * fontlist->num);
249         for (i=0, f=fontlist->list; i < fontlist->num; i++, f++) {
250             xlf[xlf_count++] = XmStringCreateLocalized(f->xlfdname);
251         }
252         FalFreeFontList(fontlist);
253 }
254
255 static void
256 udc_call(w)
257 Widget w;
258 {
259         XmString label;
260         char *moji;
261         XtVaGetValues(w, XmNlabelString, &label, NULL);
262         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
263         if(strncmp(moji, "*", 1) == 0) {
264                 udc_flag = False;
265         } else if(strcmp(moji, CS0) == 0) {
266                 udc_val = FAL_FONT_CS0;
267                 udc_flag = True;
268         } else if(strcmp(moji, CS1) == 0) {
269                 udc_val = FAL_FONT_CS1;
270                 udc_flag = True;
271         } else if(strcmp(moji, CS2) == 0) {
272                 udc_val = FAL_FONT_CS2;
273                 udc_flag = True;
274         } else if(strcmp(moji, CS3) == 0) {
275                 udc_val = FAL_FONT_CS3;
276                 udc_flag = True;
277         } else {
278                 udc_flag = False;
279         }
280         XtFree(moji);
281         create_xlfd();
282         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
283 }
284
285 static void
286 sty_call(w)
287 Widget w;
288 {
289         XmString label;
290         char *moji;
291         if (sty_val) {
292                 XtFree(sty_val);
293                 sty_val = NULL;
294         }
295         XtVaGetValues(w, XmNlabelString, &label, NULL);
296         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
297         if(strncmp(moji, "*", 1) == 0) {
298                 sty_flag = False;
299         }
300         else {
301                 sty_val = XtMalloc(sizeof(char) * (strlen(moji) + 1));
302                 strcpy(sty_val, moji);
303                 sty_flag = True;
304         }
305         XtFree(moji);
306         create_xlfd();
307         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
308 }
309
310 static void
311 wls_call(w)
312 Widget w;
313 {
314         XmString label;
315         char *moji;
316         XtVaGetValues(w, XmNlabelString, &label, NULL);
317         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
318         if(strncmp(moji, "*", 1) == 0) {
319                 wls_flag = False;
320         }
321         else {
322                 wls_val = atoi(moji);
323                 wls_flag = True;
324         }
325         XmStringFree(label);
326         XtFree(moji);
327         create_xlfd();
328         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
329 }
330
331 static void
332 hls_call(w)
333 Widget w;
334 {
335         XmString label;
336         char *moji;
337         XtVaGetValues(w, XmNlabelString, &label, NULL);
338         moji = (char *) _XmStringUngenerate(label, NULL, XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
339         if(strncmp(moji, "*", 1) == 0) {
340                 hls_flag = False;
341         }
342         else {
343                 hls_val = atoi(moji);
344                 hls_flag = True;
345         }
346         XmStringFree(label);
347         XtFree(moji);
348         create_xlfd();
349         XtVaSetValues(scrolllist, XmNitems, xlf, XmNitemCount, xlf_count, NULL);
350 }
351
352 static void
353 button_set1()
354 {
355     int         i, j;
356     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
357     FalFontData key;
358     FalFontDataList *fontlist;
359     FalFontData *f;
360     Boolean found;
361
362     if (sty_flag == True) {
363         key.style.name = sty_val;
364         mask |= FAL_FONT_MASK_STYLE_NAME;
365     }
366     if (wls_flag == True) {
367         key.size.w = wls_val;
368         mask |= FAL_FONT_MASK_SIZE_W;
369     }
370     if (hls_flag == True) {
371         key.size.h = hls_val;
372         mask |= FAL_FONT_MASK_SIZE_H;
373     }
374     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
375         for (j=0; j<udc_count; j++)
376             XtSetSensitive(button1[j], False);
377         return;
378     }
379     if(fontlist->num == 0) {
380         for (j=0; j<udc_count; j++)
381             XtSetSensitive(button1[j], False);
382         FalFreeFontList(fontlist);
383         return;
384     }
385  
386     for (j=0; j<udc_count; j++) {
387         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
388             if(udc[j] == f->cd_set) {
389                 found = True;
390                 break;
391             }
392         }
393         if(found == False)
394             XtSetSensitive(button1[j], False);
395         else
396             XtSetSensitive(button1[j], True);
397     }
398     FalFreeFontList(fontlist);
399 }
400
401 static void
402 button_set2()
403 {
404     int         i, j;
405     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
406     FalFontData key;
407     FalFontDataList *fontlist;
408     FalFontData *f;
409     Boolean found;
410
411     if (udc_flag == True) {
412         key.cd_set = udc_val;
413         mask |= FAL_FONT_MASK_CODE_SET;
414     }
415     if (wls_flag == True) {
416         key.size.w = wls_val;
417         mask |= FAL_FONT_MASK_SIZE_W;
418     }
419     if (hls_flag == True) {
420         key.size.h = hls_val;
421         mask |= FAL_FONT_MASK_SIZE_H;
422     }
423     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
424         for (j=0; j<sty_count; j++)
425             XtSetSensitive(button2[j], False);
426         return;
427     }
428     if(fontlist->num == 0) {
429         for (j=0; j<sty_count; j++)
430             XtSetSensitive(button2[j], False);
431         FalFreeFontList(fontlist);
432         return;
433     }
434  
435     for (j=0; j<sty_count; j++) {
436         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
437             if(strcmp(sty[j], f->style.name) == 0) {
438                 found = True;
439                 break;
440             }
441         }
442         if(found == False)
443             XtSetSensitive(button2[j], False);
444         else
445             XtSetSensitive(button2[j], True);
446     }
447     FalFreeFontList(fontlist);
448 }
449
450 static void
451 button_set3()
452 {
453     int         i, j;
454     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
455     FalFontData key;
456     FalFontDataList *fontlist;
457     FalFontData *f;
458     Boolean found;
459
460     if (udc_flag == True) {
461         key.cd_set = udc_val;
462         mask |= FAL_FONT_MASK_CODE_SET;
463     }
464     if (sty_flag == True) {
465         key.style.name = sty_val;
466         mask |= FAL_FONT_MASK_STYLE_NAME;
467     }
468     if (hls_flag == True) {
469         key.size.h = hls_val;
470         mask |= FAL_FONT_MASK_SIZE_H;
471     }
472     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
473         for (j=0; j<wls_count; j++)
474             XtSetSensitive(button3[j], False);
475         return;
476     }
477     if(fontlist->num == 0) {
478         for (j=0; j<wls_count; j++)
479             XtSetSensitive(button3[j], False);
480         FalFreeFontList(fontlist);
481         return;
482     }
483  
484     for (j=0; j<wls_count; j++) {
485         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
486             if(wls[j] == f->size.w) {
487                 found = True;
488                 break;
489             }
490         }
491         if(found == False)
492             XtSetSensitive(button3[j], False);
493         else
494             XtSetSensitive(button3[j], True);
495     }
496     FalFreeFontList(fontlist);
497 }
498
499 static void
500 button_set4()
501 {
502     int         i, j;
503     int mask = FAL_FONT_MASK_DEFINED | FAL_FONT_MASK_UNDEFINED;
504     FalFontData key;
505     FalFontDataList *fontlist;
506     FalFontData *f;
507     Boolean found;
508
509     if (udc_flag == True) {
510         key.cd_set = udc_val;
511         mask |= FAL_FONT_MASK_CODE_SET;
512     }
513     if (sty_flag == True) {
514         key.style.name = sty_val;
515         mask |= FAL_FONT_MASK_STYLE_NAME;
516     }
517     if (wls_flag == True) {
518         key.size.w = wls_val;
519         mask |= FAL_FONT_MASK_SIZE_W;
520     }
521     if (FalGetFontList(&key, mask, &fontlist) == FAL_ERROR) {
522         for (j=0; j<hls_count; j++)
523             XtSetSensitive(button4[j], False);
524         return;
525     }
526     if(fontlist->num == 0) {
527         for (j=0; j<hls_count; j++)
528             XtSetSensitive(button4[j], False);
529         FalFreeFontList(fontlist);
530         return;
531     }
532  
533     for (j=0; j<hls_count; j++) {
534         for (i=0, f=fontlist->list, found=False; i < fontlist->num; i++, f++) {
535             if(hls[j] == f->size.h) {
536                 found = True;
537                 break;
538             }
539         }
540         if (found == False)
541             XtSetSensitive(button4[j], False);
542         else
543             XtSetSensitive(button4[j], True);
544     }
545     FalFreeFontList(fontlist);
546 }
547
548 void
549 data_sort(data, count)
550 int *data;
551 int count;
552 {
553     int *p1, *p2, tmp, i;
554
555     for (; count; count--) {
556         for (i=1, p1=data, p2=data+1; i < count; i++, p1++, p2++) {
557             if( *p1 > *p2) {
558                 tmp = *p2;
559                 *p2 = *p1;
560                 *p1 = tmp;
561             }
562         }
563     }
564 }
565
566
567 static void
568 font_init()
569 {
570         FalFontDataList *fontlist;
571         FalFontData     *f;
572         Boolean         found;
573         int             i, j;
574         char            tmp[16];
575         char            err[128];
576         Widget          button;
577         extern void Error_message();
578
579         xlf_count = udc_count = sty_count = wls_count = hls_count = 0;
580         if (FalGetFontList(NULL, FAL_FONT_MASK_DEFINED |
581                         FAL_FONT_MASK_UNDEFINED, &fontlist) == FAL_ERROR) {
582                 strcpy(err, FAL_ERROR_STR);
583                 Error_message((Widget)NULL, err);
584                 return;
585         }
586         if(fontlist->num == 0) {
587                 FalFreeFontList(fontlist);
588                 strcpy(err, resource.mn_no_font);
589                 Error_message((Widget)NULL, err);
590                 return;
591         }
592         udc = (int *)XtMalloc(sizeof(int) * fontlist->num);
593         sty = (char **)XtMalloc(sizeof(char *) * fontlist->num);
594         wls = (int *)XtMalloc(sizeof(int) * fontlist->num);
595         hls = (int *)XtMalloc(sizeof(int) * fontlist->num);
596         for (i=0, f=fontlist->list; i < fontlist->num; i++, f++) {
597             for (j=0,found=False; j<udc_count; j++) {
598                 if(udc[j] == f->cd_set) {
599                         found=True;
600                         break;
601                 }
602             }
603             if (found == False) {
604                 udc[udc_count++] = f->cd_set;
605             }
606             for (j=0,found=False; j<sty_count; j++) {
607                 if(strcmp(sty[j], f->style.name) == 0) {
608                         found=True;
609                         break;
610                 }
611             }
612             if (found == False) {
613                 sty[sty_count] = XtMalloc(sizeof(char) * (strlen(f->style.name) + 1));
614                 strcpy(sty[sty_count++], f->style.name);
615             }
616             if (f->size.w != -1) {
617             for (j=0,found=False; j<wls_count; j++) {
618                 if(wls[j] == f->size.w) {
619                         found=True;
620                         break;
621                 }
622             }
623             if (found == False) {
624                 wls[wls_count++] = f->size.w;
625             }
626             }
627             for (j=0,found=False; j<hls_count; j++) {
628                 if(hls[j] == f->size.h) {
629                         found=True;
630                         break;
631                 }
632             }
633             if (found == False) {
634                 hls[hls_count++] = f->size.h;
635             }
636         }
637         FalFreeFontList(fontlist);
638
639         data_sort(udc, udc_count);
640         data_sort(wls, wls_count);
641         data_sort(hls, hls_count);
642
643         button1 = (Widget *) XtMalloc(sizeof(Widget) * udc_count);
644         button2 = (Widget *) XtMalloc(sizeof(Widget) * sty_count);
645         button3 = (Widget *) XtMalloc(sizeof(Widget) * wls_count);
646         button4 = (Widget *) XtMalloc(sizeof(Widget) * hls_count);
647
648         button = XmCreatePushButton(pull1, "*", NULL, 0);
649         XtManageChild(button);
650         XtAddCallback(button, XmNactivateCallback,
651                                                 (XtCallbackProc)udc_call, NULL);
652         for (i=0; i < udc_count; i++) {
653                 if(udc[i] == FAL_FONT_CS0)
654                         sprintf(tmp, CS0);
655                 else if(udc[i] == FAL_FONT_CS1)
656                         sprintf(tmp, CS1);
657                 else if(udc[i] == FAL_FONT_CS2)
658                         sprintf(tmp, CS2);
659                 else if(udc[i] == FAL_FONT_CS3)
660                         sprintf(tmp, CS3);
661                 else
662                         sprintf(tmp, "Codeset %x?", udc[i]);
663                 button1[i] = XmCreatePushButton(pull1, tmp, NULL, 0);
664                 XtManageChild(button1[i]);
665                 XtAddCallback(button1[i], XmNactivateCallback,
666                                                 (XtCallbackProc)udc_call, NULL);
667         }
668
669         button = XmCreatePushButton(pull2, "*", NULL, 0);
670         XtManageChild(button);
671         XtAddCallback(button, XmNactivateCallback,
672                                                 (XtCallbackProc)sty_call, NULL);
673         for (i=0; i < sty_count; i++) {
674                 button2[i] = XmCreatePushButton(pull2, sty[i], NULL, 0);
675                 XtManageChild(button2[i]);
676                 XtAddCallback(button2[i], XmNactivateCallback,
677                                                 (XtCallbackProc)sty_call, NULL);
678         }
679
680         button = XmCreatePushButton(pull3, "*", NULL, 0);
681         XtManageChild(button);
682         XtAddCallback(button, XmNactivateCallback,
683                                                 (XtCallbackProc)wls_call, NULL);
684         for (i=0; i < wls_count; i++) {
685                 sprintf(tmp, "%d", wls[i]);
686                 button3[i] = XmCreatePushButton(pull3, tmp, NULL, 0);
687                 XtManageChild(button3[i]);
688                 XtAddCallback(button3[i], XmNactivateCallback,
689                                                 (XtCallbackProc)wls_call, NULL);
690         }
691
692         button = XmCreatePushButton(pull4, "*", NULL, 0);
693         XtManageChild(button);
694         XtAddCallback(button, XmNactivateCallback,
695                                                 (XtCallbackProc)hls_call, NULL);
696         for (i=0; i < hls_count; i++) {
697                 sprintf(tmp, "%d", hls[i]);
698                 button4[i] = XmCreatePushButton(pull4, tmp, NULL, 0);
699                 XtManageChild(button4[i]);
700                 XtAddCallback(button4[i], XmNactivateCallback,
701                                                 (XtCallbackProc)hls_call, NULL);
702         }
703 }
704
705
706 static Widget
707 CreateSelectXLFD( top )
708 Widget  top ;
709 {
710
711         int             n;
712         Arg             args[16];
713         XmString        xms, xms1 ;
714         Widget          editW ;
715         Widget          frame, row1, label1, row2, cas1, cas2, cas3, cas4;
716         XmString        str;
717         udc_flag = sty_flag = wls_flag = hls_flag = False;
718
719         /*
720         *  create base window
721         */
722         n = 0 ;
723         XtSetArg( args[n], XmNautoUnmanage, False ) ;           n++ ;
724         XtSetArg( args[n], XmNnoResize, True ) ;                n++ ;
725         XtSetArg( args[n], XmNminimizeButtons, True ) ;         n++ ;
726         xms = XmStringCreateLocalized( resource.exec_label ) ;
727         XtSetArg( args[n], XmNokLabelString, xms ) ;            n++ ;
728         xms1 = XmStringCreateLocalized( resource.quit_label) ;
729         XtSetArg( args[n], XmNhelpLabelString, xms1 ) ;         n++ ;
730         XtSetArg( args[n], XmNtitle, resource.l_open_title ) ;  n++ ;
731         editW = XmCreateTemplateDialog( top, "open_dialog", args, n );
732
733         XmStringFree( xms ) ;
734         XmStringFree( xms1 ) ;
735
736         n = 0;
737         pull1 = XmCreatePulldownMenu(toplevel, "pull", args, n);
738         pull2 = XmCreatePulldownMenu(toplevel, "pull", args, n);
739         pull3 = XmCreatePulldownMenu(toplevel, "pull", args, n);
740         pull4 = XmCreatePulldownMenu(toplevel, "pull", args, n);
741
742         n = 0 ;
743         xlfdWform  = XmCreateRowColumn( editW, "BaseForm", args, n );
744         XtManageChild( xlfdWform );
745
746         n = 0;
747         frame = XmCreateFrame( xlfdWform, "frame", args, n);
748         XtManageChild( frame );
749
750         n = 0 ;
751         row1  = XmCreateRowColumn( frame, "row", args, n );
752         XtManageChild( row1 );
753
754         n = 0;
755         str = XmStringCreateLocalized(resource.l_selectitem) ;
756         XtSetArg(args[n], XmNlabelString, str);  n++;
757         label1 = XmCreateLabel( row1, "SelectItems", args, n);
758         XtManageChild( label1 );
759         XmStringFree(str);
760
761         n = 0 ;
762         row2  = XmCreateRowColumn( row1, "row", args, n );
763         XtManageChild( row2 );
764
765         n = 0 ;
766         str = XmStringCreateLocalized(resource.l_codeset) ;
767         XtSetArg(args[n], XmNlabelString, str);  n++;
768         XtSetArg(args[n], XmNsubMenuId, pull1);  n++;
769         cas1  = XmCreateOptionMenu( row2, "CodeSet", args, n );
770         XtManageChild( cas1 );
771         XtAddCallback(XmOptionButtonGadget(cas1), XmNcascadingCallback,
772                                         (XtCallbackProc)button_set1, NULL);
773         XmStringFree(str);
774  
775         n = 0 ;
776         str = XmStringCreateLocalized(resource.l_style) ;
777         XtSetArg(args[n], XmNlabelString, str);  n++;
778         XtSetArg(args[n], XmNsubMenuId, pull2);  n++;
779         cas2  = XmCreateOptionMenu( row2, "Style", args, n );
780         XtAddCallback(XmOptionButtonGadget(cas2), XmNcascadingCallback,
781                                         (XtCallbackProc)button_set2, NULL);
782         XtManageChild( cas2 );
783         XmStringFree(str);
784
785         n = 0 ;
786         str = XmStringCreateLocalized(resource.l_width) ;
787         XtSetArg(args[n], XmNlabelString, str);  n++;
788         XtSetArg(args[n], XmNsubMenuId, pull3);  n++;
789         cas3  = XmCreateOptionMenu( row2, "Width", args, n );
790         XtManageChild( cas3 );
791         XtAddCallback(XmOptionButtonGadget(cas3), XmNcascadingCallback,
792                                         (XtCallbackProc)button_set3, NULL);
793         XmStringFree(str);
794
795         n = 0 ;
796         str = XmStringCreateLocalized(resource.l_height) ;
797         XtSetArg(args[n], XmNlabelString, str);  n++;
798         XtSetArg(args[n], XmNsubMenuId, pull4);  n++;
799         cas4  = XmCreateOptionMenu( row2, "Height", args, n );
800         XtManageChild( cas4 );
801         XtAddCallback(XmOptionButtonGadget(cas4), XmNcascadingCallback,
802                                         (XtCallbackProc)button_set4, NULL);
803         XmStringFree(str);
804
805         font_init();
806         create_xlfd();
807
808         n = 0;
809         XtSetArg(args[n], XmNvisibleItemCount, 10) ;    n++ ;
810         XtSetArg(args[n], XmNlistSizePolicy, XmCONSTANT) ;      n++ ;
811         XtSetArg(args[n], XmNscrollBarDisplayPolicy, XmSTATIC) ;        n++ ;
812         XtSetArg(args[n], XmNselectionPolicy, XmSINGLE_SELECT) ;        n++ ;
813         XtSetArg(args[n], XmNitems, xlf) ;      n++ ;
814         XtSetArg(args[n], XmNitemCount, xlf_count) ;    n++ ;
815         scrolllist = XmCreateScrolledList(xlfdWform, "scrolllist", args, n);
816         XtManageChild(scrolllist);
817
818         /*  
819          * Error_Messege
820          */
821
822         XtAddCallback(editW, XmNokCallback, (XtCallbackProc)OpenWindowCB, NULL);
823         XtAddCallback(editW, XmNokCallback, (XtCallbackProc)ReadCB, NULL);
824         XtAddCallback(editW, XmNhelpCallback,
825                                         (XtCallbackProc)OpenCancelCB, NULL);
826
827         return( editW ) ;
828 }
829