1 /****************************************************************************/
3 /* Chaine de CAO & VLSI Alliance */
5 /* Produit : XTAS Version 5 */
6 /* Fichier : xtas_common.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) : Nizar ABDALLAH Date : 01/04/1993 */
14 /* Modified by : Stephane PICAULT Date : 30/07/1998 */
15 /* Modified by : Date : ../../.... */
16 /* Modified by : Date : ../../.... */
18 /****************************************************************************/
21 /****************************************************************************/
24 /*--------------------------------------------------------------------------*/
26 /*--------------------------------------------------------------------------*/
30 /*--------------------------------------------------------------------------*/
32 /*--------------------------------------------------------------------------*/
34 static Widget
*Xtas_pt_buttons
;
35 static struct XalButtonsItem
*Xtas_final_menus
;
37 XalBitmapsStruct Xtas_bitmaps
[] = {
38 {"xtas_al2spice",xtas_al2spice_bits
,xtas_al2spice_width
,xtas_al2spice_height
},
39 {"xtas_all_paths",xtas_all_paths_bits
,xtas_all_paths_width
,xtas_all_paths_height
},
40 {"xtas_all_sig",xtas_all_sig_bits
,xtas_all_sig_width
,xtas_all_sig_height
},
41 {"xtas_break",xtas_break_bits
,xtas_break_width
,xtas_break_height
},
42 {"xtas_capa",xtas_capa_bits
,xtas_capa_width
,xtas_capa_height
},
43 {"xtas_close",xtas_close_bits
,xtas_close_width
,xtas_close_height
},
44 {"xtas_command",xtas_command_bits
,xtas_command_width
,xtas_command_height
},
45 {"xtas_connectors",xtas_connectors_bits
,xtas_connectors_width
,xtas_connectors_height
},
46 {"xtas_deb",xtas_deb_bits
,xtas_deb_width
,xtas_deb_height
},
47 {"xtas_detail",xtas_detail_bits
,xtas_detail_width
,xtas_detail_height
},
48 {"xtas_dummy",xtas_dummy_bits
,xtas_dummy_width
,xtas_dummy_height
},
49 {"xtas_fpath",xtas_false_path_bits
,xtas_false_path_width
,xtas_false_path_height
},
50 {"xtas_f_edge",xtas_f_edge_bits
,xtas_f_edge_width
,xtas_f_edge_height
},
51 {"xtas_gate",xtas_gate_bits
,xtas_gate_width
,xtas_gate_height
},
52 {"xtas_h_resistance",xtas_h_resistance_bits
,xtas_h_resistance_width
,xtas_h_resistance_height
},
53 {"xtas_l_resistance",xtas_l_resistance_bits
,xtas_l_resistance_width
,xtas_l_resistance_height
},
54 {"xtas_info",xtas_info_bits
,xtas_info_width
,xtas_info_height
},
55 {"xtas_main_win",xtas_main_win_bits
,xtas_main_win_width
,xtas_main_win_height
},
56 {"xtas_memo",xtas_memo_bits
,xtas_memo_width
,xtas_memo_height
},
57 {"xtas_open",xtas_open_bits
,xtas_open_width
,xtas_open_height
},
58 {"xtas_paths",xtas_paths_bits
,xtas_paths_width
,xtas_paths_height
},
59 {"xtas_prech",xtas_prech_bits
,xtas_prech_width
,xtas_prech_height
},
60 {"xtas_rc",xtas_rc_bits
,xtas_rc_width
,xtas_rc_height
},
61 {"xtas_r_edge",xtas_r_edge_bits
,xtas_r_edge_width
,xtas_r_edge_height
},
62 {"xtas_save",xtas_save_bits
,xtas_save_width
,xtas_save_height
},
63 {"xtas_time",xtas_time_bits
,xtas_time_width
,xtas_time_height
},
64 {"xtas_time",xtas_time_bits
,xtas_time_width
,xtas_time_height
},
65 {"xtas_stb",xtas_stb_bits
,xtas_stb_width
,xtas_stb_height
} ,
66 {"xtas_false",xtas_falsemap_bits
,xtas_falsemap_width
,xtas_falsemap_height
},
67 {"xtas_true",xtas_truemap_bits
,xtas_truemap_width
,xtas_truemap_height
} ,
68 {"xtas_tas",xtas_tas_bits
,xtas_tas_width
,xtas_tas_height
} ,
69 {"xtas_tma",xtas_tma_bits
,xtas_tma_width
,xtas_tma_height
} ,
70 {"xtas_xya",xtas_xya_bits
,xtas_xya_width
,xtas_xya_height
} ,
71 {"xtas_vis",xtas_visual_bits
,xtas_visual_width
,xtas_visual_height
} ,
72 {"xtas_cmd",xtas_cmd_bits
,xtas_cmd_width
,xtas_cmd_height
} ,
73 {"xtas_simu",xtas_simu_bits
,xtas_simu_width
,xtas_simu_height
} ,
74 {"xtas_ctki",xtas_ctk_info_bits
,xtas_ctk_info_width
,xtas_ctk_info_height
} ,
75 {"xtas_noise",xtas_noise_bits
,xtas_noise_width
,xtas_noise_height
} ,
76 {"xtas_scores",xtas_scores_bits
,xtas_scores_width
,xtas_scores_height
}} ;
78 /*---------------------------------------------------------------------------*/
80 /*---------------------------------------------------------------------------*/
82 /*---------------------------------------------------------------------------*/
88 sprintf(buf
,"%ld",l
) ;
92 int XtasSizeFloatUnit(l
)
97 sprintf(buf
,"%.1f",l
/TTV_UNIT
) ;
101 /*---------------------------------------------------------------------------*/
102 void XtasPrintType(number
,type
,buf
,maxsize
)
113 len
= XtasSizeLong(number
) ;
114 len
= maxsize
- len
- strlen(type
) - 3 ;
122 sprintf(pt
,"%ld : %s",number
,type
) ;
125 /*---------------------------------------------------------------------------*/
127 void XtasCalcSize(ttvfig
,sizetype
,sizedelay
,sizeotherdelay
,sizecumul
,sizeothercumul
,sizeslope
,sizeotherslope
,sizename1
,sizename2
,type
,chain
,delay
,otherdelay
,infos
,w
)
128 ttvfig_list
*ttvfig
;
131 int *sizeotherdelay
;
133 int *sizeothercumul
;
135 int *sizeotherslope
;
146 ttvcritic_list
*critic
;
162 if((type
== 'd') || (type
== 'm') || (type
== 'p')) {
163 if (infos
== XTAS_SIMU
) {
168 *sizeotherdelay
= 8 ;
169 *sizeotherslope
= 11 ;
170 *sizeothercumul
= 11 ;
173 else if (infos
== XTAS_CTK
) {
178 *sizeotherdelay
= 6 ;
179 *sizeotherslope
= 9 ;
180 *sizeothercumul
= 9 ;
188 *sizeotherdelay
= 0 ;
189 *sizeotherslope
= 0 ;
190 *sizeothercumul
= 0 ;
201 *sizeotherdelay
= 0 ;
203 *sizeotherslope
= 0 ;
205 *sizeothercumul
= 0 ;
215 if((type
== 'd') || (type
== 'm') || (type
== 'p') || (type
== 'l'))
222 critic
= (ttvcritic_list
*)chain
->DATA
;
223 for(; critic
!= NULL
; critic
= critic
->NEXT
)
225 if (infos
== XTAS_SIMU
) {
226 *delay
+= critic
->REFDELAY
;
227 auxdelay
= XtasSizeLong(critic
->REFDELAY
) ;
228 if(auxdelay
> *sizedelay
)
229 *sizedelay
= auxdelay
;
230 auxslope
= XtasSizeLong(critic
->REFSLOPE
) ;
231 if(auxslope
> *sizeslope
)
232 *sizeslope
= auxslope
;
233 *otherdelay
+= critic
->SIMDELAY
;
234 auxotherdelay
= XtasSizeLong(critic
->SIMDELAY
) ;
235 if(auxotherdelay
> *sizeotherdelay
)
236 *sizeotherdelay
= auxotherdelay
;
237 auxotherslope
= XtasSizeLong(critic
->SIMSLOPE
) ;
238 if(auxotherslope
> *sizeotherslope
)
239 *sizeotherslope
= auxotherslope
;
241 else if (infos
== XTAS_CTK
){
242 *delay
+= critic
->REFDELAY
;
243 auxdelay
= XtasSizeLong(critic
->REFDELAY
) ;
244 if(auxdelay
> *sizedelay
)
245 *sizedelay
= auxdelay
;
246 auxslope
= XtasSizeLong(critic
->REFSLOPE
) ;
247 if(auxslope
> *sizeslope
)
248 *sizeslope
= auxslope
;
249 *otherdelay
+= critic
->DELAY
;
250 auxotherdelay
= XtasSizeLong(critic
->DELAY
) ;
251 if(auxotherdelay
> *sizeotherdelay
)
252 *sizeotherdelay
= auxotherdelay
;
253 auxotherslope
= XtasSizeLong(critic
->SLOPE
) ;
254 if(auxotherslope
> *sizeotherslope
)
255 *sizeotherslope
= auxotherslope
;
258 *delay
+= critic
->DELAY
;
259 auxdelay
= XtasSizeLong(critic
->DELAY
) ;
260 if(auxdelay
> *sizedelay
)
261 *sizedelay
= auxdelay
;
262 auxslope
= XtasSizeLong(critic
->SLOPE
) ;
263 if(auxslope
> *sizeslope
)
264 *sizeslope
= auxslope
;
266 if(critic
->NEXT
!= NULL
)
268 auxname1
= strlen(critic
->NAME
) ;
269 if(auxname1
> *sizename1
)
270 *sizename1
= auxname1
;
274 auxname2
= strlen(critic
->NAME
) ;
275 if(auxname2
> *sizename2
)
276 *sizename2
= auxname2
;
280 *sizecumul
= XtasSizeLong(*delay
) ;
281 if(*sizecumul
< auxcumul
) *sizecumul
= auxcumul
;
283 *sizeothercumul
= XtasSizeLong(*otherdelay
) ;
284 if(*sizeothercumul
< auxothercumul
) *sizeothercumul
= auxothercumul
;
292 chain
= chain
->NEXT
;
301 for(; chain
!= NULL
; chain
= chain
->NEXT
)
303 critic
= (ttvcritic_list
*)chain
->DATA
;
304 auxdelay
= XtasSizeLong(critic
->NEXT
->DELAY
) ;
305 if(auxdelay
> *sizedelay
)
306 *sizedelay
= auxdelay
;
307 auxslope
= XtasSizeLong(critic
->NEXT
->SLOPE
) ;
308 if(auxslope
> *sizeslope
)
309 *sizeslope
= auxslope
;
310 auxname1
= strlen(critic
->NAME
) ;
311 if(auxname1
> *sizename1
)
312 *sizename1
= auxname1
;
313 auxname2
= strlen(critic
->NEXT
->NAME
) ;
314 if(auxname2
> *sizename2
)
315 *sizename2
= auxname2
;
316 auxtype
= XtasSizeLong(i
) + 5 ;
317 if(auxtype
> *sizetype
)
318 *sizetype
= auxtype
;
328 for(; chain
!= NULL
; chain
= chain
->NEXT
)
330 path
= (ttvpath_list
*)chain
;
332 auxdelay
= XtasSizeLong(path
->DELAY
) ;
333 if(auxdelay
> *sizedelay
)
334 *sizedelay
= auxdelay
;
335 auxslope
= XtasSizeLong(path
->SLOPE
) ;
336 if(auxslope
> *sizeslope
)
337 *sizeslope
= auxslope
;
338 auxname1
= strlen(ttv_getsigname(ttvfig
,buf
,path
->NODE
->ROOT
)) ;
339 if(auxname1
> *sizename1
)
340 *sizename1
= auxname1
;
341 auxname2
= strlen(ttv_getsigname(ttvfig
,buf
,path
->ROOT
->ROOT
)) ;
342 if(auxname2
> *sizename2
)
343 *sizename2
= auxname2
;
344 auxtype
= XtasSizeLong(i
) + 8 ;
345 if(auxtype
> *sizetype
)
346 *sizetype
= auxtype
;
355 /*---------------------------------------------------------------------------*/
357 void XtasPrintFirstEnd(file
,sizetype
,sizedelay
,sizeotherdelay
,sizecumul
,sizeothercumul
,sizeslope
,sizeotherslope
,sizename1
,sizename2
,infos
)
390 if (infos
== XTAS_SIMU
) {
391 len
= sizedelay
- 6 ;
397 strcpy(pt
,"TAS Tp") ;
400 else if (infos
== XTAS_CTK
) {
401 len
= sizedelay
- 6 ;
407 strcpy(pt
,"Ref Tp") ;
411 len
= sizedelay
- 2 ;
424 if(sizeotherdelay
> 0)
426 if (infos
== XTAS_SIMU
) {
427 len
= sizeotherdelay
- 8 ;
433 strcpy(pt
,"SPICE Tp") ;
437 len
= sizeotherdelay
- 6 ;
443 strcpy(pt
,"Tp CTK") ;
452 if (infos
== XTAS_SIMU
) {
453 len
= sizecumul
- 9 ;
459 strcpy(pt
,"TAS Total") ;
462 else if (infos
== XTAS_CTK
) {
463 len
= sizecumul
- 9 ;
469 strcpy(pt
,"Ref Total") ;
473 len
= sizecumul
- 5 ;
486 if(sizeothercumul
> 0)
488 if (infos
== XTAS_SIMU
) {
489 len
= sizeothercumul
- 11 ;
495 strcpy(pt
,"SPICE Total") ;
499 len
= sizeothercumul
- 9 ;
505 strcpy(pt
,"Total CTK") ;
514 if (infos
== XTAS_SIMU
) {
515 len
= sizeslope
- 9 ;
521 strcpy(pt
,"TAS Slope") ;
524 else if (infos
== XTAS_CTK
) {
525 len
= sizeslope
- 9 ;
531 strcpy(pt
,"Ref Slope") ;
535 len
= sizeslope
- 5 ;
548 if(sizeotherslope
> 0)
550 if (infos
== XTAS_SIMU
) {
551 len
= sizeotherslope
- 11 ;
557 strcpy(pt
,"SPICE Slope") ;
561 len
= sizeotherslope
- 9 ;
567 strcpy(pt
,"Slope CTK") ;
576 len
= sizename1
- 4 ;
590 len
= sizename2
- 2 ;
600 fprintf(file
,"%s\n",buf
) ;
603 /*---------------------------------------------------------------------------*/
605 void XtasPrintLinesepar(file
,sizetype
,sizedelay
,sizeotherdelay
,sizecumul
,sizeothercumul
,sizeslope
,sizeotherslope
,sizename1
,sizename2
)
648 if(sizeotherdelay
> 0)
650 len
= sizeotherdelay
;
672 if(sizeothercumul
> 0)
674 len
= sizeothercumul
;
696 if(sizeotherslope
> 0)
698 len
= sizeotherslope
;
734 fprintf(file
,"%s\n",buf
) ;
737 /*---------------------------------------------------------------------------*/
739 void XtasPrintLine(file
,typedelay
,sizetype
,delay
,sizedelay
,otherdelay
,sizeotherdelay
,cumul
,sizecumul
,othercumul
,sizeothercumul
,
740 slope
,sizeslope
,otherslope
,sizeotherslope
,name1
,sizename1
,slope1
,slope2
,
770 fprintf(file
,"%s ",typedelay
) ;
777 len
= XtasSizeLong(delay
) ;
778 len
= sizedelay
- len
;
784 sprintf(pt
,"%.1f ",delay
/TTV_UNIT
) ;
785 pt
+= (XtasSizeFloatUnit(delay
) + 1) ;
788 if(sizeotherdelay
> 0)
790 len
= XtasSizeLong(otherdelay
) ;
791 len
= sizeotherdelay
- len
;
797 sprintf(pt
,"%.1f ",otherdelay
/TTV_UNIT
) ;
798 pt
+= (XtasSizeFloatUnit(otherdelay
) + 1) ;
803 len
= XtasSizeLong(cumul
) ;
804 len
= sizecumul
- len
;
810 sprintf(pt
,"%.1f ",cumul
/TTV_UNIT
) ;
811 pt
+= (XtasSizeFloatUnit(cumul
) + 1) ;
814 if(sizeothercumul
> 0)
816 len
= XtasSizeLong(othercumul
) ;
817 len
= sizeothercumul
- len
;
823 sprintf(pt
,"%.1f ",othercumul
/TTV_UNIT
) ;
824 pt
+= (XtasSizeFloatUnit(othercumul
) + 1) ;
829 len
= XtasSizeLong(slope
) ;
830 len
= sizeslope
- len
;
836 sprintf(pt
,"%.1f ",slope
/TTV_UNIT
) ;
837 pt
+= (XtasSizeFloatUnit(slope
) + 1) ;
840 if(sizeotherslope
> 0)
842 len
= XtasSizeLong(otherslope
) ;
843 len
= sizeotherslope
- len
;
849 sprintf(pt
,"%.1f ",otherslope
/TTV_UNIT
) ;
850 pt
+= (XtasSizeFloatUnit(otherslope
) + 1) ;
855 len
= strlen(name1
) ;
856 len
= sizename1
- len
;
862 sprintf(pt
,"%s %c%c ",name1
,slope1
,slope2
) ;
863 pt
= pt
+ strlen(name1
) + 4 ;
868 sprintf(pt
,"%s",name2
) ;
869 len
= strlen(name2
) ;
871 len
= sizename2
- len
;
881 fprintf(file
,"%s\n",buf
) ;
884 /*---------------------------------------------------------------------------*/
886 /* FUNCTION : XtasGetMask */
888 /* IN ARGS : mask_widget : mask widget */
890 /* OUT ARGS : ( void ) */
892 /* OBJECT : this function is called to build a mask chain from a text */
895 /*---------------------------------------------------------------------------*/
896 chain_list
*XtasGetMask( mask_widget
)
899 static chain_list
*mask
;
903 prompt
= XmTextGetString( mask_widget
) ;
905 if (strlen( prompt
) == 0)
910 mask
= addchain(NULL
,NULL
) ;
912 if ( (p
= strrchr(prompt
, ' ')) == NULL
)
914 mask
->DATA
= namealloc( prompt
);
920 mask
->DATA
= namealloc( p
);
921 while ((p
= strrchr(prompt
, ' ')) != NULL
)
925 mask
= addchain( mask
, (char *)namealloc( p
));
927 mask
= addchain( mask
, (char *)namealloc( prompt
));
934 /*---------------------------------------------------------------------------*/
936 /* FUNCTION : XtasSuppresStringSpace */
938 /* IN ARGS : s : string */
940 /* OUT ARGS : ( void ) */
942 /* OBJECT : this function is called to supress the blank char in the begin */
943 /* and the end of s. */
945 /*---------------------------------------------------------------------------*/
946 char* XtasSuppresStringSpace( s
)
951 while (!strncmp(s
," ",1))
956 for ( i
=strlen(s
); i
>=0; i
-- )
960 for ( j
= i
; j
<(int)strlen(s
); j
++ )
969 /*---------------------------------------------------------------------------*/
971 /* FUNCTION : XtasSetLabelString */
973 /* IN ARGS : label_widget : label widget */
974 /* text : text to set */
976 /* OUT ARGS : ( void ) */
978 /* OBJECT : this function is called to set a string in a label widget. */
980 /*---------------------------------------------------------------------------*/
981 void XtasSetLabelString( label_widget
, text
)
992 label
= XmStringCreateSimple( text
);
993 XtSetArg( args
[n
], XmNlabelString
, label
); n
++;
994 XtSetValues( label_widget
, args
, n
);
995 XmStringFree( label
);
998 /*---------------------------------------------------------------------------*/
1000 /* FUNCTION : XtasDestroyAllFig */
1002 /* IN ARGS : ( none ) */
1004 /* OUT ARGS : ( void ) */
1006 /* OBJECT : Remove all figure */
1008 /*---------------------------------------------------------------------------*/
1009 void XtasDestroyAllFig()
1011 ttvfig_list
*ttvfig
;
1013 for(ttvfig
= TTV_LIST_TTVFIG
; ttvfig
!= NULL
; ttvfig
= ttvfig
->NEXT
)
1014 if(ttvfig
== XtasMainParam
->ttvfig
)
1018 XtasRemovePathSession(NULL
);
1019 XtasRemoveDetailPathSession(NULL
) ;
1020 XtasRemoveStbSession(NULL
) ;
1022 XtasMainParam
->ttvfig
= NULL
;
1026 /*---------------------------------------------------------------------------*/
1028 /* FUNCTION : XtasMainPopupCallback */
1030 /* IN ARGS : .widget : The widget on which the event occurs. */
1031 /* .client_data : Widget to popup. */
1032 /* .call_data : Not significant. */
1034 /* OUT ARGS : ( void ) */
1036 /* OBJECT : This function is called from other sub-windows in order to */
1037 /* make the main window appears at the top of the screen or */
1038 /* the client_data != NULL */
1039 /*---------------------------------------------------------------------------*/
1040 void XtasMainPopupCallback( widget
, client_data
, call_data
)
1042 XtPointer client_data
;
1043 XtPointer call_data
;
1045 XtVaSetValues( XtasTopLevel
, XmNiconic
, False
, NULL
);
1046 XtPopup( XtasTopLevel
, XtGrabNone
);
1049 /*---------------------------------------------------------------------------*/
1051 /* FUNCTION : XtasReloadInfCallback */
1053 /* IN ARGS : .widget : The widget on which the event occurs. */
1054 /* .client_data : Not significant. */
1055 /* .call_data : Not significant. */
1057 /* OUT ARGS : ( void ) */
1059 /* OBJECT : Reload the INF file from any Xtas window. */
1060 /*---------------------------------------------------------------------------*/
1061 void XtasReloadInfCallback( widget
, client_data
, call_data
)
1063 XtPointer client_data
;
1064 XtPointer call_data
;
1066 if (XtasMainParam
->ttvfig
== NULL
) {
1067 XalDrawMessage( XtasErrorWidget
, XTAS_NODBERR
);
1072 if(sigsetjmp( XtasMyEnv
, 1 ) == 0)
1075 XtasSetLabelString(XtasDeskMessageField
, " ");
1076 XalForceUpdate( XtasTopLevel
);
1077 XalSetCursor( XtasTopLevel
, WAIT
);
1078 inf_Dirty(XtasMainParam
->ttvfig
->INFO
->FIGNAME
);
1079 infRead(XtasMainParam
->ttvfig
->INFO
->FIGNAME
,'E') ;
1080 ttv_getinffile (XtasMainParam
->ttvfig
);
1081 tas_update_mcctemp (getloadedinffig(XtasMainParam
->ttvfig
->INFO
->FIGNAME
)); /*mise a jour de la temperature pour une eventuelle simu */
1082 XtasGetWarningMess() ;
1084 XalSetCursor( XtasTopLevel
, NORMAL
);
1085 XtasSetLabelString(XtasDeskMessageField
, "INF file Reloaded");
1086 XalForceUpdate( XtasTopLevel
);
1089 XtasGetWarningMess() ;
1091 XtasSetLabelString(XtasDeskMessageField
, "INF file Not Reloaded");
1092 XalForceUpdate( XtasTopLevel
);
1097 /*---------------------------------------------------------------------------*/
1099 /* FUNCTION : XtasAppNotReady */
1101 /* IN ARGS : ( None ) */
1103 /* OUT ARGS : 1: Not Ready, 0: Ready. */
1105 /* OBJECT : Changes the current state of the current session. */
1107 /*---------------------------------------------------------------------------*/
1108 int XtasAppNotReady()
1110 if(XtasMainParam
->ttvfig
== NULL
)
1112 XalDrawMessage( XtasErrorWidget
, XTAS_NODBERR
);
1118 /*---------------------------------------------------------------------------*/
1120 /* FUNCTION : XtasDestroyWidgetCallback */
1122 /* IN ARGS : .widget : The widget on which the event occurs. */
1123 /* .client_data : Not significant. */
1124 /* .call_data : Not significant. */
1126 /* OUT ARGS : ( void ) */
1128 /* OBJECT : The callback function for all destroy commands. All it does is */
1129 /* to destroy the widget. */
1131 /*---------------------------------------------------------------------------*/
1132 void XtasDestroyWidgetCallback( widget
, root_widget
, call_data
)
1135 XtPointer root_widget
;
1136 XtPointer call_data
;
1139 XtDestroyWidget( root_widget
);
1142 /*---------------------------------------------------------------------------*/
1144 /* FUNCTION : XtasCancelCallback */
1146 /* IN ARGS : .widget : The widget on which the event occurs. */
1147 /* .client_data : Not significant. */
1148 /* .call_data : Not significant. */
1150 /* OUT ARGS : ( void ) */
1152 /* OBJECT : The callback function for all Cancel commands. All it does is */
1153 /* to unmanage the widget to be canceled. */
1155 /*---------------------------------------------------------------------------*/
1156 void XtasCancelCallback( widget
, root_widget
, call_data
)
1159 XtPointer root_widget
;
1160 XtPointer call_data
;
1163 XtUnmanageChild( root_widget
);
1164 // XalLeaveLimitedLoop();
1168 /*---------------------------------------------------------------------------*/
1170 /* FUNCTION : XtasDummyCallback */
1172 /* IN ARGS : .widget : The widget on which the event occurs. */
1173 /* .client_data : Not significant. */
1174 /* .call_data : Not significant. */
1176 /* OUT ARGS : ( void ) */
1178 /* OBJECT : This is just a dummy function in order to do nothing. */
1180 /*---------------------------------------------------------------------------*/
1181 void XtasDummyCallback( widget
, client_data
, call_data
)
1184 XtPointer client_data
;
1185 XtPointer call_data
;
1189 /*---------------------------------------------------------------------------*/
1191 /* FUNCTION : XtasNotYetCallback */
1193 /* IN ARGS : .widget : The widget on which the event occurs. */
1194 /* .client_data : Not significant. */
1195 /* .call_data : Not significant. */
1197 /* OUT ARGS : ( void ) */
1199 /* OBJECT : This is to display a message for functions under development. */
1201 /*---------------------------------------------------------------------------*/
1202 void XtasNotYetCallback( widget
, client_data
, call_data
)
1205 XtPointer client_data
;
1206 XtPointer call_data
;
1209 XalDrawMessage( XtasNotYetWidget
, XTAS_NYETWAR
);
1213 /*---------------------------------------------------------------------------*/
1215 /* FUNCTION : XtasAddDummyButton */
1217 /* IN ARGS : .widget : Parent widget id. */
1219 /* OUT ARGS : ( none ) */
1221 /* OBJECT : Adds a dummy Button in order to have at least one. */
1223 /*---------------------------------------------------------------------------*/
1224 void XtasAddDummyButton( widget
)
1231 XtVaGetValues( widget
, XmNforeground
, &fg
, XmNbackground
, &bg
, NULL
);
1232 gc
= XCreateGC(XtDisplay(widget
), RootWindowOfScreen(XtScreen(widget
)), 0, 0);
1233 XSetForeground(XtDisplay(widget
), gc
, fg
);
1234 XSetBackground(XtDisplay(widget
), gc
, bg
);
1235 XFreeGC(XtDisplay(widget
),gc
) ;
1237 XtVaCreateManagedWidget( "dbutton",
1238 xmDrawnButtonWidgetClass
,
1242 XmNpushButtonEnabled
, False
,
1243 XmNsensitive
, False
,
1244 XmNshadowThickness
, 0,
1249 /*---------------------------------------------------------------------------*/
1251 /* FUNCTION : XtasButtonsChangedCallback */
1253 /* IN ARGS : .widget : The widget on which the event occurs. */
1254 /* .new_state : Pointer to the specific "selected" field. */
1255 /* .call_data : The toggle callback structure. */
1257 /* OUT ARGS : ( void ) */
1259 /* OBJECT : The callback function for the Options/Buttons command when */
1260 /* a Button is selected or unselected. */
1262 /*---------------------------------------------------------------------------*/
1263 void XtasButtonsChangedCallback( widget
, new_state
, cbs
)
1265 XtPointer new_state
;
1268 Boolean
*res
= (Boolean
*)new_state
;
1270 XmToggleButtonCallbackStruct
*state
= (XmToggleButtonCallbackStruct
*) cbs
;
1276 /*---------------------------------------------------------------------------*/
1278 /* FUNCTION : XtasButtonsOkCallback */
1280 /* IN ARGS : .widget : The widget on which the event occurs. */
1281 /* .options : User New choices. */
1282 /* .call_data : Not significant. */
1284 /* OUT ARGS : ( void ) */
1286 /* OBJECT : The callback function for the Options/Buttons command when */
1287 /* the OK Button is selected. */
1289 /*---------------------------------------------------------------------------*/
1290 void XtasButtonsOkCallback( widget
, client_data
, call_data
)
1293 XtPointer client_data
;
1294 XtPointer call_data
;
1300 struct XalButtonsItem
*options
= (struct XalButtonsItem
*)client_data
;
1303 Xtas_final_menus
[i
].pix_file
!= -1 ;
1306 Xtas_final_menus
[i
].selected
= options
[i
].selected
;
1309 parent
= XtParent( *Xtas_pt_buttons
);
1310 XtDestroyWidget( *Xtas_pt_buttons
);
1313 XtSetArg( args
[n
], XmNnumColumns
, 1 ); n
++;
1314 XtSetArg( args
[n
], XmNorientation
, XmHORIZONTAL
); n
++;
1315 *Xtas_pt_buttons
= XalButtonMenus( parent
,
1319 XtasAddDummyButton( *Xtas_pt_buttons
);
1320 XtManageChild( *Xtas_pt_buttons
);
1321 XmAddTabGroup( *Xtas_pt_buttons
);
1323 // XalLeaveLimitedLoop();
1326 /*---------------------------------------------------------------------------*/
1328 /* FUNCTION : XtasOptionsButtonsTreat */
1330 /* IN ARGS : .parent : The parent widget. */
1331 /* .pt_buttons_widget : Pointer to the Button's Bar. */
1332 /* .button_menus : The Menu's table. */
1333 /* .button_options : The Button's name list. */
1335 /* OUT ARGS : ( void ) */
1337 /* OBJECT : A function to customize the button's bar menu. */
1339 /*---------------------------------------------------------------------------*/
1340 void XtasOptionsButtonsTreat( parent
, pt_buttons_widget
, button_menus
, button_options
)
1343 Widget
*pt_buttons_widget
;
1344 struct XalButtonsItem button_menus
[];
1345 struct XalButtonsItem button_options
[];
1359 Atom WM_DELETE_WINDOW
;
1362 Xtas_pt_buttons
= pt_buttons_widget
;
1363 Xtas_final_menus
= button_menus
;
1365 /*= PromptDialog prompt =*/
1367 XtSetArg( args
[n
], XmNtitle
, XTAS_NAME
": Button's Configuration" ); n
++;
1368 XtSetArg( args
[n
], XmNdialogStyle
, XmDIALOG_APPLICATION_MODAL
); n
++;
1369 prompt
= XmCreatePromptDialog( parent
,
1372 XtUnmanageChild(XmSelectionBoxGetChild( prompt
, XmDIALOG_TEXT
));
1373 XtUnmanageChild(XmSelectionBoxGetChild( prompt
, XmDIALOG_PROMPT_LABEL
));
1374 XtAddCallback( prompt
,
1376 XtasButtonsOkCallback
,
1377 (XtPointer
)button_options
);
1378 XtAddCallback( prompt
,
1381 (XtPointer
)prompt
);
1383 WM_DELETE_WINDOW
= XmInternAtom(XtDisplay(parent
), "WM_DELETE_WINDOW", False
);
1384 XmAddWMProtocolCallback(XtParent(prompt
), WM_DELETE_WINDOW
, XtasCancelCallback
, (XtPointer
)prompt
);
1388 form
= XmCreateForm( prompt
,
1391 XtManageChild( form
);
1393 /*= ScrolledWindow scroll =*/
1394 for ( i
=0, height
=0;
1395 button_options
[i
].pix_file
!= -1 ;
1401 XtSetArg( args
[n
], XmNtopAttachment
, XmATTACH_FORM
); n
++;
1402 XtSetArg( args
[n
], XmNbottomAttachment
, XmATTACH_FORM
); n
++;
1403 XtSetArg( args
[n
], XmNleftAttachment
, XmATTACH_FORM
); n
++;
1404 XtSetArg( args
[n
], XmNrightAttachment
, XmATTACH_FORM
); n
++;
1405 XtSetArg( args
[n
], XmNscrollingPolicy
, XmAUTOMATIC
); n
++;
1406 XtSetArg( args
[n
], XmNheight
, height
); n
++;
1407 XtSetArg( args
[n
], XmNwidth
, 250 ); n
++;
1408 scroll
= XmCreateScrolledWindow( form
,
1409 "XtasButtonsScroll",
1411 XtManageChild( scroll
);
1413 /*= Widget Row : main_row =*/
1415 XtSetArg( args
[n
], XmNorientation
, XmHORIZONTAL
); n
++;
1416 main_row
= XtCreateManagedWidget( "XtasButtonsRow",
1417 xmRowColumnWidgetClass
,
1420 /*= Widget Column : buttons =*/
1422 button_options
[i
].pix_file
!= -1 ;
1425 button_options
[i
].selected
= True
;
1429 XtSetArg( args
[n
], XmNorientation
, XmVERTICAL
); n
++;
1430 buttons
= XalButtonMenus( main_row
, button_options
, args
, n
, 40, 40 );
1431 XtManageChild( buttons
);
1433 /*= Widget Column : sub_row =*/
1435 XtSetArg( args
[n
], XmNorientation
, XmVERTICAL
); n
++;
1436 XtSetArg( args
[n
], XmNspacing
, 21 ); n
++;
1437 sub_row
= XtCreateManagedWidget( "XtasButtonsRow",
1438 xmRowColumnWidgetClass
,
1441 /*= Widget ToggleButton : toggle =*/
1442 for ( i
=0; button_menus
[i
].pix_file
!= -1 ; i
++ )
1445 text
= XmStringCreateSimple( button_options
[i
].callback_data
);
1446 XtSetArg( args
[n
], XmNlabelString
, text
); n
++;
1447 XtSetArg( args
[n
], XmNindicatorType
, XmN_OF_MANY
); n
++;
1448 XtSetArg( args
[n
], XmNset
, False
); n
++;
1449 toggle
= XtCreateManagedWidget( "XtasButtonsToggles",
1450 xmToggleButtonWidgetClass
,
1453 XmStringFree( text
);
1455 if ( button_menus
[i
].selected
== True
)
1458 XtSetArg( args
[n
], XmNset
, True
); n
++;
1459 XtSetValues( toggle
, args
, n
);
1463 button_options
[i
].selected
= False
;
1466 XtAddCallback( toggle
,
1467 XmNvalueChangedCallback
,
1468 XtasButtonsChangedCallback
,
1469 &button_options
[i
].selected
);
1471 XtManageChild( prompt
);
1472 // XalLimitedLoop( prompt );