From 59a84726ef9023f0055fc5b3419e5a63c8d7c89e Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 28 Oct 2004 03:44:37 +0000
Subject: [PATCH] - make the rotation matrix a matrix of doubles (instead of
 floats)

- store the modelview and the projection matrices in CTX

- new unproject() routine to transform window coordinates to model
  coordinates

- cleaned up all the static variables in the Opengl_Window class

- small fix to reduce normal clamping when zooming
---
 Common/Context.cpp     |  8 +++---
 Common/Context.h       | 10 ++++---
 Common/Trackball.cpp   | 62 +++++++++++++++++++++---------------------
 Common/Trackball.h     |  8 +++---
 Fltk/Callbacks.cpp     | 29 +++++++++++++++++++-
 Fltk/GUI.cpp           | 15 ++++------
 Fltk/Opengl_Window.cpp | 12 +-------
 Fltk/Opengl_Window.h   | 25 +++++++++++++++--
 Graphics/Draw.cpp      | 41 ++++++++++++++++++++++++++--
 Graphics/Draw.h        |  2 ++
 Graphics/Geom.cpp      | 46 ++++++++++++++-----------------
 Parser/OpenFile.cpp    |  9 +++---
 doc/VERSIONS           |  3 +-
 13 files changed, 170 insertions(+), 100 deletions(-)

diff --git a/Common/Context.cpp b/Common/Context.cpp
index bbf955e848..c2760c336b 100644
--- a/Common/Context.cpp
+++ b/Common/Context.cpp
@@ -1,4 +1,4 @@
-// $Id: Context.cpp,v 1.51 2004-10-11 17:21:16 geuzaine Exp $
+// $Id: Context.cpp,v 1.52 2004-10-28 03:44:36 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -79,14 +79,14 @@ void Context_T::buildRotmatrix(void)
   }
 }
 
-void Context_T::addQuaternion(float p1x, float p1y, float p2x, float p2y)
+void Context_T::addQuaternion(double p1x, double p1y, double p2x, double p2y)
 {
-  float quat[4];
+  double quat[4];
   trackball(quat, p1x, p1y, p2x, p2y);
   add_quats(quat, quaternion, quaternion);
 }
 
-void Context_T::setQuaternion(float q0, float q1, float q2, float q3)
+void Context_T::setQuaternion(double q0, double q1, double q2, double q3)
 {
   quaternion[0] = q0;
   quaternion[1] = q1;
diff --git a/Common/Context.h b/Common/Context.h
index a02325eb66..744ac46fc6 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -88,12 +88,14 @@ public :
   int initial_context;        // 0=automatic; 1=geom; 2=mesh; 3=solver; 4=post 
   int verbosity;              // 0=silent -> 3=debug 
 
-  float rot[4][4];            // current rotation matrix 
+  double rot[4][4];           // current rotation matrix 
+  double mod[4][4];           // current modelview matrix 
+  double proj[4][4];          // current projection matrix
   double r[3];                // position angles (if succ. rot. along x, y and z) 
   double t[3], s[3];          // current translation and scale 
   int rlock[3], tlock[3], slock[3];
                               // locks for r, t and s 
-  float quaternion[4];        // the actual quaternion used for "trackball" rotating 
+  double quaternion[4];       // the actual quaternion used for "trackball" rotating 
   int useTrackball;           // do or do not use the trackball for rotations 
   double rotation_center[3];  // point around which to rotate the scene
   int rotation_center_cg;     // rotate around the center of mass instead of rotation_center[]
@@ -235,8 +237,8 @@ public :
   
   // trackball functions 
   void buildRotmatrix(void);
-  void setQuaternion (float p1x, float p1y, float p2x, float p2y);
-  void addQuaternion (float p1x, float p1y, float p2x, float p2y);
+  void setQuaternion (double p1x, double p1y, double p2x, double p2y);
+  void addQuaternion (double p1x, double p1y, double p2x, double p2y);
 };
 
 #endif
diff --git a/Common/Trackball.cpp b/Common/Trackball.cpp
index d5a9e0a10e..9254c59326 100644
--- a/Common/Trackball.cpp
+++ b/Common/Trackball.cpp
@@ -1,4 +1,4 @@
-/* $Id: Trackball.cpp,v 1.2 2002-05-19 19:49:41 geuzaine Exp $ */
+/* $Id: Trackball.cpp,v 1.3 2004-10-28 03:44:36 geuzaine Exp $ */
 /*
  * (c) Copyright 1993, 1994, Silicon Graphics, Inc.
  * ALL RIGHTS RESERVED
@@ -65,11 +65,11 @@
 /*
  * Local function prototypes (not defined in trackball.h)
  */
-static float tb_project_to_sphere(float, float, float);
-static void normalize_quat(float [4]);
+static double tb_project_to_sphere(double, double, double);
+static void normalize_quat(double [4]);
 
 void
-vzero(float *v)
+vzero(double *v)
 {
     v[0] = 0.0;
     v[1] = 0.0;
@@ -77,7 +77,7 @@ vzero(float *v)
 }
 
 void
-vset(float *v, float x, float y, float z)
+vset(double *v, double x, double y, double z)
 {
     v[0] = x;
     v[1] = y;
@@ -85,7 +85,7 @@ vset(float *v, float x, float y, float z)
 }
 
 void
-vsub(const float *src1, const float *src2, float *dst)
+vsub(const double *src1, const double *src2, double *dst)
 {
     dst[0] = src1[0] - src2[0];
     dst[1] = src1[1] - src2[1];
@@ -93,7 +93,7 @@ vsub(const float *src1, const float *src2, float *dst)
 }
 
 void
-vcopy(const float *v1, float *v2)
+vcopy(const double *v1, double *v2)
 {
     register int i;
     for (i = 0 ; i < 3 ; i++)
@@ -101,9 +101,9 @@ vcopy(const float *v1, float *v2)
 }
 
 void
-vcross(const float *v1, const float *v2, float *cross)
+vcross(const double *v1, const double *v2, double *cross)
 {
-    float temp[3];
+    double temp[3];
 
     temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]);
     temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]);
@@ -111,14 +111,14 @@ vcross(const float *v1, const float *v2, float *cross)
     vcopy(temp, cross);
 }
 
-float
-vlength(const float *v)
+double
+vlength(const double *v)
 {
     return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
 }
 
 void
-vscale(float *v, float div)
+vscale(double *v, double div)
 {
     v[0] *= div;
     v[1] *= div;
@@ -126,19 +126,19 @@ vscale(float *v, float div)
 }
 
 void
-vnormal(float *v)
+vnormal(double *v)
 {
     vscale(v,1.0/vlength(v));
 }
 
-float
-vdot(const float *v1, const float *v2)
+double
+vdot(const double *v1, const double *v2)
 {
     return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
 }
 
 void
-vadd(const float *src1, const float *src2, float *dst)
+vadd(const double *src1, const double *src2, double *dst)
 {
     dst[0] = src1[0] + src2[0];
     dst[1] = src1[1] + src2[1];
@@ -158,12 +158,12 @@ vadd(const float *src1, const float *src2, float *dst)
  * (-1.0 ... 1.0)
  */
 void
-trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
+trackball(double q[4], double p1x, double p1y, double p2x, double p2y)
 {
-    float a[3]; /* Axis of rotation */
-    float phi;  /* how much to rotate about axis */
-    float p1[3], p2[3], d[3];
-    float t;
+    double a[3]; /* Axis of rotation */
+    double phi;  /* how much to rotate about axis */
+    double p1[3], p2[3], d[3];
+    double t;
 
     if (p1x == p2x && p1y == p2y) {
         /* Zero rotation */
@@ -204,7 +204,7 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
  *  Given an axis and angle, compute quaternion.
  */
 void
-axis_to_quat(float a[3], float phi, float q[4])
+axis_to_quat(double a[3], double phi, double q[4])
 {
     vnormal(a);
     vcopy(a,q);
@@ -216,10 +216,10 @@ axis_to_quat(float a[3], float phi, float q[4])
  * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet
  * if we are away from the center of the sphere.
  */
-static float
-tb_project_to_sphere(float r, float x, float y)
+static double
+tb_project_to_sphere(double r, double x, double y)
 {
-    float d, t, z;
+    double d, t, z;
 
     d = sqrt(x*x + y*y);
     if (d < r * 0.70710678118654752440) {    /* Inside sphere */
@@ -245,11 +245,11 @@ tb_project_to_sphere(float r, float x, float y)
 #define RENORMCOUNT 97
 
 void
-add_quats(float q1[4], float q2[4], float dest[4])
+add_quats(double q1[4], double q2[4], double dest[4])
 {
     static int count=0;
-    float t1[4], t2[4], t3[4];
-    float tf[4];
+    double t1[4], t2[4], t3[4];
+    double tf[4];
 
     vcopy(q1,t1);
     vscale(t1,q2[3]);
@@ -286,10 +286,10 @@ add_quats(float q1[4], float q2[4], float dest[4])
  *   graphics, The Visual Computer 5, 2-13, 1989.
  */
 static void
-normalize_quat(float q[4])
+normalize_quat(double q[4])
 {
     int i;
-    float mag;
+    double mag;
 
     mag = (q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]);
     for (i = 0; i < 4; i++) q[i] /= mag;
@@ -300,7 +300,7 @@ normalize_quat(float q[4])
  *
  */
 void
-build_rotmatrix(float m[4][4], float q[4])
+build_rotmatrix(double m[4][4], double q[4])
 {
     m[0][0] = 1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]);
     m[0][1] = 2.0 * (q[0] * q[1] - q[2] * q[3]);
diff --git a/Common/Trackball.h b/Common/Trackball.h
index b676fb4e54..af27549051 100644
--- a/Common/Trackball.h
+++ b/Common/Trackball.h
@@ -48,7 +48,7 @@
  * first paramater.
  */
 void
-trackball(float q[4], float p1x, float p1y, float p2x, float p2y);
+trackball(double q[4], double p1x, double p1y, double p2x, double p2y);
 
 /*
  * Given two quaternions, add them together to get a third quaternion.
@@ -59,14 +59,14 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y);
  * over-written with the resulting new total rotation).
  */
 void
-add_quats(float *q1, float *q2, float *dest);
+add_quats(double *q1, double *q2, double *dest);
 
 /*
  * A useful function, builds a rotation matrix in Matrix based on
  * given quaternion.
  */
 void
-build_rotmatrix(float m[4][4], float q[4]);
+build_rotmatrix(double m[4][4], double q[4]);
 
 /*
  * This function computes a quaternion based on an axis (defined by
@@ -74,5 +74,5 @@ build_rotmatrix(float m[4][4], float q[4]);
  * expressed in radians.  The result is put into the third argument.
  */
 void
-axis_to_quat(float a[3], float phi, float q[4]);
+axis_to_quat(double a[3], double phi, double q[4]);
 
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index bf14f507bd..6c3150112f 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.291 2004-10-26 01:04:51 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.292 2004-10-28 03:44:36 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -1666,6 +1666,33 @@ void geometry_elementary_add_new_parameter_cb(CALLBACK_ARGS)
 void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
 {
   WID->create_geometry_context_window(1);
+
+#if 0
+  WID->try_selection = 0;
+  while(1) {
+    Msg(STATUS3N, "Creating point");
+    Msg(ONSCREEN, "Click or enter coordinates\n"
+	"[Press 'q' to abort]");
+    WID->wait();
+    if(WID->quit_selection) {
+      WID->quit_selection = 0;
+      return;
+    }
+    if(WID->try_selection) {
+      WID->try_selection = 0;
+      double p[3], d[3];
+      unproject(WID->g_opengl_window->xpos, WID->g_opengl_window->ypos, p, d);
+      //printf("click: %d %d  -> p=%g %g %g  d=%g %g %g\n",
+      //	     WID->g_opengl_window->xpos, WID->g_opengl_window->ypos,
+      //	     p[0], p[1], p[2], d[0], d[1], d[2]);
+      // and find e.g. closest point to the cg update fields in dialog
+      char str[32];
+      sprintf(str, "%g", p[0]); WID->context_geometry_input[2]->value(str);
+      sprintf(str, "%g", p[1]); WID->context_geometry_input[3]->value(str);
+      sprintf(str, "%g", p[2]); WID->context_geometry_input[4]->value(str);
+    }
+  }
+#endif
 }
 
 static void _new_multiline(int type)
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index ad376e4afa..2375279adc 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.371 2004-10-27 20:53:04 geuzaine Exp $
+// $Id: GUI.cpp,v 1.372 2004-10-28 03:44:36 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -791,7 +791,7 @@ GUI::GUI(int argc, char **argv)
     solver[i].window = NULL;
     create_solver_window(i);
   }
-  call_for_solver_plugin (-1);
+  call_for_solver_plugin(-1);
 
   // Draw the scene
   g_opengl_window->redraw();
@@ -3644,15 +3644,12 @@ void GUI::create_geometry_context_window(int num)
 
 void GUI::call_for_solver_plugin (int dim)
 { 
-   GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();   
-   if (sp)
-     {
-       sp->popupPropertiesForPhysicalEntity(dim);
-     }
+  GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();   
+  if (sp) {
+    sp->popupPropertiesForPhysicalEntity(dim);
+  }
 }
 
-
-
 // Create the window for mesh context dependant definitions
 
 void GUI::create_mesh_context_window(int num)
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index e1f7a6a5d6..4cd80402cf 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.39 2004-09-12 04:13:59 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.40 2004-10-28 03:44:37 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -43,9 +43,6 @@ void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2, GLdouble Xc1,
             GLdouble Xc2, GLdouble Yc1, GLdouble Yc2);
 int check_type(int type, Vertex * v, Curve * c, Surface * s);
 
-static int ZOOM = 0;
-static double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1;
-
 void Opengl_Window::draw()
 {
   static int locked = 0;
@@ -133,13 +130,6 @@ void Opengl_Window::draw()
 
 int Opengl_Window::handle(int event)
 {
-  static int xpos, ypos, xmov, ymov, ibut, hits;
-  static int ZoomClick = 0, FirstClick = 0;
-  static GLdouble xc, yc, xc1, yc1, xc2, yc2, xt1, yt1, xscale1, yscale1;
-  static Vertex *v = NULL, *ov;
-  static Curve *c = NULL, *oc;
-  static Surface *s = NULL, *os;
-
   GLuint ii[SELECTION_BUFFER_SIZE], jj[SELECTION_BUFFER_SIZE];
 
   switch (event) {
diff --git a/Fltk/Opengl_Window.h b/Fltk/Opengl_Window.h
index 3c6df37ea9..d580e85bb5 100644
--- a/Fltk/Opengl_Window.h
+++ b/Fltk/Opengl_Window.h
@@ -22,14 +22,35 @@
 
 #include <FL/Fl_Gl_Window.H>
 #include <FL/Fl_Box.H>
+#include "Mesh.h"
 
 class Opengl_Window : public Fl_Gl_Window {
+ public:
+  int xpos, ypos;
+ private:
+  int xmov, ymov, ibut, hits;
+  int ZoomClick, FirstClick;
+  GLdouble xc, yc, xc1, yc1, xc2, yc2, xt1, yt1, xscale1, yscale1;
+  Vertex *v, *ov;
+  Curve *c, *oc;
+  Surface *s, *os;
+  int ZOOM;
+  double ZOOM_X0, ZOOM_Y0, ZOOM_X1, ZOOM_Y1;
+
   void draw();
   int handle(int);
 
-public:
+ public:
   Opengl_Window(int x,int y,int w,int h,const char *l=0)
-    : Fl_Gl_Window(x, y, w, h, l) {}
+    : Fl_Gl_Window(x, y, w, h, l) {
+    xpos = ypos = xmov = ymov = ibut = hits = 0;
+    ZoomClick = FirstClick = 0;
+    v = ov = NULL;
+    c = oc = NULL;
+    s = os = NULL;
+    ZOOM = 0;
+    ZOOM_X0 = ZOOM_Y0 = ZOOM_X1 = ZOOM_Y1 = 0.;
+  }
 };
 
 // This dummy box class permits to define a box widget that will not
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 5b4d0b8638..a4bfde0a85 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.62 2004-09-03 19:00:52 geuzaine Exp $
+// $Id: Draw.cpp,v 1.63 2004-10-28 03:44:37 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -217,7 +217,7 @@ void InitPosition(void)
 		 CTX.rotation_center[2]);
   
   CTX.buildRotmatrix();
-  glMultMatrixf(&(CTX.rot[0][0]));
+  glMultMatrixd(&(CTX.rot[0][0]));
 
   if(CTX.rotation_center_cg)
     glTranslated(-CTX.cg[0], -CTX.cg[1], -CTX.cg[2]);
@@ -225,6 +225,10 @@ void InitPosition(void)
     glTranslated(-CTX.rotation_center[0],
 		 -CTX.rotation_center[1],
 		 -CTX.rotation_center[2]);
+
+  // store the modelview and projection matrices
+  glGetDoublev(GL_MODELVIEW_MATRIX, &(CTX.mod[0][0]));
+  glGetDoublev(GL_PROJECTION_MATRIX, &(CTX.proj[0][0]));
 }
 
 // Entity selection
@@ -308,7 +312,7 @@ void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
   set_s(0, CTX.s[0] * (CTX.vxmax - CTX.vxmin) / (X2 - X1));
   set_s(1, CTX.s[1] * (CTX.vymax - CTX.vymin) / (Y1 - Y2));
   //set_s(2, 0.5 * (CTX.s[0] + CTX.s[1])); // bof, bof. bof: can cause normal clamping
-  set_s(2, MAX(CTX.s[0], CTX.s[1])); // not much better...
+  set_s(2, MIN(CTX.s[0], CTX.s[1])); // better, but not great...
   set_t(0, CTX.t[0] * (xscale1 / CTX.s[0]) - 
 	((Xc1 + Xc2) / 2.) * (1. - (xscale1 / CTX.s[0])));
   set_t(1, CTX.t[1] * (yscale1 / CTX.s[1]) - 
@@ -317,3 +321,34 @@ void myZoom(GLdouble X1, GLdouble X2, GLdouble Y1, GLdouble Y2,
   Draw();
 }
 
+// Takes a cursor position in window coordinates and returns the line
+// (given by a point and a unit direction vector), in real space, that
+// corresponds to that cursor position
+
+void unproject(double x, double y, double p[3], double d[3])
+{
+  GLint viewport[4];
+  glGetIntegerv(GL_VIEWPORT, viewport);
+
+  y = viewport[3]-y;
+
+  GLdouble x0, y0, z0, x1, y1, z1;
+  
+  if(!gluUnProject(x, y, 0.0, &(CTX.mod[0][0]), &(CTX.proj[0][0]),
+		   viewport, &x0, &y0, &z0))
+    Msg(WARNING, "unproject1 failed");
+  if(!gluUnProject(x, y, 1.0, &(CTX.mod[0][0]), &(CTX.proj[0][0]),
+		   viewport, &x1, &y1, &z1))
+    Msg(WARNING, "unproject2 failed");
+  
+  p[0] = x0;
+  p[1] = y0;
+  p[2] = z0;
+  d[0] = x1-x0;
+  d[1] = y1-y0;
+  d[2] = z1-z0;
+  double len = sqrt(d[0]*d[0] + d[1]*d[1] + d[2]*d[2]);
+  d[0] /= len;
+  d[1] /= len;
+  d[2] /= len;
+}
diff --git a/Graphics/Draw.h b/Graphics/Draw.h
index aad55cd0f2..af683a629a 100644
--- a/Graphics/Draw.h
+++ b/Graphics/Draw.h
@@ -42,6 +42,8 @@ void set_r(int i, double val);
 void set_t(int i, double val);
 void set_s(int i, double val);
 
+void unproject(double x, double y, double p[3], double d[3]);
+
 unsigned int PaletteContinuous(Post_View * View, double min, double max, double val);
 unsigned int PaletteContinuousLinear(Post_View * v, double min, double max, double val);
 unsigned int PaletteDiscrete(Post_View * View, int nbi, int i);
diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp
index 64d049dec1..b756cae0e6 100644
--- a/Graphics/Geom.cpp
+++ b/Graphics/Geom.cpp
@@ -1,4 +1,4 @@
-// $Id: Geom.cpp,v 1.72 2004-10-15 18:36:04 geuzaine Exp $
+// $Id: Geom.cpp,v 1.73 2004-10-28 03:44:37 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -73,17 +73,15 @@ void Draw_Geo_Point(void *a, void *b)
         Draw_Sphere(CTX.geom.point_size, v->Pos.X, v->Pos.Y, v->Pos.Z,
 		    CTX.geom.light);
     }
-    else if (CTX.geom.point_type == 2)
-      {
-	GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();
-	if (sp)
-	  {
-	    sp-> GL_enhancePoint (v);
-	  }
-	glBegin(GL_POINTS);
-	glVertex3d(v->Pos.X, v->Pos.Y, v->Pos.Z);
-	glEnd();
+    else if(CTX.geom.point_type == 2) {
+      GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();
+      if(sp) {
+	sp-> GL_enhancePoint (v);
       }
+      glBegin(GL_POINTS);
+      glVertex3d(v->Pos.X, v->Pos.Y, v->Pos.Z);
+      glEnd();
+    }
     else {
       glBegin(GL_POINTS);
       glVertex3d(v->Pos.X, v->Pos.Y, v->Pos.Z);
@@ -165,7 +163,7 @@ void Draw_Curve(void *a, void *b)
       List_Delete(temp);
     }
     else {
-      if(CTX.geom.line_type>=1) {
+      if(CTX.geom.line_type >= 1) {
         for(int i = 0; i < N - 1; i++) {
           v = InterpolateCurve(c, (double)i / (double)(N - 1), 0);
           dv = InterpolateCurve(c, (double)(i + 1) / (double)(N - 1), 0);
@@ -178,20 +176,18 @@ void Draw_Curve(void *a, void *b)
           Draw_Cylinder(c->ipar[3] ? CTX.geom.line_sel_width : CTX.geom.line_width,
 			x, y, z, CTX.geom.light);
         }
-	if(CTX.geom.line_type==2) 
-	  {
-	    GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();
-	    if (sp)
-	      {
-		int NN=(N>1)?N:1;
-		const double eps=0.e-2;
-		for(int i = 0; i < NN - 1; i++) {
-		  v = InterpolateCurve(c, (double)i / (double)(NN - 1)-eps, 0);
-		  dv = InterpolateCurve(c, (double)(i + 1) / (double)(NN - 1)+eps, 0);
-		  sp-> GL_enhanceLine (c->Num,&v,&dv);
-		}
-	      }
+	if(CTX.geom.line_type == 2) {
+	  GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();
+	  if(sp) {
+	    int NN=(N>1)?N:1;
+	    const double eps=0.e-2;
+	    for(int i = 0; i < NN - 1; i++) {
+	      v = InterpolateCurve(c, (double)i / (double)(NN - 1)-eps, 0);
+	      dv = InterpolateCurve(c, (double)(i + 1) / (double)(NN - 1)+eps, 0);
+	      sp-> GL_enhanceLine (c->Num,&v,&dv);
+	    }
 	  }
+	}
       }
       else {
         glBegin(GL_LINE_STRIP);
diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp
index 8e96c78440..e54db5de19 100644
--- a/Parser/OpenFile.cpp
+++ b/Parser/OpenFile.cpp
@@ -1,4 +1,4 @@
-// $Id: OpenFile.cpp,v 1.64 2004-10-27 20:37:10 geuzaine Exp $
+// $Id: OpenFile.cpp,v 1.65 2004-10-28 03:44:37 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -172,10 +172,9 @@ int ParseFile(char *f, int silent, int close, int warn_if_missing)
   yylineno = yylineno_old;
 
   GMSH_Solve_Plugin *sp = GMSH_PluginManager::instance()->findSolverPlugin();
-  if (sp)
-    {
-      sp->readSolverFile(f);
-    }
+  if(sp) {
+    sp->readSolverFile(f);
+  }
 
   return status;
 }
diff --git a/doc/VERSIONS b/doc/VERSIONS
index 5c5135e076..5077d60b48 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,10 +1,11 @@
-$Id: VERSIONS,v 1.260 2004-10-26 01:04:53 geuzaine Exp $
+$Id: VERSIONS,v 1.261 2004-10-28 03:44:37 geuzaine Exp $
 
 New since 1.56: generalized displacement maps to display arbitrary
 view types; the arrows representing a vector field can now also be
 colored by the values from other scalar, vector or tensor fields; new
 adaptive high order visualization mode; new options for solvers
 (SocketCommand and NameCommand) and views (ArrowSizeProportional);
+fixed display of undesired solver plugin popups;
 
 New in 1.56: new post-processing option to draw a scalar view raised
 by a displacement view without using Plugin(DisplacementRaise) (makes
-- 
GitLab