4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License
18 * as published by the Free Software Foundation; either version 2
19 * of the License, or (at your option) any later version.
21 * If you want to redistribute modifications, please consider that
22 * scientific software is very special. Version control is crucial -
23 * bugs must be traceable. We will be happy to consider code for
24 * inclusion in the official distribution, but derived work must not
25 * be called official GROMACS. Details are found in the README & COPYING
26 * files - if they are missing, get the official version at www.gromacs.org.
28 * To help us fund GROMACS development, we humbly ask that you cite
29 * the papers on the package - you can find them in the top README file.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Good gRace! Old Maple Actually Chews Slate
36 static char *SRCID_xstat_c = "$Id$";
56 static void ApplCallback(t_x11 *x11,int dlg_mess,int item_id,
68 fprintf(stderr,"item_id: %d (%s)\n",item_id,set);
69 if (strcasecmp(set,"OK") == 0) {
72 "xterm -geometry +100+100 -n %s"
73 " -title \"GROMACS: %s\" -e nice %s ",
74 data->name[data->nAppl],
75 data->name[data->nAppl],
76 data->name[data->nAppl]);
77 for(i=0; (i<dlg->nitem); i++) {
81 strcat(doit,item->set);
85 if (item->u.checkbox.bChecked)
86 strcat(doit,item->set);
90 if (strlen(item->u.edittext.buf) > 0) {
91 strcat(doit,item->set);
93 strcat(doit,item->u.edittext.buf);
98 fprintf(stderr,"Type: %d\n",item->type);
102 fprintf(stderr,"Going to exec: '%s'\n",doit);
106 else if (strcasecmp(set,"Cancel") == 0) {
112 static void Callback(t_x11 *x11,int dlg_mess,int item_id,
115 t_data *data=(t_data *)dta;
117 if (item_id == data->nopt) {
118 fprintf(stderr,"Doei...\n");
122 fprintf(stderr,"%d: %s\n",item_id,data->description[item_id]);
123 if (data->nAppl != -1)
126 data->appl=ReadDlg(x11,0,data->name[item_id],
127 BLACK,LIGHTGREY,data->dlgfile[item_id],
128 50,50,FALSE,FALSE,ApplCallback,data);
133 static void read_opts(t_data *data)
136 char fn[STRLEN],buf[STRLEN];
139 sprintf(fn,"xstat.dat");
143 snew(data->name,data->nopt);
144 snew(data->description,data->nopt);
145 snew(data->dlgfile,data->nopt);
147 for(i=0; (i<data->nopt); i++) {
148 ReadQuoteString(fn,in,buf);
149 data->name[i] = strdup(buf);
150 ReadQuoteString(fn,in,buf);
151 data->description[i] = strdup(buf);
152 ReadQuoteString(fn,in,buf);
153 data->dlgfile[i] = strdup(buf);
158 static void add_opts(t_x11 *x11,t_data *data)
164 for(i=0; (i<data->nopt); i++) {
165 but=CreateButton(x11,data->description[i],FALSE,
168 AddDlgItem(data->dlg,but);
169 y0+=but->win.height+OFFS_Y;
171 but=CreateButton(x11,"Quit",TRUE,(t_id)data->nopt,(t_id)0,
173 AddDlgItem(data->dlg,but);
174 y0+=but->win.height+OFFS_Y;
177 for(i=0; (i<=data->nopt); i++)
178 w=max(w,QueryDlgItemW(data->dlg,i));
180 for(i=0; (i<=data->nopt); i++)
181 SetDlgItemSize(data->dlg,i,w,0);
182 SetDlgSize(data->dlg,w+2*OFFS_X,y0,TRUE);
185 void main(int argc,char *argv[])
190 /* Initiate X and data */
191 if ((x11=GetX11(&argc,argv))==NULL) {
192 fprintf(stderr,"Can't open DISPLAY\n");
196 data.dlg=CreateDlg(x11,0,argv[0],0,0,0,0,0,BLACK,LIGHTGREY,Callback,&data);