Moved ngmx to C++, renamed it to view.
authorDavid van der Spoel <spoel@xray.bmc.uu.se>
Sat, 31 Aug 2013 12:44:53 +0000 (14:44 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 21 Sep 2013 04:00:51 +0000 (06:00 +0200)
Part of #673
Moved all files to src/programs/view and made executable
part of the gmx binary as "gmx view".
Removed warnings.
Replacing min and max by std::min and std::max.
Removed warning in asize macro.
Changed typedef enums to C++ enums.
Changed gmx_bool to bool.
Removed g_showcol, g_xrama, xstat, test_ngmx_dialog

Change-Id: I88fc541e27705c498703006f461dd2b9b1e6a3f5

56 files changed:
CMakeLists.txt
src/CMakeLists.txt
src/config.h.cmakein
src/gromacs/legacyheaders/macros.h
src/ngmx/CMakeLists.txt [deleted file]
src/ngmx/g_showcol.c [deleted file]
src/ngmx/g_xrama.cpp [deleted file]
src/ngmx/rama.bm [deleted file]
src/ngmx/test_ngmx_dialog.c [deleted file]
src/ngmx/xstat.c [deleted file]
src/programs/CMakeLists.txt
src/programs/gmx/legacymodules.cpp
src/programs/view/Xstuff.h [moved from src/ngmx/Xstuff.h with 100% similarity]
src/programs/view/alert.bm [moved from src/ngmx/alert.bm with 100% similarity]
src/programs/view/buttons.cpp [moved from src/ngmx/buttons.c with 95% similarity]
src/programs/view/buttons.h [moved from src/ngmx/buttons.h with 99% similarity]
src/programs/view/dialogs.cpp [moved from src/ngmx/dialogs.c with 85% similarity]
src/programs/view/dialogs.h [moved from src/ngmx/dialogs.h with 97% similarity]
src/programs/view/ff.bm [moved from src/ngmx/ff.bm with 100% similarity]
src/programs/view/fgrid.cpp [moved from src/ngmx/fgrid.c with 93% similarity]
src/programs/view/fgrid.h [moved from src/ngmx/fgrid.h with 87% similarity]
src/programs/view/filter.cpp [moved from src/ngmx/filter.c with 93% similarity]
src/programs/view/gromacs.bm [moved from src/ngmx/gromacs.bm with 100% similarity]
src/programs/view/info.bm [moved from src/ngmx/info.bm with 100% similarity]
src/programs/view/logo.cpp [moved from src/ngmx/logo.c with 94% similarity]
src/programs/view/logo.h [moved from src/ngmx/logo.h with 92% similarity]
src/programs/view/manager.cpp [moved from src/ngmx/manager.c with 90% similarity]
src/programs/view/manager.h [moved from src/ngmx/manager.h with 86% similarity]
src/programs/view/molps.cpp [moved from src/ngmx/molps.c with 91% similarity]
src/programs/view/molps.h [moved from src/ngmx/molps.h with 100% similarity]
src/programs/view/nleg.cpp [moved from src/ngmx/nleg.c with 94% similarity]
src/programs/view/nleg.h [moved from src/ngmx/nleg.h with 100% similarity]
src/programs/view/nmol.cpp [moved from src/ngmx/nmol.c with 94% similarity]
src/programs/view/nmol.h [moved from src/ngmx/nmol.h with 97% similarity]
src/programs/view/play.bm [moved from src/ngmx/play.bm with 100% similarity]
src/programs/view/popup.cpp [moved from src/ngmx/popup.c with 93% similarity]
src/programs/view/popup.h [moved from src/ngmx/popup.h with 93% similarity]
src/programs/view/pulldown.cpp [moved from src/ngmx/pulldown.c with 88% similarity]
src/programs/view/pulldown.h [moved from src/ngmx/pulldown.h with 97% similarity]
src/programs/view/rewind.bm [moved from src/ngmx/rewind.bm with 100% similarity]
src/programs/view/stop.bm [moved from src/ngmx/stop.bm with 100% similarity]
src/programs/view/stop_ani.bm [moved from src/ngmx/stop_ani.bm with 100% similarity]
src/programs/view/view.cpp [moved from src/ngmx/ngmx.cpp with 86% similarity]
src/programs/view/view.h [moved from src/ngmx/g_logo.c with 67% similarity]
src/programs/view/x11.cpp [moved from src/ngmx/x11.c with 81% similarity]
src/programs/view/x11.h [moved from src/ngmx/x11.h with 95% similarity]
src/programs/view/xdlg.cpp [moved from src/ngmx/xdlg.c with 94% similarity]
src/programs/view/xdlg.h [moved from src/ngmx/xdlg.h with 86% similarity]
src/programs/view/xdlghi.cpp [moved from src/ngmx/xdlghi.c with 90% similarity]
src/programs/view/xdlghi.h [moved from src/ngmx/xdlghi.h with 92% similarity]
src/programs/view/xdlgitem.cpp [moved from src/ngmx/xdlgitem.c with 89% similarity]
src/programs/view/xdlgitem.h [moved from src/ngmx/xdlgitem.h with 84% similarity]
src/programs/view/xmb.cpp [moved from src/ngmx/xmb.c with 93% similarity]
src/programs/view/xmb.h [moved from src/ngmx/xmb.h with 95% similarity]
src/programs/view/xutil.cpp [moved from src/ngmx/xutil.c with 96% similarity]
src/programs/view/xutil.h [moved from src/ngmx/xutil.h with 93% similarity]

index bc8deea853b3e5601892d5e7177a15b6e0afdfcc..ae04ed474fb877b37ab58757d2310c6f6b611e5e 100644 (file)
@@ -471,6 +471,9 @@ if (GMX_X11)
     # X11 includes/libraries are only set in the ngmx subdirectory!
     if(NOT X11_FOUND)
         message(WARNING "X11 include files and/or libraries were not found. Will not build the GROMACS X11-binaries, such as ngmx")
     # X11 includes/libraries are only set in the ngmx subdirectory!
     if(NOT X11_FOUND)
         message(WARNING "X11 include files and/or libraries were not found. Will not build the GROMACS X11-binaries, such as ngmx")
+    else()
+        set(HAVE_X11 1)
+        include_directories(${X11_INCLUDE_DIR})
     endif()
 endif(GMX_X11)
 
     endif()
 endif(GMX_X11)
 
index 2f1d6f02a6e9aa5f13b2beed3f5285a4e5f3a44e..6a551a16afeb174cc81d8a8ab2b9eed7a051aa75 100644 (file)
@@ -18,9 +18,6 @@ endif (BUILD_TESTING)
 add_subdirectory(gromacs)
 add_subdirectory(programs)
 
 add_subdirectory(gromacs)
 add_subdirectory(programs)
 
-if (NOT GMX_FAHCORE AND NOT GMX_BUILD_MDRUN_ONLY)
-    add_subdirectory(ngmx)
-endif()
 if (NOT GMX_FAHCORE)
 if (NOT GMX_FAHCORE)
-  add_subdirectory(contrib)
+    add_subdirectory(contrib)
 endif()
 endif()
index e515c0fa3023ad53eb321b030f8795cd40c67124..3bf56ecc9e721d0273baa28601bf88f9f776c7f5 100644 (file)
 /* Define for GetSystemInfo() */
 #cmakedefine HAVE_SYSTEM_INFO
 
 /* Define for GetSystemInfo() */
 #cmakedefine HAVE_SYSTEM_INFO
 
+/* Define for X-Windows */
+#cmakedefine HAVE_X11
+
 /* Enable x86 gcc inline assembly */
 #cmakedefine GMX_X86_GCC_INLINE_ASM
 
 /* Enable x86 gcc inline assembly */
 #cmakedefine GMX_X86_GCC_INLINE_ASM
 
index 46ca3f387a782f0afeb16fdd8e9886f7781419dc..261c86f6eb663f4bd33ada169dfca387ff5af76c 100644 (file)
@@ -66,6 +66,6 @@
 #endif
 
 /* This macro calculates the size of a array */
 #endif
 
 /* This macro calculates the size of a array */
-#define asize(a) (sizeof(a)/sizeof((a)[0]))
+#define asize(a) ((int)(sizeof(a)/sizeof((a)[0])))
 
 #endif  /* _macros_h */
 
 #endif  /* _macros_h */
diff --git a/src/ngmx/CMakeLists.txt b/src/ngmx/CMakeLists.txt
deleted file mode 100644 (file)
index 10e3f09..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-if(X11_FOUND)
-
-set(NGMX_COMMON_SOURCE
-    xutil.c         xmb.c           x11.c
-    xdlghi.c        fgrid.c         xdlgitem.c
-    popup.c         pulldown.c      xdlg.c
-    manager.c       buttons.c       nmol.c
-    nleg.c          dialogs.c       logo.c
-    filter.c        molps.c)
-
-include_directories(${X11_INCLUDE_DIR})
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-
-# List of programs with single corresponding *.c source file,
-# used to create build rules automatically.
-#
-set(NGMX_PROGRAMS
-    ngmx g_xrama)
-
-foreach(PROG ${NGMX_PROGRAMS})
-        add_executable(${PROG} ${PROG}.cpp ${NGMX_COMMON_SOURCE})
-        target_link_libraries(${PROG} libgromacs ${GMX_EXTRA_LIBRARIES})
-        gmx_add_man_page(${PROG})
-        set_target_properties(${PROG} PROPERTIES OUTPUT_NAME "${PROG}${GMX_BINARY_SUFFIX}")
-endforeach(PROG)
-
-install(TARGETS ${NGMX_PROGRAMS}
-        COMPONENT ngmx
-        RUNTIME DESTINATION ${BIN_INSTALL_DIR})
-
-endif(X11_FOUND)
diff --git a/src/ngmx/g_showcol.c b/src/ngmx/g_showcol.c
deleted file mode 100644 (file)
index fddc62c..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include <smalloc.h>
-#include <sysstuff.h>
-#include <string2.h>
-#include <Xstuff.h>
-#include "xutil.h"
-#include "futil.h"
-
-typedef struct {
-    XColor    xc;
-    t_windata wd;
-} t_col;
-
-typedef struct {
-    t_windata  wd;
-    t_windata  but;
-    int        ncol;
-    t_col     *col;
-} t_sc;
-
-static gmx_bool ColCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data)
-{
-    t_col     *col;
-    XColor    *xc;
-    int        r, g, b;
-    t_windata *wd;
-
-    col = (t_col *)data;
-    xc  = &(col->xc);
-    wd  = &(col->wd);
-    switch (event->type)
-    {
-        case ButtonPress:
-            r = xc->red >> 8;
-            g = xc->green >> 8;
-            b = xc->blue >> 8;
-            printf("%6d%6d%6d\t\t%-20s\n", r, g, b, wd->text);
-            break;
-    }
-    return FALSE;
-}
-
-static gmx_bool BCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data)
-{
-    t_sc  *sc;
-
-    sc = (t_sc *)data;
-    switch (event->type)
-    {
-        case Expose:
-            XSetForeground(x11->disp, x11->gc, sc->col[sc->ncol-1].xc.pixel);
-            TextInWin(x11, &sc->but, sc->but.text, eXCenter, eYCenter);
-            break;
-        case ConfigureNotify:
-            sc->but.width  = event->xconfigure.width;
-            sc->but.height = event->xconfigure.height;
-            break;
-        case EnterNotify:
-            LightBorder(x11->disp, sc->but.self, sc->col[sc->ncol-1].xc.pixel);
-            break;
-        case LeaveNotify:
-            LightBorder(x11->disp, sc->but.self, sc->col[0].xc.pixel);
-            break;
-        case ButtonPress:
-            x11->UnRegisterCallback(x11, sc->wd.self);
-            x11->UnRegisterCallback(x11, sc->but.self);
-            return TRUE;
-    }
-    return FALSE;
-}
-
-static gmx_bool scCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data)
-{
-    t_sc  *sc;
-    int    i;
-    int    nx, ny, X, Y, Dx, Dy, th;
-    float  x, y, dx, dy;
-
-    th = XTextHeight(x11->font)+6;
-    sc = (t_sc *)data;
-    switch (event->type)
-    {
-        case ConfigureNotify:
-            x = sc->wd.width = event->xconfigure.width;
-            y = sc->wd.height = event->xconfigure.height-th;
-            if ((x >= 100) && (y >= 100))
-            {
-#ifdef DEBUG
-                printf("Disp: %x, But: %x, Font: %x x: %d, th: %d\n",
-                       x11->disp, sc->but.self, x11->font, (int)x, th);
-#endif
-                XResizeWindow(x11->disp, sc->but.self, (int)x-4, th-4);
-                nx = sqrt(sc->ncol);
-                ny = sc->ncol/nx;
-                while (nx*ny < sc->ncol)
-                {
-                    ny++;
-                }
-                dx = ((float)x) / nx;
-                dy = ((float)y) / ny;
-                for (i = 0; (i < sc->ncol); i++)
-                {
-                    X  = x = (i%nx) * dx;
-                    Y  = y = (i/nx) * dy;
-                    Dx = (int)(x+dx)-X;
-                    Dy = (int)(y+dy)-Y;
-                    XMoveWindow(x11->disp, sc->col[i].wd.self, X, th+Y);
-                    XResizeWindow(x11->disp, sc->col[i].wd.self, Dx, Dy);
-                }
-            }
-            break;
-    }
-    return FALSE;
-}
-
-static int col_comp(const void *c1, const void *c2)
-{
-    XColor *x1, *x2;
-    int     dr, dg;
-    int     diff;
-
-    x1 = &(((t_col *)c1)->xc);
-    x2 = &(((t_col *)c2)->xc);
-
-    /* sort on intensity */
-    diff = (x1->red+x1->green+x1->blue)-(x2->red+x2->green+x2->blue);
-
-    if (diff == 0)
-    {
-        if ((dr = (x1->red-x2->red)) != 0)
-        {
-            return dr;
-        }
-        if ((dg = (x1->green-x2->green)) != 0)
-        {
-            return dg;
-        }
-        return x1->blue-x2->blue;
-    }
-    else
-    {
-        return diff;
-    }
-}
-
-static void read_col(t_x11 *x11, t_sc *sc, char *rgb)
-{
-    FILE   *fp;
-    char    buf[STRLEN], name[STRLEN], *dummy;
-    int     i, j;
-    int     r, g, b;
-    XColor  xc, exact;
-    t_col  *cols;
-
-    if ((fp = fopen(rgb, "r")) == NULL)
-    {
-        perror(rgb);
-        exit(1);
-    }
-    do
-    {
-        dummy = NULL;
-        if (fscanf(fp, "%d%d%d", &r, &g, &b) == 3)
-        {
-            dummy = fgets2(buf, STRLEN-1, fp);
-            if (dummy)
-            {
-                trim(buf);
-                /* Filter out colours with names of two words */
-                sscanf(buf, "%s", name);
-                /* Filter out duplicate colours (grey and gray) */
-                if (strstr(name, "gray") == 0)
-                {
-                    if (XAllocNamedColor(x11->disp, x11->cmap, name, &xc, &exact))
-                    {
-                        srenew(sc->col, ++sc->ncol);
-                        sc->col[sc->ncol-1].xc = xc;
-#ifdef DEBUG
-                        printf("color %3d: %s\n", sc->ncol, buf);
-#endif
-                        InitWin(&(sc->col[sc->ncol-1].wd), 0, 0, 1, 1, 0, name);
-                    }
-                }
-            }
-        }
-    }
-    while (dummy);
-    fclose(fp);
-    if (sc->ncol)
-    {
-        qsort(sc->col, sc->ncol, sizeof(sc->col[0]), col_comp);
-    }
-    /* Now filter out doubles */
-    cols = &(sc->col[0]);
-    for (i = 1, j = 0; (i < sc->ncol); i++)
-    {
-        if ((cols[i].xc.red   != cols[j].xc.red) ||
-            (cols[i].xc.green != cols[j].xc.green) ||
-            (cols[i].xc.blue  != cols[j].xc.blue))
-        {
-            j++;
-            cols[j] = cols[i];
-        }
-    }
-    sc->ncol = j;
-}
-
-static t_sc *init_sc(t_x11 *x11, Window Parent, char *rgb)
-{
-    t_sc   *sc;
-    Window  w;
-    int     i;
-
-    snew(sc, 1);
-    InitWin(&sc->wd, 0, 0, 400, 300, 1, "Show Colours");
-    sc->wd.self = XCreateSimpleWindow(x11->disp, Parent, sc->wd.x, sc->wd.y,
-                                      sc->wd.width, sc->wd.height,
-                                      sc->wd.bwidth, WHITE, BLACK);
-    x11->RegisterCallback(x11, sc->wd.self, Parent, scCallBack, sc);
-    x11->SetInputMask(x11, sc->wd.self, ButtonPressMask | ExposureMask |
-                      StructureNotifyMask);
-    InitWin(&sc->but, 0, 0, sc->wd.width-2, XTextHeight(x11->font)+2, 1, "Quit");
-    sc->but.self = XCreateSimpleWindow(x11->disp, sc->wd.self, sc->but.x, sc->but.y,
-                                       sc->but.width, sc->but.height,
-                                       sc->but.bwidth, BLACK, BLACK);
-    x11->RegisterCallback(x11, sc->but.self, sc->but.self, BCallBack, sc);
-    x11->SetInputMask(x11, sc->but.self, ButtonPressMask | ExposureMask |
-                      StructureNotifyMask | EnterWindowMask |
-                      LeaveWindowMask);
-
-    read_col(x11, sc, rgb);
-    fprintf(stderr, "%d colors found\n", sc->ncol);
-    fprintf(stderr, "%6s%6s%6s\t\t%-20s\n", "Red", "Green", "Blue", "name");
-    for (i = 0; (i < sc->ncol); i++)
-    {
-        sc->col[i].wd.self = w = XCreateSimpleWindow(x11->disp, sc->wd.self, 0, 0, 1, 1, 0,
-                                                     BLACK, sc->col[i].xc.pixel);
-        x11->RegisterCallback(x11, w, sc->wd.self, ColCallBack, &(sc->col[i]));
-        x11->SetInputMask(x11, w, ButtonPressMask);
-    }
-
-    return sc;
-}
-
-int
-main(int argc, char *argv[])
-{
-    t_x11 *x11;
-    t_sc  *sc;
-    char  *fn;
-
-    x11 = GetX11(&argc, argv);
-    if (argc > 1)
-    {
-        fn = argv[1];
-    }
-    else
-    {
-        fn = "/usr/lib/X11/rgb.txt";
-    }
-    if (!gmx_fexist(fn))
-    {
-        fprintf(stderr, "Usage: %s rgb.txt\n", argv[0]);
-        fprintf(stderr, "rgb.txt is usually somewhere in your X windows directories.\n");
-        exit(1);
-    }
-    sc = init_sc(x11, x11->root, fn);
-    XMapWindow(x11->disp, sc->wd.self);
-    XMapSubwindows(x11->disp, sc->wd.self);
-    x11->MainLoop(x11);
-    x11->CleanUp(x11);
-
-    return 0;
-}
diff --git a/src/ngmx/g_xrama.cpp b/src/ngmx/g_xrama.cpp
deleted file mode 100644 (file)
index 5d553b4..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-#include "macros.h"
-#include "Xstuff.h"
-#include "xutil.h"
-#include "futil.h"
-#include "x11.h"
-#include "smalloc.h"
-#include "statutil.h"
-#include "rama.bm"
-#include "nrama.h"
-
-#include "gromacs/commandline/cmdlinemodulemanager.h"
-
-#define MAXDEG 360
-
-enum {
-    ebQuit, ebStart, ebStop, ebRewind, ebGly, ebutNR
-};
-
-static real scx, scy;
-#define SX(x) ((int)(((x)+M_PI)*scx))
-#define SY(y) ((int)((M_PI-(y))*scy))
-
-enum {
-    esStop, esGo, esNR
-};
-
-typedef struct {
-    int            status;
-    gmx_bool       bShowGly;
-    gmx_bool      *bIsGly;
-    t_windata      wd;
-    t_windata      xrwd;
-    t_xrama       *xr;
-    t_windata      but[ebutNR];
-} t_app;
-
-static void plot_pp(t_x11 *x11, Window w, t_phipsi *pp, t_dih dih[])
-{
-    int x0, y0;
-    int th = (XTextHeight(x11->font)+6)/2;
-
-    x0 = SX(dih[pp->iphi].ang);
-    y0 = SY(dih[pp->ipsi].ang);
-    XFillRectangle(x11->disp, w, x11->gc, x0-1, y0-1, 4, 4);
-    /* Draw Label ? */
-    if (pp->bShow)
-    {
-        TextInRect(x11, w, pp->label, x0+6, y0-th, 30, 2*th, eXLeft, eYCenter);
-    }
-}
-
-static gmx_bool label_pp(t_x11 *x11, Window w, int npp, t_phipsi pp[],
-                         t_dih dih[], int mx, int my)
-{
-    int d, md, x0, y0;
-    int i, imin;
-
-    imin = -1;
-    md   = 16;
-    for (i = 0; (i < npp); i++)
-    {
-        x0 = SX(dih[pp[i].iphi].ang);
-        y0 = SY(dih[pp[i].ipsi].ang);
-        d  = (mx-x0)*(mx-x0)+(my-y0)*(my-y0);
-        if (d < md)
-        {
-            md   = d;
-            imin = i;
-        }
-    }
-    if (imin != -1)
-    {
-        pp[imin].bShow = !pp[imin].bShow;
-        return TRUE;
-    }
-    return FALSE;
-}
-
-static gmx_bool xrCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data)
-{
-    t_app   *app;
-    t_xrama *xr;
-    char     buf[256];
-    int      i;
-
-    (void)XTextHeight(x11->font);
-    app = (t_app *)data;
-    xr  = app->xr;
-    scx = app->xrwd.width/(2.0*M_PI);
-    scy = app->xrwd.height/(2.0*M_PI);
-    switch (event->type)
-    {
-        case Expose:
-            XClearWindow(x11->disp, app->xrwd.self);
-            XDrawLine(x11->disp, app->xrwd.self, x11->gc,
-                      SX(0), SY(-M_PI)+1, SX(0), SY(M_PI)-1);
-            XDrawLine(x11->disp, app->xrwd.self, x11->gc,
-                      SX(-M_PI)+1, SY(0), SX(M_PI)-1, SY(0));
-            TextInRect(x11, app->xrwd.self, "Phi", SX(M_PI)-50, SY(0)+4, 46, 20, eXRight, eYTop);
-            TextInRect(x11, app->xrwd.self, "Psi", SX(0)+4, 4, 46, 20, eXLeft, eYTop);
-            for (i = 0; (i < xr->npp); i++)
-            {
-                if (app->bShowGly || !app->bIsGly[i])
-                {
-                    plot_pp(x11, app->xrwd.self, &(xr->pp[i]), xr->dih);
-                }
-            }
-            break;
-        case ButtonPress:
-            if (label_pp(x11, app->xrwd.self, xr->npp, xr->pp, xr->dih,
-                         event->xbutton.x, event->xbutton.y))
-            {
-                ExposeWin(x11->disp, app->xrwd.self);
-            }
-            break;
-        case ConfigureNotify:
-            app->xrwd.width  = event->xconfigure.width;
-            app->xrwd.height = event->xconfigure.height;
-            break;
-    }
-    if (app->status == esGo)
-    {
-        if (!new_data(app->xr))
-        {
-            app->status = ebStop;
-        }
-        else
-        {
-            ExposeWin(x11->disp, app->xrwd.self);
-            sprintf(buf, "Rama: t=%.2f", app->xr->t);
-            XSetStandardProperties(x11->disp, app->wd.self, buf,
-                                   "Rama", 0, NULL, 0, NULL);
-
-        }
-    }
-    return FALSE;
-}
-
-static gmx_bool appCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data)
-{
-    t_app  *app;
-    int     win;
-
-    app = (t_app *)data;
-    for (win = 0; (win < ebutNR); win++)
-    {
-        if (app->but[win].self == w)
-        {
-            break;
-        }
-    }
-    if (win == ebutNR)
-    {
-        return FALSE;
-    }
-
-    switch (event->type)
-    {
-        case Expose:
-            TextInWin(x11, &(app->but[win]), app->but[win].text, eXCenter, eYCenter);
-            break;
-        case ButtonPress:
-            switch (win)
-            {
-                case ebQuit:
-                    exit(1);
-                case ebStart:
-                    app->status = esGo;
-                    ExposeWin(x11->disp, app->xrwd.self);
-                    break;
-                case ebStop:
-                    app->status = esStop;
-                    break;
-                case ebRewind:
-                    rewind_trj(app->xr->traj);
-                    break;
-                case ebGly:
-                    app->bShowGly = !app->bShowGly;
-                    ExposeWin(x11->disp, app->xrwd.self);
-                    break;
-                default:
-                    XBell(x11->disp, 50);
-                    break;
-            }
-            break;
-    }
-    return FALSE;
-}
-
-static void size_app(t_x11 *x11, t_app *app)
-{
-    int i, dx, th;
-
-    th = XTextHeight(x11->font)+4;
-    dx = app->wd.width/ebutNR;
-    for (i = 0; (i < ebutNR); i++)
-    {
-        app->but[i].width  = dx-4;
-        app->but[i].height = th+4;
-        XMoveResizeWindow(x11->disp, app->but[i].self, i*dx+2, 2, dx-4, th+4);
-    }
-    XMoveResizeWindow(x11->disp, app->xrwd.self, 2, th+10,
-                      app->wd.width-6, app->wd.height-th-10-4);
-}
-
-static gmx_bool mainCallBack(struct t_x11 *x11, XEvent *event, Window w, void *data)
-{
-    t_app *app;
-    int    wt, ht;
-
-    app = (t_app *)data;
-    switch (event->type)
-    {
-        case ConfigureNotify:
-            wt = event->xconfigure.width;
-            ht = event->xconfigure.height;
-            if ((app->wd.width != wt) || (app->wd.height != ht))
-            {
-                fprintf(stderr, "New wxh = %dx%d\n", wt, ht);
-                app->wd.width  = wt;
-                app->wd.height = ht;
-                size_app(x11, app);
-            }
-            break;
-    }
-    return FALSE;
-}
-
-static t_xrama *init_xrama(t_x11 *x11, Window Parent, int y0, t_app *app)
-{
-    t_xrama *xr;
-
-    snew(xr, 1);
-
-    InitWin(&(app->xrwd), 2, y0, MAXDEG+1, MAXDEG+1, 1, "Ramachandran Movie");
-    app->xrwd.self = XCreateSimpleWindow(x11->disp, Parent, app->xrwd.x, app->xrwd.y,
-                                         app->xrwd.width, app->xrwd.height,
-                                         app->xrwd.bwidth, x11->fg, x11->bg);
-    x11->RegisterCallback(x11, app->xrwd.self, Parent, xrCallBack, app);
-    x11->SetInputMask(x11, app->xrwd.self, ButtonPressMask | ExposureMask |
-                      StructureNotifyMask);
-
-    return xr;
-}
-
-static t_app *init_app(t_x11 *x11, int argc, char *argv[])
-{
-    static const char *but_nm[ebutNR] = { "Quit", "Start", "Stop", "Rewind", "Toggle Gly" };
-    XSizeHints         hints;
-    Pixmap             pm;
-    int                th;
-    t_app             *app;
-    t_windata         *wd;
-    int                i, dx;
-
-    snew(app, 1);
-    th = XTextHeight(x11->font)+4;
-    InitWin(&(app->wd), 0, 0, MAXDEG+6, MAXDEG+6+th+6, 0, "Ramachandran Movie");
-    dx           = app->wd.width/ebutNR;
-    app->wd.self = XCreateSimpleWindow(x11->disp, x11->root, app->wd.x, app->wd.y,
-                                       app->wd.width, app->wd.height,
-                                       app->wd.bwidth, x11->fg, x11->bg);
-    x11->RegisterCallback(x11, app->wd.self, x11->root, mainCallBack, app);
-    x11->SetInputMask(x11, app->wd.self, StructureNotifyMask);
-    hints.flags = 0;
-    pm          = XCreatePixmapFromBitmapData(x11->disp, x11->root, (char *)rama_bits,
-                                              rama_width, rama_height, WHITE, BLACK, 1);
-    XSetStandardProperties(x11->disp, app->wd.self, app->wd.text,
-                           "Rama", pm, argv, argc, &hints);
-    x11->RegisterCallback(x11, app->wd.self, x11->root, appCallBack, app);
-    x11->SetInputMask(x11, app->wd.self, ButtonPressMask | ExposureMask |
-                      StructureNotifyMask);
-
-    app->xr = init_xrama(x11, app->wd.self, th+6, app);
-    for (i = 0; (i < ebutNR); i++)
-    {
-        wd = &(app->but[i]);
-        InitWin(wd, i*dx+2, 2, dx-4, th, 1, but_nm[i]);
-        wd->self = XCreateSimpleWindow(x11->disp, app->wd.self,
-                                       wd->x, wd->y, wd->width, wd->height,
-                                       wd->bwidth, x11->fg, x11->bg);
-        x11->RegisterCallback(x11, wd->self, app->wd.self, appCallBack, app);
-        x11->SetInputMask(x11, wd->self, ButtonPressMask | ExposureMask);
-    }
-    return app;
-}
-
-static void mk_gly(t_app *app)
-{
-    int i;
-
-    snew(app->bIsGly, app->xr->npp);
-    for (i = 0; (i < app->xr->npp); i++)
-    {
-        if (strstr(app->xr->pp[i].label, "GLY") != NULL)
-        {
-            app->bIsGly[i] = TRUE;
-        }
-    }
-}
-
-int gmx_xrama(int argc, char *argv[])
-{
-    const char  *desc[] = {
-        "[TT]g_xrama[tt] shows a Ramachandran movie, that is, it shows",
-        "the Phi/Psi angles as a function of time in an X-Window.[PAR]"
-        "Static Phi/Psi plots for printing can be made with [TT]g_rama[tt].[PAR]",
-        "Some of the more common X command line options can be used:[BR]",
-        "[TT]-bg[tt], [TT]-fg[tt] change colors, [TT]-font fontname[tt], changes the font."
-    };
-
-    output_env_t oenv;
-    t_x11       *x11;
-    t_app       *app;
-    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, 0, NULL, &oenv))
-    {
-        return 0;
-    }
-
-
-    if ((x11 = GetX11(&argc, argv)) == NULL)
-    {
-        fprintf(stderr, "Can't open display, set your DISPLAY environment variable\n");
-        exit(1);
-    }
-    XSetForeground(x11->disp, x11->gc, x11->fg);
-    app = init_app(x11, argc, argv);
-
-    init_rama(oenv, ftp2fn(efTRX, NFILE, fnm), ftp2fn(efTPX, NFILE, fnm),
-              app->xr, 3);
-    mk_gly(app);
-
-    XMapWindow(x11->disp, app->wd.self);
-    XMapSubwindows(x11->disp, app->wd.self);
-    x11->MainLoop(x11);
-    x11->CleanUp(x11);
-
-    return 0;
-}
-
-int main(int argc, char *argv[])
-{
-    return gmx::CommandLineModuleManager::runAsMainCMain(argc, argv, &gmx_xrama);
-}
diff --git a/src/ngmx/rama.bm b/src/ngmx/rama.bm
deleted file mode 100644 (file)
index eca8793..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 1991-2001
- * BIOSON Research Institute, Dept. of Biophysical Chemistry
- * University of Groningen, The Netherlands
- * Copyright (c) 2012, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-
-#define rama_width 48
-#define rama_height 48
-static unsigned char rama_bits[] = {
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x80, 0x00, 0x00, 0x00,
-   0x80, 0x0d, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x18, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00,
-   0x18, 0x33, 0x80, 0x00, 0x00, 0x00, 0x18, 0x30, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x03, 0x00, 0x00, 0x03, 0x80, 0x00, 0x03, 0x00,
-   0x00, 0x63, 0x80, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00};
diff --git a/src/ngmx/test_ngmx_dialog.c b/src/ngmx/test_ngmx_dialog.c
deleted file mode 100644 (file)
index 7008b64..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <xdlghi.h>
-
-int main(int argc, char *argv[])
-{
-    t_x11 *x11;
-    t_dlg *dlg;
-
-    if ((x11 = GetX11(&argc, argv)) == NULL)
-    {
-        fprintf(stderr, "No X!\n");
-        exit(1);
-    }
-    if (argc > 1)
-    {
-        dlg = ReadDlg(x11, 0, x11->title, x11->fg, x11->bg, argv[1], 100, 100, TRUE,
-                      TRUE, NULL, NULL);
-        ShowDlg(dlg);
-        x11->MainLoop(x11);
-    }
-    else
-    {
-        fprintf(stderr, "Usage: %s [ X options ] infile\n", argv[0]);
-    }
-
-    x11->CleanUp(x11);
-
-    return 0;
-}
diff --git a/src/ngmx/xstat.c b/src/ngmx/xstat.c
deleted file mode 100644 (file)
index 77c455c..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "sysstuff.h"
-#include "smalloc.h"
-#include "x11.h"
-#include "string2.h"
-#include "macros.h"
-#include "fgrid.h"
-#include "futil.h"
-#include "xdlg.h"
-#include "xdlghi.h"
-
-typedef struct {
-    int     nopt, nAppl;
-    char  **name;
-    char  **description;
-    char  **dlgfile;
-    t_dlg  *dlg;
-    t_dlg  *appl;
-} t_data;
-
-static void ApplCallback(t_x11 *x11, int dlg_mess, int item_id,
-                         char *set, void *dta)
-{
-    t_data    *data;
-    t_dlg     *dlg;
-    t_dlgitem *item;
-    int        i;
-    char       doit[1024];
-
-    data = (t_data *)dta;
-    dlg  = data->appl;
-
-    fprintf(stderr, "item_id: %d (%s)\n", item_id, set);
-    if (gmx_strcasecmp(set, "OK") == 0)
-    {
-        /* Doit */
-        sprintf(doit,
-                "xterm -geometry +100+100 -n %s"
-                " -title \"GROMACS: %s\" -e nice %s ",
-                data->name[data->nAppl],
-                data->name[data->nAppl],
-                data->name[data->nAppl]);
-        for (i = 0; (i < dlg->nitem); i++)
-        {
-            item = dlg->dlgitem[i];
-            switch (item->type)
-            {
-                case edlgRB:
-                    strcat(doit, item->set);
-                    strcat(doit, " ");
-                    break;
-                case edlgCB:
-                    if (item->u.checkbox.bChecked)
-                    {
-                        strcat(doit, item->set);
-                    }
-                    strcat(doit, " ");
-                    break;
-                case edlgET:
-                    if (strlen(item->u.edittext.buf) > 0)
-                    {
-                        strcat(doit, item->set);
-                        strcat(doit, " ");
-                        strcat(doit, item->u.edittext.buf);
-                        strcat(doit, " ");
-                    }
-                    break;
-                default:
-                    fprintf(stderr, "Type: %d\n", item->type);
-            }
-        }
-        strcat(doit, " &");
-        fprintf(stderr, "Going to exec: '%s'\n", doit);
-
-#ifdef GMX_NO_SYSTEM
-        printf("Warning-- No calls to system(3) supported on this platform.");
-        printf("Warning-- Skipping execution of 'system(\"%s\")'.", buf);
-#else
-        system(doit);
-#endif
-
-        HideDlg(data->appl);
-    }
-    else if (gmx_strcasecmp(set, "Cancel") == 0)
-    {
-        data->nAppl = -1;
-        HideDlg(data->appl);
-    }
-}
-
-static void Callback(t_x11 *x11, int dlg_mess, int item_id,
-                     char *set, void *dta)
-{
-    t_data *data = (t_data *)dta;
-
-    if (item_id == data->nopt)
-    {
-        fprintf(stderr, "Doei...\n");
-        exit(0);
-    }
-    else
-    {
-        fprintf(stderr, "%d: %s\n", item_id, data->description[item_id]);
-        if (data->nAppl != -1)
-        {
-            HideDlg(data->appl);
-        }
-        data->nAppl = item_id;
-        data->appl  = ReadDlg(x11, 0, data->name[item_id],
-                              BLACK, LIGHTGREY, data->dlgfile[item_id],
-                              50, 50, FALSE, FALSE, ApplCallback, data);
-        ShowDlg(data->appl);
-    }
-}
-
-static void read_opts(t_data *data)
-{
-    FILE *in;
-    char  fn[STRLEN], buf[STRLEN];
-    int   i, n;
-
-    sprintf(fn, "xstat.dat");
-    in = libopen(fn);
-    fscanf(in, "%d", &n);
-    data->nopt = n;
-    snew(data->name, data->nopt);
-    snew(data->description, data->nopt);
-    snew(data->dlgfile, data->nopt);
-
-    for (i = 0; (i < data->nopt); i++)
-    {
-        ReadQuoteString(fn, in, buf);
-        data->name[i] = strdup(buf);
-        ReadQuoteString(fn, in, buf);
-        data->description[i] = strdup(buf);
-        ReadQuoteString(fn, in, buf);
-        data->dlgfile[i] = strdup(buf);
-    }
-    ffclose(in);
-}
-
-static void add_opts(t_x11 *x11, t_data *data)
-{
-    t_dlgitem *but;
-    int        i, y0, w;
-
-    y0 = OFFS_Y;
-    for (i = 0; (i < data->nopt); i++)
-    {
-        but = CreateButton(x11, data->description[i], FALSE,
-                           (t_id)i, (t_id)0,
-                           OFFS_X, y0, 0, 0, 1);
-        AddDlgItem(data->dlg, but);
-        y0 += but->win.height+OFFS_Y;
-    }
-    but = CreateButton(x11, "Quit", TRUE, (t_id)data->nopt, (t_id)0,
-                       OFFS_X, y0, 0, 0, 1);
-    AddDlgItem(data->dlg, but);
-    y0 += but->win.height+OFFS_Y;
-
-    w = 0;
-    for (i = 0; (i <= data->nopt); i++)
-    {
-        w = max(w, QueryDlgItemW(data->dlg, i));
-    }
-    w += 2*OFFS_X;
-    for (i = 0; (i <= data->nopt); i++)
-    {
-        SetDlgItemSize(data->dlg, i, w, 0);
-    }
-    SetDlgSize(data->dlg, w+2*OFFS_X, y0, TRUE);
-}
-
-int
-main(int argc, char *argv[])
-{
-    t_x11  *x11;
-    t_data  data;
-
-    /* Initiate X and data */
-    if ((x11 = GetX11(&argc, argv)) == NULL)
-    {
-        fprintf(stderr, "Can't open DISPLAY\n");
-        exit(1);
-    }
-    read_opts(&data);
-    data.dlg = CreateDlg(x11, 0, argv[0], 0, 0, 0, 0, 0, BLACK, LIGHTGREY, Callback, &data);
-    add_opts(x11, &data);
-    data.nAppl = -1;
-
-    ShowDlg(data.dlg);
-    x11->MainLoop(x11);
-    HideDlg(data.dlg);
-}
index 02998643d4a8243ebabd6b43a25b6df5d1075422..a67168a5cfdb44171a8c9b5764d2b90c30d8a36b 100644 (file)
 include_directories(${CMAKE_SOURCE_DIR}/src/gromacs/gmxpreprocess)
 
 file(GLOB MDRUN_SOURCES mdrun/*.c mdrun/*.cpp)
 include_directories(${CMAKE_SOURCE_DIR}/src/gromacs/gmxpreprocess)
 
 file(GLOB MDRUN_SOURCES mdrun/*.c mdrun/*.cpp)
+if(X11_FOUND)
+    file(GLOB VIEW_SOURCES view/*.cpp)
+else()
+    file(GLOB VIEW_SOURCES view/view.cpp)
+endif(X11_FOUND)
 
 if(GMX_FAHCORE)
     add_library(fahcore ${MDRUN_SOURCES})
 
 if(GMX_FAHCORE)
     add_library(fahcore ${MDRUN_SOURCES})
@@ -48,9 +53,14 @@ elseif(GMX_BUILD_MDRUN_ONLY)
     install(TARGETS mdrun DESTINATION ${BIN_INSTALL_DIR} COMPONENT mdrun)
 else()
     file(GLOB GMX_EXECUTABLE_SOURCES gmx/*.c gmx/*.cpp)
     install(TARGETS mdrun DESTINATION ${BIN_INSTALL_DIR} COMPONENT mdrun)
 else()
     file(GLOB GMX_EXECUTABLE_SOURCES gmx/*.c gmx/*.cpp)
-    add_executable(gmx ${GMX_EXECUTABLE_SOURCES} ${MDRUN_SOURCES})
-    target_link_libraries(gmx
-        ${GMX_EXTRA_LIBRARIES} libgromacs ${GMX_EXE_LINKER_FLAGS})
+    add_executable(gmx ${GMX_EXECUTABLE_SOURCES} ${MDRUN_SOURCES} ${VIEW_SOURCES})
+    if(X11_FOUND)
+        target_link_libraries(gmx
+            ${GMX_EXTRA_LIBRARIES} libgromacs ${GMX_EXE_LINKER_FLAGS} ${X11_LIBRARIES})
+    else()
+        target_link_libraries(gmx
+            ${GMX_EXTRA_LIBRARIES} libgromacs ${GMX_EXE_LINKER_FLAGS})
+    endif(X11_FOUND)
     set_target_properties(gmx PROPERTIES
         OUTPUT_NAME "gmx${GMX_BINARY_SUFFIX}"
         COMPILE_FLAGS "${OpenMP_C_FLAGS}")
     set_target_properties(gmx PROPERTIES
         OUTPUT_NAME "gmx${GMX_BINARY_SUFFIX}"
         COMPILE_FLAGS "${OpenMP_C_FLAGS}")
index d1c81499f8e882022001014d64927cfb5679c41e..f5ca50ea2511ea9aecc59877a00012ab8fa7a1f6 100644 (file)
@@ -46,6 +46,7 @@
 
 #include "gromacs/gmxana/gmx_ana.h"
 
 
 #include "gromacs/gmxana/gmx_ana.h"
 
+#include "../view/view.h"
 #include "../mdrun/mdrun_main.h"
 
 extern "C"
 #include "../mdrun/mdrun_main.h"
 
 extern "C"
@@ -274,10 +275,11 @@ void registerLegacyModules(gmx::CommandLineModuleManager *manager)
                    "Perform weighted histogram analysis after umbrella sampling");
     registerModule(manager, &gmx_wheel, "wheel",
                    "Plot helical wheels");
                    "Perform weighted histogram analysis after umbrella sampling");
     registerModule(manager, &gmx_wheel, "wheel",
                    "Plot helical wheels");
+    registerModule(manager, &gmx_view, "view",
+                   "View a trajectory on an X-Windows terminal");
 
     // TODO: Also include binaries from other directories than src/tools/:
     //        "g_xrama|Show animated Ramachandran plots");
     //        "mdrun|finds a potential energy minimum and calculates the Hessian");
     //        "mdrun|with -rerun (re)calculates energies for trajectory frames");
 
     // TODO: Also include binaries from other directories than src/tools/:
     //        "g_xrama|Show animated Ramachandran plots");
     //        "mdrun|finds a potential energy minimum and calculates the Hessian");
     //        "mdrun|with -rerun (re)calculates energies for trajectory frames");
-    //        "ngmx|Display a trajectory");
 }
 }
similarity index 100%
rename from src/ngmx/Xstuff.h
rename to src/programs/view/Xstuff.h
similarity index 100%
rename from src/ngmx/alert.bm
rename to src/programs/view/alert.bm
similarity index 95%
rename from src/ngmx/buttons.c
rename to src/programs/view/buttons.cpp
index b46f8ff547148862118b43d7957b91d671cbc447..5a0fc376b8904e10ff25aaf0f1c291206d86bb6d 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -40,8 +40,8 @@
 #include <string.h>
 #include <smalloc.h>
 #include <macros.h>
 #include <string.h>
 #include <smalloc.h>
 #include <macros.h>
-#include <x11.h>
-#include <xutil.h>
+#include "x11.h"
+#include "xutil.h"
 #include "buttons.h"
 #include "stop_ani.bm"
 #include "play.bm"
 #include "buttons.h"
 #include "stop_ani.bm"
 #include "play.bm"
@@ -52,14 +52,14 @@ static void move_bbox(t_x11 *x11, t_butbox *bbox)
 {
     int        x0, y0;
     int        i, bw;
 {
     int        x0, y0;
     int        i, bw;
-    real       idb, bh;
+    real       idb, bh, one = 1.0;
     t_windata *wd;
 
     t_windata *wd;
 
-    bw  = max(1, bbox->wd.width-2*(AIR+BORDER));
+    bw  = std::max(1, bbox->wd.width-2*(AIR+BORDER));
     idb = bbox->nbut;
     bh  = (bbox->wd.height-AIR*(bbox->nbut+1));
     bh /= idb;
     idb = bbox->nbut;
     bh  = (bbox->wd.height-AIR*(bbox->nbut+1));
     bh /= idb;
-    bh  = max(bh, 1.0);
+    bh  = std::max(bh, one);
 
     x0 = AIR;
     y0 = AIR;
 
     x0 = AIR;
     y0 = AIR;
@@ -75,7 +75,7 @@ static void move_bbox(t_x11 *x11, t_butbox *bbox)
     }
 }
 
     }
 }
 
-static gmx_bool BBCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool BBCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_butbox *bbox;
 
 {
     t_butbox *bbox;
 
@@ -86,10 +86,10 @@ static gmx_bool BBCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         bbox->wd.height = event->xconfigure.height;
         move_bbox(x11, bbox);
     }
         bbox->wd.height = event->xconfigure.height;
         move_bbox(x11, bbox);
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-static gmx_bool VBCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool VBCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_butbox  *vbox;
     int        y0;
 {
     t_butbox  *vbox;
     int        y0;
@@ -105,7 +105,7 @@ static gmx_bool VBCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         XDrawLine(x11->disp, vbox->wd.self, x11->gc, 0, y0, vbox->wd.width, y0);
         XSetForeground(x11->disp, x11->gc, x11->fg);
     }
         XDrawLine(x11->disp, vbox->wd.self, x11->gc, 0, y0, vbox->wd.width, y0);
         XSetForeground(x11->disp, x11->gc, x11->fg);
     }
-    return FALSE;
+    return false;
 }
 
 void set_vbtime(t_x11 *x11, t_butbox *vbox, char *text)
 }
 
 void set_vbtime(t_x11 *x11, t_butbox *vbox, char *text)
@@ -115,7 +115,7 @@ void set_vbtime(t_x11 *x11, t_butbox *vbox, char *text)
     ExposeWin(x11->disp, vbox->wd.self);
 }
 
     ExposeWin(x11->disp, vbox->wd.self);
 }
 
-static gmx_bool ButtonCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool ButtonCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     XEvent     letter;
     t_mwbut   *but;
 {
     XEvent     letter;
     t_mwbut   *but;
@@ -162,7 +162,7 @@ static gmx_bool ButtonCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 t_butbox *init_vbox(t_x11 *x11, Window Parent, Window SendTo, unsigned long fg, unsigned long bg)
 }
 
 t_butbox *init_vbox(t_x11 *x11, Window Parent, Window SendTo, unsigned long fg, unsigned long bg)
similarity index 99%
rename from src/ngmx/buttons.h
rename to src/programs/view/buttons.h
index b5937bdc0c85c6b987cdf855d492c6501ed8f2bf..94688268e7c314cf0fa27577e1cdea77568cc0e3 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef _buttons_h
 #define _buttons_h
 
 #ifndef _buttons_h
 #define _buttons_h
 
-#include <xutil.h>
+#include "xutil.h"
 
 enum {
     IDROTX, IDROTY, IDROTZ, IDTRANSX, IDTRANSY, IDTRANSZ, IDZOOM, IDBUTNR,
 
 enum {
     IDROTX, IDROTY, IDROTZ, IDTRANSX, IDTRANSY, IDTRANSZ, IDZOOM, IDBUTNR,
similarity index 85%
rename from src/ngmx/dialogs.c
rename to src/programs/view/dialogs.cpp
index d46f33d38df92b50cfc14ceec3d9d770a2cdb8b9..4f6515bff4e6fc084ca639e3642f99fb5a3e31d9 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -145,12 +145,12 @@ static void MBCallback(t_x11 *x11, int dlg_mess, int item_id,
 
 static t_dlg *about_mb(t_x11 *x11, t_gmx *gmx)
 {
 
 static t_dlg *about_mb(t_x11 *x11, t_gmx *gmx)
 {
-    char *lines[] = {
+    const char *lines[] = {
         "         G R O M A C S",
         " Machine for Simulating Chemistry",
         "         G R O M A C S",
         " Machine for Simulating Chemistry",
-        "       Copyright (c) 1992-2000",
-        "  Dept. of Biophysical Chemistry",
-        "    University of Groningen"
+        "       Copyright (c) 1992-2013",
+        "  Berk Hess, David van der Spoel, Erik Lindahl",
+        "        and many collaborators!"
     };
 
     return MessageBox(x11, gmx->wd->self, gmx->wd->text,
     };
 
     return MessageBox(x11, gmx->wd->self, gmx->wd->text,
@@ -176,7 +176,7 @@ static void QuitCB(t_x11 *x11, int dlg_mess, int item_id,
 
 static t_dlg *quit_mb(t_x11 *x11, t_gmx *gmx)
 {
 
 static t_dlg *quit_mb(t_x11 *x11, t_gmx *gmx)
 {
-    char *lines[] = {
+    const char *lines[] = {
         " Do you really want to Quit ?"
     };
 
         " Do you really want to Quit ?"
     };
 
@@ -188,7 +188,7 @@ static t_dlg *quit_mb(t_x11 *x11, t_gmx *gmx)
 
 static t_dlg *help_mb(t_x11 *x11, t_gmx *gmx)
 {
 
 static t_dlg *help_mb(t_x11 *x11, t_gmx *gmx)
 {
-    char *lines[] = {
+    const char *lines[] = {
         " Help will soon be added"
     };
 
         " Help will soon be added"
     };
 
@@ -200,7 +200,7 @@ static t_dlg *help_mb(t_x11 *x11, t_gmx *gmx)
 
 static t_dlg *ni_mb(t_x11 *x11, t_gmx *gmx)
 {
 
 static t_dlg *ni_mb(t_x11 *x11, t_gmx *gmx)
 {
-    char *lines[] = {
+    const char *lines[] = {
         " This feature has not been",
         " implemented yet."
     };
         " This feature has not been",
         " implemented yet."
     };
@@ -218,7 +218,7 @@ enum {
 static void ExportCB(t_x11 *x11, int dlg_mess, int item_id,
                      char *set, void *data)
 {
 static void ExportCB(t_x11 *x11, int dlg_mess, int item_id,
                      char *set, void *data)
 {
-    gmx_bool   bOk;
+    bool       bOk;
     t_gmx     *gmx;
     t_dlg     *dlg;
 
     t_gmx     *gmx;
     t_dlg     *dlg;
 
@@ -280,9 +280,10 @@ static void BondsCB(t_x11 *x11, int dlg_mess, int item_id,
 {
     static int ebond = -1;
     static int ebox  = -1;
 {
     static int ebond = -1;
     static int ebox  = -1;
-    gmx_bool   bOk, bBond = FALSE;
+    bool       bOk, bBond = false;
     int        nskip, nwait;
     t_gmx     *gmx;
     int        nskip, nwait;
     t_gmx     *gmx;
+    char      *endptr;
 
     gmx = (t_gmx *)data;
     if (ebond == -1)
 
     gmx = (t_gmx *)data;
     if (ebond == -1)
@@ -296,12 +297,12 @@ static void BondsCB(t_x11 *x11, int dlg_mess, int item_id,
             if (item_id <= eBNR)
             {
                 ebond = item_id-1;
             if (item_id <= eBNR)
             {
                 ebond = item_id-1;
-                bBond = FALSE;
+                bBond = false;
             }
             else if (item_id <= eBNR+esbNR+1)
             {
                 ebox  = item_id-eBNR-2;
             }
             else if (item_id <= eBNR+esbNR+1)
             {
                 ebox  = item_id-eBNR-2;
-                bBond = TRUE;
+                bBond = true;
             }
             else
             {
             }
             else
             {
@@ -316,39 +317,44 @@ static void BondsCB(t_x11 *x11, int dlg_mess, int item_id,
                     case ebDPlus:
                         DO_NOT(gmx->man->bPlus);
 #ifdef DEBUG
                     case ebDPlus:
                         DO_NOT(gmx->man->bPlus);
 #ifdef DEBUG
-                        fprintf(stderr, "gmx->man->bPlus=%s\n", gmx_bool_names[gmx->man->bPlus]);
+                        fprintf(stderr, "gmx->man->bPlus=%s\n",
+                                gmx->man->bPlus ? "true" : "false");
 #endif
                         break;
 #endif
                         break;
-                    /*case ebSBox:
-                       set_box_type(x11,gmx->man->molw,ebond);
-                       break;*/
                     case ebRMPBC:
                         toggle_pbc(gmx->man);
                         break;
                     case ebCue:
                         DO_NOT(gmx->man->bSort);
 #ifdef DEBUG
                     case ebRMPBC:
                         toggle_pbc(gmx->man);
                         break;
                     case ebCue:
                         DO_NOT(gmx->man->bSort);
 #ifdef DEBUG
-                        fprintf(stderr, "gmx->man->bSort=%s\n", gmx_bool_names[gmx->man->bSort]);
+                        fprintf(stderr, "gmx->man->bSort=%s\n",
+                                gmx->man->bSort ? "true" : "false");
 #endif
                         break;
                     case ebSkip:
 #endif
                         break;
                     case ebSkip:
-                        sscanf(set, "%d", &nskip);
+                        nskip = strtol(set, &endptr, 10);
+                        if (endptr != set)
+                        {
 #ifdef DEBUG
 #ifdef DEBUG
-                        fprintf(stderr, "nskip: %d frames\n", nskip);
+                            fprintf(stderr, "nskip: %d frames\n", nskip);
 #endif
 #endif
-                        if (nskip >= 0)
-                        {
-                            gmx->man->nSkip = nskip;
+                            if (nskip >= 0)
+                            {
+                                gmx->man->nSkip = nskip;
+                            }
                         }
                         break;
                     case ebWait:
                         }
                         break;
                     case ebWait:
-                        sscanf(set, "%d", &nwait);
+                        nwait = strtol(set, &endptr, 10);
+                        if (endptr != set)
+                        {
 #ifdef DEBUG
 #ifdef DEBUG
-                        fprintf(stderr, "wait: %d ms\n", nwait);
+                            fprintf(stderr, "wait: %d ms\n", nwait);
 #endif
 #endif
-                        if (nwait >= 0)
-                        {
-                            gmx->man->nWait = nwait;
+                            if (nwait >= 0)
+                            {
+                                gmx->man->nWait = nwait;
+                            }
                         }
                     default:
 #ifdef DEBUG
                         }
                     default:
 #ifdef DEBUG
@@ -414,53 +420,41 @@ enum {
     esFUNCT = 1, esBSHOW, esINFIL, esINDEXFIL, esLSQ, esSHOW, esPLOTFIL
 };
 
     esFUNCT = 1, esBSHOW, esINFIL, esINDEXFIL, esLSQ, esSHOW, esPLOTFIL
 };
 
-static gmx_bool in_set(int i, int n, int set[])
+static bool in_set(int i, int n, int set[])
 {
     int j;
     for (j = 0; (j < n); j++)
     {
         if (set[j] == i)
         {
 {
     int j;
     for (j = 0; (j < n); j++)
     {
         if (set[j] == i)
         {
-            return TRUE;
+            return true;
         }
     }
         }
     }
-    return FALSE;
+    return false;
 }
 
 typedef t_dlg *t_mmb (t_x11 *x11, t_gmx *gmx);
 
 typedef struct {
 }
 
 typedef t_dlg *t_mmb (t_x11 *x11, t_gmx *gmx);
 
 typedef struct {
-    eDialogs    ed;
     const char  *dlgfile;
     DlgCallback *cb;
 } t_dlginit;
 
     const char  *dlgfile;
     DlgCallback *cb;
 } t_dlginit;
 
-typedef struct {
-    eMBoxes     ed;
-    t_mmb       *mmb;
-    DlgCallback *cb;
-} t_mbinit;
-
 void init_dlgs(t_x11 *x11, t_gmx *gmx)
 {
     static t_dlginit di[] = {
 void init_dlgs(t_x11 *x11, t_gmx *gmx)
 {
     static t_dlginit di[] = {
-        { edExport,   "export.dlg",   ExportCB },
-        { edBonds,    "bonds.dlg",    BondsCB  }
+        { "export.dlg",   ExportCB },
+        { "bonds.dlg",    BondsCB  }
     };
     };
-    static t_mbinit mi[emNR] = {
-        { emQuit,       quit_mb,    QuitCB     },
-        { emHelp,       help_mb,    MBCallback },
-        { emAbout,      about_mb,   MBCallback },
-        { emNotImplemented, ni_mb,      MBCallback }
-    };
-    int i;
+    static t_mmb *mi[emNR] = { quit_mb,    help_mb,    about_mb,   ni_mb };
+    unsigned int i;
 
     snew(gmx->dlgs, edNR);
     for (i = 0; (i < asize(di)); i++)
     {
         gmx->dlgs[i] = ReadDlg(x11, gmx->wd->self, di[i].dlgfile,
 
     snew(gmx->dlgs, edNR);
     for (i = 0; (i < asize(di)); i++)
     {
         gmx->dlgs[i] = ReadDlg(x11, gmx->wd->self, di[i].dlgfile,
-                               x11->fg, x11->bg, di[i].dlgfile,
-                               0, 0, TRUE, FALSE, di[i].cb, gmx);
+                               di[i].dlgfile,
+                               0, 0, true, false, di[i].cb, gmx);
     }
 
     gmx->dlgs[edFilter] = select_filter(x11, gmx);
     }
 
     gmx->dlgs[edFilter] = select_filter(x11, gmx);
@@ -468,7 +462,7 @@ void init_dlgs(t_x11 *x11, t_gmx *gmx)
     snew(gmx->mboxes, emNR);
     for (i = 0; (i < emNR); i++)
     {
     snew(gmx->mboxes, emNR);
     for (i = 0; (i < emNR); i++)
     {
-        gmx->mboxes[i] = mi[i].mmb(x11, gmx);
+        gmx->mboxes[i] = mi[i](x11, gmx);
     }
     gmx->which_mb = -1;
 }
     }
     gmx->which_mb = -1;
 }
similarity index 97%
rename from src/ngmx/dialogs.h
rename to src/programs/view/dialogs.h
index e3a9170f0fda09bcd0a91ccae2becd45d551aaf4..cdb3d43bf0c634629980a7d8534285dc14695738 100644 (file)
 #include "logo.h"
 
 typedef struct {
 #include "logo.h"
 
 typedef struct {
-    gmx_bool  bMapped;
+    bool      bMapped;
     t_dlg    *dlg;
 } t_dialogs;
 
     t_dlg    *dlg;
 } t_dialogs;
 
-typedef enum {
+enum eDialogs {
     edExport, edBonds, edFilter, edNR
     edExport, edBonds, edFilter, edNR
-} eDialogs;
+};
 
 
-typedef enum {
+enum eMBoxes {
     emQuit, emHelp, emAbout, emNotImplemented, emNR
     emQuit, emHelp, emAbout, emNotImplemented, emNR
-} eMBoxes;
+};
 
 
-typedef enum {
+enum eExport {
     eExpGromos, eExpPDB, eExpNR
     eExpGromos, eExpPDB, eExpNR
-} eExport;
+};
 
 typedef struct {
     char           confout[256]; /* Export file                        */
 
 typedef struct {
     char           confout[256]; /* Export file                        */
similarity index 100%
rename from src/ngmx/ff.bm
rename to src/programs/view/ff.bm
similarity index 93%
rename from src/ngmx/fgrid.c
rename to src/programs/view/fgrid.cpp
index 172e40cb7e1dd7348df313fdbadec120fc830cf0..a8ca08524671a2c7fd5a0526e2c30f9efdafe2e9 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -91,24 +91,17 @@ void ReadDlgError(const char *infile, eDLGERR err, const char *s,
             break;
     }
     fprintf(stderr, " in file %s\n", infile);
             break;
     }
     fprintf(stderr, " in file %s\n", infile);
-    fprintf(stderr, "C-File: %s, line: %d\n", file, line);
+    fprintf(stderr, "source file: %s, line: %d\n", file, line);
     exit(1);
 }
 
 #define ReadDlgErr(in, er, es) ReadDlgError(in, er, es, __FILE__, __LINE__)
 
     exit(1);
 }
 
 #define ReadDlgErr(in, er, es) ReadDlgError(in, er, es, __FILE__, __LINE__)
 
-static void GetBuf(FILE *in, char *buf)
-{
-    int rc;
-
-    rc = fscanf(in, "%s", buf);
-}
-
 static void ReadAccOpen(const char *infile, FILE *in)
 {
     char buf[STRLEN];
 
 static void ReadAccOpen(const char *infile, FILE *in)
 {
     char buf[STRLEN];
 
-    GetBuf(in, buf);
+    fscanf(in, "%4s", buf);
     if (strcmp(buf, "{") != 0)
     {
         ReadDlgErr(infile, eACCOEXP, buf);
     if (strcmp(buf, "{") != 0)
     {
         ReadDlgErr(infile, eACCOEXP, buf);
@@ -119,7 +112,7 @@ static void ReadAccClose(const char *infile, FILE *in)
 {
     char buf[STRLEN];
 
 {
     char buf[STRLEN];
 
-    GetBuf(in, buf);
+    fscanf(in, "%4s", buf);
     if (strcmp(buf, "}") != 0)
     {
         ReadDlgErr(infile, eACCCEXP, buf);
     if (strcmp(buf, "}") != 0)
     {
         ReadDlgErr(infile, eACCCEXP, buf);
@@ -174,7 +167,7 @@ static void ReadQuoteStringOrAccClose(FILE *in, char *buf)
     buf[i] = '\0';
 }
 
     buf[i] = '\0';
 }
 
-static gmx_bool bNotAccClose(const char *buf)
+static bool bNotAccClose(const char *buf)
 {
     return (strcmp(buf, "}") != 0);
 }
 {
     return (strcmp(buf, "}") != 0);
 }
@@ -324,7 +317,7 @@ static t_fitem *ScanFItem(const char *infile, FILE *in, char *buf)
     {
         /* Special case */
         edlg        = edlgBN;
     {
         /* Special case */
         edlg        = edlgBN;
-        fitem->bDef = TRUE;
+        fitem->bDef = true;
     }
     if (edlg == edlgNR+1)
     {
     }
     if (edlg == edlgNR+1)
     {
@@ -373,8 +366,6 @@ t_fgrid *FGridFromFile(const char *infile)
 {
     FILE      *in;
     char       buf[STRLEN];
 {
     FILE      *in;
     char       buf[STRLEN];
-    char      *gmxlib;
-    char       newinfile[STRLEN];
 
     t_fgrid   *fgrid;
     t_fgroup  *fgroup;
 
     t_fgrid   *fgrid;
     t_fgroup  *fgroup;
@@ -382,20 +373,20 @@ t_fgrid *FGridFromFile(const char *infile)
     int        gridx, gridy;
 
     in = libopen(infile);
     int        gridx, gridy;
 
     in = libopen(infile);
-    GetBuf(in, buf);
+    fscanf(in, "%6s", buf);
     if (strcmp(buf, "grid") != 0)
     {
         ReadDlgErr(infile, eGRIDEXP, buf);
     }
     fgrid = NewFGrid();
     if (strcmp(buf, "grid") != 0)
     {
         ReadDlgErr(infile, eGRIDEXP, buf);
     }
     fgrid = NewFGrid();
-    if ((fscanf(in, "%d%d", &gridx, &gridy)) != 2)
+    if ((fscanf(in, "%5d%5d", &gridx, &gridy)) != 2)
     {
         ReadDlgErr(infile, eNOVALS, "grid w,h");
     }
     fgrid->w = gridx;
     fgrid->h = gridy;
     ReadAccOpen(infile, in);
     {
         ReadDlgErr(infile, eNOVALS, "grid w,h");
     }
     fgrid->w = gridx;
     fgrid->h = gridy;
     ReadAccOpen(infile, in);
-    GetBuf(in, buf);
+    fscanf(in, "%15s", buf);
     while (bNotAccClose(buf))
     {
         if (strcmp(buf, "group") == 0)
     while (bNotAccClose(buf))
     {
         if (strcmp(buf, "group") == 0)
@@ -403,7 +394,7 @@ t_fgrid *FGridFromFile(const char *infile)
             fgroup = AddFGridFGroup(fgrid);
             ReadQuoteString(infile, in, buf);
             fgroup->name = strdup(buf);
             fgroup = AddFGridFGroup(fgrid);
             ReadQuoteString(infile, in, buf);
             fgroup->name = strdup(buf);
-            if ((fscanf(in, "%d%d%d%d", &fgroup->x, &fgroup->y, &fgroup->w, &fgroup->h)) != 4)
+            if ((fscanf(in, "%5d%5d%5d%5d", &fgroup->x, &fgroup->y, &fgroup->w, &fgroup->h)) != 4)
             {
                 ReadDlgErr(infile, eNOVALS, "group x,y,w,h");
             }
             {
                 ReadDlgErr(infile, eNOVALS, "group x,y,w,h");
             }
@@ -416,17 +407,17 @@ t_fgrid *FGridFromFile(const char *infile)
                 ReadDlgErr(infile, eTOOHIGH, buf);
             }
             ReadAccOpen(infile, in);
                 ReadDlgErr(infile, eTOOHIGH, buf);
             }
             ReadAccOpen(infile, in);
-            GetBuf(in, buf);
+            fscanf(in, "%15s", buf);
             while (bNotAccClose(buf))
             {
                 AddFGroupFItem(fgroup, ScanFItem(infile, in, buf));
             while (bNotAccClose(buf))
             {
                 AddFGroupFItem(fgroup, ScanFItem(infile, in, buf));
-                GetBuf(in, buf);
+                fscanf(in, "%15s", buf);
             }
         }
         else if (strcmp(buf, "simple") == 0)
         {
             fsimple = AddFGridFSimple(fgrid);
             }
         }
         else if (strcmp(buf, "simple") == 0)
         {
             fsimple = AddFGridFSimple(fgrid);
-            if ((fscanf(in, "%d%d%d%d", &fsimple->x, &fsimple->y, &fsimple->w, &fsimple->h)) != 4)
+            if ((fscanf(in, "%5d%5d%5d%5d", &fsimple->x, &fsimple->y, &fsimple->w, &fsimple->h)) != 4)
             {
                 ReadDlgErr(infile, eNOVALS, "simple x,y,w,h");
             }
             {
                 ReadDlgErr(infile, eNOVALS, "simple x,y,w,h");
             }
@@ -439,11 +430,11 @@ t_fgrid *FGridFromFile(const char *infile)
                 ReadDlgErr(infile, eTOOHIGH, "simple");
             }
             ReadAccOpen(infile, in);
                 ReadDlgErr(infile, eTOOHIGH, "simple");
             }
             ReadAccOpen(infile, in);
-            GetBuf(in, buf);
+            fscanf(in, "%15s", buf);
             fsimple->fitem = ScanFItem(infile, in, buf);
             ReadAccClose(infile, in);
         }
             fsimple->fitem = ScanFItem(infile, in, buf);
             ReadAccClose(infile, in);
         }
-        GetBuf(in, buf);
+        fscanf(in, "%15s", buf);
     }
     ffclose(in);
 
     }
     ffclose(in);
 
similarity index 87%
rename from src/ngmx/fgrid.h
rename to src/programs/view/fgrid.h
index 08b16d0d6cdad82914f198be59a14b7a4774fdae..b90978dcd87edf35e58618d75a0898deca92dfdb 100644 (file)
 #define _fgrid_h
 
 #include <typedefs.h>
 #define _fgrid_h
 
 #include <typedefs.h>
-#include <xdlg.h>
+#include "xdlgitem.h"
 
 typedef struct {
     edlgitem edlg;
 
 typedef struct {
     edlgitem edlg;
-    gmx_bool bDef;
+    bool     bDef;
     int      nname;
     char   **name;
     char    *set, *get, *def, *help;
     int      nname;
     char   **name;
     char    *set, *get, *def, *help;
@@ -72,14 +72,14 @@ typedef enum {
     eTOOWIDE, eTOOHIGH, eQUOTE,   eNOVALS
 } eDLGERR;
 
     eTOOWIDE, eTOOHIGH, eQUOTE,   eNOVALS
 } eDLGERR;
 
-extern void ReadDlgErr(const char *infile, eDLGERR err, const char *s);
+void ReadDlgErr(const char *infile, eDLGERR err, const char *s);
 
 
-extern t_fgrid *FGridFromFile(const char *infile);
+t_fgrid *FGridFromFile(const char *infile);
 
 
-extern void DoneFGrid(t_fgrid *fgrid);
+void DoneFGrid(t_fgrid *fgrid);
 
 
-extern void DumpFGrid(t_fgrid *fgrid);
+void DumpFGrid(t_fgrid *fgrid);
 
 
-extern void ReadQuoteString(const char *infile, FILE *in, char *buf);
+void ReadQuoteString(const char *infile, FILE *in, char *buf);
 
 #endif  /* _fgrid_h */
 
 #endif  /* _fgrid_h */
similarity index 93%
rename from src/ngmx/filter.c
rename to src/programs/view/filter.cpp
index b5cfdeec0dcad2c96a0931bed870471b96ae0da2..a9cec7e0b51bfdc99d08d5ea51cd86b7bffae332 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -61,7 +61,7 @@ t_filter *init_filter(t_atoms *atoms, const char *fn, int natom_trx)
     {
         snew(f->grps, 1);
         snew(f->grps->index, 1);
     {
         snew(f->grps, 1);
         snew(f->grps->index, 1);
-        analyse(atoms, f->grps, &f->grpnames, FALSE, FALSE);
+        analyse(atoms, f->grps, &f->grpnames, false, false);
     }
     snew(f->bDisable, f->grps->nr);
     for (g = 0; g < f->grps->nr; g++)
     }
     snew(f->bDisable, f->grps->nr);
     for (g = 0; g < f->grps->nr; g++)
@@ -97,7 +97,7 @@ static void FilterCB(t_x11 *x11, int dlg_mess, int item_id,
         case DLG_SET:
             if (set)
             {
         case DLG_SET:
             if (set)
             {
-                if (sscanf(set, "%d", &nset) == 1)
+                if (sscanf(set, "%10d", &nset) == 1)
                 {
                     f->bShow[nset] = !f->bShow[nset];
                 }
                 {
                     f->bShow[nset] = !f->bShow[nset];
                 }
@@ -123,7 +123,7 @@ t_dlg *select_filter(t_x11 *x11, t_gmx *gmx)
     len = strlen(title);
     for (i = 0; (i < (int)gmx->filter->grps->nr); i++)
     {
     len = strlen(title);
     for (i = 0; (i < (int)gmx->filter->grps->nr); i++)
     {
-        len = max(len, (int)strlen(gmx->filter->grpnames[i]));
+        len = std::max(len, (int)strlen(gmx->filter->grpnames[i]));
     }
     len += 2;
 
     }
     len += 2;
 
@@ -181,8 +181,8 @@ t_dlg *select_filter(t_x11 *x11, t_gmx *gmx)
     fprintf(tmp, "}\n\n}\n");
     fclose(tmp);
 
     fprintf(tmp, "}\n\n}\n");
     fclose(tmp);
 
-    dlg = ReadDlg(x11, gmx->wd->self, title, x11->fg, x11->bg, tmpfile,
-                  0, 0, TRUE, FALSE, FilterCB, gmx);
+    dlg = ReadDlg(x11, gmx->wd->self, title, tmpfile,
+                  0, 0, true, false, FilterCB, gmx);
 
     remove(tmpfile);
 
 
     remove(tmpfile);
 
similarity index 100%
rename from src/ngmx/info.bm
rename to src/programs/view/info.bm
similarity index 94%
rename from src/ngmx/logo.c
rename to src/programs/view/logo.cpp
index 4a4dbb5e9b10127ae2d67df80d2f69dcc614ffba..f0980df08261bdfe3186367a7d8fca9f09b4daf1 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
 #endif
 
 #include "sysstuff.h"
 #endif
 
 #include "sysstuff.h"
+#include "macros.h"
 #include "xutil.h"
 #include "Xstuff.h"
 #include "smalloc.h"
 #include "xutil.h"
 #include "Xstuff.h"
 #include "smalloc.h"
-#include "macros.h"
 #include "copyrite.h"
 #include "logo.h"
 
 #include "copyrite.h"
 #include "logo.h"
 
@@ -66,10 +66,10 @@ void hide_logo(t_x11 *x11, t_logo *logo)
     XUnmapWindow(x11->disp, logo->wd.self);
 }
 
     XUnmapWindow(x11->disp, logo->wd.self);
 }
 
-static gmx_bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     /* Assume window is 100x110 */
 {
     /* Assume window is 100x110 */
-    static gmx_bool bFirst = TRUE;
+    static bool bFirst = true;
 #define CSIZE 9
 #define NSIZE 8
 #define OSIZE 9
 #define CSIZE 9
 #define NSIZE 8
 #define OSIZE 9
@@ -84,7 +84,7 @@ static gmx_bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         { 40, YOFFS+22, CSIZE, &LIGHTGREEN },
         { 40, YOFFS+34, CSIZE, &LIGHTGREEN },
         { 50, YOFFS+12, CSIZE, &LIGHTGREEN },
         { 40, YOFFS+22, CSIZE, &LIGHTGREEN },
         { 40, YOFFS+34, CSIZE, &LIGHTGREEN },
         { 50, YOFFS+12, CSIZE, &LIGHTGREEN },
-        { 50, YOFFS, OSIZE, &LIGHTRED   },
+        { 50, YOFFS,    OSIZE, &LIGHTRED   },
         { 60, YOFFS+22, NSIZE, &LIGHTCYAN  },
         { 60, YOFFS+32, HSIZE, &WHITE     },
         { 70, YOFFS+12, CSIZE, &LIGHTGREEN },
         { 60, YOFFS+22, NSIZE, &LIGHTCYAN  },
         { 60, YOFFS+32, HSIZE, &WHITE     },
         { 70, YOFFS+12, CSIZE, &LIGHTGREEN },
@@ -102,7 +102,7 @@ static gmx_bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
     static t_mess   Mess[] = {
         { "GROMACS",                         0,       20, NULL },
         { NULL,                             16,        9, NULL },
     static t_mess   Mess[] = {
         { "GROMACS",                         0,       20, NULL },
         { NULL,                             16,        9, NULL },
-        { "Copyright (c) 1991-2010",        COFFS+ 2,  9, NULL },
+        { "Copyright (c) 1991-2013",        COFFS+ 2,  9, NULL },
         { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11,  9, NULL },
         { "& Groningen University ",        COFFS+20,  9, NULL },
         { "click to dismiss",               COFFS+31,  8, NULL }
         { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11,  9, NULL },
         { "& Groningen University ",        COFFS+20,  9, NULL },
         { "click to dismiss",               COFFS+31,  8, NULL }
@@ -132,7 +132,7 @@ static gmx_bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
             Mess[i].fnt = (i == 0) ? logo->bigfont : (i == NMESS-1) ? x11->font :
                 logo->smallfont;
         }
             Mess[i].fnt = (i == 0) ? logo->bigfont : (i == NMESS-1) ? x11->font :
                 logo->smallfont;
         }
-        bFirst = FALSE;
+        bFirst = false;
     }
     switch (event->type)
     {
     }
     switch (event->type)
     {
@@ -152,7 +152,7 @@ static gmx_bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
             }
             XSetForeground(x11->disp, x11->gc, BLACK);
             XDrawRectangle(x11->disp, wd->self, x11->gc, 2, 2, wd->width-5, wd->height-5);
             }
             XSetForeground(x11->disp, x11->gc, BLACK);
             XDrawRectangle(x11->disp, wd->self, x11->gc, 2, 2, wd->width-5, wd->height-5);
-            for (i = 0; (i < asize(Mess)); i++)
+            for (i = 0; (i < NMESS); i++)
             {
                 SpecialTextInRect(x11, Mess[i].fnt, wd->self, Mess[i].text,
                                   0, Mess[i].y, wd->width, Mess[i].h,
             {
                 SpecialTextInRect(x11, Mess[i].fnt, wd->self, Mess[i].text,
                                   0, Mess[i].y, wd->width, Mess[i].h,
@@ -168,10 +168,10 @@ static gmx_bool LogoCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
             break;
     }
 
             break;
     }
 
-    return FALSE;
+    return false;
 }
 
 }
 
-t_logo *init_logo(t_x11 *x11, Window parent, gmx_bool bQuitOnClick)
+t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick)
 {
     static const char *bfname[] = {
         "-b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1",
 {
     static const char *bfname[] = {
         "-b&h-lucida-bold-i-normal-sans-34-240-100-100-p-215-iso8859-1",
@@ -188,7 +188,7 @@ t_logo *init_logo(t_x11 *x11, Window parent, gmx_bool bQuitOnClick)
         "fixed"
     };
 #define NSF asize(sfname)
         "fixed"
     };
 #define NSF asize(sfname)
-    int                i;
+    unsigned int       i;
     unsigned long      bg;
     char              *newcol;
     t_logo            *logo;
     unsigned long      bg;
     char              *newcol;
     t_logo            *logo;
similarity index 92%
rename from src/ngmx/logo.h
rename to src/programs/view/logo.h
index 0d29ff62c357e625d9ad18ee138e326ca829cab5..9f1cdc3e0b82429fd4d6ccf537405885daf0c86d 100644 (file)
 #ifndef _logo_h
 #define _logo_h
 
 #ifndef _logo_h
 #define _logo_h
 
-#include <x11.h>
-#include <xutil.h>
+#include "x11.h"
+#include "xutil.h"
 
 typedef struct {
     XFontStruct *bigfont;
     XFontStruct *smallfont;
     t_windata    wd;
 
 typedef struct {
     XFontStruct *bigfont;
     XFontStruct *smallfont;
     t_windata    wd;
-    gmx_bool     bQuitOnClick;
+    bool         bQuitOnClick;
 } t_logo;
 
 extern void show_logo(t_x11 *x11, t_logo *logo);
 
 extern void hide_logo(t_x11 *x11, t_logo *logo);
 
 } t_logo;
 
 extern void show_logo(t_x11 *x11, t_logo *logo);
 
 extern void hide_logo(t_x11 *x11, t_logo *logo);
 
-extern t_logo *init_logo(t_x11 *x11, Window parent, gmx_bool bQuitOnClick);
+extern t_logo *init_logo(t_x11 *x11, Window parent, bool bQuitOnClick);
 
 extern void done_logo(t_x11 *x11, t_logo *logo);
 
 
 extern void done_logo(t_x11 *x11, t_logo *logo);
 
similarity index 90%
rename from src/ngmx/manager.c
rename to src/programs/view/manager.cpp
index cf4d4c0dd7107967c621e2420aaadf324d51a565..63e42164eea9089198c802a2b874ec01368ced4b 100644 (file)
@@ -69,9 +69,9 @@ static void add_object(t_manager *man, eObject eO, atom_id ai, atom_id aj)
 }
 
 static void add_bonds(t_manager *man, t_functype func[],
 }
 
 static void add_bonds(t_manager *man, t_functype func[],
-                      t_ilist *b, gmx_bool bB[])
+                      t_ilist *b, bool bB[])
 {
 {
-    gmx_bool    *bH = man->bHydro;
+    bool        *bH = man->bHydro;
     t_iatom     *ia;
     t_iatom      type, ai, aj, ak;
     int          i, delta, ftype;
     t_iatom     *ia;
     t_iatom      type, ai, aj, ak;
     int          i, delta, ftype;
@@ -91,7 +91,7 @@ static void add_bonds(t_manager *man, t_functype func[],
         {
             aj     = ia[2];
             ak     = ia[3];
         {
             aj     = ia[2];
             ak     = ia[3];
-            bB[ai] = bB[aj] = bB[ak] = TRUE;
+            bB[ai] = bB[aj] = bB[ak] = true;
             add_object(man, eOHBond, ai, aj);
             add_object(man, eOHBond, ai, ak);
         }
             add_object(man, eOHBond, ai, aj);
             add_object(man, eOHBond, ai, ak);
         }
@@ -101,7 +101,7 @@ static void add_bonds(t_manager *man, t_functype func[],
 #ifdef DEBUG
             fprintf(stderr, "Adding bond from %d to %d\n", ai, aj);
 #endif
 #ifdef DEBUG
             fprintf(stderr, "Adding bond from %d to %d\n", ai, aj);
 #endif
-            bB[ai] = bB[aj] = TRUE;
+            bB[ai] = bB[aj] = true;
             if (!(bH[ai] == bH[aj]))
             {
                 add_object(man, eOHBond, ai, aj);
             if (!(bH[ai] == bH[aj]))
             {
                 add_object(man, eOHBond, ai, aj);
@@ -119,7 +119,7 @@ static void add_bonds(t_manager *man, t_functype func[],
     }
 }
 
     }
 }
 
-static void add_bpl(t_manager *man, t_idef *idef, gmx_bool bB[])
+static void add_bpl(t_manager *man, t_idef *idef, bool bB[])
 {
     int ftype;
 
 {
     int ftype;
 
@@ -151,7 +151,7 @@ static atom_id which_atom(t_manager *man, int x, int y)
     return NO_ATID;
 }
 
     return NO_ATID;
 }
 
-static void do_label(t_x11 *x11, t_manager *man, int x, int y, gmx_bool bSet)
+static void do_label(t_x11 *x11, t_manager *man, int x, int y, bool bSet)
 {
     atom_id         ai;
     unsigned long   col;
 {
     atom_id         ai;
     unsigned long   col;
@@ -163,12 +163,12 @@ static void do_label(t_x11 *x11, t_manager *man, int x, int y, gmx_bool bSet)
         if (bSet && !man->bLabel[ai])
         {
             col             = WHITE;
         if (bSet && !man->bLabel[ai])
         {
             col             = WHITE;
-            man->bLabel[ai] = TRUE;
+            man->bLabel[ai] = true;
         }
         else if (!bSet && man->bLabel[ai])
         {
             col             = BLUE;
         }
         else if (!bSet && man->bLabel[ai])
         {
             col             = BLUE;
-            man->bLabel[ai] = FALSE;
+            man->bLabel[ai] = false;
         }
         else
         {
         }
         else
         {
@@ -183,12 +183,12 @@ static void do_label(t_x11 *x11, t_manager *man, int x, int y, gmx_bool bSet)
 
 static void show_label(t_x11 *x11, t_manager *man, int x, int y)
 {
 
 static void show_label(t_x11 *x11, t_manager *man, int x, int y)
 {
-    do_label(x11, man, x, y, TRUE);
+    do_label(x11, man, x, y, true);
 }
 
 static void hide_label(t_x11 *x11, t_manager *man, int x, int y)
 {
 }
 
 static void hide_label(t_x11 *x11, t_manager *man, int x, int y)
 {
-    do_label(x11, man, x, y, FALSE);
+    do_label(x11, man, x, y, false);
 }
 
 void set_file(t_x11 *x11, t_manager *man, const char *trajectory,
 }
 
 void set_file(t_x11 *x11, t_manager *man, const char *trajectory,
@@ -198,10 +198,10 @@ void set_file(t_x11 *x11, t_manager *man, const char *trajectory,
     char              buf[256], quote[256];
     t_tpxheader       sh;
     t_atoms          *at;
     char              buf[256], quote[256];
     t_tpxheader       sh;
     t_atoms          *at;
-    gmx_bool         *bB;
-    int               i, idum;
+    bool             *bB;
+    int               i;
 
 
-    read_tpxheader(status, &sh, TRUE, NULL, NULL);
+    read_tpxheader(status, &sh, true, NULL, NULL);
     snew(man->ix, sh.natoms);
     snew(man->zz, sh.natoms);
     snew(man->col, sh.natoms);
     snew(man->ix, sh.natoms);
     snew(man->zz, sh.natoms);
     snew(man->col, sh.natoms);
@@ -211,16 +211,16 @@ void set_file(t_x11 *x11, t_manager *man, const char *trajectory,
     snew(man->bVis, sh.natoms);
     for (i = 0; (i < sh.natoms); i++)
     {
     snew(man->bVis, sh.natoms);
     for (i = 0; (i < sh.natoms); i++)
     {
-        man->bVis[i] = FALSE;
+        man->bVis[i] = false;
     }
 
     }
 
-    man->bPbc = FALSE;
+    man->bPbc = false;
 
     snew(man->szLab, sh.natoms);
     snew(man->bHydro, sh.natoms);
     snew(bB, sh.natoms);
     read_tpx_top(status, NULL, man->box, &man->natom, NULL, NULL, NULL, &man->top);
 
     snew(man->szLab, sh.natoms);
     snew(man->bHydro, sh.natoms);
     snew(bB, sh.natoms);
     read_tpx_top(status, NULL, man->box, &man->natom, NULL, NULL, NULL, &man->top);
-    man->gpbc = gmx_rmpbc_init(&man->top.idef, -1, man->natom, man->box);
+    man->gpbc = gmx_rmpbc_init(&man->top.idef, -1, man->natom);
 
     man->natom =
         read_first_x(man->oenv, &man->status, trajectory, &(man->time), &(man->x),
 
     man->natom =
         read_first_x(man->oenv, &man->status, trajectory, &(man->time), &(man->x),
@@ -292,24 +292,6 @@ void step_message(t_x11 *x11, t_manager *man)
     XSendEvent(x11->disp, letter.xclient.window, True, 0, &letter);
 }
 
     XSendEvent(x11->disp, letter.xclient.window, True, 0, &letter);
 }
 
-gmx_bool ReadMonfile(char *fn, int *nbars, int *bars)
-{
-    FILE *fp;
-    if ((fp = fopen(fn, "r")) == NULL)
-    {
-        return(FALSE);
-    }
-    else
-    {
-        for ((*nbars) = 0; fscanf(fp, "%d", &bars[*nbars]) > 0; (*nbars)++)
-        {
-            ;
-        }
-        fclose(fp);
-        return (TRUE);
-    }
-}
-
 static void reset_mols(t_block *mols, matrix box, rvec x[])
 {
     int  i, m0, m1, j, m;
 static void reset_mols(t_block *mols, matrix box, rvec x[])
 {
     int  i, m0, m1, j, m;
@@ -357,12 +339,11 @@ static void reset_mols(t_block *mols, matrix box, rvec x[])
     }
 }
 
     }
 }
 
-static gmx_bool step_man(t_manager *man, int *nat)
+static bool step_man(t_manager *man, int *nat)
 {
     static int      ncount = 0;
 {
     static int      ncount = 0;
-    static gmx_bool bWarn  = FALSE;
-    gmx_bool        bEof;
-    int             dum;
+    static bool     bWarn  = false;
+    bool            bEof;
     const char     *warn;
 
     if (!man->natom)
     const char     *warn;
 
     if (!man->natom)
@@ -370,7 +351,7 @@ static gmx_bool step_man(t_manager *man, int *nat)
         fprintf(stderr, "Not initiated yet!");
         exit(1);
     }
         fprintf(stderr, "Not initiated yet!");
         exit(1);
     }
-    bEof = read_next_x(man->oenv, man->status, &man->time, man->natom, man->x, man->box);
+    bEof = read_next_x(man->oenv, man->status, &man->time, man->x, man->box);
     *nat = man->natom;
     if (ncount == man->nSkip)
     {
     *nat = man->natom;
     if (ncount == man->nSkip)
     {
@@ -385,7 +366,7 @@ static gmx_bool step_man(t_manager *man, int *nat)
                 if (warn && !bWarn)
                 {
                     fprintf(stderr, "\n%s\n", warn);
                 if (warn && !bWarn)
                 {
                     fprintf(stderr, "\n%s\n", warn);
-                    bWarn = TRUE;
+                    bWarn = true;
                 }
                 break;
             case esbRect:
                 }
                 break;
             case esbRect:
@@ -414,9 +395,9 @@ static gmx_bool step_man(t_manager *man, int *nat)
 
 static void HandleClient(t_x11 *x11, t_manager *man, long data[])
 {
 
 static void HandleClient(t_x11 *x11, t_manager *man, long data[])
 {
-    int      ID, button, x, y;
-    gmx_bool bPos;
-    real     fac;
+    int  ID, button, x, y;
+    bool bPos;
+    real fac;
 
     ID     = data[0];
     button = data[1];
 
     ID     = data[0];
     button = data[1];
@@ -458,9 +439,9 @@ static void HandleClient(t_x11 *x11, t_manager *man, long data[])
             if (man->status)
             {
                 rewind_trj(man->status);
             if (man->status)
             {
                 rewind_trj(man->status);
-                read_next_x(man->oenv, man->status, &(man->time), man->natom, man->x,
+                read_next_x(man->oenv, man->status, &(man->time), man->x,
                             man->box);
                             man->box);
-                man->bEof = FALSE;
+                man->bEof = false;
                 draw_mol(x11, man);
             }
             break;
                 draw_mol(x11, man);
             }
             break;
@@ -471,8 +452,8 @@ static void HandleClient(t_x11 *x11, t_manager *man, long data[])
             nat = 0;
             if (!step_man(man, &nat))
             {
             nat = 0;
             if (!step_man(man, &nat))
             {
-                man->bEof  = TRUE;
-                man->bStop = TRUE;
+                man->bEof  = true;
+                man->bStop = true;
             }
             else
             {
             }
             else
             {
@@ -485,10 +466,10 @@ static void HandleClient(t_x11 *x11, t_manager *man, long data[])
             break;
         }
         case IDFF:
             break;
         }
         case IDFF:
-            man->bStop = FALSE;
+            man->bStop = false;
             break;
         case IDSTOP_ANI:
             break;
         case IDSTOP_ANI:
-            man->bStop = TRUE;
+            man->bStop = true;
             break;
         case IDDRAWMOL:
             draw_mol(x11, man);
             break;
         case IDDRAWMOL:
             draw_mol(x11, man);
@@ -514,7 +495,7 @@ static void HandleClient(t_x11 *x11, t_manager *man, long data[])
     }
 }
 
     }
 }
 
-static gmx_bool TitleCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool TitleCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_windata *wd;
 
 {
     t_windata *wd;
 
@@ -535,10 +516,10 @@ static gmx_bool TitleCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
             wd->height = event->xconfigure.height;
             break;
     }
             wd->height = event->xconfigure.height;
             break;
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-static gmx_bool ManCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool ManCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_manager *man;
     int        width, height;
 {
     t_manager *man;
     int        width, height;
@@ -560,7 +541,7 @@ static gmx_bool ManCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 void no_labels(t_x11 *x11, t_manager *man)
 }
 
 void no_labels(t_x11 *x11, t_manager *man)
@@ -569,7 +550,7 @@ void no_labels(t_x11 *x11, t_manager *man)
 
     for (i = 0; (i < man->natom); i++)
     {
 
     for (i = 0; (i < man->natom); i++)
     {
-        man->bLabel[i] = FALSE;
+        man->bLabel[i] = false;
     }
     draw_mol(x11, man);
 }
     }
     draw_mol(x11, man);
 }
@@ -626,13 +607,13 @@ void map_man(t_x11 *x11, t_manager *man)
     show_but(x11, man->bbox);
 }
 
     show_but(x11, man->bbox);
 }
 
-gmx_bool toggle_animate (t_x11 *x11, t_manager *man)
+bool toggle_animate (t_x11 *x11, t_manager *man)
 {
     if (man->status)
     {
         man->bAnimate = !man->bAnimate;
 {
     if (man->status)
     {
         man->bAnimate = !man->bAnimate;
-        man->bStop    = TRUE;
-        man->bEof     = FALSE;
+        man->bStop    = true;
+        man->bEof     = false;
         if (man->bAnimate)
         {
             show_but(x11, man->vbox);
         if (man->bAnimate)
         {
             show_but(x11, man->vbox);
@@ -645,7 +626,7 @@ gmx_bool toggle_animate (t_x11 *x11, t_manager *man)
     return man->bAnimate;
 }
 
     return man->bAnimate;
 }
 
-gmx_bool toggle_pbc (t_manager *man)
+bool toggle_pbc (t_manager *man)
 {
     man->bPbc = !man->bPbc;
 
 {
     man->bPbc = !man->bPbc;
 
@@ -663,8 +644,8 @@ t_manager *init_man(t_x11 *x11, Window Parent,
 
     snew(man, 1);
     man->status = NULL;
 
     snew(man, 1);
     man->status = NULL;
-    man->bPlus  = TRUE;
-    man->bSort  = TRUE;
+    man->bPlus  = true;
+    man->bSort  = true;
     man->oenv   = oenv;
     InitWin(&(man->wd), x, y, width, height, 0, "Manager");
     man->wd.self = XCreateSimpleWindow(x11->disp, Parent, man->wd.x, man->wd.y,
     man->oenv   = oenv;
     InitWin(&(man->wd), x, y, width, height, 0, "Manager");
     man->wd.self = XCreateSimpleWindow(x11->disp, Parent, man->wd.x, man->wd.y,
@@ -724,7 +705,7 @@ void do_filter(t_x11 *x11, t_manager *man, t_filter *filter)
 
     for (i = 0; (i < man->natom); i++)
     {
 
     for (i = 0; (i < man->natom); i++)
     {
-        man->bVis[i] = FALSE;
+        man->bVis[i] = false;
     }
     for (i = 0; (i < filter->grps->nr); i++)
     {
     }
     for (i = 0; (i < filter->grps->nr); i++)
     {
@@ -732,7 +713,7 @@ void do_filter(t_x11 *x11, t_manager *man, t_filter *filter)
         {
             for (j = filter->grps->index[i]; (j < filter->grps->index[i+1]); j++)
             {
         {
             for (j = filter->grps->index[i]; (j < filter->grps->index[i+1]); j++)
             {
-                man->bVis[filter->grps->a[j]] = TRUE;
+                man->bVis[filter->grps->a[j]] = true;
             }
         }
     }
             }
         }
     }
similarity index 86%
rename from src/ngmx/manager.h
rename to src/programs/view/manager.h
index 3f8767405360cc0f5f835bde1dd1be90579468cd..4a150764900083bb8fe6c4cfc55d67dd20b72269 100644 (file)
 #define LDHEIGHT      0
 #define LEGHEIGHT    60
 
 #define LDHEIGHT      0
 #define LEGHEIGHT    60
 
-typedef enum {
+enum eObject {
     eOSingle, eOBond, eOHBond, eONR
     eOSingle, eOBond, eOHBond, eONR
-} eObject;
+};
 
 
-typedef enum {
+enum eVisible {
     eVNormal, eVSpecial, eVHidden, evNR
     eVNormal, eVSpecial, eVHidden, evNR
-} eVisible;
+};
 
 
-enum {
+enum eBwidth {
     eBThin, eBFat, eBVeryFat, eBSpheres, eBNR
 };
 
     eBThin, eBFat, eBVeryFat, eBSpheres, eBNR
 };
 
-enum {
+enum esBox {
     esbNone, esbRect, esbTri, esbTrunc, esbNR
 };
 
 typedef struct {
     t_windata     wd;            /* Mol window structure                       */
     esbNone, esbRect, esbTri, esbTrunc, esbNR
 };
 
 typedef struct {
     t_windata     wd;            /* Mol window structure                       */
-    gmx_bool      bShowHydrogen; /* Show Hydrogens?                    */
+    bool          bShowHydrogen; /* Show Hydrogens?                    */
     int           bond_type;     /* Show one of the above bondtypes      */
     int           ePBC;          /* PBC type                             */
     int           boxtype;       /* Rectangular, Tric, TruncOct (display)*/
     int           bond_type;     /* Show one of the above bondtypes      */
     int           ePBC;          /* PBC type                             */
     int           boxtype;       /* Rectangular, Tric, TruncOct (display)*/
@@ -88,8 +88,8 @@ typedef struct {
 typedef struct {
     t_blocka    *grps;     /* Blocks with atom numbers         */
     char       **grpnames; /* The names of the groups          */
 typedef struct {
     t_blocka    *grps;     /* Blocks with atom numbers         */
     char       **grpnames; /* The names of the groups          */
-    gmx_bool    *bDisable; /* Group indexes out of natoms in TRX   */
-    gmx_bool    *bShow;    /* Show a group ?                   */
+    bool        *bDisable; /* Group indexes out of natoms in TRX   */
+    bool        *bShow;    /* Show a group ?                   */
 } t_filter;
 
 /*
 } t_filter;
 
 /*
@@ -113,19 +113,19 @@ typedef struct {
     matrix         box;      /* The box                                */
     int            nobj;     /* The number of objects          */
     t_object      *obj;      /* The objects on screen          */
     matrix         box;      /* The box                                */
     int            nobj;     /* The number of objects          */
     t_object      *obj;      /* The objects on screen          */
-    gmx_bool      *bHydro;   /* TRUE for hydrogen atoms                */
-    gmx_bool      *bLabel;   /* Show a label on atom i?              */
+    bool          *bHydro;   /* true for hydrogen atoms                */
+    bool          *bLabel;   /* Show a label on atom i?              */
     char         **szLab;    /* Array of pointers to labels          */
     unsigned long *col;      /* The colour of the atoms                */
     int           *size;     /* The size of the atoms          */
     real          *vdw;      /* The VDWaals radius of the atoms        */
     char         **szLab;    /* Array of pointers to labels          */
     unsigned long *col;      /* The colour of the atoms                */
     int           *size;     /* The size of the atoms          */
     real          *vdw;      /* The VDWaals radius of the atoms        */
-    gmx_bool      *bVis;     /* visibility of atoms                  */
-    gmx_bool       bPbc;     /* Remove Periodic boundary             */
-    gmx_bool       bAnimate; /* Animation going on?                    */
-    gmx_bool       bEof;     /* End of file reached?                 */
-    gmx_bool       bStop;    /* Stopped by user?                     */
-    gmx_bool       bSort;    /* Sort the coordinates                   */
-    gmx_bool       bPlus;    /* Draw plus for single atom              */
+    bool          *bVis;     /* visibility of atoms                  */
+    bool           bPbc;     /* Remove Periodic boundary             */
+    bool           bAnimate; /* Animation going on?                    */
+    bool           bEof;     /* End of file reached?                 */
+    bool           bStop;    /* Stopped by user?                     */
+    bool           bSort;    /* Sort the coordinates                   */
+    bool           bPlus;    /* Draw plus for single atom              */
     int            nSkip;    /* Skip n steps after each frame  */
     int            nWait;    /* Wait n ms after each frame           */
     gmx_rmpbc_t    gpbc;     /* For removing peridiocity             */
     int            nSkip;    /* Skip n steps after each frame  */
     int            nWait;    /* Wait n ms after each frame           */
     gmx_rmpbc_t    gpbc;     /* For removing peridiocity             */
@@ -161,9 +161,9 @@ extern void map_man(t_x11 *x11, t_manager *man);
 
 extern void move_man(t_x11 *x11, t_manager *man, int width, int height);
 
 
 extern void move_man(t_x11 *x11, t_manager *man, int width, int height);
 
-extern gmx_bool toggle_animate (t_x11 *x11, t_manager *man);
+extern bool toggle_animate (t_x11 *x11, t_manager *man);
 
 
-extern gmx_bool toggle_pbc (t_manager *man);
+extern bool toggle_pbc (t_manager *man);
 
 extern void no_labels(t_x11 *x11, t_manager *man);
 /* Turn off all labels */
 
 extern void no_labels(t_x11 *x11, t_manager *man);
 /* Turn off all labels */
similarity index 91%
rename from src/ngmx/molps.c
rename to src/programs/view/molps.cpp
index 736594e40420b1f18568060a39326991975b8b77..a2f851e79a3d1c776fbbcb8c528102c419352d56 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -78,7 +78,7 @@ static void init_pbc(matrix box)
     }
 }
 
     }
 }
 
-static gmx_bool local_pbc_dx(rvec x1, rvec x2)
+static bool local_pbc_dx(rvec x1, rvec x2)
 {
     int  i;
     real dx;
 {
     int  i;
     real dx;
@@ -88,19 +88,19 @@ static gmx_bool local_pbc_dx(rvec x1, rvec x2)
         dx = x1[i]-x2[i];
         if (dx > gl_hbox[i])
         {
         dx = x1[i]-x2[i];
         if (dx > gl_hbox[i])
         {
-            return FALSE;
+            return false;
         }
         else if (dx <= gl_mhbox[i])
         {
         }
         else if (dx <= gl_mhbox[i])
         {
-            return FALSE;
+            return false;
         }
     }
         }
     }
-    return TRUE;
+    return true;
 }
 
 static void ps_draw_bond(t_psdata ps,
                          atom_id ai, atom_id aj, iv2 vec2[],
 }
 
 static void ps_draw_bond(t_psdata ps,
                          atom_id ai, atom_id aj, iv2 vec2[],
-                         rvec x[], char **atomnm[], int size[], gmx_bool bBalls)
+                         rvec x[], char **atomnm[], int size[], bool bBalls)
 {
     char    *ic, *jc;
     int      xi, yi, xj, yj;
 {
     char    *ic, *jc;
     int      xi, yi, xj, yj;
@@ -142,14 +142,14 @@ static void ps_draw_bond(t_psdata ps,
 }
 
 void ps_draw_objects(t_psdata ps, int nobj, t_object objs[], iv2 vec2[], rvec x[],
 }
 
 void ps_draw_objects(t_psdata ps, int nobj, t_object objs[], iv2 vec2[], rvec x[],
-                     char **atomnm[], int size[], gmx_bool bShowHydro, int bond_type,
-                     gmx_bool bPlus)
+                     char **atomnm[], int size[], bool bShowHydro, int bond_type,
+                     bool bPlus)
 {
 {
-    gmx_bool     bBalls;
+    bool         bBalls;
     int          i;
     t_object    *obj;
 
     int          i;
     t_object    *obj;
 
-    bBalls = FALSE;
+    bBalls = false;
     for (i = 0; (i < nobj); i++)
     {
         obj = &(objs[i]);
     for (i = 0; (i < nobj); i++)
     {
         obj = &(objs[i]);
@@ -219,8 +219,6 @@ static void draw_box(t_psdata ps, t_3dview *view, matrix box,
 
 void ps_draw_mol(t_psdata ps, t_manager *man)
 {
 
 void ps_draw_mol(t_psdata ps, t_manager *man)
 {
-    static char tstr[2][20];
-    static int  ntime = 0;
     t_windata  *win;
     t_3dview   *view;
     t_molwin   *mw;
     t_windata  *win;
     t_3dview   *view;
     t_molwin   *mw;
@@ -265,13 +263,6 @@ void ps_draw_mol(t_psdata ps, t_manager *man)
     /* Start drawing
        XClearWindow(x11->disp,win->self); */
 
     /* Start drawing
        XClearWindow(x11->disp,win->self); */
 
-    /* Draw Time
-       sprintf(tstr[ntime],"Time: %.3 ps",man->time);
-       if (strcmp(tstr[ntime],tstr[1-ntime]) != 0) {
-       set_vbtime(x11,man->vbox,tstr[ntime]);
-       ntime=1-ntime;
-       }*/
-
     if (mw->boxtype != esbNone)
     {
         draw_box(ps, view, man->box, x0, y0, sx, sy);
     if (mw->boxtype != esbNone)
     {
         draw_box(ps, view, man->box, x0, y0, sx, sy);
similarity index 100%
rename from src/ngmx/molps.h
rename to src/programs/view/molps.h
similarity index 94%
rename from src/ngmx/nleg.c
rename to src/programs/view/nleg.cpp
index d5f25eadab994fec0a3c9010d19ccefa88fb9598..acc23e10d5621bdccd0e0e2a76d3d09466c6c8bb 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -66,15 +66,15 @@ static t_atomcolor ac[] = {
 
 int search_ac(const char *type)
 {
 
 int search_ac(const char *type)
 {
-    int i, nb, mij, best, besti;
+    unsigned int i, nb, mij, best, besti;
 
     best  = 0;
     besti = 0;
 
     best  = 0;
     besti = 0;
-    if (type)
+    if (NULL != type)
     {
         for (i = 0; (i < NAC); i++)
         {
     {
         for (i = 0; (i < NAC); i++)
         {
-            mij = min((int)strlen(type), (int)strlen(ac[i].tp));
+            mij = std::min((int)strlen(type), (int)strlen(ac[i].tp));
             for (nb = 0; (nb < mij); nb++)
             {
                 if (type[nb] != ac[i].tp[nb])
             for (nb = 0; (nb < mij); nb++)
             {
                 if (type[nb] != ac[i].tp[nb])
@@ -141,7 +141,7 @@ void DrawLegend(t_x11 *x11, t_windata *Win)
     XSetForeground(x11->disp, x11->gc, x11->fg);
 }
 
     XSetForeground(x11->disp, x11->gc, x11->fg);
 }
 
-static gmx_bool LegWCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool LegWCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_legendwin *lw;
 
 {
     t_legendwin *lw;
 
@@ -154,7 +154,7 @@ static gmx_bool LegWCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 t_legendwin *init_legw(t_x11 *x11, Window Parent,
 }
 
 t_legendwin *init_legw(t_x11 *x11, Window Parent,
similarity index 100%
rename from src/ngmx/nleg.h
rename to src/programs/view/nleg.h
similarity index 94%
rename from src/ngmx/nmol.c
rename to src/programs/view/nmol.cpp
index c9dd2f781d12b1f1bef23d2af044b85447a73511..8851f6c5fa5a63edc8fed432d10566de46c542a8 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -53,7 +53,7 @@
 
 #define MSIZE 4
 
 
 #define MSIZE 4
 
-static gmx_bool MWCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool MWCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_molwin *mw;
     Window    To;
 {
     t_molwin *mw;
     Window    To;
@@ -93,12 +93,12 @@ static gmx_bool MWCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 void set_def (t_molwin *mw, int ePBC, matrix box)
 {
 }
 
 void set_def (t_molwin *mw, int ePBC, matrix box)
 {
-    mw->bShowHydrogen = TRUE;
+    mw->bShowHydrogen = true;
     mw->bond_type     = eBFat;
     mw->ePBC          = ePBC;
     mw->boxtype       = esbRect;
     mw->bond_type     = eBFat;
     mw->ePBC          = ePBC;
     mw->boxtype       = esbRect;
@@ -131,7 +131,7 @@ void map_mw(t_x11 *x11, t_molwin *mw)
     XMapWindow(x11->disp, mw->wd.self);
 }
 
     XMapWindow(x11->disp, mw->wd.self);
 }
 
-gmx_bool toggle_hydrogen(t_x11 *x11, t_molwin *mw)
+bool toggle_hydrogen(t_x11 *x11, t_molwin *mw)
 {
     mw->bShowHydrogen = !mw->bShowHydrogen;
     ExposeWin(x11->disp, mw->wd.self);
 {
     mw->bShowHydrogen = !mw->bShowHydrogen;
     ExposeWin(x11->disp, mw->wd.self);
@@ -175,7 +175,7 @@ void done_mw(t_x11 *x11, t_molwin *mw)
 
 static void draw_atom(Display *disp, Window w, GC gc,
                       atom_id ai, iv2 vec2[], unsigned long col[], int size[],
 
 static void draw_atom(Display *disp, Window w, GC gc,
                       atom_id ai, iv2 vec2[], unsigned long col[], int size[],
-                      gmx_bool bBall, gmx_bool bPlus)
+                      bool bBall, bool bPlus)
 {
     int xi, yi;
 
 {
     int xi, yi;
 
@@ -217,7 +217,7 @@ static void my_init_pbc(matrix box)
     }
 }
 
     }
 }
 
-static gmx_bool local_pbc_dx(rvec x1, rvec x2)
+static bool local_pbc_dx(rvec x1, rvec x2)
 {
     int  i;
     real dx;
 {
     int  i;
     real dx;
@@ -227,19 +227,19 @@ static gmx_bool local_pbc_dx(rvec x1, rvec x2)
         dx = x1[i]-x2[i];
         if (dx > gl_hbox[i])
         {
         dx = x1[i]-x2[i];
         if (dx > gl_hbox[i])
         {
-            return FALSE;
+            return false;
         }
         else if (dx <= gl_mhbox[i])
         {
         }
         else if (dx <= gl_mhbox[i])
         {
-            return FALSE;
+            return false;
         }
     }
         }
     }
-    return TRUE;
+    return true;
 }
 
 static void draw_bond(Display *disp, Window w, GC gc,
                       atom_id ai, atom_id aj, iv2 vec2[],
 }
 
 static void draw_bond(Display *disp, Window w, GC gc,
                       atom_id ai, atom_id aj, iv2 vec2[],
-                      rvec x[], unsigned long col[], int size[], gmx_bool bBalls)
+                      rvec x[], unsigned long col[], int size[], bool bBalls)
 {
     unsigned long   ic, jc;
     int             xi, yi, xj, yj;
 {
     unsigned long   ic, jc;
     int             xi, yi, xj, yj;
@@ -247,8 +247,8 @@ static void draw_bond(Display *disp, Window w, GC gc,
 
     if (bBalls)
     {
 
     if (bBalls)
     {
-        draw_atom(disp, w, gc, ai, vec2, col, size, TRUE, FALSE);
-        draw_atom(disp, w, gc, aj, vec2, col, size, TRUE, FALSE);
+        draw_atom(disp, w, gc, ai, vec2, col, size, true, false);
+        draw_atom(disp, w, gc, aj, vec2, col, size, true, false);
     }
     else
     {
     }
     else
     {
@@ -313,12 +313,12 @@ void create_visibility(t_manager *man)
     {
         if (obj->eV != eVHidden)
         {
     {
         if (obj->eV != eVHidden)
         {
-            man->bVis[obj->ai] = TRUE;
+            man->bVis[obj->ai] = true;
             switch (obj->eO)
             {
                 case eOBond:
                 case eOHBond:
             switch (obj->eO)
             {
                 case eOBond:
                 case eOHBond:
-                    man->bVis[obj->aj] = TRUE;
+                    man->bVis[obj->aj] = true;
                     break;
                 default:
                     break;
                     break;
                 default:
                     break;
@@ -353,7 +353,7 @@ int filter_vis(t_manager *man)
 {
     int          i, nobj, nvis, nhide;
     atom_id      ai;
 {
     int          i, nobj, nvis, nhide;
     atom_id      ai;
-    gmx_bool     bAdd, *bVis;
+    bool         bAdd, *bVis;
     t_object    *obj;
     t_object    *newobj;
 
     t_object    *obj;
     t_object    *newobj;
 
@@ -391,14 +391,14 @@ int filter_vis(t_manager *man)
 
 void draw_objects(Display *disp, Window w, GC gc, int nobj,
                   t_object objs[], iv2 vec2[], rvec x[],
 
 void draw_objects(Display *disp, Window w, GC gc, int nobj,
                   t_object objs[], iv2 vec2[], rvec x[],
-                  unsigned long col[], int size[], gmx_bool bShowHydro, int bond_type,
-                  gmx_bool bPlus)
+                  unsigned long col[], int size[], bool bShowHydro, int bond_type,
+                  bool bPlus)
 {
 {
-    gmx_bool     bBalls;
+    bool         bBalls;
     int          i;
     t_object    *obj;
 
     int          i;
     t_object    *obj;
 
-    bBalls = FALSE;
+    bBalls = false;
     switch (bond_type)
     {
         case eBThin:
     switch (bond_type)
     {
         case eBThin:
@@ -411,8 +411,8 @@ void draw_objects(Display *disp, Window w, GC gc, int nobj,
             XSetLineAttributes(disp, gc, 5, LineSolid, CapNotLast, JoinRound);
             break;
         case eBSpheres:
             XSetLineAttributes(disp, gc, 5, LineSolid, CapNotLast, JoinRound);
             break;
         case eBSpheres:
-            bBalls = TRUE;
-            bPlus  = FALSE;
+            bBalls = true;
+            bPlus  = false;
             break;
         default:
             gmx_fatal(FARGS, "Invalid bond_type selected: %d\n", bond_type);
             break;
         default:
             gmx_fatal(FARGS, "Invalid bond_type selected: %d\n", bond_type);
similarity index 97%
rename from src/ngmx/nmol.h
rename to src/programs/view/nmol.h
index 1fb529f4fd59d4753fbb5d144483dd0cbb44c70c..4c0d81248b1e55dbe2350578b2c05af05982db3e 100644 (file)
@@ -53,7 +53,7 @@ extern int  compare_obj(const void *a, const void *b);
 extern int  filter_vis(t_manager *man);
 extern void set_sizes(t_manager *man, real sx, real sy);
 
 extern int  filter_vis(t_manager *man);
 extern void set_sizes(t_manager *man, real sx, real sy);
 
-extern gmx_bool toggle_hydrogen(t_x11 *x11, t_molwin *mw);
+extern bool toggle_hydrogen(t_x11 *x11, t_molwin *mw);
 /* Toggle the state of the hydrogen drawing,
  * return the current state
  */
 /* Toggle the state of the hydrogen drawing,
  * return the current state
  */
similarity index 100%
rename from src/ngmx/play.bm
rename to src/programs/view/play.bm
similarity index 93%
rename from src/ngmx/popup.c
rename to src/programs/view/popup.cpp
index d0d465f34c710960ae19c041f39390cfdcc4e554..df45e2fa21b1b74d94b50c2b413ef9267304f02b 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
 #include <math.h>
 #include <macros.h>
 #include <smalloc.h>
 #include <math.h>
 #include <macros.h>
 #include <smalloc.h>
-#include <x11.h>
-#include <xutil.h>
+#include "x11.h"
+#include "xutil.h"
 #include "popup.h"
 
 #include "popup.h"
 
-gmx_bool ChildCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+bool ChildCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_child   *child;
     t_mentry  *m;
 {
     t_child   *child;
     t_mentry  *m;
@@ -86,10 +86,10 @@ gmx_bool ChildCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-gmx_bool MenuCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+bool MenuCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_menu *m;
 
 {
     t_menu *m;
 
@@ -116,7 +116,7 @@ gmx_bool MenuCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg,
 }
 
 t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg,
@@ -137,7 +137,7 @@ t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg,
     mlen = 0;
     for (i = 0; (i < nent); i++)
     {
     mlen = 0;
     for (i = 0; (i < nent); i++)
     {
-        mlen = max(mlen, XTextWidth(x11->font, ent[i].str, strlen(ent[i].str)));
+        mlen = std::max(mlen, XTextWidth(x11->font, ent[i].str, strlen(ent[i].str)));
     }
     mht = XTextHeight(x11->font);
     /* Now we have the biggest single box, add a border of 2 pixels */
     }
     mht = XTextHeight(x11->font);
     /* Now we have the biggest single box, add a border of 2 pixels */
@@ -202,7 +202,7 @@ t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg,
     return m;
 }
 
     return m;
 }
 
-void show_menu(t_x11 *x11, t_menu *m, int x, int y, gmx_bool bGrab)
+void show_menu(t_x11 *x11, t_menu *m, int x, int y, bool bGrab)
 {
     XMoveWindow(x11->disp, m->wd.self, x, y);
     m->bGrabbed = bGrab;
 {
     XMoveWindow(x11->disp, m->wd.self, x, y);
     m->bGrabbed = bGrab;
@@ -219,7 +219,7 @@ void hide_menu(t_x11 *x11, t_menu *m)
     XUnmapWindow(x11->disp, m->wd.self);
 }
 
     XUnmapWindow(x11->disp, m->wd.self);
 }
 
-void check_menu_item(t_menu *m, int nreturn, gmx_bool bStatus)
+void check_menu_item(t_menu *m, int nreturn, bool bStatus)
 {
     int i;
 
 {
     int i;
 
similarity index 93%
rename from src/ngmx/popup.h
rename to src/programs/view/popup.h
index 285e277dbafa396f2ccf37c8c24ea23090e86b1a..882a09d241fbba985e896a45b2c79d788e48bd60 100644 (file)
@@ -42,7 +42,7 @@
 typedef struct {
     Window      send_to;  /* Window to send messages to                        */
     int         nreturn;  /* Value returned when entry is selected  */
 typedef struct {
     Window      send_to;  /* Window to send messages to                        */
     int         nreturn;  /* Value returned when entry is selected  */
-    gmx_bool    bChecked; /* Indicate whether menu item is check-marked        */
+    bool        bChecked; /* Indicate whether menu item is check-marked        */
     const char *str;      /* Text for menu entry                               */
 } t_mentry;
 
     const char *str;      /* Text for menu entry                               */
 } t_mentry;
 
@@ -57,7 +57,7 @@ typedef struct {
     Window        Parent;   /* The parent of the menu                   */
     int           nitem;    /* The number of menu items                        */
     t_child      *item;     /* Array of child windows                   */
     Window        Parent;   /* The parent of the menu                   */
     int           nitem;    /* The number of menu items                        */
     t_child      *item;     /* Array of child windows                   */
-    gmx_bool      bGrabbed; /* Did this menu grab the pointer?              */
+    bool          bGrabbed; /* Did this menu grab the pointer?              */
 } t_menu;
 
 extern t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg,
 } t_menu;
 
 extern t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned long bg,
@@ -76,7 +76,7 @@ extern t_menu *init_menu(t_x11 *x11, Window Parent, unsigned long fg, unsigned l
  * has to be shown, call show_menu.
  */
 
  * has to be shown, call show_menu.
  */
 
-extern void show_menu(t_x11 *x11, t_menu *m, int x, int y, gmx_bool bGrab);
+extern void show_menu(t_x11 *x11, t_menu *m, int x, int y, bool bGrab);
 /* Show the menu in m at (x,y)
  * This will popup the menu, and when a button is released in the
  * menu send a ClientMessage to the Parent window of the menu
 /* Show the menu in m at (x,y)
  * This will popup the menu, and when a button is released in the
  * menu send a ClientMessage to the Parent window of the menu
@@ -87,7 +87,7 @@ extern void show_menu(t_x11 *x11, t_menu *m, int x, int y, gmx_bool bGrab);
 extern void hide_menu(t_x11 *x11, t_menu *m);
 /* Unmaps the window for m, hides the window */
 
 extern void hide_menu(t_x11 *x11, t_menu *m);
 /* Unmaps the window for m, hides the window */
 
-extern void check_menu_item(t_menu *m, int nreturn, gmx_bool bStatus);
+extern void check_menu_item(t_menu *m, int nreturn, bool bStatus);
 /* Set the bChecked field in the menu item with return code
  * nreturn to bStatus. This function must always be called when
  * the bChecked flag has to changed.
 /* Set the bChecked field in the menu item with return code
  * nreturn to bStatus. This function must always be called when
  * the bChecked flag has to changed.
similarity index 88%
rename from src/ngmx/pulldown.c
rename to src/programs/view/pulldown.cpp
index 398a997923170f2aed24f16f6a26156e1faedbe5..f621b9add997c7fbb4b24d88bdaab82fd787f00a 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
 
 #include <string.h>
 #include <smalloc.h>
 
 #include <string.h>
 #include <smalloc.h>
-#include <x11.h>
 #include <macros.h>
 #include <macros.h>
+#include "x11.h"
 #include "popup.h"
 #include "pulldown.h"
 
 #include "popup.h"
 #include "pulldown.h"
 
-static gmx_bool PDCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool PDCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_pulldown *pd;
     int         i, x, x1, y, nsel;
 {
     t_pulldown *pd;
     int         i, x, x1, y, nsel;
@@ -70,8 +70,8 @@ static gmx_bool PDCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
                     ;
                 }
                 pd->nsel = nsel;
                     ;
                 }
                 pd->nsel = nsel;
-                x1       = max(0, min(pd_width(pd)-menu_width(pd->m[nsel]), pd->xpos[nsel]));
-                show_menu(x11, pd->m[nsel], x1, y+1, FALSE);
+                x1       = std::max(0, std::min(pd_width(pd)-menu_width(pd->m[nsel]), pd->xpos[nsel]));
+                show_menu(x11, pd->m[nsel], x1, y+1, false);
             }
             break;
         case ButtonRelease:
             }
             break;
         case ButtonRelease:
@@ -80,10 +80,10 @@ static gmx_bool PDCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-t_pulldown *init_pd(t_x11 *x11, Window Parent, int width, int height,
+t_pulldown *init_pd(t_x11 *x11, Window Parent, int width,
                     unsigned long fg, unsigned long bg,
                     int nmenu, int *nsub, t_mentry *ent[], const char **title)
 {
                     unsigned long fg, unsigned long bg,
                     int nmenu, int *nsub, t_mentry *ent[], const char **title)
 {
@@ -134,7 +134,7 @@ void hide_pd(t_x11 *x11, t_pulldown *pd)
     pd->nsel = -1;
 }
 
     pd->nsel = -1;
 }
 
-void check_pd_item(t_pulldown *pd, int nreturn, gmx_bool bStatus)
+void check_pd_item(t_pulldown *pd, int nreturn, bool bStatus)
 {
     int i;
 
 {
     int i;
 
@@ -164,9 +164,9 @@ int pd_width(t_pulldown *pd)
     w = 0;
     for (i = 0; (i < pd->nmenu); i++)
     {
     w = 0;
     for (i = 0; (i < pd->nmenu); i++)
     {
-        w = max(w, menu_width(pd->m[i]));
+        w = std::max(w, menu_width(pd->m[i]));
     }
     }
-    w = max(w, pd->xpos[pd->nmenu]);
+    w = std::max(w, pd->xpos[pd->nmenu]);
     return w;
 }
 
     return w;
 }
 
@@ -177,7 +177,7 @@ int pd_height(t_pulldown *pd)
     h = 0;
     for (i = 0; (i < pd->nmenu); i++)
     {
     h = 0;
     for (i = 0; (i < pd->nmenu); i++)
     {
-        h = max(h, menu_height(pd->m[i]));
+        h = std::max(h, menu_height(pd->m[i]));
     }
 
     return h;
     }
 
     return h;
similarity index 97%
rename from src/ngmx/pulldown.h
rename to src/programs/view/pulldown.h
index 951cd4aaaef58e6308898904d6449124dbe78181..b122625a07b2e990c47a0fd9adb2e6c37f22f3e1 100644 (file)
@@ -47,7 +47,7 @@ typedef struct {
     const char **title;
 } t_pulldown;
 
     const char **title;
 } t_pulldown;
 
-extern t_pulldown *init_pd(t_x11 *x11, Window Parent, int width, int height,
+extern t_pulldown *init_pd(t_x11 *x11, Window Parent, int width,
                            unsigned long fg, unsigned long bg,
                            int nmenu, int *nsub, t_mentry *ent[],
                            const char **title);
                            unsigned long fg, unsigned long bg,
                            int nmenu, int *nsub, t_mentry *ent[],
                            const char **title);
@@ -69,7 +69,7 @@ extern t_pulldown *init_pd(t_x11 *x11, Window Parent, int width, int height,
 extern void hide_pd(t_x11 *x11, t_pulldown *pd);
 /* Hides any menu that is still on the screen when it shouldn't */
 
 extern void hide_pd(t_x11 *x11, t_pulldown *pd);
 /* Hides any menu that is still on the screen when it shouldn't */
 
-extern void check_pd_item(t_pulldown *pd, int nreturn, gmx_bool bStatus);
+extern void check_pd_item(t_pulldown *pd, int nreturn, bool bStatus);
 /* Set the bChecked field in the pd item with return code
  * nreturn to bStatus. This function must always be called when
  * the bChecked flag has to changed.
 /* Set the bChecked field in the pd item with return code
  * nreturn to bStatus. This function must always be called when
  * the bChecked flag has to changed.
similarity index 100%
rename from src/ngmx/stop.bm
rename to src/programs/view/stop.bm
similarity index 86%
rename from src/ngmx/ngmx.cpp
rename to src/programs/view/view.cpp
index 2aa3e0123ee131755312928aa43971b3d1a1ed72..b640e4dd3abc9f8f9ad5bad9bec7eca8b3b5f3a0 100644 (file)
@@ -36,9 +36,9 @@
 #include <config.h>
 #endif
 
 #include <config.h>
 #endif
 
+#include <stdio.h>
 #include <ctype.h>
 #include <string.h>
 #include <ctype.h>
 #include <string.h>
-
 #include "sysstuff.h"
 #include "macros.h"
 #include "smalloc.h"
 #include "sysstuff.h"
 #include "macros.h"
 #include "smalloc.h"
 #include "typedefs.h"
 #include "string2.h"
 #include "statutil.h"
 #include "typedefs.h"
 #include "string2.h"
 #include "statutil.h"
-#include "Xstuff.h"
-#include "gromacs.bm"
 #include "copyrite.h"
 #include "confio.h"
 #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 "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[],
 
 /* Forward declarations: I Don't want all that init shit here */
 void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[],
@@ -66,7 +68,7 @@ static void dump_it(t_manager *man)
 {
     t_psdata ps;
 
 {
     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);
 }
     ps_draw_mol(ps, man);
     ps_close(ps);
 }
@@ -81,7 +83,7 @@ static void done_gmx(t_x11 *x11, t_gmx *gmx)
 }
 
 static void move_gmx(t_x11 *x11, t_gmx *gmx, int width, int height,
 }
 
 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
 {
     int y0, wl, hl;
 #ifdef DEBUG
@@ -102,7 +104,7 @@ static void move_gmx(t_x11 *x11, t_gmx *gmx, int width, int height,
     XMoveWindow(x11->disp, gmx->logo->wd.self, (width-wl)/2, (height-y0-hl)/2);
 }
 
     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;
 
 {
     t_pulldown *pd;
 
@@ -140,7 +142,7 @@ static gmx_bool HandleClient(t_x11 *x11, int ID, t_gmx *gmx)
             break;
         case IDTERM:
             done_gmx(x11, gmx);
             break;
         case IDTERM:
             done_gmx(x11, gmx);
-            return TRUE;
+            return true;
 
         /* Edit Menu */
         case IDEDITTOP:
 
         /* Edit Menu */
         case IDEDITTOP:
@@ -226,16 +228,16 @@ static gmx_bool HandleClient(t_x11 *x11, int ID, t_gmx *gmx)
         default:
             break;
     }
         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;
 {
     t_gmx    *gmx;
     int       nsel, width, height;
-    gmx_bool  result;
+    bool      result;
 
 
-    result = FALSE;
+    result = false;
     gmx    = (t_gmx *)data;
     switch (event->type)
     {
     gmx    = (t_gmx *)data;
     switch (event->type)
     {
@@ -247,7 +249,7 @@ static gmx_bool MainCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
             height = event->xconfigure.height;
             if ((width != gmx->wd->width) || (height != gmx->wd->height))
             {
             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:
             }
             break;
         case ClientMessage:
@@ -260,11 +262,13 @@ static gmx_bool MainCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
     }
     return result;
 }
     }
     return result;
 }
+//! HAVE_X11
+#endif
 
 
-int gmx_ngmx(int argc, char *argv[])
+int gmx_view(int argc, char *argv[])
 {
     const char  *desc[] = {
 {
     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",
         "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",
@@ -285,7 +289,6 @@ int gmx_ngmx(int argc, char *argv[])
     };
 
     output_env_t oenv;
     };
 
     output_env_t oenv;
-    t_x11       *x11;
     t_filenm     fnm[] = {
         { efTRX, "-f", NULL, ffREAD },
         { efTPX, NULL, NULL, ffREAD },
     t_filenm     fnm[] = {
         { efTRX, "-f", NULL, ffREAD },
         { efTPX, NULL, NULL, ffREAD },
@@ -293,48 +296,48 @@ int gmx_ngmx(int argc, char *argv[])
     };
 #define NFILE asize(fnm)
 
     };
 #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;
 }
 
     return 0;
 }
 
-int main(int argc, char *argv[])
-{
-    return gmx::CommandLineModuleManager::runAsMainCMain(argc, argv, &gmx_ngmx);
-}
-
+#ifdef HAVE_X11
 static t_mentry  FileMenu[] = {
 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[] = {
 };
 
 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[] = {
 };
 
 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 };
 };
 
 static t_mentry *gmx_pd[] = { FileMenu, DispMenu, HelpMenu };
@@ -402,17 +405,17 @@ void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[],
     /* 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);
     /* 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 */
 
     /* 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,
 
     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 */
                       MSIZE, gmx_pd_size, gmx_pd, MenuTitle);
 
     /* Dialogs & Filters */
@@ -425,7 +428,8 @@ void init_gmx(t_x11 *x11, char *program, int nfile, t_filenm fnm[],
     /* Now do file shit */
     set_file(x11, gmx->man, ftp2fn(efTRX, nfile, fnm), ftp2fn(efTPX, nfile, fnm));
 
     /* 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]);
 }
     ShowDlg(gmx->dlgs[edFilter]);
 }
+
+//! HAVE_X11
+#endif
similarity index 67%
rename from src/ngmx/g_logo.c
rename to src/programs/view/view.h
index d60eada32fed9ae4f74961b41e8adba97844ff83..7e1a06cceb283351083d5c60e6a9257a3d2da4dd 100644 (file)
@@ -6,10 +6,8 @@
  *
  *          GROningen MAchine for Chemical Simulations
  *
  *
  *          GROningen MAchine for Chemical Simulations
  *
- *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * For more info, check our website at http://www.gromacs.org
  *
  * And Hey:
  * For more info, check our website at http://www.gromacs.org
  *
  * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
+ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
  */
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
 
 
-#include "logo.h"
+#ifndef _view_h
+#define _view_h
 
 int
 
 int
-main(int argc, char *argv[])
-{
-    t_x11  *x11;
-    t_logo *logo;
-
-    if ((x11 = GetX11(&argc, argv)) == NULL)
-    {
-        fprintf(stderr, "No X!\n");
-        exit(1);
-    }
-    logo = init_logo(x11, x11->root, TRUE);
-    show_logo(x11, logo);
-    x11->MainLoop(x11);
+gmx_view(int argc, char *argv[]);
 
 
-    x11->CleanUp(x11);
-    return 0;
-}
+#endif
+/* _view_h */
similarity index 81%
rename from src/ngmx/x11.c
rename to src/programs/view/x11.cpp
index b5b69972101a8660e2bf7a73948f34d743368b26..49534d1ff4d738906df7821c67ee7f2f06be553b 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
 #include <config.h>
 #endif
 
 #include <config.h>
 #endif
 
+#include <string.h>
 #include "typedefs.h"
 #include "typedefs.h"
-#include <Xstuff.h>
-#include <x11.h>
 #include "sysstuff.h"
 #include "sysstuff.h"
-#include <string.h>
 #include "smalloc.h"
 #include "string2.h"
 #include "smalloc.h"
 #include "string2.h"
+#include "Xstuff.h"
+#include "x11.h"
 
 /* These colours will be mapped to black on a monochrome screen */
 unsigned long BLACK, BLUE, GREEN, CYAN, RED, BROWN, GREY, DARKGREY;
 
 /* These colours will be mapped to black on a monochrome screen */
 unsigned long BLACK, BLUE, GREEN, CYAN, RED, BROWN, GREY, DARKGREY;
@@ -69,15 +69,15 @@ static XFontStruct *GetFont(FILE *err, Display *disp, char *name)
         "9x15", "6x13", "fixed"
     };
 #define MAXNAMES (sizeof(fontnames)/sizeof(fontnames[0]))
         "9x15", "6x13", "fixed"
     };
 #define MAXNAMES (sizeof(fontnames)/sizeof(fontnames[0]))
-    int                i;
+    unsigned int       i;
     XFontStruct       *font;
     int                count;
     char             **fontlist;
     XFontStruct       *font;
     int                count;
     char             **fontlist;
-    gmx_bool           bFont = FALSE;
+    bool               bFont = false;
 
     if (name)
     {
 
     if (name)
     {
-        bFont = (gmx_bool) ((font = XLQF(err, disp, name)) != NULL);
+        bFont = ((font = XLQF(err, disp, name)) != NULL);
     }
     else
     {
     }
     else
     {
@@ -86,7 +86,7 @@ static XFontStruct *GetFont(FILE *err, Display *disp, char *name)
 
     for (i = 0; (!bFont && (i < MAXNAMES)); i++)
     {
 
     for (i = 0; (!bFont && (i < MAXNAMES)); i++)
     {
-        bFont = (gmx_bool) ((font = XLQF(err, disp, fontnames[i])) != NULL);
+        bFont = ((font = XLQF(err, disp, fontnames[i])) != NULL);
     }
 
     if (!bFont)
     }
 
     if (!bFont)
@@ -94,7 +94,7 @@ static XFontStruct *GetFont(FILE *err, Display *disp, char *name)
         fontlist = XListFonts(disp, "?", 1, &count);
         if (count != 0)
         {
         fontlist = XListFonts(disp, "?", 1, &count);
         if (count != 0)
         {
-            bFont = (gmx_bool) ((font = XLQF(err, disp, fontlist[0])) != NULL);
+            bFont = ((font = XLQF(err, disp, fontlist[0])) != NULL);
         }
     }
     if (!bFont)
         }
     }
     if (!bFont)
@@ -142,33 +142,14 @@ static t_wlist *GetWList(t_x11 *x11, Window w)
     return curs;
 }
 
     return curs;
 }
 
-typedef struct {
-    Window     w;
-    gmx_bool   b;
-} t_peek;
-
-static Bool TestEvent(Display *disp, XEvent *event, char *arg)
-{
-    t_peek *tp;
-
-    fprintf(stderr, "TestEvent\n");
-    tp = (t_peek *)arg;
-    if ((event->xany.window == tp->w) && (event->type == ConfigureNotify))
-    {
-        tp->b = TRUE;
-        return True;
-    }
-    return False;
-}
-
 static void MainLoop(t_x11 *x11)
 {
 static void MainLoop(t_x11 *x11)
 {
-    gmx_bool    bReturn;
+    bool        bReturn;
     XEvent      event;
     t_wlist    *curs;
     Window      w;
 
     XEvent      event;
     t_wlist    *curs;
     Window      w;
 
-    for (bReturn = FALSE; (!bReturn); )
+    for (bReturn = false; (!bReturn); )
     {
         if (x11->wlist)
         {
     {
         if (x11->wlist)
         {
@@ -177,7 +158,7 @@ static void MainLoop(t_x11 *x11)
             curs = GetWList(x11, w);
             if (!curs)
             {
             curs = GetWList(x11, w);
             if (!curs)
             {
-                bReturn = TRUE;
+                bReturn = true;
             }
             if (!bReturn)
             {
             }
             if (!bReturn)
             {
@@ -310,53 +291,6 @@ static void CleanUp(t_x11 *x11)
     XCloseDisplay(x11->disp);
 }
 
     XCloseDisplay(x11->disp);
 }
 
-static void Xrm(int *argc, char *argv[])
-{
-    /*
-       static XrmOptionDescRec opTable[] = {
-       {"-background",   "*background",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-bd",           "*borderColor",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-bg",           "*background",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-borderwidth",  "*TopLevelShell.borderwidth",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-bordercolor",   "*borderColor",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-bw",            "*TopLevelShell.borderColor",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-display",       ".display",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-fg",            "*foreground",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-fn",            "*font",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-font",          "*font",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-foreground",    "*foreground",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-geometry",      ".TopLevelShell.geometry",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-iconic",        ".TopLevelShell.iconic",
-         XrmoptionNoArg,  (caddr_t) "on"},
-       {"-name",          ".name",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-reverse",       "*reverseVideo",
-         XrmoptionNoArg,  (caddr_t) "on"},
-       {"-rv",            "*reverseVideo",
-         XrmoptionNoArg,  (caddr_t) "on"},
-       {"-synchronous",   ".synchronous",
-         XrmoptionNoArg,  (caddr_t) "on"},
-       {"-title",         ".TopLevelShell.title",
-         XrmoptionSepArg, (caddr_t) NULL},
-       {"-xrm",            NULL,
-         XrmoptionSepArg, (caddr_t) NULL},
-       };
-       #define TABLELENGTH (sizeof(opTable)/sizeof(opTable[0]))
-       XrmInitialize();*/
-}
-
 static void Flush(t_x11 *x11)
 {
     fflush(x11->console);
 static void Flush(t_x11 *x11)
 {
     fflush(x11->console);
@@ -381,7 +315,7 @@ t_x11 *GetX11(int *argc, char *argv[])
     char           *display;
     char           *fontname;
     char           *title, *FG = NULL, *BG = NULL;
     char           *display;
     char           *fontname;
     char           *title, *FG = NULL, *BG = NULL;
-    gmx_bool        bVerbose = FALSE;
+    bool            bVerbose = false;
     int             i;
 
     title = strdup(argv[0]);
     int             i;
 
     title = strdup(argv[0]);
@@ -424,7 +358,7 @@ t_x11 *GetX11(int *argc, char *argv[])
                             title = strdup(argv[++i]);
                             break;
                         case 'v':
                             title = strdup(argv[++i]);
                             break;
                         case 'v':
-                            bVerbose = TRUE;
+                            bVerbose = true;
                             break;
                         default:
                             ARGV[ARGC++] = argv[i];
                             break;
                         default:
                             ARGV[ARGC++] = argv[i];
@@ -492,7 +426,7 @@ t_x11 *GetX11(int *argc, char *argv[])
     if (x11->depth > 1)
     {
         /* Not B & W, Look what kind of screen we've got... */
     if (x11->depth > 1)
     {
         /* Not B & W, Look what kind of screen we've got... */
-        for (i = 0; (i < NCLASS); i++)
+        for (i = 0; (i < (int)NCLASS); i++)
         {
             if (!XMatchVisualInfo(x11->disp, x11->screen, x11->depth,
                                   v_class[i], &v_info))
         {
             if (!XMatchVisualInfo(x11->disp, x11->screen, x11->depth,
                                   v_class[i], &v_info))
similarity index 95%
rename from src/ngmx/x11.h
rename to src/programs/view/x11.h
index b30c6470834e9d5f09649ea688f2a1d2c913992a..2d7cf04928b3f429b5e60a17dcaabef180ca3cda 100644 (file)
@@ -47,12 +47,8 @@ extern unsigned long BLACK, BLUE, GREEN, CYAN, RED, BROWN, GREY, DARKGREY;
 extern unsigned long LIGHTBLUE, LIGHTGREY, LIGHTGREEN, LIGHTCYAN,
                      LIGHTRED, VIOLET, YELLOW, WHITE;
 
 extern unsigned long LIGHTBLUE, LIGHTGREY, LIGHTGREEN, LIGHTCYAN,
                      LIGHTRED, VIOLET, YELLOW, WHITE;
 
-typedef enum {
-    ecbOK
-} ecbReturn;
-
 #define CBARGS (struct t_x11 *x11, XEvent *event, Window w, void *data)
 #define CBARGS (struct t_x11 *x11, XEvent *event, Window w, void *data)
-/* Callback function. Return FALSE to continue, TRUE to exit */
+/* Callback function. Return false to continue, true to exit */
 
 typedef struct t_x11 {
     Display            *disp;
 
 typedef struct t_x11 {
     Display            *disp;
@@ -69,7 +65,7 @@ typedef struct t_x11 {
     void        (*GetNamedColor)(struct t_x11 *x11, const char *name, unsigned long *col);
     void        (*MainLoop)(struct t_x11 *x11);
     void        (*RegisterCallback)(struct t_x11 *x11, Window w, Window Parent,
     void        (*GetNamedColor)(struct t_x11 *x11, const char *name, unsigned long *col);
     void        (*MainLoop)(struct t_x11 *x11);
     void        (*RegisterCallback)(struct t_x11 *x11, Window w, Window Parent,
-                                    gmx_bool cb CBARGS, void *data);
+                                    bool cb CBARGS, void *data);
     void        (*UnRegisterCallback)(struct t_x11 *x11, Window w);
     void        (*SetInputMask)(struct t_x11 *x11, Window w, unsigned long mask);
     unsigned long       (*GetInputMask)(struct t_x11 *x11, Window w);
     void        (*UnRegisterCallback)(struct t_x11 *x11, Window w);
     void        (*SetInputMask)(struct t_x11 *x11, Window w, unsigned long mask);
     unsigned long       (*GetInputMask)(struct t_x11 *x11, Window w);
@@ -77,7 +73,7 @@ typedef struct t_x11 {
     void        (*Flush)(struct t_x11 *x11);
 } t_x11;
 
     void        (*Flush)(struct t_x11 *x11);
 } t_x11;
 
-typedef gmx_bool CallBack CBARGS;
+typedef bool CallBack CBARGS;
 
 typedef struct t_wlist {
     Window                 w;      /* The window itself                        */
 
 typedef struct t_wlist {
     Window                 w;      /* The window itself                        */
@@ -126,7 +122,7 @@ t_x11 *GetX11(int *argc, char *argv[]);
  *    events. It is up to the window to destroy itself. The MainLoop
  *    routine exits when there are no more windows to manage, i.e. when
  *    all routines have called UnRegisterCallback, OR when one Callback
  *    events. It is up to the window to destroy itself. The MainLoop
  *    routine exits when there are no more windows to manage, i.e. when
  *    all routines have called UnRegisterCallback, OR when one Callback
- *    routine returns non-zero (TRUE).
+ *    routine returns non-zero (true).
  * 5. Call x11->CleanUp. This closes the display, and frees all
  *    memory allocated by x11 before.
  */
  * 5. Call x11->CleanUp. This closes the display, and frees all
  *    memory allocated by x11 before.
  */
similarity index 94%
rename from src/ngmx/xdlg.c
rename to src/programs/view/xdlg.cpp
index 6705135365fe0e6c5578a9ab32f654e89bc467b1..8d5e2cf2feeda127357d466f414a506419dcc3ba 100644 (file)
@@ -85,7 +85,7 @@ t_dlgitem *FindWin(t_dlg *dlg, Window win)
  * Routines to manipulate items on a dialog box
  *
  ****************************/
  * Routines to manipulate items on a dialog box
  *
  ****************************/
-gmx_bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h)
+bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h)
 {
     t_dlgitem *dlgitem;
 
 {
     t_dlgitem *dlgitem;
 
@@ -93,12 +93,12 @@ gmx_bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h)
     {
         *w = dlgitem->win.width;
         *h = dlgitem->win.height;
     {
         *w = dlgitem->win.width;
         *h = dlgitem->win.height;
-        return TRUE;
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-gmx_bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0)
+bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0)
 {
     t_dlgitem *dlgitem;
 
 {
     t_dlgitem *dlgitem;
 
@@ -106,9 +106,9 @@ gmx_bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0)
     {
         *x0 = dlgitem->win.x;
         *y0 = dlgitem->win.y;
     {
         *x0 = dlgitem->win.x;
         *y0 = dlgitem->win.y;
-        return TRUE;
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 int QueryDlgItemX(t_dlg *dlg, t_id id)
 }
 
 int QueryDlgItemX(t_dlg *dlg, t_id id)
@@ -155,7 +155,7 @@ int QueryDlgItemH(t_dlg *dlg, t_id id)
     return 0;
 }
 
     return 0;
 }
 
-gmx_bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h)
+bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h)
 {
     t_dlgitem *dlgitem;
 #ifdef DEBUG
 {
     t_dlgitem *dlgitem;
 #ifdef DEBUG
@@ -201,12 +201,12 @@ gmx_bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h)
                 }
             }
         }
                 }
             }
         }
-        return TRUE;
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-gmx_bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0)
+bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0)
 {
     t_dlgitem *dlgitem;
     int        old_x, old_y;
 {
     t_dlgitem *dlgitem;
     int        old_x, old_y;
@@ -242,9 +242,9 @@ gmx_bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0)
                 }
             }
         }
                 }
             }
         }
-        return TRUE;
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 /*****************************
 }
 
 /*****************************
@@ -253,7 +253,7 @@ gmx_bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0)
  * after dlg is exec'ed
  *
  ****************************/
  * after dlg is exec'ed
  *
  ****************************/
-gmx_bool IsCBChecked(t_dlg *dlg, t_id id)
+bool IsCBChecked(t_dlg *dlg, t_id id)
 {
     t_dlgitem *dlgitem;
 
 {
     t_dlgitem *dlgitem;
 
@@ -265,7 +265,7 @@ gmx_bool IsCBChecked(t_dlg *dlg, t_id id)
         }
     }
 
         }
     }
 
-    return FALSE;
+    return false;
 }
 
 t_id RBSelected(t_dlg *dlg, int gid)
 }
 
 t_id RBSelected(t_dlg *dlg, int gid)
@@ -342,11 +342,11 @@ void ShowDlg(t_dlg *dlg)
         {
             PushMouse(dlg->x11->disp, dlgitem->win.self,
                       dlgitem->win.width/2, dlgitem->win.height/2);
         {
             PushMouse(dlg->x11->disp, dlgitem->win.self,
                       dlgitem->win.width/2, dlgitem->win.height/2);
-            dlg->bPop = TRUE;
+            dlg->bPop = true;
             break;
         }
     }
             break;
         }
     }
-    dlg->bGrab = FALSE;
+    dlg->bGrab = false;
 }
 
 void HideDlg(t_dlg *dlg)
 }
 
 void HideDlg(t_dlg *dlg)
@@ -362,21 +362,17 @@ void HideDlg(t_dlg *dlg)
 
 void NoHelp(t_dlg *dlg)
 {
 
 void NoHelp(t_dlg *dlg)
 {
-    char **lines = NULL;
-
-    snew(lines, 2);
-    lines[0] = strdup("Error");
-    lines[1] = strdup("No help for this item");
+    const char *lines[2] = {
+        "Error",
+        "No help for this item"
+    };
     MessageBox(dlg->x11, dlg->wDad, "No Help", 2, lines,
                MB_OK | MB_ICONSTOP | MB_APPLMODAL, NULL, NULL);
     MessageBox(dlg->x11, dlg->wDad, "No Help", 2, lines,
                MB_OK | MB_ICONSTOP | MB_APPLMODAL, NULL, NULL);
-    sfree(lines[0]);
-    sfree (lines[1]);
-    sfree(lines);
 }
 
 void HelpDlg(t_dlg *dlg)
 {
 }
 
 void HelpDlg(t_dlg *dlg)
 {
-    char *lines[] = {
+    const char *lines[] = {
         "Place the cursor over one of the items",
         "and press the F1 key to get more help.",
         "First press the OK button."
         "Place the cursor over one of the items",
         "and press the F1 key to get more help.",
         "First press the OK button."
@@ -388,7 +384,7 @@ void HelpDlg(t_dlg *dlg)
 void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem)
 {
     char     buf[80];
 void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem)
 {
     char     buf[80];
-    gmx_bool bCont = TRUE;
+    bool     bCont = true;
     int      i, nlines = 0;
     char   **lines = NULL;
 
     int      i, nlines = 0;
     char   **lines = NULL;
 
@@ -429,7 +425,8 @@ void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem)
     }
     while (bCont);
     MessageBox(dlg->x11, dlg->wDad, "Help",
     }
     while (bCont);
     MessageBox(dlg->x11, dlg->wDad, "Help",
-               nlines, lines, MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, NULL, NULL);
+               nlines, lines,
+               MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, NULL, NULL);
     for (i = 0; (i < nlines); i++)
     {
         sfree(lines[i]);
     for (i = 0; (i < nlines); i++)
     {
         sfree(lines[i]);
@@ -454,7 +451,7 @@ static void ExitDlg(t_dlg *dlg)
     if (dlg->bGrab)
     {
         XUngrabPointer(dlg->x11->disp, CurrentTime);
     if (dlg->bGrab)
     {
         XUngrabPointer(dlg->x11->disp, CurrentTime);
-        dlg->bGrab = FALSE;
+        dlg->bGrab = false;
     }
     HideDlg(dlg);
     if (dlg->flags & DLG_FREEONBUTTON)
     }
     HideDlg(dlg);
     if (dlg->flags & DLG_FREEONBUTTON)
@@ -463,7 +460,7 @@ static void ExitDlg(t_dlg *dlg)
     }
 }
 
     }
 }
 
-static gmx_bool DlgCB(t_x11 *x11, XEvent *event, Window w, void *data)
+static bool DlgCB(t_x11 *x11, XEvent *event, Window w, void *data)
 {
     t_dlg     *dlg = (t_dlg *)data;
     int        i, nWndProc;
 {
     t_dlg     *dlg = (t_dlg *)data;
     int        i, nWndProc;
@@ -526,14 +523,14 @@ static gmx_bool DlgCB(t_x11 *x11, XEvent *event, Window w, void *data)
                 if (tid != -1)
                 {
                     t_dlgitem *dit = FindItem(dlg, tid);
                 if (tid != -1)
                 {
                     t_dlgitem *dit = FindItem(dlg, tid);
-                    dit->u.radiobutton.bSelect = FALSE;
+                    dit->u.radiobutton.bSelect = false;
                     ExposeWin(x11->disp, dit->win.self);
                 }
                 else
                 {
                     gmx_fatal(FARGS, "No RB Selected initially!\n");
                 }
                     ExposeWin(x11->disp, dit->win.self);
                 }
                 else
                 {
                     gmx_fatal(FARGS, "No RB Selected initially!\n");
                 }
-                dlgitem->u.radiobutton.bSelect = TRUE;
+                dlgitem->u.radiobutton.bSelect = true;
                 ExposeWin(x11->disp, dlgitem->win.self);
                 if (dlg->cb)
                 {
                 ExposeWin(x11->disp, dlgitem->win.self);
                 if (dlg->cb)
                 {
@@ -586,7 +583,7 @@ static gmx_bool DlgCB(t_x11 *x11, XEvent *event, Window w, void *data)
                 break;
         }
     }
                 break;
         }
     }
-    return FALSE;
+    return false;
 }
 
 /*****************************
 }
 
 /*****************************
@@ -765,7 +762,7 @@ void FreeDlg(t_dlg *dlg)
  *
  ****************************/
 t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title,
  *
  ****************************/
 t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title,
-                 int x0, int y0, int w, int h, int bw, unsigned long fg, unsigned long bg,
+                 int x0, int y0, int w, int h, int bw,
                  DlgCallback *cb, void *data)
 {
     t_dlg   *dlg;
                  DlgCallback *cb, void *data)
 {
     t_dlg   *dlg;
@@ -831,7 +828,7 @@ t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title,
     return dlg;
 }
 
     return dlg;
 }
 
-void SetDlgSize(t_dlg *dlg, int w, int h, gmx_bool bAutoPosition)
+void SetDlgSize(t_dlg *dlg, int w, int h, bool bAutoPosition)
 {
     if (bAutoPosition)
     {
 {
     if (bAutoPosition)
     {
similarity index 86%
rename from src/ngmx/xdlg.h
rename to src/programs/view/xdlg.h
index 11909233fa12cfcb4aa0a862af866cf35906cf32..c4aeb26011ff4d90ac3da443117c0dea59691f83 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef _xdlg_h
 #define _xdlg_h
 
 #ifndef _xdlg_h
 #define _xdlg_h
 
-#include <xdlgitem.h>
+#include "xdlgitem.h"
 
 #define DLG_SHOW         (1<<0)
 #define DLG_HIDE         (1<<1)
 
 #define DLG_SHOW         (1<<0)
 #define DLG_HIDE         (1<<1)
@@ -65,8 +65,8 @@ typedef struct {
     unsigned int          xmax, ymax; /* Dimensions of parent window        */
     unsigned long         flags;      /* Flags for display          */
     unsigned long         fg, bg;     /* The colours                */
     unsigned int          xmax, ymax; /* Dimensions of parent window        */
     unsigned long         flags;      /* Flags for display          */
     unsigned long         fg, bg;     /* The colours                */
-    gmx_bool              bPop;       /* Should we pop the mouse back   */
-    gmx_bool              bGrab;      /* Have we grabbed the mouse ?        */
+    bool                  bPop;       /* Should we pop the mouse back   */
+    bool                  bGrab;      /* Have we grabbed the mouse ?        */
     int                   nitem;      /* The number of items            */
     t_dlgitem           **dlgitem;    /* The array of item pointers         */
     DlgCallback          *cb;         /* User call back function               */
     int                   nitem;      /* The number of items            */
     t_dlgitem           **dlgitem;    /* The array of item pointers         */
     DlgCallback          *cb;         /* User call back function               */
@@ -80,7 +80,7 @@ typedef struct {
  *
  ****************************/
 t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title,
  *
  ****************************/
 t_dlg *CreateDlg(t_x11 *x11, Window Parent, const char *title,
-                 int x0, int y0, int w, int h, int bw, unsigned long fg, unsigned long bg,
+                 int x0, int y0, int w, int h, int bw,
                  DlgCallback *cb, void *data);
 
 /*****************************
                  DlgCallback *cb, void *data);
 
 /*****************************
@@ -97,13 +97,13 @@ void AddDlgItems(t_dlg *dlg, int nitem, t_dlgitem *item[]);
 /*****************************
  *
  * Routines to manipulate items on a dialog box
 /*****************************
  *
  * Routines to manipulate items on a dialog box
- * They return TRUE on succes, FALSE otherwise
- * FALSE will mean most of the time, that item id was not found
+ * They return true on succes, false otherwise
+ * false will mean most of the time, that item id was not found
  *
  ****************************/
  *
  ****************************/
-gmx_bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h);
+bool QueryDlgItemSize(t_dlg *dlg, t_id id, int *w, int *h);
 
 
-gmx_bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0);
+bool QueryDlgItemPos(t_dlg *dlg, t_id id, int *x0, int *y0);
 
 int QueryDlgItemX(t_dlg *dlg, t_id id);
 
 
 int QueryDlgItemX(t_dlg *dlg, t_id id);
 
@@ -113,11 +113,11 @@ int QueryDlgItemW(t_dlg *dlg, t_id id);
 
 int QueryDlgItemH(t_dlg *dlg, t_id id);
 
 
 int QueryDlgItemH(t_dlg *dlg, t_id id);
 
-gmx_bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h);
+bool SetDlgItemSize(t_dlg *dlg, t_id id, int w, int h);
 
 
-gmx_bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0);
+bool SetDlgItemPos(t_dlg *dlg, t_id id, int x0, int y0);
 
 
-void SetDlgSize(t_dlg *dlg, int w, int h, gmx_bool bAutoPosition);
+void SetDlgSize(t_dlg *dlg, int w, int h, bool bAutoPosition);
 
 /*****************************
  *
 
 /*****************************
  *
@@ -125,7 +125,7 @@ void SetDlgSize(t_dlg *dlg, int w, int h, gmx_bool bAutoPosition);
  * after dlg is exec'ed
  *
  ****************************/
  * after dlg is exec'ed
  *
  ****************************/
-gmx_bool IsCBChecked(t_dlg *dlg, t_id id);
+bool IsCBChecked(t_dlg *dlg, t_id id);
 
 t_id RBSelected(t_dlg *dlg, int gid);
 
 
 t_id RBSelected(t_dlg *dlg, int gid);
 
similarity index 90%
rename from src/ngmx/xdlghi.c
rename to src/programs/view/xdlghi.cpp
index b8193ae5d808d5e367634a3273d403ac48eabd49..832ef437ed881a411efdc6c2af7790c3a8e900e8 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -43,6 +43,7 @@
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "macros.h"
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "macros.h"
+#include "xutil.h"
 #include "xdlghi.h"
 #include "fgrid.h"
 
 #include "xdlghi.h"
 #include "fgrid.h"
 
@@ -71,7 +72,7 @@ t_dlgitem **CreateRadioButtonGroup(t_x11 *x11, char *szTitle,
         dlgitem[i+1] = CreateRadioButton(x11, szRB[i], (i == nSelect),
                                          rb[i], GroupID, x, y, 0, 0, 0);
         y += dlgitem[i+1]->win.height+OFFS_Y;
         dlgitem[i+1] = CreateRadioButton(x11, szRB[i], (i == nSelect),
                                          rb[i], GroupID, x, y, 0, 0, 0);
         y += dlgitem[i+1]->win.height+OFFS_Y;
-        w  = max(w, dlgitem[i+1]->win.width);
+        w  = std::max(w, dlgitem[i+1]->win.width);
     }
     for (i = 0; (i < nrb); i++)
     {
     }
     for (i = 0; (i < nrb); i++)
     {
@@ -98,7 +99,7 @@ t_dlgitem **CreateDlgitemGroup(t_x11 *x11, const char *szTitle,
     t_id         *ids;
     edlgitem      edlg;
     char         *name;
     t_id         *ids;
     edlgitem      edlg;
     char         *name;
-    gmx_bool      bBool;
+    bool          bBool;
     Pixmap        pm;
     int           nlines, buflen;
     char         *buf, **lines;
     Pixmap        pm;
     int           nlines, buflen;
     char         *buf, **lines;
@@ -135,7 +136,7 @@ t_dlgitem **CreateDlgitemGroup(t_x11 *x11, const char *szTitle,
                 break;
             case edlgPM:
                 pm           = va_arg(ap, Pixmap);
                 break;
             case edlgPM:
                 pm           = va_arg(ap, Pixmap);
-                dlgitem[i+1] = CreatePixmap(x11, pm, ids[i], GroupID, x, y, 0, 0, 0);
+                dlgitem[i+1] = CreatePixmap(pm, ids[i], GroupID, x, y, 0, 0, 0);
                 break;
             case edlgST:
                 nlines       = va_arg(ap, int);
                 break;
             case edlgST:
                 nlines       = va_arg(ap, int);
@@ -155,7 +156,7 @@ t_dlgitem **CreateDlgitemGroup(t_x11 *x11, const char *szTitle,
                 gmx_fatal(FARGS, "Invalid dlgitem type: %d\n", edlg);
         }
         y += dlgitem[i+1]->win.height+OFFS_Y;
                 gmx_fatal(FARGS, "Invalid dlgitem type: %d\n", edlg);
         }
         y += dlgitem[i+1]->win.height+OFFS_Y;
-        w  = max(w, dlgitem[i+1]->win.width);
+        w  = std::max(w, dlgitem[i+1]->win.width);
     }
     va_end(ap);
     sfree(dlgitem[0]->u.groupbox.item);
     }
     va_end(ap);
     sfree(dlgitem[0]->u.groupbox.item);
@@ -171,7 +172,7 @@ t_dlgitem **CreateDlgitemGroup(t_x11 *x11, const char *szTitle,
 }
 
 static void AddDlgItemGroups(t_dlg *dlg, int gridx, int gridy,
 }
 
 static void AddDlgItemGroups(t_dlg *dlg, int gridx, int gridy,
-                             t_dlgitemlist **grid, gmx_bool bAutoPosition)
+                             t_dlgitemlist **grid, bool bAutoPosition)
 {
     t_dlgitemlist *item;
     int            x1, y1, w1, h1;
 {
     t_dlgitemlist *item;
     int            x1, y1, w1, h1;
@@ -198,8 +199,8 @@ static void AddDlgItemGroups(t_dlg *dlg, int gridx, int gridy,
                     AddDlgItems(dlg, item->nitem, item->list);
                     dw = item->w;
                     dh = item->h;
                     AddDlgItems(dlg, item->nitem, item->list);
                     dw = item->w;
                     dh = item->h;
-                    w  = max(w, ((float) QueryDlgItemW(dlg, item->list[0]->ID))/dw);
-                    h  = max(h, ((float) QueryDlgItemH(dlg, item->list[0]->ID))/dh);
+                    w  = std::max(w, ((float) QueryDlgItemW(dlg, item->list[0]->ID))/dw);
+                    h  = std::max(h, ((float) QueryDlgItemH(dlg, item->list[0]->ID))/dh);
                 }
             }
         }
                 }
             }
         }
@@ -259,7 +260,7 @@ static void AddListItem(t_dlgitemlist *list, t_dlgitem *item)
 
 static void AddListFItem(t_x11 *x11, t_dlgitemlist *list,
                          t_fitem *fitem, t_id GroupID, t_id *ID,
 
 static void AddListFItem(t_x11 *x11, t_dlgitemlist *list,
                          t_fitem *fitem, t_id GroupID, t_id *ID,
-                         int x, int *y, int *w, gmx_bool bUseMon)
+                         int x, int *y, int *w, bool bUseMon)
 {
     int  i, iSel, slen;
     char buf[STRLEN];
 {
     int  i, iSel, slen;
     char buf[STRLEN];
@@ -292,14 +293,14 @@ static void AddListFItem(t_x11 *x11, t_dlgitemlist *list,
                             CreateRadioButton(x11, fitem->name[i], (iSel == i),
                                               (*ID)++, GroupID, x, (*y), 0, 0, 0));
                 (*y) += list->list[list->nitem-1]->win.height+OFFS_Y;
                             CreateRadioButton(x11, fitem->name[i], (iSel == i),
                                               (*ID)++, GroupID, x, (*y), 0, 0, 0));
                 (*y) += list->list[list->nitem-1]->win.height+OFFS_Y;
-                (*w)  = max((*w), list->list[list->nitem-1]->win.width);
+                (*w)  = std::max((*w), list->list[list->nitem-1]->win.width);
                 SetDlgitemOpts(list->list[list->nitem-1], bUseMon,
                                fitem->set, fitem->get, fitem->help);
             }
             break;
         case edlgCB:
         {
                 SetDlgitemOpts(list->list[list->nitem-1], bUseMon,
                                fitem->set, fitem->get, fitem->help);
             }
             break;
         case edlgCB:
         {
-            gmx_bool bCheck;
+            bool bCheck;
 
             bCheck = gmx_strcasecmp(fitem->def, "TRUE") == 0;
             AddListItem(list, CreateCheckBox(x11, fitem->name[0], bCheck,
 
             bCheck = gmx_strcasecmp(fitem->def, "TRUE") == 0;
             AddListItem(list, CreateCheckBox(x11, fitem->name[0], bCheck,
@@ -308,7 +309,8 @@ static void AddListFItem(t_x11 *x11, t_dlgitemlist *list,
         }
         case edlgST:
             AddListItem(list,
         }
         case edlgST:
             AddListItem(list,
-                        CreateStaticText(x11, fitem->nname, fitem->name, (*ID)++,
+                        CreateStaticText(x11, fitem->nname,
+                                         fitem->name, (*ID)++,
                                          GroupID, x, (*y), 0, 0, 0));
             break;
         case edlgET:
                                          GroupID, x, (*y), 0, 0, 0));
             break;
         case edlgET:
@@ -327,12 +329,12 @@ static void AddListFItem(t_x11 *x11, t_dlgitemlist *list,
     if (fitem->edlg != edlgRB)
     {
         (*y) += list->list[list->nitem-1]->win.height+OFFS_Y;
     if (fitem->edlg != edlgRB)
     {
         (*y) += list->list[list->nitem-1]->win.height+OFFS_Y;
-        (*w)  = max((*w), list->list[list->nitem-1]->win.width);
+        (*w)  = std::max((*w), list->list[list->nitem-1]->win.width);
     }
 }
 
 static void AddListFGroup(t_x11 *x11, t_dlgitemlist **grid,
     }
 }
 
 static void AddListFGroup(t_x11 *x11, t_dlgitemlist **grid,
-                          t_fgroup *fgroup, t_id *ID, gmx_bool bUseMon)
+                          t_fgroup *fgroup, t_id *ID, bool bUseMon)
 {
     int            i;
     t_id           GroupID, *ids;
 {
     int            i;
     t_id           GroupID, *ids;
@@ -351,7 +353,7 @@ static void AddListFGroup(t_x11 *x11, t_dlgitemlist **grid,
         AddListFItem(x11, item, fgroup->fitem[i], GroupID, ID, x, &y, &w, bUseMon);
     }
 
         AddListFItem(x11, item, fgroup->fitem[i], GroupID, ID, x, &y, &w, bUseMon);
     }
 
-    w = max(w, item->list[0]->win.width+4*OFFS_X);
+    w = std::max(w, item->list[0]->win.width+4*OFFS_X);
     sfree(item->list[0]->u.groupbox.item);
     sfree(item->list[0]->win.text);
     snew(ids, item->nitem);
     sfree(item->list[0]->u.groupbox.item);
     sfree(item->list[0]->win.text);
     snew(ids, item->nitem);
@@ -368,7 +370,7 @@ static void AddListFGroup(t_x11 *x11, t_dlgitemlist **grid,
 }
 
 static void AddListFSimple(t_x11 *x11, t_dlgitemlist **grid,
 }
 
 static void AddListFSimple(t_x11 *x11, t_dlgitemlist **grid,
-                           t_fsimple *fsimple, t_id *ID, gmx_bool bUseMon)
+                           t_fsimple *fsimple, t_id *ID, bool bUseMon)
 {
     t_dlgitemlist *item;
     int            x, y, w;
 {
     t_dlgitemlist *item;
     int            x, y, w;
@@ -383,8 +385,8 @@ static void AddListFSimple(t_x11 *x11, t_dlgitemlist **grid,
 }
 
 t_dlg *ReadDlg(t_x11 *x11, Window Parent, const char *title,
 }
 
 t_dlg *ReadDlg(t_x11 *x11, Window Parent, const char *title,
-               unsigned long fg, unsigned long bg, const char *infile,
-               int x0, int y0, gmx_bool bAutoPosition, gmx_bool bUseMon,
+               const char *infile,
+               int x0, int y0, bool bAutoPosition, bool bUseMon,
                DlgCallback *cb, void *data)
 {
     t_fgrid        *fgrid;
                DlgCallback *cb, void *data)
 {
     t_fgrid        *fgrid;
@@ -394,7 +396,7 @@ t_dlg *ReadDlg(t_x11 *x11, Window Parent, const char *title,
     t_id            ID;
 
     fgrid = FGridFromFile(infile);
     t_id            ID;
 
     fgrid = FGridFromFile(infile);
-    dlg   = CreateDlg(x11, Parent, title, x0, y0, 0, 0, 0, fg, bg, cb, data);
+    dlg   = CreateDlg(x11, Parent, title, x0, y0, 0, 0, 0, cb, data);
     grid  = NewDlgitemList(fgrid->w, fgrid->h);
     ID    = 0;
 
     grid  = NewDlgitemList(fgrid->w, fgrid->h);
     ID    = 0;
 
similarity index 92%
rename from src/ngmx/xdlghi.h
rename to src/programs/view/xdlghi.h
index 1bf5e18955f42ebad571464be41b607c88d9302e..376ddc718dd1d74078f6b5f1bbd7d3c7fb28cc9f 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -68,8 +68,8 @@ extern t_dlgitem **CreateDlgitemGroup(t_x11 *x11, const char *szTitle,
  */
 
 extern t_dlg *ReadDlg(t_x11 *x11, Window Parent, const char *title,
  */
 
 extern t_dlg *ReadDlg(t_x11 *x11, Window Parent, const char *title,
-                      unsigned long fg, unsigned long bg, const char *infile,
-                      int x0, int y0, gmx_bool bAutoPosition, gmx_bool bUseMon,
+                      const char *infile,
+                      int x0, int y0, bool bAutoPosition, bool bUseMon,
                       DlgCallback *cb, void *data);
 /* Read a dialog box from a template file */
 
                       DlgCallback *cb, void *data);
 /* Read a dialog box from a template file */
 
similarity index 89%
rename from src/ngmx/xdlgitem.c
rename to src/programs/view/xdlgitem.cpp
index eecc300fb3bfe22b32a9b92159ce1b7ca2913c84..a53ba6811552f92463bf9f2e4b3517d18a6459c2 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -50,7 +50,7 @@
 
 #define BUFSIZE 16
 
 
 #define BUFSIZE 16
 
-t_dlgitem *newitem(t_x11 *x11)
+static t_dlgitem *newitem(void)
 {
     t_dlgitem *item;
 
 {
     t_dlgitem *item;
 
@@ -119,12 +119,12 @@ static int DefWndProc(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
             }
             break;
         case EnterNotify:
             }
             break;
         case EnterNotify:
-            dlgitem->win.bFocus = TRUE;
+            dlgitem->win.bFocus = true;
             ShowCaret(x11, dlgitem);
             /*    LightBorder(x11->disp,dlgitem->win.self,x11->fg); */
             break;
         case LeaveNotify:
             ShowCaret(x11, dlgitem);
             /*    LightBorder(x11->disp,dlgitem->win.self,x11->fg); */
             break;
         case LeaveNotify:
-            dlgitem->win.bFocus = FALSE;
+            dlgitem->win.bFocus = false;
             HideCaret(x11, dlgitem);
             /*    LightBorder(x11->disp,dlgitem->win.self,x11->bg); */
             break;
             HideCaret(x11, dlgitem);
             /*    LightBorder(x11->disp,dlgitem->win.self,x11->bg); */
             break;
@@ -319,7 +319,7 @@ static int WndProcST(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
     return ITEMOK;
 }
 
     return ITEMOK;
 }
 
-static gmx_bool insert(char *s, char c, int *pos)
+static bool insert(char *s, char c, int *pos)
 {
     int i, sl;
 
 {
     int i, sl;
 
@@ -333,12 +333,12 @@ static gmx_bool insert(char *s, char c, int *pos)
         }
         s[*pos] = c;
         (*pos)++;
         }
         s[*pos] = c;
         (*pos)++;
-        return TRUE;
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-static gmx_bool my_backspace(char *s, int *pos)
+static bool my_backspace(char *s, int *pos)
 {
     int i, sl;
 
 {
     int i, sl;
 
@@ -349,13 +349,13 @@ static gmx_bool my_backspace(char *s, int *pos)
         {
             s[i] = s[i+1];
         }
         {
             s[i] = s[i+1];
         }
-        (*pos) = max(0, (*pos)-1);
-        return TRUE;
+        (*pos) = std::max(0, (*pos)-1);
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 }
 
-static gmx_bool my_delete(char *s, int *pos)
+static bool my_delete(char *s, int *pos)
 {
     int i, sl;
 
 {
     int i, sl;
 
@@ -366,19 +366,20 @@ static gmx_bool my_delete(char *s, int *pos)
         {
             s[i] = s[i+1];
         }
         {
             s[i] = s[i+1];
         }
-        return TRUE;
+        return true;
     }
     }
-    return FALSE;
+    return false;
 }
 
 static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
 {
 }
 
 static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
 {
-    t_edittext *et;
-    t_windata  *win;
-    KeySym      keysym;
-    char        c[BUFSIZE+1], *bp;
-    char        scrbuf[STRLEN];
-    int         i, xp, xtitle, ewidth;
+    t_edittext  *et;
+    t_windata   *win;
+    KeySym       keysym;
+    char         c[BUFSIZE+1], *bp;
+    char         scrbuf[STRLEN];
+    int          i;
+    int          xp, xtitle, ewidth;
 
     if (dlgitem->type != edlgET)
     {
 
     if (dlgitem->type != edlgET)
     {
@@ -425,7 +426,7 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
                 bp[et->pos] = '\0';
             }
             sfree(bp);
                 bp[et->pos] = '\0';
             }
             sfree(bp);
-            et->bChanged = TRUE;
+            et->bChanged = true;
             return ETCHANGED;
         case KeyPress:
             /* Check for HelpKey */
             return ETCHANGED;
         case KeyPress:
             /* Check for HelpKey */
@@ -442,7 +443,7 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
                 case XK_Delete:
                     if (my_delete(et->buf, &(et->pos)))
                     {
                 case XK_Delete:
                     if (my_delete(et->buf, &(et->pos)))
                     {
-                        et->bChanged = TRUE;
+                        et->bChanged = true;
                         return ETCHANGED;
                     }
                     else
                         return ETCHANGED;
                     }
                     else
@@ -453,7 +454,7 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
                 case XK_BackSpace:
                     if (my_backspace(et->buf, &(et->pos)))
                     {
                 case XK_BackSpace:
                     if (my_backspace(et->buf, &(et->pos)))
                     {
-                        et->bChanged = TRUE;
+                        et->bChanged = true;
                         return ETCHANGED;
                     }
                     else
                         return ETCHANGED;
                     }
                     else
@@ -467,10 +468,10 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
                 case XK_Home:
                     et->pos      = 0;
                     et->strbegin = 0;
                 case XK_Home:
                     et->pos      = 0;
                     et->strbegin = 0;
-                    et->bChanged = TRUE;
+                    et->bChanged = true;
                     return ETCHANGED;
                 case XK_End:
                     return ETCHANGED;
                 case XK_End:
-                    if (strlen(et->buf) <= et->buflen)
+                    if (strlen(et->buf) <= (unsigned int)et->buflen)
                     {
                         et->pos = strlen(et->buf);
                     }
                     {
                         et->pos = strlen(et->buf);
                     }
@@ -479,20 +480,21 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
                         et->pos      = et->buflen;
                         et->strbegin = strlen(et->buf)-et->buflen;
                     }
                         et->pos      = et->buflen;
                         et->strbegin = strlen(et->buf)-et->buflen;
                     }
-                    et->bChanged = TRUE;
+                    et->bChanged = true;
                     return ETCHANGED;
                 case XK_Left:
                     return ETCHANGED;
                 case XK_Left:
-                    et->pos      = max(0, et->pos-1);
-                    et->strbegin = min(et->strbegin, et->pos);
-                    et->bChanged = TRUE;
+                    et->pos      = std::max(0, et->pos-1);
+                    et->strbegin = std::min(et->strbegin, et->pos);
+                    et->bChanged = true;
                     return ETCHANGED;
                 case XK_Right:
                     return ETCHANGED;
                 case XK_Right:
-                    if ((et->pos < et->buflen) && (et->strbegin+et->buflen > strlen(et->buf)))
+                    if ((et->pos < et->buflen) &&
+                        (et->strbegin+et->buflen > (int)strlen(et->buf)))
                     {
                         et->pos++;
                     }
                     {
                         et->pos++;
                     }
-                    else if ((et->buflen   < strlen(et->buf)) &&
-                             (et->strbegin < strlen(et->buf)-et->buflen))
+                    else if ((et->buflen   < (int)strlen(et->buf)) &&
+                             (et->strbegin < (int)strlen(et->buf)-et->buflen))
                     {
                         et->strbegin++;
                     }
                     {
                         et->strbegin++;
                     }
@@ -500,14 +502,14 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
                     {
                         break;
                     }
                     {
                         break;
                     }
-                    et->bChanged = TRUE;
+                    et->bChanged = true;
                     return ETCHANGED;
                 default:
                     if (keysym < 256)
                     {
                         if (insert(et->buf, c[0], &(et->pos)))
                         {
                     return ETCHANGED;
                 default:
                     if (keysym < 256)
                     {
                         if (insert(et->buf, c[0], &(et->pos)))
                         {
-                            et->bChanged = TRUE;
+                            et->bChanged = true;
                             return ETCHANGED;
                         }
                     }
                             return ETCHANGED;
                         }
                     }
@@ -516,11 +518,11 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
             }
             break;
         case LeaveNotify:
             }
             break;
         case LeaveNotify:
-            win->bFocus = FALSE;
+            win->bFocus = false;
             HideCaret(x11, dlgitem);
             if (et->bChanged)
             {
             HideCaret(x11, dlgitem);
             if (et->bChanged)
             {
-                et->bChanged = FALSE;
+                et->bChanged = false;
             }
             break;
         default:
             }
             break;
         default:
@@ -544,13 +546,13 @@ static int WndProcET(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
  *
  ****************************/
 t_dlgitem *CreateButton(t_x11 *x11,
  *
  ****************************/
 t_dlgitem *CreateButton(t_x11 *x11,
-                        const char *szLab, gmx_bool bDef, t_id id, t_id groupid,
+                        const char *szLab, bool bDef, t_id id, t_id groupid,
                         int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
     char      *lab;
 
                         int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
     char      *lab;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     if (h == 0)
     {
         h = XTextHeight(x11->font)+2*OFFS_Y;
     if (h == 0)
     {
         h = XTextHeight(x11->font)+2*OFFS_Y;
@@ -580,13 +582,13 @@ t_dlgitem *CreateButton(t_x11 *x11,
 }
 
 t_dlgitem *CreateRadioButton(t_x11 *x11,
 }
 
 t_dlgitem *CreateRadioButton(t_x11 *x11,
-                             const char *szLab, gmx_bool bSet, t_id id,
+                             const char *szLab, bool bSet, t_id id,
                              t_id groupid,
                              int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
 
                              t_id groupid,
                              int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
@@ -612,7 +614,7 @@ t_dlgitem *CreateGroupBox(t_x11 *x11,
 {
     t_dlgitem *dlgitem;
 
 {
     t_dlgitem *dlgitem;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
@@ -635,13 +637,13 @@ t_dlgitem *CreateGroupBox(t_x11 *x11,
 }
 
 t_dlgitem *CreateCheckBox(t_x11 *x11,
 }
 
 t_dlgitem *CreateCheckBox(t_x11 *x11,
-                          const char *szLab, gmx_bool bCheckedInitial, t_id id,
+                          const char *szLab, bool bCheckedInitial, t_id id,
                           t_id groupid,
                           int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
 
                           t_id groupid,
                           int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
@@ -660,13 +662,12 @@ t_dlgitem *CreateCheckBox(t_x11 *x11,
     return dlgitem;
 }
 
     return dlgitem;
 }
 
-t_dlgitem *CreatePixmap(t_x11 *x11,
-                        Pixmap pm, t_id id,
+t_dlgitem *CreatePixmap(Pixmap pm, t_id id,
                         t_id groupid, int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
 
                         t_id groupid, int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL);
     dlgitem->ID          = id;
     dlgitem->type        = edlgPM;
     InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL);
     dlgitem->ID          = id;
     dlgitem->type        = edlgPM;
@@ -677,14 +678,14 @@ t_dlgitem *CreatePixmap(t_x11 *x11,
 }
 
 t_dlgitem *CreateStaticText(t_x11 *x11,
 }
 
 t_dlgitem *CreateStaticText(t_x11 *x11,
-                            int nlines, char * const * lines, t_id id,
+                            int nlines, const char * const *lines, t_id id,
                             t_id groupid,
                             int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
     int        i;
 
                             t_id groupid,
                             int x0, int y0, int w, int h, int bw)
 {
     t_dlgitem *dlgitem;
     int        i;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     if (h == 0)
     {
         h = (XTextHeight(x11->font)+OFFS_Y)*nlines+OFFS_Y;
     if (h == 0)
     {
         h = (XTextHeight(x11->font)+OFFS_Y)*nlines+OFFS_Y;
@@ -693,7 +694,7 @@ t_dlgitem *CreateStaticText(t_x11 *x11,
     {
         for (i = 0; (i < nlines); i++)
         {
     {
         for (i = 0; (i < nlines); i++)
         {
-            w = max(w, XTextWidth(x11->font, lines[i], strlen(lines[i])));
+            w = std::max(w, XTextWidth(x11->font, lines[i], strlen(lines[i])));
         }
         w += 2*OFFS_X;
     }
         }
         w += 2*OFFS_X;
     }
@@ -720,7 +721,7 @@ t_dlgitem *CreateEditText(t_x11 *x11,
     t_dlgitem  *dlgitem;
     t_edittext *et;
 
     t_dlgitem  *dlgitem;
     t_edittext *et;
 
-    dlgitem = newitem(x11);
+    dlgitem = newitem();
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
     if (h == 0)
     {
         h = XTextHeight(x11->font)+OFFS_Y;
@@ -745,7 +746,7 @@ t_dlgitem *CreateEditText(t_x11 *x11,
     strcpy(et->buf, buf);
     et->buflen       = screenbuf;
     et->strbegin     = 0;
     strcpy(et->buf, buf);
     et->buflen       = screenbuf;
     et->strbegin     = 0;
-    et->bChanged     = FALSE;
+    et->bChanged     = false;
     dlgitem->WndProc = WndProcET;
 
     return dlgitem;
     dlgitem->WndProc = WndProcET;
 
     return dlgitem;
@@ -753,7 +754,7 @@ t_dlgitem *CreateEditText(t_x11 *x11,
 
 #define SC(src) (strlen(src) ? strdup(src) : NULL)
 
 
 #define SC(src) (strlen(src) ? strdup(src) : NULL)
 
-void SetDlgitemOpts(t_dlgitem *dlgitem, gmx_bool bUseMon,
+void SetDlgitemOpts(t_dlgitem *dlgitem, bool bUseMon,
                     char *set, char *get, char *help)
 {
     dlgitem->bUseMon = bUseMon;
                     char *set, char *get, char *help)
 {
     dlgitem->bUseMon = bUseMon;
similarity index 84%
rename from src/ngmx/xdlgitem.h
rename to src/programs/view/xdlgitem.h
index a1076045c9522bf549ea5f1df2d2d5d9e7eb6fa3..e4f011e762586437dbcb16f2b2b0b06d1844d4d1 100644 (file)
 #define _xdlgitem_h
 
 #include <typedefs.h>
 #define _xdlgitem_h
 
 #include <typedefs.h>
-#include <Xstuff.h>
-#include <xutil.h>
-#include <x11.h>
+#include "Xstuff.h"
+#include "xutil.h"
+#include "x11.h"
 
 
+typedef enum {
+    edlgBN, edlgRB, edlgGB, edlgCB, edlgPM, edlgST, edlgET, edlgNR
+} edlgitem;
 #define XCARET  2
 
 enum {
 #define XCARET  2
 
 enum {
@@ -50,15 +53,15 @@ enum {
 typedef int t_id;
 
 typedef struct {
 typedef int t_id;
 
 typedef struct {
-    gmx_bool bDefault;  /* This is the default button */
+    bool bDefault;  /* This is the default button */
 } t_button;
 
 typedef struct {
 } t_button;
 
 typedef struct {
-    gmx_bool bSelect;   /* Is this rb selected ? */
+    bool bSelect;   /* Is this rb selected ? */
 } t_radiobutton;
 
 typedef struct {
 } t_radiobutton;
 
 typedef struct {
-    gmx_bool bChecked;  /* Is this cb checked ? */
+    bool bChecked;  /* Is this cb checked ? */
 } t_checkbox;
 
 typedef struct {
 } t_checkbox;
 
 typedef struct {
@@ -72,10 +75,10 @@ typedef struct {
 
 typedef struct {
     int  buflen, strbegin; /* Length of the screen buf and begin of string  */
 
 typedef struct {
     int  buflen, strbegin; /* Length of the screen buf and begin of string  */
-    int  pos /*,len*/;     /* Current length of the string and pos of caret */
+    int  pos;              /* Current length of the string and pos of caret */
     /* Pos is relative to strbegin, and is the pos   */
     /* in the window.                                */
     /* Pos is relative to strbegin, and is the pos   */
     /* in the window.                                */
-    gmx_bool bChanged;
+    bool     bChanged;
     char    *buf;
 } t_edittext;
 
     char    *buf;
 } t_edittext;
 
@@ -84,14 +87,11 @@ typedef struct {
     t_id *item;
 } t_groupbox;
 
     t_id *item;
 } t_groupbox;
 
-typedef enum {
-    edlgBN, edlgRB, edlgGB, edlgCB, edlgPM, edlgST, edlgET, edlgNR
-} edlgitem;
 
 typedef struct t_dlgitem {
     t_windata         win;
     t_id              ID, GroupID;
 
 typedef struct t_dlgitem {
     t_windata         win;
     t_id              ID, GroupID;
-    gmx_bool          bUseMon;
+    bool              bUseMon;
     char             *set, *get, *help;
     edlgitem          type;
     int       (*WndProc)(t_x11 *x11, struct t_dlgitem *dlgitem, XEvent *event);
     char             *set, *get, *help;
     edlgitem          type;
     int       (*WndProc)(t_x11 *x11, struct t_dlgitem *dlgitem, XEvent *event);
@@ -120,12 +120,12 @@ typedef struct t_dlgitem {
  * on the dlg box, and if wished resize them.
  *
  ****************************/
  * on the dlg box, and if wished resize them.
  *
  ****************************/
-extern t_dlgitem *CreateButton(t_x11 *x11, const char *szLab, gmx_bool bDef,
+extern t_dlgitem *CreateButton(t_x11 *x11, const char *szLab, bool bDef,
                                t_id id, t_id groupid,
                                int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateRadioButton(t_x11 *x11,
                                t_id id, t_id groupid,
                                int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateRadioButton(t_x11 *x11,
-                                    const char *szLab, gmx_bool bSet, t_id id,
+                                    const char *szLab, bool bSet, t_id id,
                                     t_id groupid,
                                     int x0, int y0, int w, int h, int bw);
 
                                     t_id groupid,
                                     int x0, int y0, int w, int h, int bw);
 
@@ -134,23 +134,23 @@ extern t_dlgitem *CreateGroupBox(t_x11 *x11, const char *szLab, t_id id,
                                  int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateCheckBox(t_x11 *x11, const char *szLab,
                                  int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateCheckBox(t_x11 *x11, const char *szLab,
-                                 gmx_bool bCheckedInitial,
+                                 bool bCheckedInitial,
                                  t_id id, t_id groupid,
                                  int x0, int y0, int w, int h, int bw);
 
                                  t_id id, t_id groupid,
                                  int x0, int y0, int w, int h, int bw);
 
-extern t_dlgitem *CreatePixmap(t_x11 *x11, Pixmap pm, t_id id, t_id groupid,
+extern t_dlgitem *CreatePixmap(Pixmap pm, t_id id, t_id groupid,
                                int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateStaticText(t_x11 *x11,
                                int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateStaticText(t_x11 *x11,
-                                   int nlines, char * const * lines, t_id id,
-                                   t_id groupid,
+                                   int nlines, const char * const *lines,
+                                   t_id id, t_id groupid,
                                    int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateEditText(t_x11 *x11, const char *title,
                                  int screenbuf, char *buf, t_id id, t_id groupid,
                                  int x0, int y0, int w, int h, int bw);
 
                                    int x0, int y0, int w, int h, int bw);
 
 extern t_dlgitem *CreateEditText(t_x11 *x11, const char *title,
                                  int screenbuf, char *buf, t_id id, t_id groupid,
                                  int x0, int y0, int w, int h, int bw);
 
-extern void SetDlgitemOpts(t_dlgitem *dlgitem, gmx_bool bUseMon,
+extern void SetDlgitemOpts(t_dlgitem *dlgitem, bool bUseMon,
                            char *set, char *get, char *help);
 
 #endif  /* _xdlgitem_h */
                            char *set, char *get, char *help);
 
 #endif  /* _xdlgitem_h */
similarity index 93%
rename from src/ngmx/xmb.c
rename to src/programs/view/xmb.cpp
index a840367edf76f2e8e5eb2a41d4a4e2041cf57908..643b2605bf8968f1966fe620a1ed72fe00e7943c 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
@@ -44,6 +44,7 @@
 #include "macros.h"
 #include "Xstuff.h"
 #include "x11.h"
 #include "macros.h"
 #include "Xstuff.h"
 #include "x11.h"
+#include "xutil.h"
 #include "xdlg.h"
 #include "xmb.h"
 #include "gmx_fatal.h"
 #include "xdlg.h"
 #include "xmb.h"
 #include "gmx_fatal.h"
@@ -72,7 +73,7 @@ void SetIcon(unsigned char *bits, int w, int h, unsigned long fg, unsigned long
 }
 
 t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
 }
 
 t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
-                  int nlines, char ** lines, unsigned long Flags,
+                  int nlines, const char * const * lines, unsigned long Flags,
                   DlgCallback *cb, void *data)
 {
     t_dlg                *dlg;
                   DlgCallback *cb, void *data)
 {
     t_dlg                *dlg;
@@ -132,12 +133,12 @@ t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
         }
     }
 
         }
     }
 
-    dlg = CreateDlg(x11, Parent, title, 0, 0, 0, 0, 3, x11->fg, bg, cb, data);
+    dlg = CreateDlg(x11, Parent, title, 0, 0, 0, 0, 3, cb, data);
     x   = 2*OFFS_X;
     if (nicon > 0)
     {
         AddDlgItem(dlg, CreatePixmap
     x   = 2*OFFS_X;
     if (nicon > 0)
     {
         AddDlgItem(dlg, CreatePixmap
-                       (x11, XCreatePixmapFromBitmapData
+                       (XCreatePixmapFromBitmapData
                            (x11->disp, dlg->win.self, icon_bits, icon_width, icon_height,
                            icon_fg, icon_bg, x11->depth),
                        ID_ICON, ID_BOX, 2*OFFS_X, 2*OFFS_Y, icon_width, icon_height, 0));
                            (x11->disp, dlg->win.self, icon_bits, icon_width, icon_height,
                            icon_fg, icon_bg, x11->depth),
                        ID_ICON, ID_BOX, 2*OFFS_X, 2*OFFS_Y, icon_width, icon_height, 0));
@@ -160,7 +161,10 @@ t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
         {
             SetDlgItemPos(dlg, ID_ICON, 2*OFFS_X, 2*OFFS_Y+(y-yi)/2);
         }
         {
             SetDlgItemPos(dlg, ID_ICON, 2*OFFS_X, 2*OFFS_Y+(y-yi)/2);
         }
-        y = max(y, yi);
+        if (yi > y)
+        {
+            y = yi;
+        }
     }
     x    += QueryDlgItemW(dlg, ID_TEXT)+2*OFFS_X;
     y    += 2*OFFS_Y;
     }
     x    += QueryDlgItemW(dlg, ID_TEXT)+2*OFFS_X;
     y    += 2*OFFS_Y;
@@ -177,7 +181,7 @@ t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
     }
 
 #define CB(name, butx, id) AddDlgItem(dlg, CreateButton(x11, name, \
     }
 
 #define CB(name, butx, id) AddDlgItem(dlg, CreateButton(x11, name, \
-                                                        TRUE, id, ID_BOX, \
+                                                        true, id, ID_BOX, \
                                                         butx, y, width, 0, 0))
     if (Flags & MB_OK)
     {
                                                         butx, y, width, 0, 0))
     if (Flags & MB_OK)
     {
@@ -197,7 +201,7 @@ t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
     }
 
     SetDlgSize(dlg, x, y+2*OFFS_Y+
     }
 
     SetDlgSize(dlg, x, y+2*OFFS_Y+
-               QueryDlgItemH(dlg, (Flags & MB_OK) ? MB_OK : MB_YES), TRUE);
+               QueryDlgItemH(dlg, (Flags & MB_OK) ? MB_OK : MB_YES), true);
 
     if (Flags & MB_SYSTEMMODAL)
     {
 
     if (Flags & MB_SYSTEMMODAL)
     {
similarity index 95%
rename from src/ngmx/xmb.h
rename to src/programs/view/xmb.h
index da8b4c4caf4242128f203ba8ef148891d3c9a5e8..c470c85e6cf04960e3112984c968674b1c50fc5a 100644 (file)
@@ -36,7 +36,7 @@
 #ifndef _xmb_h
 #define _xmb_h
 
 #ifndef _xmb_h
 #define _xmb_h
 
-#include <x11.h>
+#include "x11.h"
 
 #define MB_OK              1
 #define MB_CANCEL          (1<<1)
 
 #define MB_OK              1
 #define MB_CANCEL          (1<<1)
@@ -53,7 +53,7 @@
 #define MB_DONTSHOW        (1<<22)
 
 t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
 #define MB_DONTSHOW        (1<<22)
 
 t_dlg *MessageBox(t_x11 *x11, Window Parent, const char *title,
-                  int nlines, char ** lines, unsigned long Flags,
+                  int nlines, const char * const *lines, unsigned long Flags,
                   DlgCallback *cb, void *data);
 
 #endif  /* _xmb_h */
                   DlgCallback *cb, void *data);
 
 #endif  /* _xmb_h */
similarity index 96%
rename from src/ngmx/xutil.c
rename to src/programs/view/xutil.cpp
index da23521f552212d9518a21c7728ce58fcfed4eb5..8da40ba688975514265e34b60d3f2c792102bf57 100644 (file)
@@ -9,7 +9,7 @@
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2013, The GROMACS development team,
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
  * check out http://www.gromacs.org for more information.
 
  * This program is free software; you can redistribute it and/or
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <xutil.h>
-#include <Xstuff.h>
 #include "smalloc.h"
 #include "typedefs.h"
 #include "string2.h"
 #include "smalloc.h"
 #include "typedefs.h"
 #include "string2.h"
+#include "xutil.h"
+#include "Xstuff.h"
 
 int CheckWin(Window win, const char *file, int line)
 {
     typedef struct {
 
 int CheckWin(Window win, const char *file, int line)
 {
     typedef struct {
-        int         n;
+        Window      n;
         const char *s;
     } t_winerr;
         const char *s;
     } t_winerr;
-    t_winerr winerr[] = {
+    t_winerr          winerr[] = {
         { BadAlloc,  "Bad Alloc" },
         { BadColor,  "Bad Color" },
         { BadCursor, "Bad Cursor"},
         { BadAlloc,  "Bad Alloc" },
         { BadColor,  "Bad Color" },
         { BadCursor, "Bad Cursor"},
@@ -61,7 +61,7 @@ int CheckWin(Window win, const char *file, int line)
         { BadWindow, "Bad Window"}
     };
 #define NERR (sizeof(winerr)/sizeof(winerr[0]))
         { BadWindow, "Bad Window"}
     };
 #define NERR (sizeof(winerr)/sizeof(winerr[0]))
-    int      i;
+    unsigned int      i;
 
     for (i = 0; (i < NERR); i++)
     {
 
     for (i = 0; (i < NERR); i++)
     {
@@ -162,7 +162,7 @@ void InitWin(t_windata *win, int x0, int y0, int w, int h, int bw, const char *t
     win->width  = w;
     win->height = h;
     win->bwidth = bw;
     win->width  = w;
     win->height = h;
     win->bwidth = bw;
-    win->bFocus = FALSE;
+    win->bFocus = false;
     win->cursor = 0;
     if (text)
     {
     win->cursor = 0;
     if (text)
     {
@@ -295,7 +295,7 @@ void PopMouse(Display *disp)
     sfree(old);
 }
 
     sfree(old);
 }
 
-gmx_bool HelpPressed(XEvent *event)
+bool HelpPressed(XEvent *event)
 {
 #define BUFSIZE 24
     char           buf[BUFSIZE+1];
 {
 #define BUFSIZE 24
     char           buf[BUFSIZE+1];
@@ -307,12 +307,12 @@ gmx_bool HelpPressed(XEvent *event)
     return (keysym == XK_F1);
 }
 
     return (keysym == XK_F1);
 }
 
-gmx_bool GrabOK(FILE *out, int err)
+bool GrabOK(FILE *out, int err)
 {
     switch (err)
     {
         case GrabSuccess:
 {
     switch (err)
     {
         case GrabSuccess:
-            return TRUE;
+            return true;
         case GrabNotViewable:
             fprintf(out, "GrabNotViewable\n"); break;
         case AlreadyGrabbed:
         case GrabNotViewable:
             fprintf(out, "GrabNotViewable\n"); break;
         case AlreadyGrabbed:
@@ -324,5 +324,5 @@ gmx_bool GrabOK(FILE *out, int err)
         default:
             break;
     }
         default:
             break;
     }
-    return FALSE;
+    return false;
 }
 }
similarity index 93%
rename from src/ngmx/xutil.h
rename to src/programs/view/xutil.h
index a251030415e08bc43221bb2183872ea0f24022b6..b69452d9a2681b92023c7c756e655eae7e210f9e 100644 (file)
@@ -48,7 +48,7 @@ typedef struct {
     Window         self, Parent;
     unsigned long  color;
     char          *text;
     Window         self, Parent;
     unsigned long  color;
     char          *text;
-    gmx_bool       bFocus;
+    bool           bFocus;
     int            x, y, width, height, bwidth;
     Cursor         cursor;
 } t_windata;
     int            x, y, width, height, bwidth;
     Cursor         cursor;
 } t_windata;
@@ -87,11 +87,11 @@ extern void PushMouse(Display *disp, Window dest, int x, int y);
 
 extern void PopMouse(Display *disp);
 
 
 extern void PopMouse(Display *disp);
 
-extern gmx_bool HelpPressed(XEvent *event);
+extern bool HelpPressed(XEvent *event);
 
 
-extern gmx_bool GrabOK(FILE *out, int err);
-/* Return TRUE if grab succeeded, prints a message to out
- * and returns FALSE otherwise.
+extern bool GrabOK(FILE *out, int err);
+/* Return true if grab succeeded, prints a message to out
+ * and returns false otherwise.
  */
 
 #endif  /* _xutil_h */
  */
 
 #endif  /* _xutil_h */