1 /****************************************************************************/
3 /* Chaine de CAO & VLSI Alliance */
5 /* Produit : XTAS Version 5 */
6 /* Fichier : xtas_init.c */
8 /* (c) copyright 1991-1998 Laboratoire LIP6 equipe ASIM */
9 /* Tous droits reserves */
10 /* Support : e-mail alliance-support@asim.lip6.fr */
12 /* Author(s) : Lionel PROTZENKO Date : 01/08/1997 */
14 /* Modified by : Date : ../../.... */
15 /* Modified by : Date : ../../.... */
16 /* Modified by : Date : ../../.... */
18 /*--------------------------------------------------------------------------*/
21 /*--------------------------------------------------------------------------*/
23 /*--------------------------------------------------------------------------*/
25 /*--------------------------------------------------------------------------*/
28 /*--------------------------------------------------------------------------*/
31 /*--------------------------------------------------------------------------*/
32 XtAppContext XtasApplicationContext
;
33 char XTAS_SWITCH_COLOR_MAP
= 'N';
35 char *WORK_LIB_SAVE
= NULL
;
36 char *spi_sfx
= "spi";
37 char *vhd_sfx
= "vhd";
38 char *vlg_sfx
= "vlg";
41 Widget XtasMainWindow
;
42 Widget XtasDeskMainForm
;
43 Widget XtasFrontWidget
;
45 XalMessageWidgetStruct
*XtasErrorWidget
;
46 XalMessageWidgetStruct
*XtasWarningWidget
;
47 XalMessageWidgetStruct
*XtasTraceWidget
;
48 XalMessageWidgetStruct
*XtasNotYetWidget
;
50 XtasMainInfoStruct
*XtasMainParam
;
52 static String XtasFallBacks
[] = {
54 "*pathMode : XmPATH_MODE_RELATIVE",
55 "xtas.*.menuBar*background : gray64",
56 "xtas.*.main*XtasInfosBox.background : Grey",
57 "xtas.*.main*XtasLogoForm*background : gray64",
58 "xtas.*.main*XtasMainTitles*background : gray64",
59 "xtas.*.main*XtasMainTitles*foreground : Maroon",
60 "xtas.*.XalExit.foreground : Red",
61 "xtas.*.XalErrorBox.foreground : Red",
62 "xtas.*.XalWarningBox.foreground : DarkOliveGreen",
63 "xtas.*.XalOnVersion.foreground : Blue",
64 "xtas.*.XtasMainState.foreground : DarkOliveGreen",
65 "xtas.*.XtasStateForm.borderColor : DarkOliveGreen",
66 "xtas.*.XtasUserField.foreground : royal blue",
67 "xtas.*.XtasUserField.background : PeachPuff",
68 "xtas.*.XtasDrawingArea.background : Black",
69 "xtas.*.XtasHelpField.foreground : royal blue",
70 "xtas.*.XtasHelpField.background : PeachPuff",
71 "xtas.*XtasTextualDisplay*background : PeachPuff",
72 "xtas.*XtasTextualDisplay*foreground : royal blue",
73 "xtas.*XtasTextualDisplay*listSizePolicy : XmCONSTANT",
74 "xtas.*.XtasRequesterBox.Text.background : PeachPuff",
75 "xtas.*.XtasRequesterBox.FilterText.background : PeachPuff",
79 "xtas.minWidth : 540",
80 "xtas.maxWidth : 660",
81 "xtas.minHeight: 180",
82 "xtas.maxHeight: 335",
84 "xtas.title : "XTAS_NAME
" Main Desk Window",
85 "xtas.iconName : "XTAS_NAME
,
86 "xtas.*.main.*.fontList: -*-helvetica-bold-r-normal--14-*",
87 "xtas.*fontList: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-*",
88 "xtas.*.XtasTextualDisplay.*.fontList: -*-fixed-medium-r-normal-*-13-*-*-*-*-*-iso8859-*",
89 "xtas.*.main.*.XtasShellSubForm.*.fontList: -*-helvetica-bold-r-normal--12-*",
90 "xtas.*.XalMessageScrolled.*.fontList: -*-fixed-medium-r-normal-*-14-*-*-*-*-*-iso8859-*",
93 #ifdef AVERTEC_LICENSE
94 /*---------------------------------------------------------------------------*/
96 /* FUNCTION : XtasAvtlicence */
100 /* OUT ARGS : ( void ) */
102 /* OBJECT : Call to avt licence server */
104 /*---------------------------------------------------------------------------*/
105 void XtasAvtlicence()
107 if(avt_givetoken("HITAS_LICENSE_SERVER","xtas") != AVT_VALID_TOKEN
)
109 XtAppAddTimeOut( XtasApplicationContext
,60000,XtasAvtlicence
,NULL
);
113 /*---------------------------------------------------------------------------*/
115 /* FUNCTION : XtasPresent */
119 /* OUT ARGS : ( void ) */
121 /* OBJECT : Call to alliancebanner */
123 /*---------------------------------------------------------------------------*/
127 #ifdef AVERTEC_LICENSE
128 if(avt_givetoken("HITAS_LICENSE_SERVER","xtas") != AVT_VALID_TOKEN
)
132 avt_banner(XTAS_NAME
,XTAS_ABOUT
,"1998");
136 /*---------------------------------------------------------------------------*/
138 /* FUNCTION : XtasInitMainParam */
140 /* IN ARGS : .widget : The widget on which the event occurs. */
141 /* .client_data : Not significant. */
142 /* .call_data : Not significant. */
144 /* OUT ARGS : ( void ) */
146 /* OBJECT : The callback function for the Front Page push button. */
147 /* In this fuction, we build the main window widgets. */
149 /*---------------------------------------------------------------------------*/
150 XtasMainInfoStruct
*XtasInitMainParam()
152 XtasMainInfoStruct
*param
;
154 param
= (XtasMainInfoStruct
*)mbkalloc(sizeof(XtasMainInfoStruct
)) ;
155 param
->ttvfig
= NULL
;
156 param
->stbfig
= NULL
;
157 param
->befig
= NULL
;
161 /*---------------------------------------------------------------------------*/
163 /* FUNCTION : XtasFrontCallback */
165 /* IN ARGS : .widget : The widget on which the event occurs. */
166 /* .client_data : Not significant. */
167 /* .call_data : Not significant. */
169 /* OUT ARGS : ( void ) */
171 /* OBJECT : The callback function for the Front Page push button. */
172 /* In this fuction, we build the main window widgets. */
174 /*---------------------------------------------------------------------------*/
175 void XtasInitializeWindows()
177 Widget XtasDeskMenuWidget
, version_form
;
181 XtasInitializeSignalsWindow();
183 XtasDeskMainForm
= XtasCreateDesk( XtasDeskMainForm
);
184 version_form
= XtNameToWidget (XtasDeskMainForm
, "*XtasVersionForm");
185 HelpFather
= XtasDeskMainForm
;
186 XtasDeskMenuWidget
= XtasCreateMainMenus( XtasMainWindow
);
187 XtManageChild( XtasDeskMenuWidget
);
189 /*---------------------------------*/
190 /* Use the Motif default areas set */
191 /*---------------------------------*/
192 XmMainWindowSetAreas( XtasMainWindow
,
199 /*------------------------------------------------------------------*/
200 /* Creates a Motif Error and Warning Boxs and AllianceFrontPage */
201 /*------------------------------------------------------------------*/
202 XtasErrorWidget
= XalCreateErrorBox( XtasDeskMainForm
);
203 XtasWarningWidget
= XalCreateWarningBox( XtasDeskMainForm
);
204 XtasNotYetWidget
= XalCreateWarningBox( XtasDeskMainForm
);
205 XtasTraceWidget
= XalCreateTraceBox( XtasDeskMainForm
);
206 XalFrontPage( version_form
,
214 XtSetArg( args
[n
], XmNallowShellResize
, False
); n
++;
215 XtSetValues( XtasTopLevel
, args
, n
);
217 XalForceUpdate( XtasTopLevel
);
220 /*---------------------------------------------------------------------------*/
222 /* FUNCTION : XtasEnv */
225 /*---------------------------------------------------------------------------*/
233 mbkenv() ; /* sinon => traitement normal */
234 /* forcage de SCALE_X: la variable d'environnement ne sert plus */
235 if(V_INT_TAB
[__MBK_SCALE_X
].VALUE
== NULL
)
245 yagenv(tas_yaginit
) ;
267 if ((c
=V_STR_TAB
[__MBK_SPI_SUFFIX
].VALUE
)!=NULL
) spi_sfx
=c
;
268 if ((c
=V_STR_TAB
[__MVL_FILE_SUFFIX
].VALUE
)!=NULL
) vhd_sfx
=c
;
269 if ((c
=V_STR_TAB
[__MGL_FILE_SUFFIX
].VALUE
)!=NULL
) vlg_sfx
=c
;
271 XTAS_DISPLAY_NEW
= V_BOOL_TAB
[__XTAS_TEXT_DISPLAY
].VALUE
;
275 /*---------------------------------------------------------------------------*/
277 /* FUNCTION : XtasAppInit */
281 /* OUT ARGS : ( void ) */
283 /* OBJECT : Initialization of graphics variables. */
285 /*---------------------------------------------------------------------------*/
286 void XtasAppInit( void )
289 char avertec_version
[128];
291 /*------------------------------------*/
292 /* Set MBK environnement variables */
293 /*------------------------------------*/
296 XalBitmaps
= Xtas_bitmaps
;
300 sprintf (avertec_version
,"%g%s", AVT_VERSION
, PATCH_NUM
) ;
302 /*--------------------------------------------------*/
303 /* Prepare the message for the Help On Version box */
304 /*--------------------------------------------------*/
305 XtasOnVersion
= (char *)mbkalloc( strlen(XTAS_ABOUT
) + strlen( avertec_version
) + 2 );
306 strcpy( XtasOnVersion
, XTAS_ABOUT
);
307 strcat( XtasOnVersion
, "\n" );
308 strcat( XtasOnVersion
, avertec_version
);
311 /*---------------------------------------------------------------------------*/
313 /* FUNCTION : XtasInitializeRessources */
315 /* IN ARGS : .You can give some X resources in your argv. They will be */
316 /* passed to the X server in the XtVaAppInitialize call. */
318 /* OUT ARGS : ( void ) */
320 /* OBJECT : initialise the main widget */
322 /*---------------------------------------------------------------------------*/
323 void XtasInitializeRessources( argc
, argv
)
329 Colormap XtasColorMap
;
337 XtasTopLevel
= XtVaAppInitialize( &XtasApplicationContext
,
348 XtSetArg( args[n], XmNx , 100 ); n++;
349 XtSetArg( args[n], XmNy , 100 ); n++;
350 XtSetArg( args[n], XmNwidth , 660 ); n++;
351 XtSetArg( args[n], XmNheight , 320 ); n++;
354 ADisplay
= XtDisplay(XtasTopLevel
);
355 AScreen
= XtScreen(XtasTopLevel
);
356 XtasColorMap
= DefaultColormapOfScreen(AScreen
);
358 if (XTAS_SWITCH_COLOR_MAP
== 'Y') {
359 XtasColorMap
= XCopyColormapAndFree(ADisplay
, XtasColorMap
);
360 XInstallColormap(ADisplay
, XtasColorMap
);
361 XtSetArg( args
[n
], XmNcolormap
, XtasColorMap
); n
++;
364 XtSetValues( XtasTopLevel
, args
, n
);
366 XalSetIcon( XtasTopLevel
);
368 XtasMainWindow
= XtVaCreateManagedWidget( "XtasMainWindow",
369 xmMainWindowWidgetClass
,
374 XtasDeskMainForm
= XtVaCreateManagedWidget( "XtasDeskMainForm",
381 XtasMainParam
= XtasInitMainParam() ;
383 XtasInitializeWindows();
385 XtasSetXyagleQuitFOnction() ;
386 XyagCreateMainWindow(XtasTopLevel
,XtasApplicationContext
,&XtasColorMap
) ;
388 XtRealizeWidget( XtasTopLevel
);
390 #ifdef AVERTEC_LICENSE