Moved ngmx to C++, renamed it to view.
[alexxy/gromacs.git] / src / programs / view / pulldown.cpp
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.
- * 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 <string.h>
 #include <smalloc.h>
-#include <x11.h>
 #include <macros.h>
+#include "x11.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;
@@ -70,8 +70,8 @@ static gmx_bool PDCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
                     ;
                 }
                 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:
@@ -80,10 +80,10 @@ static gmx_bool PDCallBack(t_x11 *x11, XEvent *event, Window w, void *data)
         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)
 {
@@ -134,7 +134,7 @@ void hide_pd(t_x11 *x11, t_pulldown *pd)
     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;
 
@@ -164,9 +164,9 @@ int pd_width(t_pulldown *pd)
     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;
 }
 
@@ -177,7 +177,7 @@ int pd_height(t_pulldown *pd)
     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;