4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
11 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
12 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
13 * Copyright (c) 2001-2004, The GROMACS development team,
14 * check out http://www.gromacs.org for more information.
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 * For more info, check our website at http://www.gromacs.org
34 * Gyas ROwers Mature At Cryogenic Speed
55 static void ApplCallback(t_x11
*x11
,int dlg_mess
,int item_id
,
67 fprintf(stderr
,"item_id: %d (%s)\n",item_id
,set
);
68 if (strcasecmp(set
,"OK") == 0) {
71 "xterm -geometry +100+100 -n %s"
72 " -title \"GROMACS: %s\" -e nice %s ",
73 data
->name
[data
->nAppl
],
74 data
->name
[data
->nAppl
],
75 data
->name
[data
->nAppl
]);
76 for(i
=0; (i
<dlg
->nitem
); i
++) {
80 strcat(doit
,item
->set
);
84 if (item
->u
.checkbox
.bChecked
)
85 strcat(doit
,item
->set
);
89 if (strlen(item
->u
.edittext
.buf
) > 0) {
90 strcat(doit
,item
->set
);
92 strcat(doit
,item
->u
.edittext
.buf
);
97 fprintf(stderr
,"Type: %d\n",item
->type
);
101 fprintf(stderr
,"Going to exec: '%s'\n",doit
);
105 else if (strcasecmp(set
,"Cancel") == 0) {
111 static void Callback(t_x11
*x11
,int dlg_mess
,int item_id
,
114 t_data
*data
=(t_data
*)dta
;
116 if (item_id
== data
->nopt
) {
117 fprintf(stderr
,"Doei...\n");
121 fprintf(stderr
,"%d: %s\n",item_id
,data
->description
[item_id
]);
122 if (data
->nAppl
!= -1)
125 data
->appl
=ReadDlg(x11
,0,data
->name
[item_id
],
126 BLACK
,LIGHTGREY
,data
->dlgfile
[item_id
],
127 50,50,FALSE
,FALSE
,ApplCallback
,data
);
132 static void read_opts(t_data
*data
)
135 char fn
[STRLEN
],buf
[STRLEN
];
138 sprintf(fn
,"xstat.dat");
142 snew(data
->name
,data
->nopt
);
143 snew(data
->description
,data
->nopt
);
144 snew(data
->dlgfile
,data
->nopt
);
146 for(i
=0; (i
<data
->nopt
); i
++) {
147 ReadQuoteString(fn
,in
,buf
);
148 data
->name
[i
] = strdup(buf
);
149 ReadQuoteString(fn
,in
,buf
);
150 data
->description
[i
] = strdup(buf
);
151 ReadQuoteString(fn
,in
,buf
);
152 data
->dlgfile
[i
] = strdup(buf
);
157 static void add_opts(t_x11
*x11
,t_data
*data
)
163 for(i
=0; (i
<data
->nopt
); i
++) {
164 but
=CreateButton(x11
,data
->description
[i
],FALSE
,
167 AddDlgItem(data
->dlg
,but
);
168 y0
+=but
->win
.height
+OFFS_Y
;
170 but
=CreateButton(x11
,"Quit",TRUE
,(t_id
)data
->nopt
,(t_id
)0,
172 AddDlgItem(data
->dlg
,but
);
173 y0
+=but
->win
.height
+OFFS_Y
;
176 for(i
=0; (i
<=data
->nopt
); i
++)
177 w
=max(w
,QueryDlgItemW(data
->dlg
,i
));
179 for(i
=0; (i
<=data
->nopt
); i
++)
180 SetDlgItemSize(data
->dlg
,i
,w
,0);
181 SetDlgSize(data
->dlg
,w
+2*OFFS_X
,y0
,TRUE
);
184 void main(int argc
,char *argv
[])
189 /* Initiate X and data */
190 if ((x11
=GetX11(&argc
,argv
))==NULL
) {
191 fprintf(stderr
,"Can't open DISPLAY\n");
195 data
.dlg
=CreateDlg(x11
,0,argv
[0],0,0,0,0,0,BLACK
,LIGHTGREY
,Callback
,&data
);