From 70db54fc6387bdf66494b923304d0dc7b46368fa Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 19 Nov 2001 14:24:02 +0000
Subject: [PATCH] PointSize+LineWidth -> double precision!

---
 Common/Context.h        |  9 ++++-----
 Common/DefaultOptions.h |  8 ++++----
 Common/Options.cpp      | 26 +++++++++++++-------------
 Common/Views.h          |  3 ++-
 Fltk/GUI.cpp            | 26 +++++++++++++-------------
 Fltk/Opengl_Window.cpp  |  4 ++--
 Graphics/Axes.cpp       |  6 +++---
 Graphics/Graph2D.cpp    |  6 +++---
 Graphics/gl2ps.cpp      |  4 ++--
 9 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index daf889dc67..98eaa52d6e 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -84,7 +84,7 @@ public :
 
   int fontsize;               // font size for fltk UI
   int gl_fontsize;            // font size for opengl graphics
-  int point_size, line_width; // point/line widths
+  double point_size, line_width; // point/line widths
 
   int viewport[4];            // current viewport 
   double vxmin, vxmax, vymin, vymax; // current viewport in real coordinates 
@@ -104,8 +104,7 @@ public :
     int vis_type;
     int points, lines, surfaces, volumes;
     int points_num, lines_num, surfaces_num, volumes_num;
-    int point_size, line_width;
-    int point_sel_size, line_sel_width;
+    double point_size, line_width, point_sel_size, line_sel_width;
     int hidden, shade;
     int highlight;
     int level, old_circle, circle_points, extrude_spline_points, old_newreg;
@@ -121,7 +120,7 @@ public :
     int draw;
     int points, lines, surfaces, volumes;
     int points_num, lines_num, surfaces_num, volumes_num;
-    int point_size, line_width;
+    double point_size, line_width;
     double quality;
     double gamma_inf, gamma_sup, radius_inf, radius_sup;
     double scaling_factor, lc_factor, rand_factor;
@@ -159,7 +158,7 @@ public :
     int format;
     int eps_quality, eps_background, eps_font_size;
     char *eps_font;
-    int eps_line_width_factor, eps_point_size_factor;
+    double eps_line_width_factor, eps_point_size_factor;
     int jpeg_quality;
     int gif_dither, gif_sort, gif_interlace, gif_transparent;
     int gl_fonts;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 550f065419..16afa79267 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -230,7 +230,7 @@ StringXNumber GeneralOptions_Number[] = {
     "Y position of light source 5" },
   { F|O, "Light5Z" , opt_general_light52 , 1.0 , 
     "Z position of light source 5" },
-  { F|O, "LineWidth" , opt_general_line_width , 1. , 
+  { F|O, "LineWidth" , opt_general_line_width , 0.2 , 
     "Display width of lines (in pixels)" },
 
   { F|S, "MenuPositionX" , opt_general_menu_position0 , 800. , 
@@ -340,7 +340,7 @@ StringXNumber GeometryOptions_Number[] = {
     "Display curve numbers?" },
   { F|O, "LineSelectWidth" , opt_geometry_line_sel_width , 2. , 
     "Display width of selected lines (in pixels)" },
-  { F|O, "LineWidth" , opt_geometry_line_width , 1. , 
+  { F|O, "LineWidth" , opt_geometry_line_width , 0.2 , 
     "Display width of lines (in pixels)" },
 
   { F|O, "Normals" , opt_geometry_normals , 0. , 
@@ -430,7 +430,7 @@ StringXNumber MeshOptions_Number[] = {
     "Display mesh vertices on curves?" },
   { F|O, "LinesNumbers" , opt_mesh_lines_num , 0. , 
     "Display mesh line numbers?" },
-  { F|O, "LineWidth" , opt_mesh_line_width , 1. , 
+  { F|O, "LineWidth" , opt_mesh_line_width , 0.2 , 
     "Display width of lines (in pixels)" },
 
   { F|O, "MinimumCirclePoints" , opt_mesh_min_circ_points, 7. ,
@@ -574,7 +574,7 @@ StringXNumber ViewOptions_Number[] = {
 
   { F|O, "Light" , opt_view_light , 0. ,
     "Enable light sources?" },
-  { F|O, "LineWidth" , opt_view_line_width , 1. , 
+  { F|O, "LineWidth" , opt_view_line_width , 0.2 , 
     "Display width of lines (in pixels)" },
 
   { F,   "Max" , opt_view_max , -1.e200 , 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index c28d7b4dbc..37efb30d6d 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.64 2001-11-19 13:48:19 geuzaine Exp $
+// $Id: Options.cpp,v 1.65 2001-11-19 14:24:01 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -705,7 +705,7 @@ double opt_general_scale2(OPT_ARGS_NUM){
 }
 double opt_general_point_size(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.point_size = (int)val;
+    CTX.point_size = val;
 #ifdef _FLTK
   if(WID && (action & GMSH_GUI))
     WID->gen_value[6]->value(CTX.point_size);
@@ -714,7 +714,7 @@ double opt_general_point_size(OPT_ARGS_NUM){
 }
 double opt_general_line_width(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.line_width = (int)val;
+    CTX.line_width = val;
 #ifdef _FLTK
   if(WID && (action & GMSH_GUI))
     WID->gen_value[7]->value(CTX.line_width);
@@ -1211,7 +1211,7 @@ double opt_geometry_volumes_num(OPT_ARGS_NUM){
 }
 double opt_geometry_point_size(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.geom.point_size = (int)val;
+    CTX.geom.point_size = val;
 #ifdef _FLTK
   if(WID && (action & GMSH_GUI))
     WID->geo_value[3]->value(CTX.geom.point_size);
@@ -1220,12 +1220,12 @@ double opt_geometry_point_size(OPT_ARGS_NUM){
 }
 double opt_geometry_point_sel_size(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.geom.point_sel_size = (int)val;
+    CTX.geom.point_sel_size = val;
   return CTX.geom.point_sel_size;
 }
 double opt_geometry_line_width(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.geom.line_width = (int)val;
+    CTX.geom.line_width = val;
 #ifdef _FLTK
   if(WID && (action & GMSH_GUI))
     WID->geo_value[4]->value(CTX.geom.line_width);
@@ -1234,7 +1234,7 @@ double opt_geometry_line_width(OPT_ARGS_NUM){
 }
 double opt_geometry_line_sel_width(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.geom.line_sel_width = (int)val;
+    CTX.geom.line_sel_width = val;
   return CTX.geom.line_sel_width;
 }
 double opt_geometry_aspect(OPT_ARGS_NUM){
@@ -1459,7 +1459,7 @@ double opt_mesh_volumes_num(OPT_ARGS_NUM){
 }
 double opt_mesh_point_size(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.mesh.point_size = (int)val;
+    CTX.mesh.point_size = val;
 #ifdef _FLTK
   if(WID && (action & GMSH_GUI))
     WID->mesh_value[10]->value(CTX.mesh.point_size);
@@ -1468,7 +1468,7 @@ double opt_mesh_point_size(OPT_ARGS_NUM){
 }
 double opt_mesh_line_width(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.mesh.line_width = (int)val;
+    CTX.mesh.line_width = val;
 #ifdef _FLTK
   if(WID && (action & GMSH_GUI))
     WID->mesh_value[11]->value(CTX.mesh.line_width);
@@ -2317,7 +2317,7 @@ double opt_view_arrow_location(OPT_ARGS_NUM){
 double opt_view_point_size(OPT_ARGS_NUM){
   GET_VIEW(0.) ;
   if(action & GMSH_SET){
-    v->PointSize = (int)val;
+    v->PointSize = val;
     v->Changed = 1;
   }
 #ifdef _FLTK
@@ -2329,7 +2329,7 @@ double opt_view_point_size(OPT_ARGS_NUM){
 double opt_view_line_width(OPT_ARGS_NUM){
   GET_VIEW(0.) ;
   if(action & GMSH_SET){
-    v->LineWidth = (int)val;
+    v->LineWidth = val;
     v->Changed = 1;
   }
 #ifdef _FLTK
@@ -2362,12 +2362,12 @@ double opt_print_eps_font_size(OPT_ARGS_NUM){
 }
 double opt_print_eps_line_width_factor(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.print.eps_line_width_factor = (int)val;
+    CTX.print.eps_line_width_factor = val;
   return CTX.print.eps_line_width_factor;
 }
 double opt_print_eps_point_size_factor(OPT_ARGS_NUM){
   if(action & GMSH_SET) 
-    CTX.print.eps_point_size_factor = (int)val;
+    CTX.print.eps_point_size_factor = val;
   return CTX.print.eps_point_size_factor;
 }
 double opt_print_jpeg_quality(OPT_ARGS_NUM){
diff --git a/Common/Views.h b/Common/Views.h
index a284e9c3ae..d7784152f7 100644
--- a/Common/Views.h
+++ b/Common/Views.h
@@ -42,7 +42,8 @@ class Post_View{
   int DrawStrings;
   int DrawPoints, DrawLines, DrawTriangles, DrawTetrahedra;
   int DrawScalars, DrawVectors, DrawTensors;
-  int Boundary, PointSize, LineWidth, Grid;
+  int Boundary, Grid;
+  double PointSize, LineWidth;
   ColorTable CT;
 
   // dynamic
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index f316619336..c7be7345ed 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.131 2001-11-19 13:53:18 geuzaine Exp $
+// $Id: GUI.cpp,v 1.132 2001-11-19 14:24:02 geuzaine Exp $
 
 // To make the interface as visually consistent as possible, please:
 // - use the IW, BB, BH, BW and WB values
@@ -1017,9 +1017,9 @@ void GUI::create_general_options_window(){
       gen_value[6]->maximum(50);
       gen_value[6]->step(1);
       gen_value[7] = new Fl_Value_Input(2*WB, 2*WB+4*BH, IW, BH, "Line width");
-      gen_value[7]->minimum(1);
-      gen_value[7]->maximum(50);
-      gen_value[7]->step(1);
+      gen_value[7]->minimum(0.2);
+      gen_value[7]->maximum(20);
+      gen_value[7]->step(0.1);
       for(i=6 ; i<= 7 ; i++){
 	gen_value[i]->labelsize(CTX.fontsize);
 	gen_value[i]->textsize(CTX.fontsize);
@@ -1187,9 +1187,9 @@ void GUI::create_geometry_options_window(){
       geo_value[3]->maximum(50);
       geo_value[3]->step(1);
       geo_value[4] = new Fl_Value_Input(2*WB, 2*WB+2*BH, IW, BH, "Line width");
-      geo_value[4]->minimum(1);
-      geo_value[4]->maximum(50);
-      geo_value[4]->step(1);
+      geo_value[4]->minimum(0.2);
+      geo_value[4]->maximum(20);
+      geo_value[4]->step(0.1);
       for(i=3 ; i<= 4 ; i++){
 	geo_value[i]->labelsize(CTX.fontsize);
 	geo_value[i]->textsize(CTX.fontsize);
@@ -1383,9 +1383,9 @@ void GUI::create_mesh_options_window(){
       mesh_value[10]->maximum(50);
       mesh_value[10]->step(1);
       mesh_value[11] = new Fl_Value_Input(2*WB, 2*WB+6*BH, IW, BH, "Line width");
-      mesh_value[11]->minimum(1);
-      mesh_value[11]->maximum(50);
-      mesh_value[11]->step(1);
+      mesh_value[11]->minimum(0.2);
+      mesh_value[11]->maximum(20);
+      mesh_value[11]->step(0.1);
       for(i=9 ; i<= 11 ; i++){
 	mesh_value[i]->labelsize(CTX.fontsize);
 	mesh_value[i]->textsize(CTX.fontsize);
@@ -2321,9 +2321,9 @@ void GUI::create_view_options_window(int num){
       view_value[61]->maximum(50);
       view_value[61]->step(1);
       view_value[62] = new Fl_Value_Input(2*WB, 2*WB+ 2*BH, IW, BH, "Line width");
-      view_value[62]->minimum(1); 
-      view_value[62]->maximum(50);
-      view_value[62]->step(1);
+      view_value[62]->minimum(0.2); 
+      view_value[62]->maximum(20);
+      view_value[62]->step(0.1);
       for(i=60 ; i<=62 ; i++){
 	view_value[i]->labelsize(CTX.fontsize);
 	view_value[i]->textsize(CTX.fontsize);
diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp
index 0c9fa5191c..83ea8aca71 100644
--- a/Fltk/Opengl_Window.cpp
+++ b/Fltk/Opengl_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl_Window.cpp,v 1.18 2001-10-06 09:21:47 geuzaine Exp $
+// $Id: Opengl_Window.cpp,v 1.19 2001-11-19 14:24:02 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -62,7 +62,7 @@ void Opengl_Window::draw() {
     glColor3f(1.,1.,1.);
     glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
     glEnable(GL_BLEND);
-    glLineWidth(1);
+    glLineWidth(0.2);
     glBegin(GL_LINE_STRIP);
     glVertex2d(ZOOM_X0, ZOOM_Y0);
     glVertex2d(ZOOM_X1, ZOOM_Y0);
diff --git a/Graphics/Axes.cpp b/Graphics/Axes.cpp
index e152fff5e6..e21614bc55 100644
--- a/Graphics/Axes.cpp
+++ b/Graphics/Axes.cpp
@@ -1,4 +1,4 @@
-// $Id: Axes.cpp,v 1.10 2001-10-31 08:34:19 geuzaine Exp $
+// $Id: Axes.cpp,v 1.11 2001-11-19 14:24:02 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -23,7 +23,7 @@ void Draw_Axes (double s) {
   b = .1 * s;
   c = 0.666 * b;
 
-  glLineWidth(1); 
+  glLineWidth(0.2); 
   gl2psLineWidth(1*CTX.print.eps_line_width_factor);
   glColor4ubv((GLubyte*)&CTX.color.axes);
 
@@ -117,7 +117,7 @@ void Draw_SmallAxes(void){
   yx = l*CTX.rot[1][0] ; yy = l*CTX.rot[1][1] ;
   zx = l*CTX.rot[2][0] ; zy = l*CTX.rot[2][1] ;
 
-  glLineWidth(1); 
+  glLineWidth(0.2); 
   gl2psLineWidth(1*CTX.print.eps_line_width_factor);
   glColor4ubv((GLubyte*)&CTX.color.small_axes);
 
diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp
index a7d63fae6c..cc1d5ec775 100644
--- a/Graphics/Graph2D.cpp
+++ b/Graphics/Graph2D.cpp
@@ -1,4 +1,4 @@
-// $Id: Graph2D.cpp,v 1.12 2001-11-19 13:43:33 geuzaine Exp $
+// $Id: Graph2D.cpp,v 1.13 2001-11-19 14:24:02 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -145,7 +145,7 @@ static void Draw_Graph2D(Post_View *v,
 	glEnable(GL_LINE_STIPPLE);
 	glLineStipple(1,0x1111);
 	gl2psEnable(GL2PS_LINE_STIPPLE);
-	glLineWidth(1); 
+	glLineWidth(0.2); 
 	gl2psLineWidth(1 * CTX.print.eps_line_width_factor);
 	glBegin(GL_LINES);
 	glVertex2d(xtop,ytop-i*dy);
@@ -227,7 +227,7 @@ static void Draw_Graph2D(Post_View *v,
 	glEnable(GL_LINE_STIPPLE);
 	glLineStipple(1,0x1111);
 	gl2psEnable(GL2PS_LINE_STIPPLE);
-	glLineWidth(1); 
+	glLineWidth(0.2); 
 	gl2psLineWidth(1 * CTX.print.eps_line_width_factor);
 	glBegin(GL_LINES);
 	glVertex2d(xtop+i*dx,ytop);
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index 5c48d9f4bd..ddeb843960 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -4,7 +4,7 @@
  * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2001  Christophe Geuzaine 
  *
- * $Id: gl2ps.cpp,v 1.32 2001-11-19 11:16:44 geuzaine Exp $
+ * $Id: gl2ps.cpp,v 1.33 2001-11-19 14:24:02 geuzaine Exp $
  *
  * E-mail: Christophe.Geuzaine@AdValvas.be
  * URL: http://www.geuz.org/gl2ps/
@@ -1215,7 +1215,7 @@ GLvoid gl2psPrintPostScriptPrimitive(GLvoid *a, GLvoid *b){
   case GL2PS_LINE :
     if(linewidth != prim->width){
       linewidth = prim->width;
-      fprintf(gl2ps.stream, "%g W\n", 0.2*linewidth*linewidth);
+      fprintf(gl2ps.stream, "%g W\n", linewidth);
     }
     if(prim->dash)
       fprintf(gl2ps.stream, "[%d] 0 setdash\n", prim->dash);
-- 
GitLab