From e20f24e7ac297aeac77a3a09065b43ed4767eb94 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 20 Mar 2005 20:45:11 +0000
Subject: [PATCH] removed unused Post.Scales option

---
 Common/Context.h          |   2 +-
 Common/DefaultOptions.h   |   2 -
 Common/Options.cpp        |   9 +-
 Common/Options.h          |   1 -
 Fltk/GUI.cpp              |  15 +--
 Graphics/Draw.cpp         |   4 +-
 Graphics/Graph2D.cpp      | 214 +++++++++++++++++++-------------------
 doc/texinfo/opt_post.texi |   5 -
 8 files changed, 121 insertions(+), 131 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index 62d3301e2b..407fe548f9 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -200,7 +200,7 @@ public :
   struct{
     List_T *list ;
     int force_num, compute_bb, vertex_arrays;
-    int draw, scales, link, horizontal_scales ;
+    int draw, link, horizontal_scales ;
     int smooth, anim_cycle, combine_time, combine_remove_orig ;
     int file_format, plugins;
     double anim_delay ;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 0cf5224a29..d61a50bdd3 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -1028,8 +1028,6 @@ StringXNumber PostProcessingOptions_Number[] = {
   { F|O, "Plugins" , opt_post_plugins , 1. ,
     "Enable default post-processing plugins?" },
 
-  { F|O, "Scales" , opt_post_scales , 1. , 
-    "Show value scales" },
   { F|O, "Smoothing" , opt_post_smooth , 0. ,
     "Apply (non-reversible) smoothing to post-processing view when merged" },
 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 03b122bf9a..41df901499 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.235 2005-03-14 18:55:22 geuzaine Exp $
+// $Id: Options.cpp,v 1.236 2005-03-20 20:45:10 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -4649,13 +4649,6 @@ double opt_post_vertex_arrays(OPT_ARGS_NUM)
   return CTX.post.vertex_arrays;
 }
 
-double opt_post_scales(OPT_ARGS_NUM)
-{
-  if(action & GMSH_SET)
-    CTX.post.scales = (int)val;
-  return CTX.post.scales;
-}
-
 double opt_post_horizontal_scales(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
diff --git a/Common/Options.h b/Common/Options.h
index 707ee68a4a..9b51e363a8 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -474,7 +474,6 @@ double opt_solver_merge_views2(OPT_ARGS_NUM);
 double opt_solver_merge_views3(OPT_ARGS_NUM);
 double opt_solver_merge_views4(OPT_ARGS_NUM);
 double opt_post_vertex_arrays(OPT_ARGS_NUM);
-double opt_post_scales(OPT_ARGS_NUM);
 double opt_post_horizontal_scales(OPT_ARGS_NUM);
 double opt_post_link(OPT_ARGS_NUM);
 double opt_post_smooth(OPT_ARGS_NUM);
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 2418ad784e..e587cc9369 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.433 2005-03-15 17:53:46 geuzaine Exp $
+// $Id: GUI.cpp,v 1.434 2005-03-20 20:45:10 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -611,7 +611,10 @@ int GUI::global_shortcuts(int event)
     return 1;
   }
   else if(Fl::test_shortcut(FL_ALT + 'i')) {
-    opt_post_scales(0, GMSH_SET | GMSH_GUI, !opt_post_scales(0, GMSH_GET, 0));
+    for(i = 0; i < List_Nbr(CTX.post.list); i++)
+      if(opt_view_visible(i, GMSH_GET, 0))
+	opt_view_show_scale(i, GMSH_SET | GMSH_GUI,
+			    !opt_view_show_scale(i, GMSH_GET, 0));
     redraw_opengl();
     return 1;
   }
@@ -639,8 +642,9 @@ int GUI::global_shortcuts(int event)
     opt_mesh_light(0, GMSH_SET | GMSH_GUI,
 		   !opt_mesh_light(0, GMSH_GET, 0));
     for(i = 0; i < List_Nbr(CTX.post.list); i++)
-      opt_view_light(i, GMSH_SET | GMSH_GUI,
-		     !opt_view_light(i, GMSH_GET, 0));
+      if(opt_view_visible(i, GMSH_GET, 0))
+	opt_view_light(i, GMSH_SET | GMSH_GUI,
+		       !opt_view_light(i, GMSH_GET, 0));
     redraw_opengl();
     return 1;
   }
@@ -747,10 +751,9 @@ int GUI::global_shortcuts(int event)
     return 1;
   }
   else if(Fl::test_shortcut(FL_ALT + 'g')) {
-    for(i = 0; i < List_Nbr(CTX.post.list); i++) {
+    for(i = 0; i < List_Nbr(CTX.post.list); i++)
       if(opt_view_visible(i, GMSH_GET, 0))
         opt_view_axes(i, GMSH_SET | GMSH_GUI, opt_view_axes(i, GMSH_GET, 0)+1);
-    }
     redraw_opengl();
     return 1;
   }
diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp
index 7d3a82882c..edc9329fff 100644
--- a/Graphics/Draw.cpp
+++ b/Graphics/Draw.cpp
@@ -1,4 +1,4 @@
-// $Id: Draw.cpp,v 1.76 2005-03-12 07:52:55 geuzaine Exp $
+// $Id: Draw.cpp,v 1.77 2005-03-20 20:45:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -97,7 +97,7 @@ void Draw2d(void)
   Draw_Graph2D();
   Draw_Text2D();
   Draw_OnScreenMessages();
-  if(CTX.post.draw && CTX.post.scales)
+  if(CTX.post.draw)
     Draw_Scales();
   if(CTX.small_axes)
     Draw_SmallAxes();
diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp
index 1091e7ab61..34aed54698 100644
--- a/Graphics/Graph2D.cpp
+++ b/Graphics/Graph2D.cpp
@@ -1,4 +1,4 @@
-// $Id: Graph2D.cpp,v 1.51 2005-03-14 19:03:55 geuzaine Exp $
+// $Id: Graph2D.cpp,v 1.52 2005-03-20 20:45:11 geuzaine Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -109,6 +109,8 @@ static void Draw_Graph2D(Post_View * v, double xtop, double ytop,
   font_h = gl_height(); // total font height
   font_a = gl_height() - gl_descent();  // height above ref pt
 
+  // compute min/max
+
   switch (v->RangeType) {
   case DRAW_POST_RANGE_DEFAULT:
     ValMin = v->Min;
@@ -130,13 +132,33 @@ static void Draw_Graph2D(Post_View * v, double xtop, double ytop,
     break;
   }
 
+  if(v->Type == DRAW_POST_2D_SPACE) {
+    AbsMin = AbsMax = 0.;
+    double p1[3] = { 0., 0., 0. }, p2[3];
+    for(i = 0; i < List_Nbr(v->SP); i += List_Nbr(v->SP) / v->NbSP) {
+      for(k = 0; k < 3; k++) {
+        List_Read(v->SP, i + k, &p2[k]);
+        if(i)
+          p1[k] = p2[k] - p1[k];
+      }
+      AbsMax += sqrt(p1[0] * p1[0] + p1[1] * p1[1] + p1[2] * p1[2]);
+      for(k = 0; k < 3; k++) {
+        p1[k] = p2[k];
+      }
+    }
+  }
+  else {
+    AbsMin = *(double *)List_Pointer(v->Time, 0);
+    AbsMax = *(double *)List_Pointer(v->Time, List_Nbr(v->Time) - 1);
+  }
+
   glPointSize(CTX.point_size);
   gl2psPointSize(CTX.point_size * CTX.print.eps_point_size_factor);
 
   glLineWidth(CTX.line_width);
   gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor);
 
-  // axes
+  // axes + labels
 
   if(v->Axes) {
     glBegin(GL_LINE_STRIP);
@@ -148,48 +170,8 @@ static void Draw_Graph2D(Post_View * v, double xtop, double ytop,
       glVertex2d(xtop, ytop);
     }
     glEnd();
-  }
-
-  // y tics + labels
-
-  nb = v->NbIso ? v->NbIso : 1;
-  if(v->ShowScale && (v->NbIso * font_h > height))
-    nb = (int)floor(height / font_h);
-
-  dy = height / (double)nb;
-  dv = (ValMax - ValMin) / (double)nb;
-  for(i = 0; i < nb + 1; i++) {
-    if(v->Axes > 0) {
-      glBegin(GL_LINES);
-      glVertex2d(xtop, ytop - i * dy);
-      glVertex2d(xtop + tic, ytop - i * dy);
-      if(v->Axes > 1) {
-        glVertex2d(xtop + width - tic, ytop - i * dy);
-        glVertex2d(xtop + width, ytop - i * dy);
-      }
-      glEnd();
-      if(v->Axes > 2 && i != 0 && i != nb) {
-        glEnable(GL_LINE_STIPPLE);
-        glLineStipple(1, 0x1111);
-        gl2psEnable(GL2PS_LINE_STIPPLE);
-        gl2psLineWidth(1. * CTX.print.eps_line_width_factor);
-        glBegin(GL_LINES);
-        glVertex2d(xtop, ytop - i * dy);
-        glVertex2d(xtop + width, ytop - i * dy);
-        glEnd();
-        glDisable(GL_LINE_STIPPLE);
-        gl2psDisable(GL2PS_LINE_STIPPLE);
-        gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor);
-      }
-    }
-    if(v->ShowScale) {
-      sprintf(label, v->Format, (i == nb) ? ValMin : (ValMax - i * dv));
-      glRasterPos2d(xtop - 2 * tic, ytop - i * dy - font_a / 3.);
-      Draw_String_Right(label);
-    }
-  }
-
-  if(v->ShowScale) {
+    
+    // y
     if(v->Type == DRAW_POST_2D_SPACE &&
        ((v->ShowTime == 1 && List_Nbr(v->Time) > 1) ||
 	(v->ShowTime == 2 && List_Nbr(v->Time) > 0))){
@@ -201,80 +183,101 @@ static void Draw_Graph2D(Post_View * v, double xtop, double ytop,
       sprintf(label, "%s", v->Name);
     glRasterPos2d(xtop, ytop + font_h + tic);
     Draw_String_Center(label);
-  }
 
-  // x tics + labels
+    // x
+    sprintf(label, "%s", v->AxesLabel[0]);
+    glRasterPos2d(xtop + width / 2, ybot - 2 * font_h - 2 * tic);
+    Draw_String_Center(label);
+  }
 
-  if(v->Type == DRAW_POST_2D_SPACE) {
-    AbsMin = AbsMax = 0.;
-    double p1[3] = { 0., 0., 0. }, p2[3];
-    for(i = 0; i < List_Nbr(v->SP); i += List_Nbr(v->SP) / v->NbSP) {
-      for(k = 0; k < 3; k++) {
-        List_Read(v->SP, i + k, &p2[k]);
-        if(i)
-          p1[k] = p2[k] - p1[k];
+  // y tics + horizontal grid
+
+  if(v->NbIso > 0){
+    nb = v->NbIso;
+    if(v->ShowScale && (v->NbIso * font_h > height))
+      nb = (int)floor(height / font_h);
+    dy = height / (double)nb;
+    dv = (ValMax - ValMin) / (double)nb;
+    for(i = 0; i < nb + 1; i++) {
+      if(v->Axes > 0) {
+	glBegin(GL_LINES);
+	glVertex2d(xtop, ytop - i * dy);
+	glVertex2d(xtop + tic, ytop - i * dy);
+	if(v->Axes > 1) {
+	  glVertex2d(xtop + width - tic, ytop - i * dy);
+	  glVertex2d(xtop + width, ytop - i * dy);
+	}
+	glEnd();
+	if(v->Axes > 2 && i != 0 && i != nb) {
+	  glEnable(GL_LINE_STIPPLE);
+	  glLineStipple(1, 0x1111);
+	  gl2psEnable(GL2PS_LINE_STIPPLE);
+	  gl2psLineWidth(1. * CTX.print.eps_line_width_factor);
+	  glBegin(GL_LINES);
+	  glVertex2d(xtop, ytop - i * dy);
+	  glVertex2d(xtop + width, ytop - i * dy);
+	  glEnd();
+	  glDisable(GL_LINE_STIPPLE);
+	  gl2psDisable(GL2PS_LINE_STIPPLE);
+	  gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor);
+	}
       }
-      AbsMax += sqrt(p1[0] * p1[0] + p1[1] * p1[1] + p1[2] * p1[2]);
-      for(k = 0; k < 3; k++) {
-        p1[k] = p2[k];
+      if(v->ShowScale) {
+	sprintf(label, v->Format, (i == nb) ? ValMin : (ValMax - i * dv));
+	glRasterPos2d(xtop - 2 * tic, ytop - i * dy - font_a / 3.);
+	Draw_String_Right(label);
       }
     }
   }
-  else {
-    AbsMin = *(double *)List_Pointer(v->Time, 0);
-    AbsMax = *(double *)List_Pointer(v->Time, List_Nbr(v->Time) - 1);
-  }
 
-  nb = v->AxesTics[0];
-  if(v->Axes) {
-    sprintf(label, v->AxesFormat[0], -M_PI/1.e4);
-    if((nb-1) * gl_width(label) > width)
-      nb = (int)(width / gl_width(label)) + 1;
-  }
-  if(nb == 1) nb++;
+  // x tics + vertical grid
 
-  dx = width / (double)(nb - 1);
-  
-  for(i = 0; i < nb; i++) {
+  if(v->AxesTics[0] > 0){
+    nb = v->AxesTics[0];
     if(v->Axes) {
-      glBegin(GL_LINES);
-      glVertex2d(xtop + i * dx, ybot);
-      glVertex2d(xtop + i * dx, ybot + tic);
-      if(v->Axes > 1) {
-        glVertex2d(xtop + i * dx, ytop);
-        glVertex2d(xtop + i * dx, ytop - tic);
-      }
-      glEnd();
-      if(v->Axes > 2 && i != 0 && i != nb - 1) {
-        glEnable(GL_LINE_STIPPLE);
-        glLineStipple(1, 0x1111);
-        gl2psEnable(GL2PS_LINE_STIPPLE);
-        gl2psLineWidth(1. * CTX.print.eps_line_width_factor);
-        glBegin(GL_LINES);
-        glVertex2d(xtop + i * dx, ytop);
-        glVertex2d(xtop + i * dx, ybot);
-        glEnd();
-        glDisable(GL_LINE_STIPPLE);
-        gl2psDisable(GL2PS_LINE_STIPPLE);
-        gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor);
+      sprintf(label, v->AxesFormat[0], -M_PI/1.e4);
+      if((nb-1) * gl_width(label) > width)
+	nb = (int)(width / gl_width(label)) + 1;
+    }
+    if(nb == 1) nb++;
+    
+    dx = width / (double)(nb - 1);
+    
+    for(i = 0; i < nb; i++) {
+      if(v->Axes) {
+	glBegin(GL_LINES);
+	glVertex2d(xtop + i * dx, ybot);
+	glVertex2d(xtop + i * dx, ybot + tic);
+	if(v->Axes > 1) {
+	  glVertex2d(xtop + i * dx, ytop);
+	  glVertex2d(xtop + i * dx, ytop - tic);
+	}
+	glEnd();
+	if(v->Axes > 2 && i != 0 && i != nb - 1) {
+	  glEnable(GL_LINE_STIPPLE);
+	  glLineStipple(1, 0x1111);
+	  gl2psEnable(GL2PS_LINE_STIPPLE);
+	  gl2psLineWidth(1. * CTX.print.eps_line_width_factor);
+	  glBegin(GL_LINES);
+	  glVertex2d(xtop + i * dx, ytop);
+	  glVertex2d(xtop + i * dx, ybot);
+	  glEnd();
+	  glDisable(GL_LINE_STIPPLE);
+	  gl2psDisable(GL2PS_LINE_STIPPLE);
+	  gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor);
+	}
+	
+	if(nb == 1)
+	  sprintf(label, v->AxesFormat[0], AbsMin);
+	else
+	  sprintf(label, v->AxesFormat[0],
+		  AbsMin + i * (AbsMax - AbsMin) / (double)(nb - 1));
+	glRasterPos2d(xtop + i * dx, ybot - font_h - tic);
+	Draw_String_Center(label);
       }
-
-      if(nb == 1)
-        sprintf(label, v->AxesFormat[0], AbsMin);
-      else
-        sprintf(label, v->AxesFormat[0],
-                AbsMin + i * (AbsMax - AbsMin) / (double)(nb - 1));
-      glRasterPos2d(xtop + i * dx, ybot - font_h - tic);
-      Draw_String_Center(label);
     }
   }
 
-  if(v->Axes) {
-    sprintf(label, "%s", v->AxesLabel[0]);
-    glRasterPos2d(xtop + width / 2, ybot - 2 * font_h - 2 * tic);
-    Draw_String_Center(label);
-  }
-
   // the curve(s)
 
   glPointSize(v->PointSize);
@@ -328,7 +331,6 @@ static void Draw_Graph2D(Post_View * v, double xtop, double ytop,
       }
       glEnd();
     }
-
   }
 
 }
diff --git a/doc/texinfo/opt_post.texi b/doc/texinfo/opt_post.texi
index a5328d0323..de6df5f44c 100644
--- a/doc/texinfo/opt_post.texi
+++ b/doc/texinfo/opt_post.texi
@@ -39,11 +39,6 @@ Enable default post-processing plugins?@*
 Default value: @code{1}@*
 Saved in: @code{General.OptionsFileName}
 
-@item PostProcessing.Scales
-Show value scales@*
-Default value: @code{1}@*
-Saved in: @code{General.OptionsFileName}
-
 @item PostProcessing.Smoothing
 Apply (non-reversible) smoothing to post-processing view when merged@*
 Default value: @code{0}@*
-- 
GitLab