From d57ef184e67edca27fc3d30ddbc05d9584c1cc32 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 18 Nov 2004 23:44:53 +0000
Subject: [PATCH] Added GUI for z-clipping plane distance factor (and changed
 the default value from 10 to 5)

---
 Common/DefaultOptions.h |  2 +-
 Common/Options.cpp      |  6 +++++-
 Fltk/Callbacks.cpp      |  3 ++-
 Fltk/GUI.cpp            | 22 ++++++++++++++--------
 4 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 10eb972112..9fc9230f32 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -452,7 +452,7 @@ StringXNumber GeneralOptions_Number[] = {
     "Third coefficient in equation for clipping plane 5" },
   { F,   "Clip5D" , opt_general_clip5d , 0.0 , 
     "Fourth coefficient in equation for clipping plane 5" },
-  { F,   "ClipFactor" , opt_general_clip_factor , 10.0 , 
+  { F,   "ClipFactor" , opt_general_clip_factor , 5.0 , 
     "Near and far clipping plane distance factor (decrease value for better z-buffer resolution)" },
   { F|S, "ClipPositionX" , opt_general_clip_position0 , 650. , 
     "Horizontal position (in pixels) of the upper left corner of the clipping planes window" }, 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 79cfa2dfc2..c33568fb13 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.205 2004-11-18 16:35:03 geuzaine Exp $
+// $Id: Options.cpp,v 1.206 2004-11-18 23:44:53 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -2254,6 +2254,10 @@ double opt_general_clip_factor(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
     CTX.clip_factor = val;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI))
+    WID->gen_value[14]->value(CTX.clip_factor);
+#endif
   return CTX.clip_factor;
 }
 
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index d252b8ded0..d9da6f0127 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.298 2004-11-14 04:38:11 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.299 2004-11-18 23:44:53 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -921,6 +921,7 @@ void general_options_ok_cb(CALLBACK_ARGS)
   opt_general_rotation_center2(0, GMSH_SET, WID->gen_value[10]->value());
   opt_general_quadric_subdivisions(0, GMSH_SET, WID->gen_value[11]->value());
   opt_general_graphics_fontsize(0, GMSH_SET, WID->gen_value[12]->value());
+  opt_general_clip_factor(0, GMSH_SET, WID->gen_value[14]->value());
 
   opt_general_default_filename(0, GMSH_SET, (char *)WID->gen_input[0]->value());
   opt_general_editor(0, GMSH_SET, (char *)WID->gen_input[1]->value());
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 4307408600..06f9c1d532 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.381 2004-11-14 05:31:04 geuzaine Exp $
+// $Id: GUI.cpp,v 1.382 2004-11-18 23:44:53 geuzaine Exp $
 //
 // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
 //
@@ -1659,19 +1659,25 @@ void GUI::create_option_window()
       gen_choice[2]->align(FL_ALIGN_RIGHT);
       gen_choice[2]->tooltip("(Alt+o)");
 
-      gen_value[11] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Number of quadric subdivisions");
+      gen_value[14] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Z-clipping planes distance factor");
+      gen_value[14]->minimum(0.1);
+      gen_value[14]->maximum(10.);
+      gen_value[14]->step(0.1);
+      gen_value[14]->align(FL_ALIGN_RIGHT);
+
+      gen_value[11] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Number of quadric subdivisions");
       gen_value[11]->minimum(3);
       gen_value[11]->maximum(30);
       gen_value[11]->step(1);
       gen_value[11]->align(FL_ALIGN_RIGHT);
 
-      gen_value[6] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 3 * BH, IW, BH, "Point size");
+      gen_value[6] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Point size");
       gen_value[6]->minimum(0.1);
       gen_value[6]->maximum(50);
       gen_value[6]->step(0.1);
       gen_value[6]->align(FL_ALIGN_RIGHT);
 
-      gen_value[7] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 4 * BH, IW, BH, "Line width");
+      gen_value[7] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Line width");
       gen_value[7]->minimum(0.1);
       gen_value[7]->maximum(50);
       gen_value[7]->step(0.1);
@@ -1684,18 +1690,18 @@ void GUI::create_option_window()
 	{"3D arrow", 0, 0, 0},
 	{0}
       };
-      gen_choice[0] = new Fl_Choice(L + 2 * WB, 2 * WB + 5 * BH, IW, BH, "Vector display");
+      gen_choice[0] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Vector display");
       gen_choice[0]->menu(menu_genvectype);
       gen_choice[0]->align(FL_ALIGN_RIGHT);
 
-      Fl_Button *b = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 5 * BH, (int)(1.5*BB), BH, "Edit arrow shape");
+      Fl_Button *b = new Fl_Button(L + 2 * IW - 2 * WB, 2 * WB + 6 * BH, (int)(1.5*BB), BH, "Edit arrow shape");
       b->callback(general_arrow_param_cb);
 
-      gen_choice[1] = new Fl_Choice(L + 2 * WB, 2 * WB + 6 * BH, IW, BH, "Font");
+      gen_choice[1] = new Fl_Choice(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Font");
       gen_choice[1]->menu(menu_font_names);
       gen_choice[1]->align(FL_ALIGN_RIGHT);
 
-      gen_value[12] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 7 * BH, IW, BH, "Font size");
+      gen_value[12] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW, BH, "Font size");
       gen_value[12]->minimum(5);
       gen_value[12]->maximum(40);
       gen_value[12]->step(1);
-- 
GitLab