#include <config.h>
#endif
+#include <stdio.h>
#include <ctype.h>
#include <string.h>
-
#include "sysstuff.h"
#include "macros.h"
#include "smalloc.h"
#include "typedefs.h"
#include "string2.h"
#include "statutil.h"
-#include "Xstuff.h"
-#include "gromacs.bm"
#include "copyrite.h"
#include "confio.h"
+#include "tpxio.h"
+
+#ifdef HAVE_X11
+
+#include "Xstuff.h"
+#include "gromacs.bm"
+#include "xutil.h"
#include "dialogs.h"
#include "writeps.h"
#include "molps.h"
#include "nmol.h"
-#include "tpxio.h"
-
-#include "gromacs/commandline/cmdlinemodulemanager.h"
/* Forward declarations: I Don't want all that init shit here */
void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[],
{
t_psdata ps;
- ps = ps_open("ngmx.ps", 0, 0, man->molw->wd.width, man->molw->wd.height);
+ ps = ps_open("view.ps", 0, 0, man->molw->wd.width, man->molw->wd.height);
ps_draw_mol(ps, man);
ps_close(ps);
}
}
static void move_gmx(t_x11 *x11, t_gmx *gmx, int width, int height,
- gmx_bool bSizePD)
+ bool bSizePD)
{
int y0, wl, hl;
#ifdef DEBUG
XMoveWindow(x11->disp, gmx->logo->wd.self, (width-wl)/2, (height-y0-hl)/2);
}
-static gmx_bool HandleClient(t_x11 *x11, int ID, t_gmx *gmx)
+static bool HandleClient(t_x11 *x11, int ID, t_gmx *gmx)
{
t_pulldown *pd;
break;
case IDTERM:
done_gmx(x11, gmx);
- return TRUE;
+ return true;
/* Edit Menu */
case IDEDITTOP:
default:
break;
}
- return FALSE;
+ return false;
}
-static gmx_bool MainCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool MainCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
{
t_gmx *gmx;
int nsel, width, height;
- gmx_bool result;
+ bool result;
- result = FALSE;
+ result = false;
gmx = (t_gmx *)data;
switch (event->type)
{
height = event->xconfigure.height;
if ((width != gmx->wd->width) || (height != gmx->wd->height))
{
- move_gmx(x11, gmx, width, height, TRUE);
+ move_gmx(x11, gmx, width, height, true);
}
break;
case ClientMessage:
}
return result;
}
+//! HAVE_X11
+#endif
-int gmx_ngmx(int argc, char *argv[])
+int gmx_view(int argc, char *argv[])
{
const char *desc[] = {
- "[TT]ngmx[tt] is the GROMACS trajectory viewer. This program reads a",
+ "[TT]view[tt] is the GROMACS trajectory viewer. This program reads a",
"trajectory file, a run input file and an index file and plots a",
"3D structure of your molecule on your standard X Window",
"screen. No need for a high end graphics workstation, it even",
};
output_env_t oenv;
- t_x11 *x11;
t_filenm fnm[] = {
{ efTRX, "-f", NULL, ffREAD },
{ efTPX, NULL, NULL, ffREAD },
};
#define NFILE asize(fnm)
- if (!parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm,
- 0, NULL, asize(desc), desc, asize(bugs), bugs, &oenv))
+ if (parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm,
+ 0, NULL, asize(desc), desc, asize(bugs), bugs, &oenv))
{
- return 0;
- }
-
- if ((x11 = GetX11(&argc, argv)) == NULL)
- {
- fprintf(stderr, "Can't connect to X Server.\n"
- "Check your DISPLAY environment variable\n");
- exit(1);
+#ifndef HAVE_X11
+ fprintf(stderr, "Compiled without X-Windows - can not run viewer.\n");
+#else
+ t_x11 *x11;
+
+ if ((x11 = GetX11(&argc, argv)) == NULL)
+ {
+ fprintf(stderr, "Can't connect to X Server.\n"
+ "Check your DISPLAY environment variable\n");
+ }
+ else
+ {
+ init_gmx(x11, argv[0], NFILE, fnm, oenv);
+ x11->MainLoop(x11);
+ x11->CleanUp(x11);
+ }
+#endif
}
- init_gmx(x11, argv[0], NFILE, fnm, oenv);
-
- x11->MainLoop(x11);
- x11->CleanUp(x11);
-
return 0;
}
-int main(int argc, char *argv[])
-{
- return gmx::CommandLineModuleManager::runAsMainCMain(argc, argv, &gmx_ngmx);
-}
-
+#ifdef HAVE_X11
static t_mentry FileMenu[] = {
- { 0, IDEXPORT, FALSE, "Export..." },
- { 0, IDDUMPWIN, FALSE, "Print" },
- { 0, IDQUIT, FALSE, "Quit" }
+ { 0, IDEXPORT, false, "Export..." },
+ { 0, IDDUMPWIN, false, "Print" },
+ { 0, IDQUIT, false, "Quit" }
};
static t_mentry DispMenu[] = {
- { 0, IDFILTER, FALSE, "Filter..." },
- { 0, IDANIMATE, FALSE, "Animate" },
- { 0, IDLABELSOFF, FALSE, "Labels Off"},
- { 0, IDRESETVIEW, FALSE, "Reset View"},
- { 0, IDBONDOPTS, FALSE, "Options..."}
+ { 0, IDFILTER, false, "Filter..." },
+ { 0, IDANIMATE, false, "Animate" },
+ { 0, IDLABELSOFF, false, "Labels Off"},
+ { 0, IDRESETVIEW, false, "Reset View"},
+ { 0, IDBONDOPTS, false, "Options..."}
};
static t_mentry HelpMenu[] = {
- { 0, IDHELP, FALSE, "Help" },
- { 0, IDABOUT, FALSE, "About Gromacs..." }
+ { 0, IDHELP, false, "Help" },
+ { 0, IDABOUT, false, "About Gromacs..." }
};
static t_mentry *gmx_pd[] = { FileMenu, DispMenu, HelpMenu };
/* 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);
+ gmx->logo = init_logo(x11, gmx->wd->self, false);
/* Now put all windows in the proper place */
- move_gmx(x11, gmx, w0, h0, FALSE);
+ 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,
- XTextHeight(x11->font), x11->fg, x11->bg,
+ x11->fg, x11->bg,
MSIZE, gmx_pd_size, gmx_pd, MenuTitle);
/* Dialogs & Filters */
/* Now do file shit */
set_file(x11, gmx->man, ftp2fn(efTRX, nfile, fnm), ftp2fn(efTPX, nfile, fnm));
- /*show_logo(x11,gmx->logo);*/
-
ShowDlg(gmx->dlgs[edFilter]);
}
+
+//! HAVE_X11
+#endif