1 /****************************************************************************/
3 /* ALLIANCE CAD FRAMEWORK */
5 /* Tool : libXal Version 1.01 */
6 /* File : FrontPage.c */
8 /* (c) copyright 1993 MASI Laboratory. CAO & VLSI CAD Team */
9 /* All rights reserved. */
10 /* Support : e-mail cao-vlsi@masi.ibp.fr */
12 /* Author(s) : Nizar ABDALLAH Date : 02/02/1993 */
14 /* Modified by : Date : ../../.... */
15 /* Modified by : Date : ../../.... */
16 /* Modified by : Date : ../../.... */
18 /****************************************************************************/
20 /* This is a complicated function of the libXal library. In order to */
21 /* present a homogeneous aspect of all ALLIANCE cad framework tools, we can */
22 /* start by having the same front page. To use this function, each tool must*/
23 /* include <Xal101.h> file. */
25 /* Concerning the programming precautions, you must take care of reserving */
26 /* a main window of 850x450 and a minimum of 650x350 so that the front page */
27 /* may be entirely visible. */
29 /* The other advice is to add in your resource's list the following line : */
31 /* "*.XalToolName.foreground: Red" */
33 /* We choose to avoid hard-coding colors in our routines; We provide enough */
34 /* flexibility for the user to configure colors through resource databases */
35 /* or interactively in the application. */
37 /* We first wrote this function for all ALLIANCE Motif Tools. This explains */
38 /* why we have default values for most arguments. But you can pass whatever */
39 /* you like in order to use this function for other frameworks. */
41 /* The last obligation is to pass an xmFormWidgetClass widget as the parent */
42 /* so that all attachments could be correctly done. */
44 /* Note : The ToolName will appear as a PushButton. When pressed, the X */
45 /* server will call your callback function passed as argument. */
47 /****************************************************************************/
50 /*--------------------------------------------------------------------------*/
52 /*--------------------------------------------------------------------------*/
62 #include <Xm/LabelG.h>
67 /*-----------------------------*/
68 /* Motif for Alliance includes */
69 /*-----------------------------*/
76 /*---------------------------------------------------------------------------*/
78 /* FUNCTION : XalFrontPage */
80 /* IN ARGS : .parent : Parent widget, MUST BE A FORM CLASS. */
81 /* .cad_title : 1st title; if NULL then "ALLIANCE CAD FRAMEWORK".*/
82 /* .tool_name : Tool Name; if NULL then "xxxxxx". */
83 /* .tool_title : Description; if NULL then BLANK. */
84 /* .version : Version; if NULL then "Version x.x". */
85 /* .right : Copyrights; if NULL then "(c) MASI...". */
86 /* .callback_func : Function to be executed when the tool */
87 /* name PushButton is pressed. */
89 /* OUT ARGS : The widget id of the frame that contains all the front page. */
91 /* OBJECT : Creates a front page within a frame widget. */
93 /*---------------------------------------------------------------------------*/
94 void XalFrontPage( parent
, cad_title
, cad_version
, cad_patch
, tool_name
, tool_title
)
96 char *cad_title
, *cad_version
, *cad_patch
, *tool_name
, *tool_title
;
99 Widget form_t
, frame_widget
, label_widget
;
100 XmString text
, text_bis
, text_ter
;
107 char day
[4], month
[4];
108 int year
, nday
, hour
, minute
, second
;
110 char cad_versionpatch
[1024];
112 char *def_cad_title
= "AVERTEC Release ";
113 char *def_cad_version
= "x.x";
114 char *def_cad_patch
= "px";
115 char *def_tool_name
= "xxxxxxxx";
116 char *def_tool_title
= " ";
117 char *rights_1
= "\251 ";
118 char *rights_2
= "\nE-mail support: support@avertec.com";
121 sscanf(ctime(&timer
), "%s %s %d %d:%d:%d %d", day
, month
, &nday
, &hour
, &minute
, &second
, &year
);
123 dpy
= XtDisplay( parent
);
124 font
= XLoadQueryFont( dpy
, "-*-helvetica-bold-o-*--24-*" );
125 fontlist
= XmFontListCreate( font
, "front_charset1" );
126 font
= XLoadQueryFont( dpy
, "-*-helvetica-bold-r-*--18-*" );
127 fontlist
= XmFontListAdd( fontlist
, font
, "front_charset2" );
128 font
= XLoadQueryFont( dpy
, "-*-helvetica-bold-r-*--12-*" );
129 fontlist
= XmFontListAdd( fontlist
, font
, "front_charset4" );
132 if ( cad_title
== NULL
) cad_title
= def_cad_title
;
133 if ( cad_version
== NULL
) cad_version
= def_cad_version
;
134 if ( cad_patch
== NULL
) cad_patch
= def_cad_patch
;
135 if ( tool_name
== NULL
) tool_name
= def_tool_name
;
136 if ( tool_title
== NULL
) tool_title
= def_tool_title
;
139 /*----------------------------------------*/
140 /* Create frame widget to add a 3D effect */
141 /*----------------------------------------*/
143 XtSetArg( args
[n
], XmNtopAttachment
, XmATTACH_POSITION
); n
++;
144 XtSetArg( args
[n
], XmNtopPosition
, 8 ); n
++;
145 XtSetArg( args
[n
], XmNbottomAttachment
, XmATTACH_POSITION
); n
++;
146 XtSetArg( args
[n
], XmNbottomPosition
, 92 ); n
++;
147 XtSetArg( args
[n
], XmNleftAttachment
, XmATTACH_POSITION
); n
++;
148 XtSetArg( args
[n
], XmNleftPosition
, 4 ); n
++;
149 XtSetArg( args
[n
], XmNrightAttachment
, XmATTACH_POSITION
); n
++;
150 XtSetArg( args
[n
], XmNrightPosition
, 96 ); n
++;
151 frame_widget
= XmCreateFrame( parent
, "XalFrontFrame", args
, n
);
152 XtManageChild( frame_widget
);
154 /*----------------------------------------------*/
155 /* Create a Form widget to manage child widgets */
156 /*----------------------------------------------*/
158 form_t
= XtCreateManagedWidget( "XalFrontForm", xmFormWidgetClass
, frame_widget
, args
, n
);
160 /*--------------------------------------*/
161 /* Create an icon to make things pretty */
162 /*--------------------------------------*/
164 label_widget
= XmCreateLabel( form_t
, "ColorXtasLogo", args
, n
);
165 PixmapLabel
= XalCreatePixmapLabel( label_widget
, LogoAsim
, NULL
);
166 XtManageChild( PixmapLabel
);
171 sprintf (cad_versionpatch
, "%s%s", cad_version
, cad_patch
);
173 text_bis
= XmStringCreateLtoR( cad_title
, "front_charset2" );
174 text_ter
= XmStringCreateLtoR( cad_versionpatch
, "front_charset2" );
175 text
= XmStringConcat( text_bis
, text_ter
);
176 label_widget
= XtVaCreateManagedWidget( "XalCadTitle", xmLabelWidgetClass
, form_t
,
177 XmNfontList
, fontlist
,
178 XmNlabelString
, text
,
179 XmNtopAttachment
, XmATTACH_POSITION
,
181 XmNrightAttachment
, XmATTACH_POSITION
,
182 XmNrightPosition
, 100,
183 XmNleftAttachment
, XmATTACH_POSITION
,
186 XmStringFree( text_bis
); XmStringFree( text_ter
); XmStringFree( text
);
188 ecart
= strlen( tool_name
) * 3 / 2;
189 text
= XmStringCreateLtoR( tool_name
, "front_charset1" );
190 label_widget
= XtVaCreateManagedWidget( "XalToolName", xmLabelWidgetClass
, form_t
,
191 XmNfontList
, fontlist
,
192 XmNlabelString
, text
,
193 XmNtopAttachment
, XmATTACH_WIDGET
,
194 XmNtopWidget
, label_widget
,
196 XmNrightAttachment
, XmATTACH_POSITION
,
197 XmNrightPosition
, 55+ecart
,
198 XmNleftAttachment
, XmATTACH_POSITION
,
199 XmNleftPosition
, 45-ecart
,
202 XmStringFree( text
);
204 text
= XmStringCreateLtoR( tool_title
, "front_charset2" );
205 label_widget
= XtVaCreateManagedWidget( "XalToolTitle", xmLabelWidgetClass
, form_t
,
206 XmNfontList
, fontlist
,
207 XmNlabelString
, text
,
208 XmNtopAttachment
, XmATTACH_WIDGET
,
209 XmNtopWidget
, label_widget
,
211 XmNrightAttachment
, XmATTACH_POSITION
,
212 XmNrightPosition
, 100,
213 XmNleftAttachment
, XmATTACH_POSITION
,
216 XmStringFree( text
);
218 text
= XmStringCreateLtoR( rights_1
, "front_charset4" );
219 sprintf(copyright
,"1998-%d",year
);
220 text_bis
= XmStringCreateLtoR( copyright
, "front_charset4" );
221 text_ter
= XmStringConcat( text
, text_bis
);
222 XmStringFree( text
); XmStringFree( text_bis
);
224 text_bis
= XmStringCreateLtoR( rights_2
, "front_charset4" );
225 text
= XmStringConcat( text_ter
, text_bis
);
226 label_widget
= XtVaCreateManagedWidget( "XalToolRights", xmLabelWidgetClass
, form_t
,
227 XmNfontList
, fontlist
,
228 XmNlabelString
, text
,
229 XmNtopAttachment
, XmATTACH_WIDGET
,
230 XmNtopWidget
, label_widget
,
232 XmNrightAttachment
, XmATTACH_FORM
,
233 XmNleftAttachment
, XmATTACH_FORM
,
234 // XmNbottomAttachment, XmATTACH_POSITION,
235 // XmNbottomPosition, 90,
237 XmStringFree( text_bis
); XmStringFree( text_ter
); XmStringFree( text
);