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-2013, 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 void show_logo(t_x11 *x11, t_logo *logo)
60 XMapWindow(x11->disp, logo->wd.self);
61 XMapSubwindows(x11->disp, logo->wd.self);
64 void hide_logo(t_x11 *x11, t_logo *logo)
66 XUnmapWindow(x11->disp, logo->wd.self);
69 static bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
71 /* Assume window is 100x110 */
72 static bool bFirst = true;
78 static t_circle c[] = {
79 { 10, YOFFS+12, CSIZE, &LIGHTGREEN },
80 { 20, YOFFS+22, CSIZE, &LIGHTGREEN },
81 { 20, YOFFS+34, OSIZE, &LIGHTRED },
82 { 30, YOFFS+12, NSIZE, &LIGHTCYAN },
83 { 30, YOFFS+ 2, HSIZE, &WHITE },
84 { 40, YOFFS+22, CSIZE, &LIGHTGREEN },
85 { 40, YOFFS+34, CSIZE, &LIGHTGREEN },
86 { 50, YOFFS+12, CSIZE, &LIGHTGREEN },
87 { 50, YOFFS, OSIZE, &LIGHTRED },
88 { 60, YOFFS+22, NSIZE, &LIGHTCYAN },
89 { 60, YOFFS+32, HSIZE, &WHITE },
90 { 70, YOFFS+12, CSIZE, &LIGHTGREEN },
91 { 80, YOFFS+22, CSIZE, &LIGHTGREEN },
92 { 80, YOFFS+34, OSIZE, &LIGHTRED },
93 { 90, YOFFS+12, NSIZE, &LIGHTCYAN },
94 { 90, YOFFS+ 2, HSIZE, &WHITE },
95 {100, YOFFS+22, CSIZE, &LIGHTGREEN }
97 static int lines[] = {
98 0, 1, 1, 2, 1, 3, 3, 4, 3, 5, 5, 6, 5, 7, 7, 8, 7, 9,
99 9, 10, 9, 11, 11, 12, 12, 13, 12, 14, 14, 15, 14, 16
102 static t_mess Mess[] = {
103 { "GROMACS", 0, 20, NULL },
104 { NULL, 16, 9, NULL },
105 { "Copyright (c) 1991-2013", COFFS+ 2, 9, NULL },
106 { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11, 9, NULL },
107 { "& Groningen University ", COFFS+20, 9, NULL },
108 { "click to dismiss", COFFS+31, 8, NULL }
110 #define NMESS asize(Mess)
116 logo = (t_logo *)data;
120 wfac = wd->width/110.0;
121 hfac = wd->height/110.0;
122 for (i = 0; (i < asize(c)); i++)
127 Mess[1].text = GromacsVersion();
128 for (i = 0; (i < NMESS); i++)
132 Mess[i].fnt = (i == 0) ? logo->bigfont : (i == NMESS-1) ? x11->font :
140 XSetForeground(x11->disp, x11->gc, WHITE);
141 XSetLineAttributes(x11->disp, x11->gc, 3, LineSolid, CapNotLast, JoinRound);
142 for (i = 0; (i < asize(lines)); i += 2)
144 XDrawLine(x11->disp, wd->self, x11->gc,
145 c[lines[i]].x, c[lines[i]].y, c[lines[i+1]].x, c[lines[i+1]].y);
147 XSetLineAttributes(x11->disp, x11->gc, 1, LineSolid, CapNotLast, JoinRound);
148 for (i = 0; (i < asize(c)); i++)
150 XSetForeground(x11->disp, x11->gc, *(c[i].col));
151 XFillCircle(x11->disp, wd->self, x11->gc, c[i].x, c[i].y, c[i].rad);
153 XSetForeground(x11->disp, x11->gc, BLACK);
154 XDrawRectangle(x11->disp, wd->self, x11->gc, 2, 2, wd->width-5, wd->height-5);
155 for (i = 0; (i < NMESS); i++)
157 SpecialTextInRect(x11, Mess[i].fnt, wd->self, Mess[i].text,
158 0, Mess[i].y, wd->width, Mess[i].h,
161 XSetForeground(x11->disp, x11->gc, x11->fg);
164 hide_logo(x11, logo);
165 return logo->bQuitOnClick;
174 t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick)
176 static const char *bfname[] = {
177 "-b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1",
178 "-b&h-lucida-bold-i-normal-sans-26-190-100-100-p-166-iso8859-1",
179 "lucidasans-bolditalic-24",
180 "lucidasans-italic-24",
184 #define NBF asize(bfname)
185 static const char *sfname[] = {
186 "lucidasans-bold-18",
190 #define NSF asize(sfname)
197 logo->bQuitOnClick = bQuitOnClick;
198 InitWin(&logo->wd, 0, 0, 360, 270, 1, "GROMACS");
200 if ((newcol = getenv("LOGO")) != NULL)
202 GetNamedColor(x11, newcol, &bg);
204 logo->wd.self = XCreateSimpleWindow(x11->disp, parent,
205 logo->wd.x, logo->wd.y,
206 logo->wd.width, logo->wd.height,
207 logo->wd.bwidth, WHITE, bg);
208 for (i = 0, logo->bigfont = NULL; (i < NBF); i++)
210 if ((logo->bigfont = XLoadQueryFont(x11->disp, bfname[i])) != NULL)
221 fprintf(stderr, "Big Logofont: %s\n", bfname[i]);
223 for (i = 0, logo->smallfont = NULL; (i < NSF); i++)
225 if ((logo->smallfont = XLoadQueryFont(x11->disp, sfname[i])) != NULL)
236 fprintf(stderr, "Small Logofont: %s\n", sfname[i]);
238 x11->RegisterCallback(x11, logo->wd.self, parent, LogoCallBack, logo);
239 x11->SetInputMask(x11, logo->wd.self, ButtonPressMask | ExposureMask);
244 void done_logo(t_x11 *x11, t_logo *logo)
246 x11->UnRegisterCallback(x11, logo->wd.self);