4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_xstat_c
= "$Id$";
50 static void ApplCallback(t_x11
*x11
,int dlg_mess
,int item_id
,
62 fprintf(stderr
,"item_id: %d (%s)\n",item_id
,set
);
63 if (strcasecmp(set
,"OK") == 0) {
66 "xterm -geometry +100+100 -n %s"
67 " -title \"GROMACS: %s\" -e nice %s ",
68 data
->name
[data
->nAppl
],
69 data
->name
[data
->nAppl
],
70 data
->name
[data
->nAppl
]);
71 for(i
=0; (i
<dlg
->nitem
); i
++) {
75 strcat(doit
,item
->set
);
79 if (item
->u
.checkbox
.bChecked
)
80 strcat(doit
,item
->set
);
84 if (strlen(item
->u
.edittext
.buf
) > 0) {
85 strcat(doit
,item
->set
);
87 strcat(doit
,item
->u
.edittext
.buf
);
92 fprintf(stderr
,"Type: %d\n",item
->type
);
96 fprintf(stderr
,"Going to exec: '%s'\n",doit
);
100 else if (strcasecmp(set
,"Cancel") == 0) {
106 static void Callback(t_x11
*x11
,int dlg_mess
,int item_id
,
109 t_data
*data
=(t_data
*)dta
;
111 if (item_id
== data
->nopt
) {
112 fprintf(stderr
,"Doei...\n");
116 fprintf(stderr
,"%d: %s\n",item_id
,data
->description
[item_id
]);
117 if (data
->nAppl
!= -1)
120 data
->appl
=ReadDlg(x11
,0,data
->name
[item_id
],
121 BLACK
,LIGHTGREY
,data
->dlgfile
[item_id
],
122 50,50,FALSE
,FALSE
,ApplCallback
,data
);
127 static void read_opts(t_data
*data
)
130 char *lib
,fn
[STRLEN
],buf
[STRLEN
];
133 if ((lib
=getenv("GMXLIB"))==NULL
) {
134 fprintf(stderr
,"No variable GMXLIB !\n");
137 sprintf(fn
,"%s/xstat.dat",lib
);
141 snew(data
->name
,data
->nopt
);
142 snew(data
->description
,data
->nopt
);
143 snew(data
->dlgfile
,data
->nopt
);
145 for(i
=0; (i
<data
->nopt
); i
++) {
146 ReadQuoteString(fn
,in
,buf
);
147 data
->name
[i
] = strdup(buf
);
148 ReadQuoteString(fn
,in
,buf
);
149 data
->description
[i
] = strdup(buf
);
150 ReadQuoteString(fn
,in
,buf
);
151 data
->dlgfile
[i
] = strdup(buf
);
156 static void add_opts(t_x11
*x11
,t_data
*data
)
162 for(i
=0; (i
<data
->nopt
); i
++) {
163 but
=CreateButton(x11
,data
->description
[i
],FALSE
,
166 AddDlgItem(data
->dlg
,but
);
167 y0
+=but
->win
.height
+OFFS_Y
;
169 but
=CreateButton(x11
,"Quit",TRUE
,(t_id
)data
->nopt
,(t_id
)0,
171 AddDlgItem(data
->dlg
,but
);
172 y0
+=but
->win
.height
+OFFS_Y
;
175 for(i
=0; (i
<=data
->nopt
); i
++)
176 w
=max(w
,QueryDlgItemW(data
->dlg
,i
));
178 for(i
=0; (i
<=data
->nopt
); i
++)
179 SetDlgItemSize(data
->dlg
,i
,w
,0);
180 SetDlgSize(data
->dlg
,w
+2*OFFS_X
,y0
,TRUE
);
183 void main(int argc
,char *argv
[])
188 /* Initiate X and data */
189 if ((x11
=GetX11(&argc
,argv
))==NULL
) {
190 fprintf(stderr
,"Can't open DISPLAY\n");
194 data
.dlg
=CreateDlg(x11
,0,argv
[0],0,0,0,0,0,BLACK
,LIGHTGREY
,Callback
,&data
);