Moved ngmx to C++, renamed it to view.
[alexxy/gromacs.git] / src / programs / view / xutil.cpp
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.
- * 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
 #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 "xutil.h"
+#include "Xstuff.h"
 
 int CheckWin(Window win, const char *file, int line)
 {
     typedef struct {
-        int         n;
+        Window      n;
         const char *s;
     } t_winerr;
-    t_winerr winerr[] = {
+    t_winerr          winerr[] = {
         { 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]))
-    int      i;
+    unsigned int      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->bFocus = FALSE;
+    win->bFocus = false;
     win->cursor = 0;
     if (text)
     {
@@ -295,7 +295,7 @@ void PopMouse(Display *disp)
     sfree(old);
 }
 
-gmx_bool HelpPressed(XEvent *event)
+bool HelpPressed(XEvent *event)
 {
 #define BUFSIZE 24
     char           buf[BUFSIZE+1];
@@ -307,12 +307,12 @@ gmx_bool HelpPressed(XEvent *event)
     return (keysym == XK_F1);
 }
 
-gmx_bool GrabOK(FILE *out, int err)
+bool GrabOK(FILE *out, int err)
 {
     switch (err)
     {
         case GrabSuccess:
-            return TRUE;
+            return true;
         case GrabNotViewable:
             fprintf(out, "GrabNotViewable\n"); break;
         case AlreadyGrabbed:
@@ -324,5 +324,5 @@ gmx_bool GrabOK(FILE *out, int err)
         default:
             break;
     }
-    return FALSE;
+    return false;
 }