3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Gyas ROwers Mature At Cryogenic Speed
58 static void ApplCallback(t_x11
*x11
,int dlg_mess
,int item_id
,
70 fprintf(stderr
,"item_id: %d (%s)\n",item_id
,set
);
71 if (strcasecmp(set
,"OK") == 0) {
74 "xterm -geometry +100+100 -n %s"
75 " -title \"GROMACS: %s\" -e nice %s ",
76 data
->name
[data
->nAppl
],
77 data
->name
[data
->nAppl
],
78 data
->name
[data
->nAppl
]);
79 for(i
=0; (i
<dlg
->nitem
); i
++) {
83 strcat(doit
,item
->set
);
87 if (item
->u
.checkbox
.bChecked
)
88 strcat(doit
,item
->set
);
92 if (strlen(item
->u
.edittext
.buf
) > 0) {
93 strcat(doit
,item
->set
);
95 strcat(doit
,item
->u
.edittext
.buf
);
100 fprintf(stderr
,"Type: %d\n",item
->type
);
104 fprintf(stderr
,"Going to exec: '%s'\n",doit
);
107 printf("Warning-- No calls to system(3) supported on this platform.");
108 printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf
);
115 else if (strcasecmp(set
,"Cancel") == 0) {
121 static void Callback(t_x11
*x11
,int dlg_mess
,int item_id
,
124 t_data
*data
=(t_data
*)dta
;
126 if (item_id
== data
->nopt
) {
127 fprintf(stderr
,"Doei...\n");
131 fprintf(stderr
,"%d: %s\n",item_id
,data
->description
[item_id
]);
132 if (data
->nAppl
!= -1)
135 data
->appl
=ReadDlg(x11
,0,data
->name
[item_id
],
136 BLACK
,LIGHTGREY
,data
->dlgfile
[item_id
],
137 50,50,FALSE
,FALSE
,ApplCallback
,data
);
142 static void read_opts(t_data
*data
)
145 char fn
[STRLEN
],buf
[STRLEN
];
148 sprintf(fn
,"xstat.dat");
152 snew(data
->name
,data
->nopt
);
153 snew(data
->description
,data
->nopt
);
154 snew(data
->dlgfile
,data
->nopt
);
156 for(i
=0; (i
<data
->nopt
); i
++) {
157 ReadQuoteString(fn
,in
,buf
);
158 data
->name
[i
] = strdup(buf
);
159 ReadQuoteString(fn
,in
,buf
);
160 data
->description
[i
] = strdup(buf
);
161 ReadQuoteString(fn
,in
,buf
);
162 data
->dlgfile
[i
] = strdup(buf
);
167 static void add_opts(t_x11
*x11
,t_data
*data
)
173 for(i
=0; (i
<data
->nopt
); i
++) {
174 but
=CreateButton(x11
,data
->description
[i
],FALSE
,
177 AddDlgItem(data
->dlg
,but
);
178 y0
+=but
->win
.height
+OFFS_Y
;
180 but
=CreateButton(x11
,"Quit",TRUE
,(t_id
)data
->nopt
,(t_id
)0,
182 AddDlgItem(data
->dlg
,but
);
183 y0
+=but
->win
.height
+OFFS_Y
;
186 for(i
=0; (i
<=data
->nopt
); i
++)
187 w
=max(w
,QueryDlgItemW(data
->dlg
,i
));
189 for(i
=0; (i
<=data
->nopt
); i
++)
190 SetDlgItemSize(data
->dlg
,i
,w
,0);
191 SetDlgSize(data
->dlg
,w
+2*OFFS_X
,y0
,TRUE
);
195 main(int argc
,char *argv
[])
200 /* Initiate X and data */
201 if ((x11
=GetX11(&argc
,argv
))==NULL
) {
202 fprintf(stderr
,"Can't open DISPLAY\n");
206 data
.dlg
=CreateDlg(x11
,0,argv
[0],0,0,0,0,0,BLACK
,LIGHTGREY
,Callback
,&data
);