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 fn[STRLEN],buf[STRLEN];
133 sprintf(fn,"xstat.dat");
137 snew(data->name,data->nopt);
138 snew(data->description,data->nopt);
139 snew(data->dlgfile,data->nopt);
141 for(i=0; (i<data->nopt); i++) {
142 ReadQuoteString(fn,in,buf);
143 data->name[i] = strdup(buf);
144 ReadQuoteString(fn,in,buf);
145 data->description[i] = strdup(buf);
146 ReadQuoteString(fn,in,buf);
147 data->dlgfile[i] = strdup(buf);
152 static void add_opts(t_x11 *x11,t_data *data)
158 for(i=0; (i<data->nopt); i++) {
159 but=CreateButton(x11,data->description[i],FALSE,
162 AddDlgItem(data->dlg,but);
163 y0+=but->win.height+OFFS_Y;
165 but=CreateButton(x11,"Quit",TRUE,(t_id)data->nopt,(t_id)0,
167 AddDlgItem(data->dlg,but);
168 y0+=but->win.height+OFFS_Y;
171 for(i=0; (i<=data->nopt); i++)
172 w=max(w,QueryDlgItemW(data->dlg,i));
174 for(i=0; (i<=data->nopt); i++)
175 SetDlgItemSize(data->dlg,i,w,0);
176 SetDlgSize(data->dlg,w+2*OFFS_X,y0,TRUE);
179 void main(int argc,char *argv[])
184 /* Initiate X and data */
185 if ((x11=GetX11(&argc,argv))==NULL) {
186 fprintf(stderr,"Can't open DISPLAY\n");
190 data.dlg=CreateDlg(x11,0,argv[0],0,0,0,0,0,BLACK,LIGHTGREY,Callback,&data);