Merge /u/jrubio/cdesktopenv/ branch implicit-int into master
[oweals/cde.git] / cde / programs / dtudcfonted / mtfgui.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 /* mtfgui.c 1.21 - Fujitsu source for CDEnext    96/10/30 13:13:46      */
24 /* $XConsortium: mtfgui.c /main/11 1996/11/08 01:55:01 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
34 #include <stdio.h>
35 #include <locale.h>
36 #include <X11/Intrinsic.h>
37 #include <Xm/MessageB.h>
38
39 #include "xoakufont.h"
40 #include "util.h"
41
42 void CBeOblB_aEnd(Widget widget, caddr_t clientData, caddr_t callData);
43 void EHeStaT_list(Widget widget, int select, XEvent *e);
44 void CBeScro(Widget widget, caddr_t clientData, caddr_t callData);
45 void EHeBulB_eMEv(Widget widget, caddr_t clientData, XEvent *e);
46 void EHeBulB_eExp(Widget widget, caddr_t clientData, XEvent *e);
47 void EHeBulB_dExp(Widget widget, caddr_t clientData);
48 static void EHStaT_disp(Widget widget, int i);
49
50 extern Resource resource;
51
52 extern int efctPtnNum(void);
53 extern char *char_set(char *str);
54
55 extern char *fullpath;
56 extern FalFontData fullFontData;
57
58 extern FalCodeRegion CodeArea[16];
59
60 /********************************************************************
61  structure of widgets
62  ********************************************************************/
63 extern  Widget  toplevel;
64         Widget  editPopW,
65                 wgeScro,
66                 wgeBulB_edit;
67 static  Widget  wgeStaT_form[EDLIST_MAX],
68                 wgeStaT_disp[EDLIST_MAX],
69                 wgeStaT_list[EDLIST_MAX],
70                 wgeBulB_disp;
71
72 /**********************************************************************
73  display windows
74  **********************************************************************/
75
76 /*
77  * contents : displays the "User Defined Charactrer editor" window
78  */
79
80 static Widget CreateEditPtn(Widget owner);
81 void OpenCB(Widget w, XtPointer client_data, XtPointer call_data);
82 void MngPtnCB(void);
83 void CpyPtnCB(void);
84 void CBeRecB_obj(Widget widget, int obj, XmToggleButtonCallbackStruct *call);
85 void CBeOblB_aAdd(void);
86 void CBeOblB_rCmd(Widget widget, int proc, caddr_t callData);
87 void CBeOblB_rCmdp(Widget widget, int proc, caddr_t callData);
88 void CBeOblB_rCan(Widget widget, caddr_t clientData, caddr_t callData);
89
90
91 /**
92  **  contents : manage the codes list
93  ** ===================================================================
94  **/
95
96 static void
97 XlfdCB(void)
98 {
99   Widget        dialog;
100   Arg           args[5];
101   char          mess[1024];
102   int           n = 0;
103   XmString      cs, cs1, cs2;
104
105   sprintf(mess, "%s : %s", resource.file_name, fullpath);
106   cs = XmStringCreateLocalized(mess);
107   cs1 = XmStringSeparatorCreate();
108   cs2 = XmStringConcat(cs, cs1);
109   XmStringFree(cs);
110   XmStringFree(cs1);
111   sprintf(mess, "%s : %s", resource.xlfd_name, fullFontData.xlfdname);
112   cs1 = XmStringCreateLocalized(mess);
113   cs = XmStringConcat(cs2, cs1);
114   XmStringFree(cs1);
115   XmStringFree(cs2);
116   XtSetArg (args[n], XmNtitle, resource.l_xlfd_title); n++;
117   XtSetArg (args[n], XmNmessageString, cs); n++;
118   XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
119   dialog = XmCreateInformationDialog (toplevel, "Xlfd_name", args, n);
120   XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
121   XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
122   XtManageChild (dialog);
123   XmStringFree(cs);
124 }
125
126 static void
127 CodeAreaCB(void)
128 {
129     char        mess[256];
130     char        tmp[16];
131     Widget      dialog;
132     Arg         args[5];
133     int         n;
134     XmString    cs;
135
136     sprintf(mess, "%s : ", resource.codearea);
137     switch (fullFontData.cd_set) {
138         case FAL_FONT_CS0:
139             strcat(mess, "CS0:");
140             break;
141         case FAL_FONT_CS1:
142             strcat(mess, "CS1:");
143             break;
144         case FAL_FONT_CS2:
145             strcat(mess, "CS2:");
146             break;
147         case FAL_FONT_CS3:
148             strcat(mess, "CS3:");
149             break;
150     }
151
152     for (n=0; CodeArea[n].start != -1; n++) {
153         sprintf(tmp, " %X - %X ", CodeArea[n].start, CodeArea[n].end);
154         strcat(mess, tmp);
155     }
156     cs = XmStringCreateLocalized(mess);
157     n = 0;
158     XtSetArg (args[n], XmNtitle, resource.l_codearea_title); n++;
159     XtSetArg (args[n], XmNmessageString, cs); n++;
160     XtSetArg (args[n], XmNdialogStyle, XmDIALOG_MODELESS); n++;
161     XtSetArg (args[n], XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON); n++;
162     dialog = XmCreateInformationDialog (toplevel, "UDCarea", args, n);
163     XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
164     XtUnmanageChild (XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
165     XtManageChild (dialog);
166     XmStringFree(cs);
167 }
168
169 void
170 ListSetLabelStr(int i, String str)
171 {
172     SetLabelString( wgeStaT_list[i], str );
173 }
174
175 void
176 ListSelectItem(int i)
177 {
178     XtVaSetValues( wgeStaT_list[i],
179         XmNbackground, (XtArgVal) resource.foreground,
180         XmNforeground, (XtArgVal) resource.background,
181         NULL);
182     xl.list_winID = XtWindow( wgeStaT_disp[i] ) ;
183 }
184
185 void
186 ListUnselectItem(int i)
187 {
188     XtVaSetValues( wgeStaT_list[i],
189         XmNbackground, (XtArgVal) resource.background,
190         XmNforeground, (XtArgVal) resource.foreground,
191         NULL);
192     xl.list_winID = 0 ;
193 }
194
195 void
196 ListSetGlyphImage( int i )
197 {
198         int     code ;
199
200         dl_glyph[i].disp_winID = XtWindow(wgeStaT_disp[i]);
201         code = noToCode(ptnSqToNo(sq_disp[i]));
202         if (codeCheck(code)) {
203                 XClearWindow(xl.display, dl_glyph[i].disp_winID);
204                 return;
205         }
206         if (code == edg.code && xl.dispImage != NULL) {
207                 XPutImage(xl.display, dl_glyph[i].disp_winID, xl.borderGC,
208                                 xl.dispImage, 0,0,0,0, edg.width, edg.height );
209         } else {
210                 if (dl_glyph[i].dispImage)
211                     XFree((char *)dl_glyph[i].dispImage);
212                 if (ptnGet(code, dl_glyph[i].ptn))
213                     return ;
214                 dl_glyph[i].dispImage  = XCreateImage( xl.display,
215                     DefaultVisual(xl.display, DefaultScreen(xl.display)), 1,
216                     XYBitmap, 0, dl_glyph[i].ptn, edg.width, edg.height, 8, 0);
217                 dl_glyph[i].dispImage->bitmap_bit_order = MSBFirst;
218                 dl_glyph[i].dispImage->byte_order       = MSBFirst;
219
220                 XPutImage(xl.display, dl_glyph[i].disp_winID, xl.borderGC,
221                         dl_glyph[i].dispImage, 0,0,0,0, edg.width, edg.height);
222         }
223 }
224
225 /*ARGSUSED*/
226 static void
227 EHStaT_disp( Widget widget, int i /* widget that have some ivent */ )
228 {
229     ListSetGlyphImage( i );
230 }
231
232 /**
233  **  contents : create the icon
234  ** ===================================================================
235  **/
236
237
238 /**
239  **  contents : set callback functions for UDC editor window
240  ** ===================================================================
241  **/
242
243 static void _create_editptn_after();
244
245 static Widget FooterMessage;
246 static Widget codeLabel;
247
248 static menuButtonItems menu_btn[] = {
249     MENUBTNARGS( 'F' ),
250     MENUBTNARGS( 'E' ),
251     MENUBTNARGS( 'C' ),
252     MENUBTNARGS( 'I' ),
253 };
254 static MButton MenuBTN = MBUTTONS( menu_btn );
255
256 static ButtonItems file_btn[] = {
257     BTNARGS( OpenCB, NULL, 'O', True, False),
258     BTNARGS( CBeOblB_aAdd,   NULL, 'S', True, False),
259     BTNARGS( NULL,           NULL, NULL, NULL, NULL),
260     BTNARGS( CBeOblB_aEnd,   NULL, 'E', True, False),
261 };
262 static Button FileBTN = BUTTONS( file_btn );
263
264 static ButtonItems edit_btn[] = {
265     BTNARGS( CBeOblB_rCmd, PROC_CLS,  'C', True, False),
266     BTNARGS( CBeOblB_rCmd, PROC_SET,  'S', True, False),
267     BTNARGS( CBeOblB_rCmd, PROC_REV,  'R', True, False),
268     BTNARGS( CBeOblB_rCmdp, PROC_CUT,  'U', True, False),
269     BTNARGS( CBeOblB_rCmdp, PROC_CPY,  'O', True, False),
270     BTNARGS( CBeOblB_rCmdp, PROC_PASTE,'P', True, False),
271     BTNARGS( CBeOblB_rCmd, PROC_ROLL, 'A', True, False),
272     BTNARGS( CBeOblB_rCmd, PROC_SYMV, 'V', True, False),
273     BTNARGS( CBeOblB_rCmd, PROC_SYMH, 'H', True, False),
274     BTNARGS( CBeOblB_rCan, NULL,      'N', True, False),
275 };
276 static Button EditBTN = BUTTONS( edit_btn );
277
278 static ButtonItems char_btn[] = {
279     BTNARGS( MngPtnCB, NULL, 'A', True, False ),
280     BTNARGS( CpyPtnCB, NULL, 'C', True, False ),
281 };
282 static Button CharBTN = BUTTONS( char_btn );
283
284 static ButtonItems info_btn[] = {
285     BTNARGS( XlfdCB, NULL, 'X', True, False ),
286     BTNARGS( CodeAreaCB, NULL, 'C', True, False ),
287 };
288 static Button InfoBTN = BUTTONS( info_btn );
289
290 static ExclusiveItems draw_ex[] = {
291     EXARGS( PROC_POINT,  "pencil",    True, CBeRecB_obj, True  ),
292     EXARGS( PROC_LINE,   "line",      True, CBeRecB_obj, False ),
293     EXARGS( PROC_RECT,   "rectangle", True, CBeRecB_obj, False ),
294     EXARGS( PROC_CIRCLE, "circle",    True, CBeRecB_obj, False ),
295     EXARGS( PROC_ERASE,  "erase",     True, CBeRecB_obj, False ),
296     EXARGS( PROC_SELECT, "select",    True, CBeRecB_obj, False ),
297 };
298 static Exclusive DrawEX = EXCLUSIVE( draw_ex );
299
300 static void
301 Unset(void)
302 {
303     XtSetSensitive(EditBTN.w[0], False);
304     XtSetSensitive(EditBTN.w[1], False);
305     XtSetSensitive(EditBTN.w[2], False);
306     XtSetSensitive(EditBTN.w[3], False);
307     XtSetSensitive(EditBTN.w[4], False);
308     XtSetSensitive(EditBTN.w[5], False);
309     XtSetSensitive(EditBTN.w[6], False);
310     XtSetSensitive(EditBTN.w[7], False);
311     XtSetSensitive(EditBTN.w[8], False);
312     XtSetSensitive(EditBTN.w[9], False);
313 }
314
315 void
316 SelectSet(void)
317 {
318     XtSetSensitive(EditBTN.w[0], True);
319     XtSetSensitive(EditBTN.w[1], True);
320     XtSetSensitive(EditBTN.w[2], True);
321     XtSetSensitive(EditBTN.w[3], True);
322     XtSetSensitive(EditBTN.w[4], True);
323     XtSetSensitive(EditBTN.w[6], True);
324     XtSetSensitive(EditBTN.w[7], True);
325     XtSetSensitive(EditBTN.w[8], True);
326 }
327
328 void
329 SelectUnset(void)
330 {
331     XtSetSensitive(EditBTN.w[0], False);
332     XtSetSensitive(EditBTN.w[1], False);
333     XtSetSensitive(EditBTN.w[2], False);
334     XtSetSensitive(EditBTN.w[3], False);
335     XtSetSensitive(EditBTN.w[4], False);
336     XtSetSensitive(EditBTN.w[6], False);
337     XtSetSensitive(EditBTN.w[7], False);
338     XtSetSensitive(EditBTN.w[8], False);
339 }
340
341 void
342 CopySet(void)
343 {
344     XtSetSensitive(EditBTN.w[5], True);
345 }
346
347 void
348 UndoSet(void)
349 {
350     XtSetSensitive(EditBTN.w[9], True);
351 }
352
353 void
354 UndoUnset(void)
355 {
356     XtSetSensitive(EditBTN.w[9], False);
357 }
358
359 /**
360  **  contents : create the UDC editor window
361  ** --------------------------------
362  **/
363
364 void
365 PopupEditPtn(Widget owner)
366 {
367     if (! editPtnW){
368         editPtnW = CreateEditPtn(owner);
369         _create_editptn_after();
370     }
371     XtPopup(editPtnW, XtGrabNone);
372 }
373
374 static Widget
375 CreateEditPtn(Widget owner)
376 {
377     int         slimax;
378     int         i;
379     Widget      baseForm, pop, font_menu, edit_menu, char_menu, info_menu;
380     Widget      listBase, listFrame, rc, editFrame, figure_w;
381     Widget      imageFrame, imageForm, editPane, image;
382     extern Widget CreateFrame();
383     extern Widget CreatePixButton();
384
385     Arg arg[1];
386
387
388     SetItemLabel(&MenuBTN, 0, resource.l_font);
389     SetItemLabel(&MenuBTN, 1, resource.l_edit);
390     SetItemLabel(&MenuBTN, 2, resource.l_manage);
391     SetItemLabel(&MenuBTN, 3, resource.l_info);
392     baseForm = (Widget)
393     CreateMenuBarAndFooterMessageForm( owner, "dtudcfonted",
394         &MenuBTN, XtNumber(menu_btn), &pop, &FooterMessage );
395
396     editPopW = pop;
397
398     AddDeleteProc(pop, CBeOblB_aEnd);
399
400     font_menu = GetMenuWidget( &MenuBTN, 0 );
401     edit_menu = GetMenuWidget( &MenuBTN, 1 );
402     char_menu = GetMenuWidget( &MenuBTN, 2 );
403     info_menu = GetMenuWidget( &MenuBTN, 3 );
404
405     SetItemLabel(&FileBTN, 0, resource.l_open_w);
406     SetItemLabel(&FileBTN, 1, resource.l_save);
407     SetItemLabel(&FileBTN, 3, resource.l_exit);
408
409     SetItemLabel(&EditBTN, 0, resource.l_clear);
410     SetItemLabel(&EditBTN, 1, resource.l_set);
411     SetItemLabel(&EditBTN, 2, resource.l_reverse);
412     SetItemLabel(&EditBTN, 3, resource.l_cut);
413     SetItemLabel(&EditBTN, 4, resource.l_Copy);
414     SetItemLabel(&EditBTN, 5, resource.l_paste);
415     SetItemLabel(&EditBTN, 6, resource.l_roll);
416     SetItemLabel(&EditBTN, 7, resource.l_updown_roll);
417     SetItemLabel(&EditBTN, 8, resource.l_leftright_roll);
418     SetItemLabel(&EditBTN, 9, resource.l_undo);
419
420     SetItemLabel(&CharBTN, 0, resource.l_manage_w);
421     SetItemLabel(&CharBTN, 1, resource.l_copy_w);
422
423     SetItemLabel(&InfoBTN, 0, resource.l_xlfd);
424     SetItemLabel(&InfoBTN, 1, resource.l_codearea);
425
426     CreateMenuButtons( font_menu, &FileBTN, XtNumber(file_btn));
427     CreateMenuButtons( edit_menu, &EditBTN, XtNumber(edit_btn));
428     Unset();
429     CreateMenuButtons( char_menu, &CharBTN, XtNumber(char_btn));
430     CreateMenuButtons( info_menu, &InfoBTN, XtNumber(info_btn));
431
432     /* create "Character list" */
433
434     listFrame =
435     CreateFrame( baseForm, "listFrame", XmSHADOW_IN, 2);
436     AddTopAttachForm(listFrame, resource.ed_wge_topoff);
437     AddLeftAttachForm(listFrame, resource.ed_wge_lftoff);
438     AddBottomAttachForm(listFrame, resource.ed_wge_btmoff);
439
440     listBase =
441     CreateRowColumn( listFrame, "listFrame", L_VERTICAL, 4, 2, 2);
442
443     for( i=0  ;  i < edlist.nlist  ;  i++ ) {
444         wgeStaT_form[i] = CreateForm( listBase, "listform" );
445         wgeStaT_list[i] =
446         CreateLabel( wgeStaT_form[i], "label",  "0000" );
447         wgeStaT_disp[i] = CreateDrawingArea( wgeStaT_form[i], "image",
448                         edg.width, edg.height, EHStaT_disp, i ) ;
449         AddLeftAttachWidget( wgeStaT_disp[i], wgeStaT_list[i], 0 ) ;
450         XtAddEventHandler( wgeStaT_list[i],
451                 ButtonPressMask|ButtonReleaseMask,
452                 False, EHeStaT_list, (XtPointer) (intptr_t) i );
453         XtAddEventHandler( wgeStaT_disp[i],
454                 ButtonPressMask|ButtonReleaseMask,
455                 False, EHeStaT_list, (XtPointer) (intptr_t) i );
456
457         if (i==0){
458             XtVaGetValues(wgeStaT_disp[i],
459                 XmNheight,      &(edlist.elem_h),
460                 XmNwidth,       &(edlist.elem_w), NULL);
461
462             edlist.back = resource.pane_background;
463             edlist.border = resource.pane_foreground;
464
465             dn.elem_h = edlist.elem_h;
466             dn.elem_w = edlist.elem_w;
467
468             /*
469             */
470             edpane.pix_w  = edpane.width / edg.width;
471             edpane.pix_h  = edpane.height / edg.height;
472             if(edpane.pix_w > edpane.pix_h)
473                 edpane.pix_w = edpane.pix_h;
474             else
475                 edpane.pix_h = edpane.pix_w;
476             /* */
477             edpane.pix_w  = ( edpane.pix_w < 8 ) ? 8 : edpane.pix_w;
478             edpane.pix_h  = ( edpane.pix_h < 8 ) ? 8 : edpane.pix_h;
479             /*
480             */
481             edpane.width  = edpane.pix_w * edg.width  - 1;
482             edpane.height = edpane.pix_h * edg.height - 1;
483
484             edlist.nlist = (edpane.height +2)/(int)(edlist.elem_h +8);
485             edlist.nlist =
486                 (edlist.nlist<EDLIST_MAX)?edlist.nlist:EDLIST_MAX;
487         }
488     }
489
490     XtManageChildren( wgeStaT_form, edlist.nlist );
491     for( i=0  ;  i < edlist.nlist  ;  i++ ) {
492         XtManageChild( wgeStaT_list[i] );
493         XtManageChild( wgeStaT_disp[i] );
494     }
495
496     /* create the scroll bar for Charcter list */
497     XtVaGetValues( listBase, XmNheight, &(edlist.list_h), NULL);
498
499     if (( slimax = efctPtnNum()) < edlist.nlist)
500         slimax = edlist.nlist;
501     wgeScro = CreateScrollBar( baseForm, "scrollBar", (edpane.height+2),
502                                 edlist.nlist, 0, slimax, CBeScro);
503     AddLeftAttachWidget( wgeScro, listFrame, 4 );
504     AddTopAttachForm( wgeScro, resource.ed_wge_topoff );
505     AddBottomAttachForm( wgeScro, resource.ed_wge_btmoff );
506
507     rc =
508     CreateForm( baseForm, "rc" );
509     AddTopAttachForm( rc, resource.ed_wge_topoff );
510     AddRightAttachForm( rc, resource.ed_wge_rghoff );
511     AddBottomAttachForm( rc, resource.ed_wge_btmoff );
512
513     editFrame =
514     CreateFrame( baseForm, "editFrame", XmSHADOW_IN, 2);
515     AddTopAttachForm(editFrame, resource.ed_wge_topoff);
516     AddLeftAttachWidget(editFrame, wgeScro, 4);
517     AddRightAttachWidget(editFrame, rc, 10);
518
519     figure_w =
520     CreatePixButton(rc, "Draw", &DrawEX);
521     AddTopAttachForm(figure_w, 0);
522     AddLeftAttachForm(figure_w, 0);
523     AddRightAttachForm(figure_w, 0);
524
525     imageFrame =
526     CreateCaptionFrame( rc, "Frame", "  ", XmSHADOW_IN, 1);
527     AddTopAttachWidget(XtParent(imageFrame), figure_w, 4);
528     AddLeftAttachForm(XtParent(imageFrame), 0);
529     AddRightAttachForm(XtParent(imageFrame), 0);
530     AddBottomAttachForm(XtParent(imageFrame), 0);
531
532     imageForm =
533     CreateForm( imageFrame, "separator" );
534
535     /* create the Editing pane */
536     wgeBulB_edit = editPane =
537     CreateDrawingArea( editFrame, "editPane",
538                         edpane.width, edpane.height, EHeBulB_eExp, 0);
539
540     XtAddEventHandler( editPane,
541               ButtonPressMask | ButtonMotionMask | ButtonReleaseMask,
542               False, EHeBulB_eMEv, NULL );
543     AddTopAttachForm( editPane, 2 );
544     AddLeftAttachForm( editPane, 2 );
545
546     /* create character image */
547     codeLabel = CreateLabel( imageForm, "codeLabel", "0000" );
548     AddTopAttachForm( codeLabel, 3 );
549     AddLeftAttachForm( codeLabel, 3 );
550
551     wgeBulB_disp = image = CreateDrawingArea( imageForm, "image", edg.width,
552                                         edg.height, EHeBulB_dExp, 0);
553     AddTopAttachWidget( image, codeLabel, 3 );
554     AddLeftAttachForm( image, 6 );
555
556     XtRealizeWidget( editPopW );
557
558     return(editPopW);
559 }
560
561
562
563
564 void
565 SetCodeString(int code)
566 {
567     char str[8];
568
569     if (! code){
570         str[0] = '\0';
571     }
572     else{
573         sprintf( str, "%4x:", code );
574     }
575     SetLabelString(codeLabel, str);
576 }
577
578
579
580 static void
581 _create_editptn_after(void)
582 {
583     int         slctloc;
584     static char dashPtn[] = {1,1};      /* Editing pane's border pattern */
585     extern void chgEdList();
586
587
588     /*
589      *  set X-library interface
590      */
591     xl.display    = XtDisplayOfObject( editPopW );
592     xl.root_winID = RootWindow( xl.display, DefaultScreen(xl.display) );
593     xl.edit_winID = XtWindow( wgeBulB_edit );
594     xl.disp_winID = XtWindow( wgeBulB_disp );
595     xl.list_winID = XtWindow( wgeStaT_disp[0] );
596
597     /*
598      *  Graphic Context ( Pixel clear )
599      */
600     xl.backGC     = XCreateGC( xl.display, xl.root_winID, 0, 0 );
601     XSetForeground( xl.display, xl.backGC, edpane.back );
602     XSetBackground( xl.display, xl.backGC, edpane.border );
603
604     /*
605      *  Graphic Context ( Pixel set )
606      */
607     xl.borderGC   = XCreateGC( xl.display, xl.root_winID, 0, 0 );
608     XSetForeground( xl.display, xl.borderGC, edpane.border );
609     XSetBackground( xl.display, xl.borderGC, edpane.back );
610
611     /*
612      *  Graphic Context ( rubber band )
613      */
614     xl.rubGC      = XCreateGC( xl.display, xl.root_winID, 0, 0 );
615     XSetForeground(xl.display, xl.rubGC, edpane.border ^ edpane.back);
616
617     XSetFunction  ( xl.display, xl.rubGC, GXxor );
618
619     /*
620      *  Graphc Context ( lattice of Editing pane )
621      */
622     xl.dashGC     = XCreateGC( xl.display, xl.root_winID, 0, 0 );
623     XSetForeground( xl.display, xl.dashGC, edpane.border );
624     XSetBackground( xl.display, xl.dashGC, edpane.back );
625
626     XSetLineAttributes( xl.display, xl.dashGC, 0,
627                         LineDoubleDash, CapButt, JoinMiter );
628     XSetDashes    ( xl.display, xl.dashGC, 0, dashPtn, 2 );
629
630     /*
631      *  display Editing pane
632      */
633     xl.dispImage  = XCreateImage( xl.display,
634         DefaultVisual( xl.display, DefaultScreen(xl.display) ),
635         1, XYBitmap, 0, edg.ptn, edg.width, edg.height, 8, 0    );
636     xl.dispImage->bitmap_bit_order = MSBFirst;
637     xl.dispImage->byte_order       = MSBFirst;
638
639     /*
640      *  initialize
641      */
642     edpane.color = ON;
643     edpane.obj   = PROC_POINT;
644     em.proc      = PROC_POINT;
645
646     if(efctPtnNum() > 0){
647         slctloc = 0;
648         SetCodeString(edg.code);
649     }
650     else{
651         slctloc = -1;
652     }
653     chgEdList( 0, slctloc, ON );
654
655 }
656
657 void
658 UpdateMessage(String str)
659 {
660     static Boolean nomsg = False;
661
662     if (! str || ! *str){
663         if (nomsg){
664             return;
665         }
666         else{
667             nomsg = True;
668         }
669     }
670     else{
671         nomsg = False;
672     }
673     SetFooterString(FooterMessage, str);
674 }