1 /*------------------------------------------------------------\
2 |                                                             |
3 | This file is part of the Alliance CAD System Copyright      |
4 | (C) Laboratoire LIP6 - D�partement ASIM Universite P&M Curie|
5 |                                                             |
6 | Home page      : http://www-asim.lip6.fr/alliance/          |
7 | E-mail         : mailto:alliance-users@asim.lip6.fr       |
8 |                                                             |
9 | This progam is  free software; you can redistribute it      |
10 | and/or modify it under the  terms of the GNU General Public |
11 | License as  published by the Free Software Foundation;      |
12 | either version 2 of the License, or (at your option) any    |
13 | later version.                                              |
14 |                                                             |
15 | Alliance VLSI  CAD System  is distributed  in the hope that |
16 | it  will be useful, but WITHOUT  ANY WARRANTY;              |
17 | without even the  implied warranty of MERCHANTABILITY or    |
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General       |
19 | Public License for more details.                            |
20 |                                                             |
21 | You should have received a copy  of the GNU General Public  |
22 | License along with the GNU C Library; see the file COPYING. |
23 | If not, write to the Free Software Foundation, Inc.,        |
24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.                     |
25 |                                                             |
26 \------------------------------------------------------------*/
27 
28 /*------------------------------------------------------------\
29 |                                                             |
30 | Tool    :                    XFSM                           |
31 |                                                             |
32 | File    :                   Panel.c                         |
33 |                                                             |
34 | Authors :              Jacomme Ludovic                      |
35 |                                                             |
36 | Date    :                   04.12.96                        |
37 |                                                             |
38 \------------------------------------------------------------*/
39 /*------------------------------------------------------------\
40 |                                                             |
41 |                         Include Files                       |
42 |                                                             |
43 \------------------------------------------------------------*/
44 
45 # include <stdio.h>
46 # include <sys/types.h>
47 # include <sys/stat.h>
48 # include <string.h>
49 # include <Xm/Xm.h>
50 # include <Xm/Form.h>
51 # include <Xm/LabelG.h>
52 # include <Xm/Label.h>
53 # include <Xm/Frame.h>
54 # include <Xm/List.h>
55 # include <Xm/Text.h>
56 # include <Xm/PushB.h>
57 # include <Xm/FileSB.h>
58 
59 # include "mut.h"
60 # include "aut.h"
61 # include "abl.h"
62 # include "bdd.h"
63 # include "fsm.h"
64 # include "XSB.h"
65 # include "XFS.h"
66 # include "XMX.h"
67 # include "XTB.h"
68 # include "XMF.h"
69 
70 # include "XMF_panel.h"
71 # include "XMF_dialog.h"
72 # include "XTB_dialog.h"
73 
74 /*------------------------------------------------------------\
75 |                                                             |
76 |                           Constants                         |
77 |                                                             |
78 \------------------------------------------------------------*/
79 /*------------------------------------------------------------\
80 |                                                             |
81 |                            Types                            |
82 |                                                             |
83 \------------------------------------------------------------*/
84 /*------------------------------------------------------------\
85 |                                                             |
86 |                          Variables                          |
87 |                                                             |
88 \------------------------------------------------------------*/
89 
90    XfsmPanelItem XfsmLibraryPanel =
91 
92          {
93            "Library",
94            1,
95            0,
96            XFSM_LIBRARY_X,
97            XFSM_LIBRARY_Y,
98            250,
99            375,
100            0,
101            0,
102            (Widget)NULL,
103            (Widget)NULL,
104            (Widget)NULL,
105            (Widget)NULL,
106            (XfsmPanelButtonItem *)NULL
107          };
108 
109    int XfsmLibraryDefaultValues[ 5 ] =
110 
111          {
112            XFSM_LIBRARY_X,
113            XFSM_LIBRARY_Y,
114            250, 375, 0
115          };
116 
117    static char **XFSM_CATA_LIB    = (char **)NULL;
118    static char  *XFSM_WORK_LIB    = (char  *)NULL;
119    static char  *XFSM_DEFAULT_LIB = (char *)NULL;
120 
121    static char   XfsmFirstLibrary = 1;
122 
123 /*------------------------------------------------------------\
124 |                                                             |
125 |                            Buffer                           |
126 |                                                             |
127 \------------------------------------------------------------*/
128 /*------------------------------------------------------------\
129 |                                                             |
130 |                    Widget For Library Panel                 |
131 |                                                             |
132 \------------------------------------------------------------*/
133 
134   Widget     XfsmLibraryListLabel;
135   Widget     XfsmLibraryList;
136 
137   Widget     XfsmLibraryButtonOk;
138   Widget     XfsmLibraryButtonUpdate;
139   Widget     XfsmLibraryButtonCancel;
140 
141   Widget     XfsmLibraryCataLabel;
142   Widget     XfsmLibraryCata;
143 
144   Widget     XfsmLibraryWorkLabel;
145   Widget     XfsmLibraryWork;
146 
147 /*------------------------------------------------------------\
148 |                                                             |
149 |                          Functions                          |
150 |                                                             |
151 \------------------------------------------------------------*/
152 /*------------------------------------------------------------\
153 |                                                             |
154 |                         XfsmIsDirectory                     |
155 |                                                             |
156 \------------------------------------------------------------*/
157 
XfsmIsDirectory(FileName)158 char XfsmIsDirectory( FileName )
159 
160    char *FileName;
161 {
162   struct stat Buffer;
163 
164   autbegin();
165 
166   if ( stat( FileName, &Buffer ) != -1 )
167   {
168     if ( ( Buffer.st_mode & S_IFMT ) == S_IFDIR )
169     {
170       autend();
171       return( 1 );
172     }
173   }
174 
175   autend();
176   return( 0 );
177 }
178 
179 /*------------------------------------------------------------\
180 |                                                             |
181 |                       XfsmSetLibraryList                    |
182 |                                                             |
183 \------------------------------------------------------------*/
184 
XfsmSetLibraryList()185 void XfsmSetLibraryList()
186 {
187   int      Index;
188   XmString Label;
189 
190   autbegin();
191 
192   XmListDeleteAllItems( XfsmLibraryList );
193 
194   for ( Index = 0;
195         XFSM_CATA_LIB[ Index ] != (char *)NULL;
196         Index++ )
197   {
198     Label = XmStringCreateSimple( XFSM_CATA_LIB[ Index ] );
199     XmListAddItem( XfsmLibraryList , Label , 0 );
200     XmStringFree( Label );
201   }
202 
203   Label = XmStringCreateSimple( XFSM_WORK_LIB );
204   XmListAddItem( XfsmLibraryList , Label , 0 );
205   XmStringFree( Label );
206 
207   XFSM_DEFAULT_LIB = (char *)NULL;
208 
209   autend();
210 }
211 
212 /*------------------------------------------------------------\
213 |                                                             |
214 |                       XfsmSetWorkLibrary                    |
215 |                                                             |
216 \------------------------------------------------------------*/
217 
XfsmSetWorkLibrary()218 void XfsmSetWorkLibrary()
219 {
220   autbegin();
221 
222   XmTextSetString( XfsmLibraryWork, XFSM_WORK_LIB );
223 
224   autend();
225 }
226 
227 /*------------------------------------------------------------\
228 |                                                             |
229 |                       XfsmSetCataLibrary                    |
230 |                                                             |
231 \------------------------------------------------------------*/
232 
XfsmSetCataLibrary()233 void XfsmSetCataLibrary()
234 {
235   int   Index;
236   long  Length;
237   char *Buffer;
238   char *Scan;
239 
240   autbegin();
241 
242   for ( Index = 0, Length = 0;
243         XFSM_CATA_LIB[ Index ] != (char *)NULL;
244         Index++ )
245   {
246     Length = Length + strlen( XFSM_CATA_LIB[ Index ] ) + 1;
247   }
248 
249   Buffer = (char *)autallocblock( Length + 1 );
250   Buffer[ 0 ] = '\0';
251   Scan   = Buffer;
252 
253   for ( Index = 0;
254         XFSM_CATA_LIB[ Index ] != (char *)NULL;
255         Index++ )
256   {
257     strcpy( Scan, XFSM_CATA_LIB[ Index ] );
258     strcat( Scan, "\n" );
259 
260     Scan = Scan + strlen( Scan );
261   }
262 
263   XmTextSetString( XfsmLibraryCata, Buffer );
264 
265   autfreeblock( Buffer );
266 
267   autend();
268 }
269 
270 /*------------------------------------------------------------\
271 |                                                             |
272 |                      XfsmInitializeLibrary                  |
273 |                                                             |
274 \------------------------------------------------------------*/
275 
XfsmInitializeLibrary()276 void XfsmInitializeLibrary()
277 {
278   int Index;
279 
280   autbegin();
281 
282   for ( Index = 0; CATA_LIB[ Index ] != (char *)NULL; Index++ );
283 
284   XFSM_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Index + 1 ));
285 
286   for ( Index = 0;
287         CATA_LIB[ Index ] != (char *)NULL;
288         Index++ )
289   {
290     XFSM_CATA_LIB[ Index ] = autallocblock( strlen( CATA_LIB[ Index ] ) + 1 );
291     strcpy( XFSM_CATA_LIB[ Index ], CATA_LIB[ Index ] );
292   }
293 
294   XFSM_CATA_LIB[ Index ] = (char *)NULL;
295 
296   XFSM_WORK_LIB = autallocblock( strlen( WORK_LIB ) + 1 );
297   strcpy( XFSM_WORK_LIB, WORK_LIB );
298 
299   XfsmSetCataLibrary();
300   XfsmSetWorkLibrary();
301   XfsmSetLibraryList();
302 
303   autend();
304 }
305 
306 /*------------------------------------------------------------\
307 |                                                             |
308 |                      XfsmGetCataLibrary                     |
309 |                                                             |
310 \------------------------------------------------------------*/
311 
XfsmGetCataLibrary()312  void XfsmGetCataLibrary()
313  {
314   char *NewCata;
315   char *Scan;
316   int   Index;
317   int   Count;
318   int   Length;
319 
320   autbegin();
321 
322   for ( Index = 0;
323         XFSM_CATA_LIB[ Index ] != (char *)NULL;
324         Index++ )
325   {
326     autfreeblock( XFSM_CATA_LIB[ Index ] );
327   }
328 
329   autfreeblock( XFSM_CATA_LIB );
330 
331   NewCata = XmTextGetString( XfsmLibraryCata );
332 
333   Count = 1;
334 
335   for ( Index = 0; NewCata[ Index ] != '\0'; Index++ )
336   {
337     if ( NewCata[ Index ] == '\n' )
338     {
339       Count = Count + 1;
340     }
341   }
342 
343   XFSM_CATA_LIB = (char **)autallocblock( sizeof(char *) * ( Count + 1 ));
344 
345   Count = 0;
346   Scan  = NewCata;
347 
348   for ( Index = 0; NewCata[ Index ] != '\0'; Index++ )
349   {
350     if ( NewCata[ Index ] == '\n' )
351     {
352       NewCata[ Index ] = '\0';
353 
354       Length = strlen( Scan );
355 
356       if ( ( Length > 0               ) &&
357            ( XfsmIsDirectory( Scan ) ) )
358       {
359         XFSM_CATA_LIB[ Count ] = autallocblock( Length + 1 );
360         strcpy( XFSM_CATA_LIB[ Count ], Scan );
361         Count = Count + 1;
362       }
363 
364       Scan  = NewCata + Index + 1;
365     }
366     else
367     if ( NewCata[ Index ] == ' ' )
368     {
369       NewCata[ Index ] = '\0';
370     }
371   }
372 
373   Length = strlen( Scan );
374 
375   if ( Length > 0 )
376   {
377     XFSM_CATA_LIB[ Count ] = autallocblock( Length + 1 );
378     strcpy( XFSM_CATA_LIB[ Count ], Scan );
379     Count = Count + 1;
380   }
381 
382   XFSM_CATA_LIB[ Count ] = (char *)NULL;
383 
384   autend();
385 }
386 
387 /*------------------------------------------------------------\
388 |                                                             |
389 |                      XfsmGetWorkLibrary                     |
390 |                                                             |
391 \------------------------------------------------------------*/
392 
XfsmGetWorkLibrary()393 void XfsmGetWorkLibrary()
394 {
395   char *NewWork;
396 
397   autbegin();
398 
399   autfreeblock( XFSM_WORK_LIB );
400 
401   NewWork = XmTextGetString( XfsmLibraryWork );
402 
403   if ( XfsmIsDirectory( NewWork ) )
404   {
405     XFSM_WORK_LIB = autallocblock( strlen( NewWork ) + 1 );
406     strcpy( XFSM_WORK_LIB, NewWork );
407   }
408 
409   autend();
410 }
411 
412 /*------------------------------------------------------------\
413 |                                                             |
414 |                       CallbackLibraryList                   |
415 |                                                             |
416 \------------------------------------------------------------*/
417 
CallbackLibraryList(MyWidget,ClientData,CallData)418 void CallbackLibraryList( MyWidget, ClientData, CallData )
419 
420      Widget                MyWidget;
421      caddr_t               ClientData;
422      XmListCallbackStruct *CallData;
423 {
424   autbegin();
425 
426   XFSM_DEFAULT_LIB = XFSM_CATA_LIB[ CallData->item_position - 1 ];
427 
428   if ( XFSM_DEFAULT_LIB == (char *)NULL )
429   {
430     XFSM_DEFAULT_LIB = XFSM_WORK_LIB;
431   }
432 
433   autend();
434 }
435 
436 /*------------------------------------------------------------\
437 |                                                             |
438 |                        CallbackLibraryOk                    |
439 |                                                             |
440 \------------------------------------------------------------*/
441 
CallbackLibraryOk(MyWidget,ClientData,CallData)442 void CallbackLibraryOk( MyWidget, ClientData, CallData )
443 
444      Widget  MyWidget;
445      caddr_t ClientData;
446      caddr_t CallData;
447 {
448   XmString Label;
449   int      Index;
450 
451   autbegin();
452 
453   XfsmExitPanel( &XfsmLibraryPanel );
454 
455   XfsmExitDialog();
456 
457   if ( XfsmFirstLibrary == 0 )
458   {
459     for ( Index = 0;
460           CATA_LIB[ Index ] != (char *)NULL;
461           Index++ )
462     {
463       autfreeblock( CATA_LIB[ Index ] );
464     }
465 
466     autfreeblock( CATA_LIB );
467     autfreeblock( WORK_LIB );
468   }
469 
470   XfsmFirstLibrary = 0;
471 
472   CATA_LIB = XFSM_CATA_LIB;
473   WORK_LIB = XFSM_WORK_LIB;
474 
475   if ( XFSM_DEFAULT_LIB != (char *)NULL )
476   {
477     Label = XmStringCreateSimple( XFSM_DEFAULT_LIB );
478 
479     XtVaSetValues( XfsmFileOpenDialog.WIDGET,
480                    XmNdirectory, Label, NULL );
481 
482     XmStringFree( Label );
483   }
484 
485   autend();
486 }
487 
488 /*------------------------------------------------------------\
489 |                                                             |
490 |                        CallbackLibraryUpdate                |
491 |                                                             |
492 \------------------------------------------------------------*/
493 
CallbackLibraryUpdate(MyWidget,ClientData,CallData)494 void CallbackLibraryUpdate( MyWidget, ClientData, CallData )
495 
496      Widget  MyWidget;
497      caddr_t ClientData;
498      caddr_t CallData;
499 {
500   autbegin();
501 
502   XfsmGetCataLibrary();
503   XfsmGetWorkLibrary();
504   XfsmSetLibraryList();
505 
506   autend();
507 }
508 
509 /*------------------------------------------------------------\
510 |                                                             |
511 |                       CallbackLibraryCancel                 |
512 |                                                             |
513 \------------------------------------------------------------*/
514 
CallbackLibraryCancel(MyWidget,ClientData,CallData)515 void CallbackLibraryCancel( MyWidget, ClientData, CallData )
516 
517      Widget  MyWidget;
518      caddr_t ClientData;
519      caddr_t CallData;
520 {
521   int Index;
522 
523   autbegin();
524 
525   for ( Index = 0;
526         XFSM_CATA_LIB[ Index ] != (char *)NULL;
527         Index++ )
528   {
529     autfreeblock( XFSM_CATA_LIB[ Index ] );
530   }
531 
532   autfreeblock( XFSM_CATA_LIB );
533   autfreeblock( XFSM_WORK_LIB );
534 
535   XfsmExitPanel( &XfsmLibraryPanel );
536 
537   XfsmExitDialog();
538 
539   autend();
540 }
541 
542 /*------------------------------------------------------------\
543 |                                                             |
544 |                       CallbackEnterLibrary                  |
545 |                                                             |
546 \------------------------------------------------------------*/
547 
CallbackEnterLibrary(MyWidget,ClientData,CallData)548 void CallbackEnterLibrary( MyWidget, ClientData, CallData )
549 
550      Widget  MyWidget;
551      caddr_t ClientData;
552      caddr_t CallData;
553 {
554   autbegin();
555 
556   XfsmInitializeLibrary();
557 
558   XfsmEnterPanel( &XfsmLibraryPanel );
559   XfsmLimitedLoop( XfsmLibraryPanel.PANEL );
560   XfsmReEnterDialog();
561 
562   autend();
563 }
564 
565 /*------------------------------------------------------------\
566 |                                                             |
567 |                       XfsmBuildPanelLibrary                 |
568 |                                                             |
569 \------------------------------------------------------------*/
570 
XfsmBuildPanelLibrary()571 void XfsmBuildPanelLibrary()
572 {
573   Arg      Args[15];
574   XmString Label;
575 
576   autbegin();
577 
578   XtSetArg( Args[0], XmNshadowType    , XmSHADOW_ETCHED_IN      );
579   XtSetArg( Args[1], XmNdeleteResponse, XmDO_NOTHING            );
580   XtSetArg( Args[2], XmNtitle         , XfsmLibraryPanel.TITLE );
581 
582   XfsmLibraryPanel.PANEL =
583 
584     XmCreateFormDialog( XfsmMainWindow, "XfsmLibraryPanel", Args, 3);
585 
586   XtAddCallback( XfsmLibraryPanel.PANEL, XmNdestroyCallback,
587                  XfsmDestroyDialogCallback, NULL  );
588 
589   XfsmLibraryPanel.PANEL_FORM =
590 
591     XtVaCreateManagedWidget( "XfsmLibraryPanelForm",
592                              xmFormWidgetClass,
593                              XfsmLibraryPanel.PANEL,
594                              XmNtopAttachment    , XmATTACH_FORM,
595                              XmNbottomAttachment , XmATTACH_FORM,
596                              XmNleftAttachment   , XmATTACH_FORM,
597                              XmNrightAttachment  , XmATTACH_FORM,
598                              XmNfractionBase     , 10,
599                              NULL
600                            );
601 
602   XfsmLibraryPanel.FRAME =
603 
604     XtVaCreateManagedWidget( "XfsmLibraryFrame",
605                              xmFrameWidgetClass,
606                              XfsmLibraryPanel.PANEL_FORM,
607                              XmNtopAttachment    , XmATTACH_FORM,
608                              XmNbottomAttachment , XmATTACH_FORM,
609                              XmNleftAttachment   , XmATTACH_FORM,
610                              XmNrightAttachment  , XmATTACH_FORM,
611                              NULL
612                            );
613 
614   XfsmLibraryPanel.FORM =
615 
616     XtVaCreateManagedWidget( "XfsmLibraryForm",
617                              xmFormWidgetClass,
618                              XfsmLibraryPanel.FRAME,
619                              XmNtopAttachment    , XmATTACH_FORM,
620                              XmNbottomAttachment , XmATTACH_FORM,
621                              XmNleftAttachment   , XmATTACH_FORM,
622                              XmNrightAttachment  , XmATTACH_FORM,
623                              XmNfractionBase     , 120,
624                              NULL
625                            );
626 
627   XfsmLibraryButtonUpdate =
628 
629     XtVaCreateManagedWidget( "Update",
630                              xmPushButtonWidgetClass,
631                              XfsmLibraryPanel.FORM,
632                              XmNleftAttachment   , XmATTACH_POSITION,
633                              XmNleftPosition     , 10,
634                              XmNrightAttachment  , XmATTACH_POSITION,
635                              XmNrightPosition    , 40,
636                              XmNtopAttachment    , XmATTACH_POSITION,
637                              XmNtopPosition      , 105,
638                              XmNbottomAttachment , XmATTACH_POSITION,
639                              XmNbottomPosition   , 115,
640                              NULL
641                            );
642 
643   XfsmLibraryButtonOk =
644 
645     XtVaCreateManagedWidget( "Ok",
646                              xmPushButtonWidgetClass,
647                              XfsmLibraryPanel.FORM,
648                              XmNleftAttachment   , XmATTACH_POSITION,
649                              XmNleftPosition     , 50,
650                              XmNrightAttachment  , XmATTACH_POSITION,
651                              XmNrightPosition    , 70,
652                              XmNtopAttachment    , XmATTACH_POSITION,
653                              XmNtopPosition      , 105,
654                              XmNbottomAttachment , XmATTACH_POSITION,
655                              XmNbottomPosition   , 115,
656                              NULL
657                            );
658 
659   XfsmLibraryButtonCancel =
660 
661     XtVaCreateManagedWidget( "Cancel",
662                              xmPushButtonWidgetClass,
663                              XfsmLibraryPanel.FORM,
664                              XmNleftAttachment   , XmATTACH_POSITION,
665                              XmNleftPosition     , 80,
666                              XmNrightAttachment  , XmATTACH_POSITION,
667                              XmNrightPosition    , 110,
668                              XmNtopAttachment    , XmATTACH_POSITION,
669                              XmNtopPosition      , 105,
670                              XmNbottomAttachment , XmATTACH_POSITION,
671                              XmNbottomPosition   , 115,
672                              NULL
673                            );
674 
675   Label = XmStringCreateSimple( "Directories" );
676 
677   XfsmLibraryListLabel =
678 
679      XtVaCreateManagedWidget( "XfsmLibraryListLabel",
680                               xmLabelGadgetClass      ,
681                               XfsmLibraryPanel.FORM,
682                               XmNlabelString          , Label,
683                               XmNleftAttachment       , XmATTACH_POSITION,
684                               XmNleftPosition         , 5,
685                               XmNtopAttachment        , XmATTACH_POSITION,
686                               XmNtopPosition          , 5,
687                               XmNbottomAttachment     , XmATTACH_POSITION,
688                               XmNbottomPosition       , 10,
689                               NULL );
690 
691   XmStringFree( Label );
692 
693   XtSetArg( Args[0]  , XmNtopAttachment         , XmATTACH_POSITION );
694   XtSetArg( Args[1]  , XmNtopPosition           , 10 );
695   XtSetArg( Args[2]  , XmNbottomAttachment      , XmATTACH_POSITION );
696   XtSetArg( Args[3]  , XmNbottomPosition        , 40 );
697   XtSetArg( Args[4]  , XmNrightAttachment       , XmATTACH_POSITION );
698   XtSetArg( Args[5]  , XmNrightPosition         , 115 );
699   XtSetArg( Args[6]  , XmNleftAttachment        , XmATTACH_POSITION );
700   XtSetArg( Args[7]  , XmNleftPosition          , 5 );
701   XtSetArg( Args[8]  , XmNscrollBarDisplayPolicy, XmSTATIC );
702   XtSetArg( Args[9]  , XmNscrollHorizontal      , True );
703   XtSetArg( Args[10] , XmNscrollVertical        , True );
704   XtSetArg( Args[11] , XmNlistSizePolicy        , XmCONSTANT );
705 
706   XfsmLibraryList =
707 
708     XmCreateScrolledList( XfsmLibraryPanel.FORM,
709                           "XfsmLibraryList", Args, 12 );
710 
711   Label = XmStringCreateSimple( "Catalog libraries" );
712 
713   XfsmLibraryCataLabel =
714 
715      XtVaCreateManagedWidget( "XfsmLibraryCataLabel",
716                               xmLabelGadgetClass      ,
717                               XfsmLibraryPanel.FORM,
718                               XmNlabelString          , Label,
719                               XmNleftAttachment       , XmATTACH_POSITION,
720                               XmNleftPosition         , 5,
721                               XmNtopAttachment        , XmATTACH_POSITION,
722                               XmNtopPosition          , 45,
723                               XmNbottomAttachment     , XmATTACH_POSITION,
724                               XmNbottomPosition       , 50,
725                               NULL );
726 
727   XmStringFree( Label );
728 
729   XtSetArg( Args[0]  , XmNrows                  , 4 );
730   XtSetArg( Args[1]  , XmNeditable              , True );
731   XtSetArg( Args[2]  , XmNcursorPositionVisible , True );
732   XtSetArg( Args[3]  , XmNscrollHorizontal      , True );
733   XtSetArg( Args[4]  , XmNscrollVertical        , True );
734   XtSetArg( Args[5]  , XmNeditMode              , XmMULTI_LINE_EDIT );
735   XtSetArg( Args[6]  , XmNtopAttachment         , XmATTACH_POSITION );
736   XtSetArg( Args[7]  , XmNtopPosition           , 50 );
737   XtSetArg( Args[8]  , XmNleftAttachment        , XmATTACH_POSITION );
738   XtSetArg( Args[9]  , XmNleftPosition          , 5 );
739   XtSetArg( Args[10] , XmNrightAttachment       , XmATTACH_POSITION );
740   XtSetArg( Args[11] , XmNrightPosition         , 115 );
741   XtSetArg( Args[12] , XmNbottomAttachment      , XmATTACH_POSITION );
742   XtSetArg( Args[13] , XmNbottomPosition        , 80 );
743 
744   XfsmLibraryCata  =
745 
746     XmCreateScrolledText( XfsmLibraryPanel.FORM,
747                           "XfsmLibraryCata", Args, 14 );
748 
749   Label = XmStringCreateSimple( "Work library" );
750 
751   XfsmLibraryWorkLabel =
752 
753      XtVaCreateManagedWidget( "XfsmLibraryWorkLabel",
754                               xmLabelGadgetClass      ,
755                               XfsmLibraryPanel.FORM,
756                               XmNlabelString          , Label,
757                               XmNleftAttachment       , XmATTACH_POSITION,
758                               XmNleftPosition         , 5,
759                               XmNtopAttachment        , XmATTACH_POSITION,
760                               XmNtopPosition          , 85,
761                               XmNbottomAttachment     , XmATTACH_POSITION,
762                               XmNbottomPosition       , 90,
763                               NULL );
764   XmStringFree( Label );
765 
766   XtSetArg( Args[0]  , XmNrows                  , 1 );
767   XtSetArg( Args[1]  , XmNeditable              , True );
768   XtSetArg( Args[2]  , XmNeditMode              , XmSINGLE_LINE_EDIT );
769   XtSetArg( Args[3]  , XmNscrollHorizontal      , False );
770   XtSetArg( Args[4]  , XmNscrollVertical        , False );
771   XtSetArg( Args[5]  , XmNcursorPositionVisible , True  );
772   XtSetArg( Args[6]  , XmNtopAttachment         , XmATTACH_POSITION );
773   XtSetArg( Args[7]  , XmNtopPosition           , 90 );
774   XtSetArg( Args[8]  , XmNleftAttachment        , XmATTACH_POSITION );
775   XtSetArg( Args[9]  , XmNleftPosition          , 5 );
776   XtSetArg( Args[10] , XmNrightAttachment       , XmATTACH_POSITION );
777   XtSetArg( Args[11] , XmNrightPosition         , 115 );
778   XtSetArg( Args[12] , XmNbottomAttachment      , XmATTACH_POSITION );
779   XtSetArg( Args[13] , XmNbottomPosition        , 100 );
780 
781   XfsmLibraryWork  =
782 
783     XmCreateText( XfsmLibraryPanel.FORM,
784                   "XfsmLibraryWork", Args, 14 );
785 
786   XtManageChild( XfsmLibraryWork );
787   XtManageChild( XfsmLibraryList );
788   XtManageChild( XfsmLibraryCata );
789 
790   XtAddCallback( XfsmLibraryList,
791                  XmNdefaultActionCallback,
792                  CallbackLibraryList, NULL );
793 
794   XtAddCallback( XfsmLibraryButtonOk,
795                  XmNactivateCallback,
796                  CallbackLibraryOk, NULL );
797 
798   XtAddCallback( XfsmLibraryButtonCancel,
799                  XmNactivateCallback,
800                  CallbackLibraryCancel, NULL );
801 
802   XtAddCallback( XfsmLibraryButtonUpdate,
803                  XmNactivateCallback,
804                  CallbackLibraryUpdate, NULL );
805 
806   XtVaSetValues( XfsmLibraryPanel.PANEL,
807                  XmNheight, XfsmLibraryPanel.HEIGHT,
808                  XmNwidth , XfsmLibraryPanel.WIDTH,
809                  XmNx     , XfsmLibraryPanel.X,
810                  XmNy     , XfsmLibraryPanel.Y,
811                  NULL );
812 
813   Label = XmStringCreateSimple( "Library" );
814 
815   XtVaSetValues( XmFileSelectionBoxGetChild( XfsmFileOpenDialog.WIDGET,
816                  XmDIALOG_HELP_BUTTON ),
817                  XmNlabelString, Label, NULL  );
818 
819   XmStringFree( Label );
820 
821   XtAddCallback( XmFileSelectionBoxGetChild( XfsmFileOpenDialog.WIDGET,
822                  XmDIALOG_HELP_BUTTON ),
823                  XmNactivateCallback,
824                  CallbackEnterLibrary, NULL );
825 
826   autend();
827 }
828