PatchData& ObjectiveFunctionTests::patch() { static PatchData the_pd; static bool did_init = init_pd( the_pd ); CPPUNIT_ASSERT(did_init); return the_pd; }
static void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[], const output_env_t oenv) { Pixmap pm; t_gmx *gmx; XSizeHints hints; int w0, h0; int natom, natom_trx; t_topology top; int ePBC; matrix box; t_trxframe fr; t_trxstatus *status; char quote[256]; snew(gmx, 1); snew(gmx->wd, 1); ePBC = read_tpx_top(ftp2fn(efTPR, nfile, fnm), NULL, box, &natom, NULL, NULL, &top); read_first_frame(oenv, &status, ftp2fn(efTRX, nfile, fnm), &fr, TRX_DONT_SKIP); close_trx(status); natom_trx = fr.natoms; /* Creates a simple window */ w0 = DisplayWidth(x11->disp, x11->screen)-132; h0 = DisplayHeight(x11->disp, x11->screen)-140; bromacs(quote, 255); InitWin(gmx->wd, 0, 0, w0, h0, 3, quote); gmx->wd->self = XCreateSimpleWindow(x11->disp, x11->root, gmx->wd->x, gmx->wd->y, gmx->wd->width, gmx->wd->height, gmx->wd->bwidth, WHITE, BLACK); pm = XCreatePixmapFromBitmapData(x11->disp, x11->root, (char *)gromacs_bits, gromacs_width, gromacs_height, WHITE, BLACK, 1); hints.flags = PMinSize; hints.min_width = 2*EWIDTH+40; hints.min_height = EHEIGHT+LDHEIGHT+LEGHEIGHT+40; XSetStandardProperties(x11->disp, gmx->wd->self, gmx->wd->text, program, pm, NULL, 0, &hints); x11->RegisterCallback(x11, gmx->wd->self, x11->root, MainCallBack, gmx); x11->SetInputMask(x11, gmx->wd->self, ButtonPressMask | ButtonReleaseMask | OwnerGrabButtonMask | ExposureMask | StructureNotifyMask); /* The order of creating windows is important here! */ /* Manager */ gmx->man = init_man(x11, gmx->wd->self, 0, 0, 1, 1, WHITE, BLACK, ePBC, box, oenv); gmx->logo = init_logo(x11, gmx->wd->self, false); /* Now put all windows in the proper place */ move_gmx(x11, gmx, w0, h0, false); XMapWindow(x11->disp, gmx->wd->self); map_man(x11, gmx->man); /* Pull Down menu */ gmx->pd = init_pd(x11, gmx->wd->self, gmx->wd->width, x11->fg, x11->bg, MSIZE, gmx_pd_size, gmx_pd, MenuTitle); /* Dialogs & Filters */ gmx->filter = init_filter(&(top.atoms), ftp2fn_null(efNDX, nfile, fnm), natom_trx); init_dlgs(x11, gmx); /* Now do file operations */ set_file(x11, gmx->man, ftp2fn(efTRX, nfile, fnm), ftp2fn(efTPR, nfile, fnm)); ShowDlg(gmx->dlgs[edFilter]); }