diff --git a/Plugin/CutGrid.cpp b/Plugin/CutGrid.cpp
index 11d856dc63b743e1a77d24fc2d6dfae3f21173be..5a861f2d9cb9b16fc1ba22bfda67192de0bc4771 100644
--- a/Plugin/CutGrid.cpp
+++ b/Plugin/CutGrid.cpp
@@ -1,4 +1,4 @@
-// $Id: CutGrid.cpp,v 1.9 2004-11-25 02:10:40 geuzaine Exp $
+// $Id: CutGrid.cpp,v 1.10 2004-12-27 08:59:29 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -23,23 +23,26 @@
 #include "CutGrid.h"
 #include "List.h"
 #include "Context.h"
-#include "Views.h"
-#include "Message.h"
+
+#if defined(HAVE_FLTK)
+#include "GmshUI.h"
+#include "Draw.h"
+#endif
 
 extern Context_T CTX;
 
 StringXNumber CutGridOptions_Number[] = {
-  {GMSH_FULLRC, "X0", NULL, -1.},
-  {GMSH_FULLRC, "Y0", NULL, -1.},
-  {GMSH_FULLRC, "Z0", NULL, 0.},
-  {GMSH_FULLRC, "X1", NULL, -1.},
-  {GMSH_FULLRC, "Y1", NULL, 0.},
-  {GMSH_FULLRC, "Z1", NULL, 0.},
-  {GMSH_FULLRC, "X2", NULL, 0.},
-  {GMSH_FULLRC, "Y2", NULL, -1.},
-  {GMSH_FULLRC, "Z2", NULL, 0.},
-  {GMSH_FULLRC, "nPointsU", NULL, 20},
-  {GMSH_FULLRC, "nPointsV", NULL, 20},
+  {GMSH_FULLRC, "X0", GMSH_CutGridPlugin::callbackX0, -1.},
+  {GMSH_FULLRC, "Y0", GMSH_CutGridPlugin::callbackY0, -1.},
+  {GMSH_FULLRC, "Z0", GMSH_CutGridPlugin::callbackZ0, 0.},
+  {GMSH_FULLRC, "X1", GMSH_CutGridPlugin::callbackX1, -1.},
+  {GMSH_FULLRC, "Y1", GMSH_CutGridPlugin::callbackY1, 0.},
+  {GMSH_FULLRC, "Z1", GMSH_CutGridPlugin::callbackZ1, 0.},
+  {GMSH_FULLRC, "X2", GMSH_CutGridPlugin::callbackX2, 0.},
+  {GMSH_FULLRC, "Y2", GMSH_CutGridPlugin::callbackY2, -1.},
+  {GMSH_FULLRC, "Z2", GMSH_CutGridPlugin::callbackZ2, 0.},
+  {GMSH_FULLRC, "nPointsU", GMSH_CutGridPlugin::callbackU, 20},
+  {GMSH_FULLRC, "nPointsV", GMSH_CutGridPlugin::callbackV, 20},
   {GMSH_FULLRC, "iView", NULL, -1.}
 };
 
@@ -56,6 +59,128 @@ GMSH_CutGridPlugin::GMSH_CutGridPlugin()
   ;
 }
 
+void GMSH_CutGridPlugin::draw()
+{
+#if defined(HAVE_FLTK)
+  glColor4ubv((GLubyte *) & CTX.color.fg);
+  double p[3];
+  glBegin(GL_LINES);
+  for(int i = 0; i < getNbU(); ++i){
+    getPoint(i, 0, p);
+    glVertex3d(p[0], p[1], p[2]);
+    getPoint(i, getNbV()-1, p);
+    glVertex3d(p[0], p[1], p[2]);
+  }
+  for(int i = 0; i < getNbV(); ++i){
+    getPoint(0, i, p);
+    glVertex3d(p[0], p[1], p[2]);
+    getPoint(getNbU()-1, i, p);
+    glVertex3d(p[0], p[1], p[2]);
+  }
+  glEnd();
+#endif
+}
+
+void GMSH_CutGridPlugin::callback()
+{
+#if defined(HAVE_FLTK)
+  CTX.post.plugin_draw_function = draw;
+  if(CTX.fast_redraw){
+    CTX.post.draw = 0;
+    CTX.mesh.draw = 0;
+  }
+  if(!CTX.batch) 
+    Draw();
+  CTX.post.plugin_draw_function = NULL;
+  CTX.post.draw = 1;
+  CTX.mesh.draw = 1;
+#endif
+}
+
+double GMSH_CutGridPlugin::callbackXYZ(int num, int action, double value, double *opt)
+{
+  switch(action){ // configure the input field
+  case 1: return CTX.lc/200.;
+  case 2: return -CTX.lc;
+  case 3: return CTX.lc;
+  default: break;
+  }
+  *opt = value;
+  callback();
+  return 0.;
+}
+
+double GMSH_CutGridPlugin::callbackX0(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[0].def);
+}
+
+double GMSH_CutGridPlugin::callbackY0(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[1].def);
+}
+
+double GMSH_CutGridPlugin::callbackZ0(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[2].def);
+}
+
+double GMSH_CutGridPlugin::callbackX1(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[3].def);
+}
+
+double GMSH_CutGridPlugin::callbackY1(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[4].def);
+}
+
+double GMSH_CutGridPlugin::callbackZ1(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[5].def);
+}
+
+double GMSH_CutGridPlugin::callbackX2(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[6].def);
+}
+
+double GMSH_CutGridPlugin::callbackY2(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[7].def);
+}
+
+double GMSH_CutGridPlugin::callbackZ2(int num, int action, double value)
+{
+  return callbackXYZ(num, action, value, &CutGridOptions_Number[8].def);
+}
+
+double GMSH_CutGridPlugin::callbackU(int num, int action, double value)
+{
+  switch(action){ // configure the input field
+  case 1: return 1;
+  case 2: return 2;
+  case 3: return 100;
+  default: break;
+  }
+  CutGridOptions_Number[9].def = value;
+  callback();
+  return 0.;
+}
+
+double GMSH_CutGridPlugin::callbackV(int num, int action, double value)
+{
+  switch(action){ // configure the input field
+  case 1: return 1;
+  case 2: return 2;
+  case 3: return 100;
+  default: break;
+  }
+  CutGridOptions_Number[10].def = value;
+  callback();
+  return 0.;
+}
+
 void GMSH_CutGridPlugin::getName(char *name) const
 {
   strcpy(name, "Cut grid");
@@ -92,17 +217,17 @@ void GMSH_CutGridPlugin::catchErrorMessage(char *errorMessage) const
   strcpy(errorMessage, "CutGrid failed...");
 }
 
-int GMSH_CutGridPlugin::getNbU()const 
+int GMSH_CutGridPlugin::getNbU()
 {
   return   (int)CutGridOptions_Number[9].def;
 }
 
-int GMSH_CutGridPlugin::getNbV()const 
+int GMSH_CutGridPlugin::getNbV()
 {
   return   (int)CutGridOptions_Number[10].def;
 }
 
-void GMSH_CutGridPlugin::getPoint(int iU, int iV, double *X) const 
+void GMSH_CutGridPlugin::getPoint(int iU, int iV, double *X)
 {
   double u = (double)iU / (double)(getNbU () - 1.);
   double v = (double)iV / (double)(getNbV () - 1.);
diff --git a/Plugin/CutGrid.h b/Plugin/CutGrid.h
index b75527f2cbcb4de2f0dcd1dfa96057fd36c7145a..88c1dc6ced1adc6b7c6dd0b03a2c6d2fe26a12e3 100644
--- a/Plugin/CutGrid.h
+++ b/Plugin/CutGrid.h
@@ -29,6 +29,8 @@ extern "C"
 
 class GMSH_CutGridPlugin : public GMSH_Post_Plugin
 {
+  static void callback();
+  static double callbackXYZ(int, int, double, double*);
 public:
   GMSH_CutGridPlugin();
   void getName  (char *name) const;
@@ -39,10 +41,24 @@ public:
   int getNbOptions() const;
   StringXNumber *getOption (int iopt);  
   Post_View *execute (Post_View *);
-  virtual int getNbU () const ;
-  virtual int getNbV () const ;
-  virtual void getPoint(int iU, int iV, double *X ) const  ;
   virtual Post_View * GenerateView (Post_View * v) const ;
+
+  static int getNbU ();
+  static int getNbV ();
+  static void getPoint(int iU, int iV, double *X );
+
+  static double callbackX0(int, int, double);
+  static double callbackY0(int, int, double);
+  static double callbackZ0(int, int, double);
+  static double callbackX1(int, int, double);
+  static double callbackY1(int, int, double);
+  static double callbackZ1(int, int, double);
+  static double callbackX2(int, int, double);
+  static double callbackY2(int, int, double);
+  static double callbackZ2(int, int, double);
+  static double callbackU(int, int, double);
+  static double callbackV(int, int, double);
+  static void draw();
 };
 
 #endif