From 81c8d3c9781374dfce1f22b358bbf49801353337 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 9 Jan 2001 15:45:38 +0000
Subject: [PATCH] *** empty log message ***

---
 Fltk/Callbacks.cpp    |  81 +++++++++----
 Fltk/Callbacks.h      |  10 +-
 Fltk/GUI.cpp          | 270 +++++++++++++++++++++++++++++-------------
 Fltk/GUI.h            |  31 +++--
 Fltk/Opengl.cpp       |  35 +-----
 Geo/Visibility.cpp    |  92 ++++++++++++++
 Geo/Visibility.h      |  11 ++
 Graphics/CreateFile.h |   6 +
 8 files changed, 386 insertions(+), 150 deletions(-)
 create mode 100644 Geo/Visibility.cpp
 create mode 100644 Geo/Visibility.h
 create mode 100644 Graphics/CreateFile.h

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index ab0280488d..fa215a6781 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.5 2001-01-09 14:24:06 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.6 2001-01-09 15:45:03 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -279,7 +279,7 @@ void file_quit_cb(CALLBACK_ARGS) {
 // Option General Menu
 
 void opt_general_cb(CALLBACK_ARGS) {
-  WID->opt_general();
+  WID->create_general_options_window();
 }
 void opt_general_moving_axes_cb(CALLBACK_ARGS){
   CTX.axes = !CTX.axes ;
@@ -305,6 +305,8 @@ void opt_general_orthographic_cb(CALLBACK_ARGS){
 }
 void opt_general_color_cb(CALLBACK_ARGS){
   Init_Colors((int)((Fl_Value_Input*)w)->value()-1);
+  Init();
+  Draw();
 }
 void opt_general_shininess_cb(CALLBACK_ARGS){
   CTX.shine = ((Fl_Value_Input*)w)->value();
@@ -316,7 +318,7 @@ void opt_general_light_cb(CALLBACK_ARGS){
 // Option Geometry Menu
 
 void opt_geometry_cb(CALLBACK_ARGS) {
-  WID->opt_geometry();
+  WID->create_geometry_options_window();
 }
 void opt_geometry_entity_cb(CALLBACK_ARGS) {
   switch((int)data){
@@ -357,7 +359,7 @@ void opt_geometry_tangents_cb(CALLBACK_ARGS) {
 // Option Mesh Menu
 
 void opt_mesh_cb(CALLBACK_ARGS) {
-  WID->opt_mesh();
+  WID->create_mesh_options_window();
 }
 void opt_mesh_entity_cb(CALLBACK_ARGS) {
   switch((int)data){
@@ -379,33 +381,64 @@ void opt_mesh_show_by_entity_num_cb(CALLBACK_ARGS) {
   opt_geometry_show_by_entity_num_cb(w,data);
 }
 void opt_mesh_show_by_quality_cb(CALLBACK_ARGS) {
-  const char * c = ((Fl_Input*)w)->value(); 
-  if (!strcmp(c,"all") || !strcmp(c,"*"))
-    CTX.mesh.limit_gamma = 0.0 ;
-  else
-    CTX.mesh.limit_gamma = atof(c);
+  CTX.mesh.limit_gamma = ((Fl_Value_Input*)w)->value();
+}
+void opt_mesh_normals_cb(CALLBACK_ARGS) {
+  CTX.mesh.normals = ((Fl_Value_Input*)w)->value();
+}
+void opt_mesh_degree_cb(CALLBACK_ARGS){
+  if(CTX.mesh.degree==2) CTX.mesh.degree = 1;
+  else CTX.mesh.degree = 2;
+}
+void opt_mesh_algo_cb(CALLBACK_ARGS){
+  if(CTX.mesh.algo==DELAUNAY_OLDALGO) CTX.mesh.algo = DELAUNAY_NEWALGO;
+  else CTX.mesh.algo = DELAUNAY_OLDALGO;
+}
+void opt_mesh_smoothing_cb(CALLBACK_ARGS){
+  CTX.mesh.nb_smoothing = (int)((Fl_Value_Input*)w)->value();
+}
+void opt_mesh_interactive_cb(CALLBACK_ARGS){
+  CTX.mesh.interactive = !CTX.mesh.interactive;
+}
+void opt_mesh_explode_cb(CALLBACK_ARGS){
+  CTX.mesh.explode = ((Fl_Value_Input*)w)->value();
+}
+void opt_mesh_aspect_cb(CALLBACK_ARGS){
+  switch((int)data){
+  case 0 : CTX.mesh.hidden = 0; CTX.mesh.shade = 0; break; 
+  case 1 : CTX.mesh.hidden = 1; CTX.mesh.shade = 0; break; 
+  case 2 : CTX.mesh.hidden = 1; CTX.mesh.shade = 1; break; 
+  }
 }
-
 
 // Option Post Menu
 
 void opt_post_cb(CALLBACK_ARGS) {
-  WID->opt_post();
+  WID->create_post_options_window();
+}
+void opt_post_link_cb(CALLBACK_ARGS) {
+  CTX.post.link = (int)data;
+}
+void opt_post_anim_delay_cb(CALLBACK_ARGS) {
+  CTX.post.anim_delay = (long)(1.e5*((Fl_Value_Input*)w)->value());
 }
 
 // Option Statistics Menu
 
 void opt_statistics_cb(CALLBACK_ARGS) {
-  WID->opt_statistics();
+  WID->create_statistics_window();
+}
+void opt_statistics_update_cb(CALLBACK_ARGS) {
+  WID->set_statistics();
 }
 
 // Help Menu
 
 void help_short_cb(CALLBACK_ARGS){
-  WID->help_short();
+  WID->create_help_window();
 }
 void help_about_cb(CALLBACK_ARGS){
-  WID->help_about();
+  WID->create_about_window();
 }
 
 // Module Menu
@@ -766,17 +799,23 @@ void view_duplicate_cb(CALLBACK_ARGS){
 }
 
 void view_lighting_cb(CALLBACK_ARGS){
-  printf("Light view %d \n", (int)data);
+  Post_View *v = (Post_View*)List_Pointer(Post_ViewList,(int)data);
+  v->Light = !v->Light;
+  v->Changed = 1;
+  Init() ;
+  Draw() ;
 }
 void view_elements_cb(CALLBACK_ARGS){
-  printf("Show Elements view %d \n", (int)data);
+  Post_View *v = (Post_View*)List_Pointer(Post_ViewList,(int)data);
+  v->ShowElement = !v->ShowElement;
+  v->Changed = 1;
+  Init() ;
+  Draw() ;
 }
 void view_applybgmesh_cb(CALLBACK_ARGS){
-  printf("Apply bgmesh view %d \n", (int)data);
-}
-void view_timestep_cb(CALLBACK_ARGS){
-  printf("Timestep view %d \n", (int)data);
+  Post_View *v = (Post_View*)List_Pointer(Post_ViewList,(int)data);
+  BGMWithView(v); 
 }
 void view_options_cb(CALLBACK_ARGS){
-  WID->opt_view();
+  WID->create_view_window();
 }
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index 207ed04246..cec9712bee 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -68,14 +68,23 @@ void opt_mesh_num_cb(CALLBACK_ARGS) ;
 void opt_mesh_show_by_entity_num_cb(CALLBACK_ARGS) ;
 void opt_mesh_show_by_quality_cb(CALLBACK_ARGS) ;
 void opt_mesh_normals_cb(CALLBACK_ARGS) ;
+void opt_mesh_degree_cb(CALLBACK_ARGS) ;
+void opt_mesh_algo_cb(CALLBACK_ARGS) ;
+void opt_mesh_smoothing_cb(CALLBACK_ARGS) ;
+void opt_mesh_interactive_cb(CALLBACK_ARGS) ;
+void opt_mesh_explode_cb(CALLBACK_ARGS) ;
+void opt_mesh_aspect_cb(CALLBACK_ARGS) ;
 
 // Option Post Menu
 
 void opt_post_cb(CALLBACK_ARGS) ;
+void opt_post_link_cb(CALLBACK_ARGS) ;
+void opt_post_anim_delay_cb(CALLBACK_ARGS) ;
 
 // Option Statistics Menu
 
 void opt_statistics_cb(CALLBACK_ARGS) ;
+void opt_statistics_update_cb(CALLBACK_ARGS) ;
 
 // Help Menu
 
@@ -173,7 +182,6 @@ void view_duplicate_cb(CALLBACK_ARGS) ;
 void view_lighting_cb(CALLBACK_ARGS) ;
 void view_elements_cb(CALLBACK_ARGS) ;
 void view_applybgmesh_cb(CALLBACK_ARGS) ;
-void view_timestep_cb(CALLBACK_ARGS) ;
 void view_options_cb(CALLBACK_ARGS) ;
 
 
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index f9ea37d6da..93cc1d807a 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -310,8 +310,6 @@ GUI::GUI() {
 			   (Fl_Callback *)view_elements_cb, (void*)i, 0);
       m_popup_butt[i]->add("Apply as Background Mesh", 0,
 			   (Fl_Callback *)view_applybgmesh_cb, (void*)i, FL_MENU_DIVIDER);
-      m_popup_butt[i]->add("Time Step...", 0,
-			   (Fl_Callback *)view_timestep_cb, (void*)i, 0);
       m_popup_butt[i]->add("Options...", 0,
 			   (Fl_Callback *)view_options_cb, (void*)i, 0);
       m_popup_butt[i]->textsize(CTX.fontsize);
@@ -412,6 +410,62 @@ void GUI::set_status(char *msg, int num){
   g_status_label[num]->redraw();
 }
 
+// Set the statistics
+void GUI::set_statistics(){
+  static double  s[50];
+  static char    label[50][256];
+
+  GetStatistics(s);
+
+  // geom
+  sprintf(label[0], "%g", s[0]); stat_value[0]->value(label[0]);
+  sprintf(label[1], "%g", s[1]); stat_value[1]->value(label[1]);
+  sprintf(label[2], "%g", s[2]); stat_value[2]->value(label[2]);
+  sprintf(label[3], "%g", s[3]); stat_value[3]->value(label[3]);
+                                                
+  // mesh
+  sprintf(label[4], "%g", s[4]); stat_value[4]->value(label[4]);
+  sprintf(label[5], "%g", s[5]); stat_value[5]->value(label[5]);
+  sprintf(label[6], "%g", s[6]); stat_value[6]->value(label[6]);
+  sprintf(label[7], "%g", s[7]-s[8]); stat_value[7]->value(label[7]);
+  sprintf(label[8], "%g", s[8]); stat_value[8]->value(label[8]);
+  sprintf(label[9], "%g", s[9]); stat_value[9]->value(label[9]);
+  sprintf(label[10], "%g", s[10]); stat_value[10]->value(label[10]);
+  sprintf(label[11], "%g", s[11]); stat_value[11]->value(label[11]);
+
+  sprintf(label[12], "%g", s[12]); stat_value[12]->value(label[12]);
+  sprintf(label[13], "%g", s[13]); stat_value[13]->value(label[13]);
+  sprintf(label[14], "%g", s[14]); stat_value[14]->value(label[14]);
+
+  sprintf(label[15], "%.4g (%.4g->%.4g)", s[17], s[19], s[18]); stat_value[15]->value(label[15]);
+  sprintf(label[16], "%.4g (%.4g->%.4g)", s[20], s[22], s[21]); stat_value[16]->value(label[16]);
+  sprintf(label[17], "%.4g (%.4g->%.4g)", s[23], s[25], s[24]); stat_value[17]->value(label[17]);
+
+  // post
+  
+  s[15] = List_Nbr(Post_ViewList) ;
+  sprintf(label[18], "%g", s[15]);   stat_value[18]->value(label[18]);
+
+  s[16] = s[17] = s[18] = s[19] = 0 ;
+  for(int i=0 ; i<List_Nbr(Post_ViewList) ; i++){
+    Post_View *v = (Post_View*)List_Pointer(Post_ViewList, i);
+    if(v->Visible){
+      s[16] += v->NbSP + v->NbVP + v->NbTP;
+      s[17] += v->NbSL + v->NbVL + v->NbTL;
+      s[18] += v->NbST + v->NbVT + v->NbTT;
+      s[19] += v->NbSS + v->NbVS + v->NbTS;
+    }
+  }
+  sprintf(label[19], "%g", s[16]); stat_value[19]->value(label[19]);
+  sprintf(label[20], "%g", s[17]); stat_value[20]->value(label[20]);
+  sprintf(label[21], "%g", s[18]); stat_value[21]->value(label[21]);
+  sprintf(label[22], "%g", s[19]); stat_value[22]->value(label[22]);
+
+  for(int i=0 ; i<23 ; i++)
+    stat_value[16]->redraw();
+
+}
+
 // set the current drawing context to the main opengl window
 
 void GUI::make_gl_current(){
@@ -549,7 +603,7 @@ int GUI::get_context(){
 
 // Create the window for general options
 
-void GUI::opt_general(){
+void GUI::create_general_options_window(){
   static int init_opt_general = 0;
 
   if(!init_opt_general){
@@ -680,7 +734,7 @@ void GUI::opt_general(){
 
 // Create the window for geometry options
 
-void GUI::opt_geometry(){
+void GUI::create_geometry_options_window(){
   static int init_opt_geometry = 0;
 
   if(!init_opt_geometry){
@@ -782,7 +836,7 @@ void GUI::opt_geometry(){
 
 // Create the window for mesh options
 
-void GUI::opt_mesh(){
+void GUI::create_mesh_options_window(){
   static int init_opt_mesh = 0;
 
   if(!init_opt_mesh){
@@ -801,8 +855,14 @@ void GUI::opt_mesh(){
 	o->labelsize(CTX.fontsize);
         o->hide();
         mesh_butt[0] = new Fl_Check_Button(2*WB, 2*WB+BH, 100, BH, "Second Order");
+	mesh_butt[0]->callback(opt_mesh_degree_cb, (void*)0);
+	mesh_butt[0]->value(CTX.mesh.degree==2);
         mesh_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 100, BH, "Interactive");
+	mesh_butt[1]->callback(opt_mesh_interactive_cb, (void*)0);
+	mesh_butt[1]->value(CTX.mesh.interactive);
         mesh_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, 100, BH, "Anisotropic");
+	mesh_butt[2]->callback(opt_mesh_algo_cb, (void*)0);
+	mesh_butt[2]->value(CTX.mesh.algo==DELAUNAY_NEWALGO);
 	for(int i=0 ; i<3 ; i++){
 	  mesh_butt[i]->type(FL_TOGGLE_BUTTON);
 	  mesh_butt[i]->down_box(FL_DOWN_BOX);
@@ -810,38 +870,69 @@ void GUI::opt_mesh(){
 	  mesh_butt[i]->selection_color(FL_YELLOW);
 	}
         mesh_value[0] = new Fl_Value_Input(2*WB, 2*WB+4*BH, 40, BH, "Smoothing Steps");
-	mesh_value[0]->minimum(0); mesh_value[0]->maximum(1000); mesh_value[0]->step(1);
-	for(int i=0 ; i<1 ; i++){
-	  mesh_value[i]->labelsize(CTX.fontsize);
-	  mesh_value[i]->type(FL_HORIZONTAL);
-	  mesh_value[i]->align(FL_ALIGN_RIGHT);
-	}
+	mesh_value[0]->minimum(0);
+	mesh_value[0]->maximum(100); 
+	mesh_value[0]->step(1);
+	mesh_value[0]->callback(opt_mesh_smoothing_cb);
+	mesh_value[0]->value(CTX.mesh.nb_smoothing);
+	mesh_value[0]->labelsize(CTX.fontsize);
+	mesh_value[0]->type(FL_HORIZONTAL);
+	mesh_value[0]->align(FL_ALIGN_RIGHT);
+
         o->end();
       }
       { 
 	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Visibility");
 	o->labelsize(CTX.fontsize);
         mesh_butt[3] = new Fl_Check_Button(2*WB, 2*WB+BH, 100, BH, "Points");
+	mesh_butt[3]->callback(opt_mesh_entity_cb, (void*)0);
+	mesh_butt[3]->value(CTX.mesh.points);
         mesh_butt[4] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 100, BH, "Curves");
+	mesh_butt[4]->callback(opt_mesh_entity_cb, (void*)1);
+	mesh_butt[4]->value(CTX.mesh.lines);
         mesh_butt[5] = new Fl_Check_Button(2*WB, 2*WB+3*BH, 100, BH, "Surfaces");
+	mesh_butt[5]->callback(opt_mesh_entity_cb, (void*)2);
+	mesh_butt[5]->value(CTX.mesh.surfaces);
         mesh_butt[6] = new Fl_Check_Button(2*WB, 2*WB+4*BH, 100, BH, "Volumes");
-        mesh_butt[7] = new Fl_Check_Button(2*WB+120, 2*WB+BH, 100, BH, "Point Numebers");
+	mesh_butt[6]->callback(opt_mesh_entity_cb, (void*)3);
+	mesh_butt[6]->value(CTX.mesh.volumes);
+        mesh_butt[7] = new Fl_Check_Button(2*WB+120, 2*WB+BH, 100, BH, "Point Numbers");
+	mesh_butt[7]->callback(opt_mesh_entity_cb, (void*)0);
+	mesh_butt[7]->value(CTX.mesh.points_num);
         mesh_butt[8] = new Fl_Check_Button(2*WB+120, 2*WB+2*BH, 100, BH, "Curve Numbers");
+	mesh_butt[8]->callback(opt_mesh_entity_cb, (void*)1);
+	mesh_butt[8]->value(CTX.mesh.lines_num);
         mesh_butt[9] = new Fl_Check_Button(2*WB+120, 2*WB+3*BH, 100, BH, "Surface Numbers");
+	mesh_butt[9]->callback(opt_mesh_entity_cb, (void*)2);
+	mesh_butt[9]->value(CTX.mesh.surfaces_num);
         mesh_butt[10] = new Fl_Check_Button(2*WB+120, 2*WB+4*BH, 100, BH, "Volume Numbers");
+	mesh_butt[10]->callback(opt_mesh_entity_cb, (void*)3);
+	mesh_butt[10]->value(CTX.mesh.volumes_num);
 	for(int i=3 ; i<11 ; i++){
 	  mesh_butt[i]->type(FL_TOGGLE_BUTTON);
 	  mesh_butt[i]->down_box(FL_DOWN_BOX);
 	  mesh_butt[i]->labelsize(CTX.fontsize);
 	  mesh_butt[i]->selection_color(FL_YELLOW);
 	}
-        mesh_value[1] = new Fl_Value_Input(2*WB, 2*WB+5*BH, 100, BH, "Entity Number");
-	mesh_value[1]->minimum(0); mesh_value[1]->maximum(1000); mesh_value[1]->step(1);
-        mesh_value[2] = new Fl_Value_Input(2*WB, 2*WB+6*BH, 100, BH, "Element Quality");
-	mesh_value[2]->minimum(0); mesh_value[2]->maximum(1000); mesh_value[2]->step(1);
-	mesh_value[3] = new Fl_Value_Input(2*WB, 2*WB+7*BH, 100, BH, "Normals");
-	mesh_value[3]->minimum(0); mesh_value[3]->maximum(100); mesh_value[3]->step(1);
-	for(int i=1 ; i<4 ; i++){
+        mesh_input = new Fl_Input(2*WB, 2*WB+5*BH, 100, BH, "Entity Number");
+	mesh_input->callback(opt_mesh_show_by_entity_num_cb);
+	mesh_input->labelsize(CTX.fontsize);
+	mesh_input->type(FL_HORIZONTAL);
+	mesh_input->align(FL_ALIGN_RIGHT);
+
+        mesh_value[1] = new Fl_Value_Input(2*WB, 2*WB+6*BH, 100, BH, "Element Quality");
+	mesh_value[1]->minimum(0); 
+	mesh_value[1]->maximum(1);
+	mesh_value[1]->step(0.001);
+	mesh_value[1]->callback(opt_mesh_show_by_quality_cb);
+	mesh_value[1]->value(CTX.mesh.limit_gamma);
+	mesh_value[2] = new Fl_Value_Input(2*WB, 2*WB+7*BH, 100, BH, "Normals");
+	mesh_value[2]->minimum(0); 
+	mesh_value[2]->maximum(100);
+	mesh_value[2]->step(1);
+	mesh_value[2]->callback(opt_mesh_normals_cb);
+	mesh_value[2]->value(CTX.mesh.normals);
+	for(int i=1 ; i<3 ; i++){
 	  mesh_value[i]->labelsize(CTX.fontsize);
 	  mesh_value[i]->type(FL_HORIZONTAL);
 	  mesh_value[i]->align(FL_ALIGN_RIGHT);
@@ -853,22 +944,30 @@ void GUI::opt_mesh(){
 	o->labelsize(CTX.fontsize);
         o->hide();
         mesh_butt[11] = new Fl_Check_Button(2*WB, 2*WB+BH, 100, BH, "Wireframe");
+	mesh_butt[11]->callback(opt_mesh_aspect_cb, (void*)0);
+	mesh_butt[11]->value(!CTX.mesh.hidden);
         mesh_butt[12] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 100, BH, "Hidden lines");
+	mesh_butt[12]->callback(opt_mesh_aspect_cb, (void*)1);
+	mesh_butt[12]->value(CTX.mesh.hidden);
         mesh_butt[13] = new Fl_Check_Button(2*WB, 2*WB+3*BH, 100, BH, "Solid");
+	mesh_butt[13]->callback(opt_mesh_aspect_cb, (void*)2);
+	mesh_butt[13]->value(CTX.mesh.shade);
 	for(int i=11 ; i<14 ; i++){
-	  mesh_butt[i]->type(FL_TOGGLE_BUTTON);
+	  mesh_butt[i]->type(FL_RADIO_BUTTON);
 	  mesh_butt[i]->down_box(FL_DOWN_BOX);
 	  mesh_butt[i]->labelsize(CTX.fontsize);
 	  mesh_butt[i]->selection_color(FL_YELLOW);
 	}
         mesh_value[4] = new Fl_Value_Input(2*WB, 2*WB+4*BH, 40, BH, "Explode");
-	mesh_value[4]->minimum(0); mesh_value[4]->maximum(100); mesh_value[4]->step(1);
+	mesh_value[4]->minimum(0);
+	mesh_value[4]->maximum(100);
+	mesh_value[4]->step(1);
+	mesh_value[4]->callback(opt_mesh_explode_cb);
+	mesh_value[4]->value(CTX.mesh.explode);
+	mesh_value[4]->labelsize(CTX.fontsize);
+	mesh_value[4]->type(FL_HORIZONTAL);
+	mesh_value[4]->align(FL_ALIGN_RIGHT);
         o->end();
-	for(int i=4 ; i<5 ; i++){
-	  mesh_value[i]->labelsize(CTX.fontsize);
-	  mesh_value[i]->type(FL_HORIZONTAL);
-	  mesh_value[i]->align(FL_ALIGN_RIGHT);
-	}
       }
       o->end();
     }
@@ -900,7 +999,7 @@ void GUI::opt_mesh(){
 
 // Create the window for post-processing options
 
-void GUI::opt_post(){
+void GUI::create_post_options_window(){
   static int init_opt_post = 0;
 
   if(!init_opt_post){
@@ -918,8 +1017,14 @@ void GUI::opt_post(){
 	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Links");
 	o->labelsize(CTX.fontsize);
         post_butt[0] = new Fl_Check_Button(2*WB, 2*WB+BH, 150, BH, "No link between views");
-        post_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 150, BH, "Link all views");
-        post_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, 150, BH, "Link visible views");
+	post_butt[0]->callback(opt_post_link_cb, (void*)0);
+	post_butt[0]->value(CTX.post.link==0);
+        post_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, 150, BH, "Link visible views");
+	post_butt[1]->callback(opt_post_link_cb, (void*)1);
+	post_butt[1]->value(CTX.post.link==1);
+        post_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, 150, BH, "Link all views");
+	post_butt[2]->callback(opt_post_link_cb, (void*)2);
+	post_butt[2]->value(CTX.post.link==2);
 	for(int i=0 ; i<3 ; i++){
 	  post_butt[i]->type(FL_RADIO_BUTTON);
 	  post_butt[i]->labelsize(CTX.fontsize);
@@ -932,12 +1037,14 @@ void GUI::opt_post(){
 	o->labelsize(CTX.fontsize);
 	o->hide();
         post_value[0] = new Fl_Value_Input(2*WB, 2*WB+BH, 40, BH, "Animation delay");
-	post_value[0]->minimum(0); post_value[0]->maximum(10); post_value[0]->step(0.1);
-	for(int i=0 ; i<1 ; i++){
-	  post_value[i]->labelsize(CTX.fontsize);
-	  post_value[i]->type(FL_HORIZONTAL);
-	  post_value[i]->align(FL_ALIGN_RIGHT);
-	}
+	post_value[0]->minimum(0);
+	post_value[0]->maximum(10); 
+	post_value[0]->step(0.1);
+	post_value[0]->callback(opt_post_anim_delay_cb);
+	post_value[0]->value(CTX.post.anim_delay);
+	post_value[0]->labelsize(CTX.fontsize);
+	post_value[0]->type(FL_HORIZONTAL);
+	post_value[0]->align(FL_ALIGN_RIGHT);
 	o->end();
       }
       o->end();
@@ -969,7 +1076,7 @@ void GUI::opt_post(){
 
 // Create the window for the statistics
 
-void GUI::opt_statistics(){
+void GUI::create_statistics_window(){
   static int init_opt_statistics = 0;
 
   if(!init_opt_statistics){
@@ -987,40 +1094,40 @@ void GUI::opt_statistics(){
 	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Geometry");
 	o->labelsize(CTX.fontsize);
 	o->hide();
-        stat_value[0] = new Fl_Value_Output(110+2*WB, 2*WB+BH, 100, BH, "Number of points");
-        stat_value[1] = new Fl_Value_Output(110+2*WB, 2*WB+2*BH, 100, BH, "Number of curves");
-        stat_value[2] = new Fl_Value_Output(110+2*WB, 2*WB+3*BH, 100, BH, "Number of surfaces");
-        stat_value[3] = new Fl_Value_Output(110+2*WB, 2*WB+4*BH, 100, BH, "Number of volumes");
+        stat_value[0] = new Fl_Output(110+2*WB, 2*WB+BH, 100, BH, "Number of points");
+        stat_value[1] = new Fl_Output(110+2*WB, 2*WB+2*BH, 100, BH, "Number of curves");
+        stat_value[2] = new Fl_Output(110+2*WB, 2*WB+3*BH, 100, BH, "Number of surfaces");
+        stat_value[3] = new Fl_Output(110+2*WB, 2*WB+4*BH, 100, BH, "Number of volumes");
         o->end();
       }
       { 
 	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Mesh");
 	o->labelsize(CTX.fontsize);
-        stat_value[4] = new Fl_Value_Output(110+2*WB, 2*WB+BH, 100, BH, "Nodes on curves");
-        stat_value[5] = new Fl_Value_Output(110+2*WB, 2*WB+2*BH, 100, BH, "Nodes on surfaces");
-        stat_value[6] = new Fl_Value_Output(110+2*WB, 2*WB+3*BH, 100, BH, "Nodes in Volumes");
-        stat_value[7] = new Fl_Value_Output(110+2*WB, 2*WB+4*BH, 100, BH, "Triangles");
-        stat_value[8] = new Fl_Value_Output(110+2*WB, 2*WB+5*BH, 100, BH, "Quadrangles");
-        stat_value[9] = new Fl_Value_Output(110+2*WB, 2*WB+6*BH, 100, BH, "Tetrahedra");
-        stat_value[10] = new Fl_Value_Output(110+2*WB, 2*WB+7*BH, 100, BH, "Hexahedra");
-        stat_value[11] = new Fl_Value_Output(110+2*WB, 2*WB+8*BH, 100, BH, "Prisms");
-        stat_value[12] = new Fl_Value_Output(110+2*WB, 2*WB+9*BH, 100, BH, "Time for 1D mesh");
-        stat_value[13] = new Fl_Value_Output(110+2*WB, 2*WB+10*BH, 100, BH, "Time for 2D mesh");
-        stat_value[14] = new Fl_Value_Output(110+2*WB, 2*WB+11*BH, 100, BH, "Time for 3D mesh");
-        stat_value[15] = new Fl_Value_Output(110+2*WB, 2*WB+12*BH, 100, BH, "Gamma factor");
-        stat_value[16] = new Fl_Value_Output(110+2*WB, 2*WB+13*BH, 100, BH, "Eta factor");
-        stat_value[17] = new Fl_Value_Output(110+2*WB, 2*WB+14*BH, 100, BH, "Rho factor");
+        stat_value[4] = new Fl_Output(110+2*WB, 2*WB+BH, 100, BH, "Nodes on curves");
+        stat_value[5] = new Fl_Output(110+2*WB, 2*WB+2*BH, 100, BH, "Nodes on surfaces");
+        stat_value[6] = new Fl_Output(110+2*WB, 2*WB+3*BH, 100, BH, "Nodes in Volumes");
+        stat_value[7] = new Fl_Output(110+2*WB, 2*WB+4*BH, 100, BH, "Triangles");
+        stat_value[8] = new Fl_Output(110+2*WB, 2*WB+5*BH, 100, BH, "Quadrangles");
+        stat_value[9] = new Fl_Output(110+2*WB, 2*WB+6*BH, 100, BH, "Tetrahedra");
+        stat_value[10] = new Fl_Output(110+2*WB, 2*WB+7*BH, 100, BH, "Hexahedra");
+        stat_value[11] = new Fl_Output(110+2*WB, 2*WB+8*BH, 100, BH, "Prisms");
+        stat_value[12] = new Fl_Output(110+2*WB, 2*WB+9*BH, 100, BH, "Time for 1D mesh");
+        stat_value[13] = new Fl_Output(110+2*WB, 2*WB+10*BH, 100, BH, "Time for 2D mesh");
+        stat_value[14] = new Fl_Output(110+2*WB, 2*WB+11*BH, 100, BH, "Time for 3D mesh");
+        stat_value[15] = new Fl_Output(110+2*WB, 2*WB+12*BH, 100, BH, "Gamma factor");
+        stat_value[16] = new Fl_Output(110+2*WB, 2*WB+13*BH, 100, BH, "Eta factor");
+        stat_value[17] = new Fl_Output(110+2*WB, 2*WB+14*BH, 100, BH, "Rho factor");
         o->end();
       }
       { 
 	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Post-processing");
 	o->labelsize(CTX.fontsize);
 	o->hide();
-        stat_value[18] = new Fl_Value_Output(110+2*WB, 2*WB+BH, 100, BH, "Views loaded");
-        stat_value[19] = new Fl_Value_Output(110+2*WB, 2*WB+2*BH, 100, BH, "Visible Points");
-        stat_value[20] = new Fl_Value_Output(110+2*WB, 2*WB+3*BH, 100, BH, "Visible Lines");
-        stat_value[21] = new Fl_Value_Output(110+2*WB, 2*WB+4*BH, 100, BH, "Visible Triangles");
-        stat_value[22] = new Fl_Value_Output(110+2*WB, 2*WB+5*BH, 100, BH, "Visible Tetrahedra");
+        stat_value[18] = new Fl_Output(110+2*WB, 2*WB+BH, 100, BH, "Views loaded");
+        stat_value[19] = new Fl_Output(110+2*WB, 2*WB+2*BH, 100, BH, "Visible Points");
+        stat_value[20] = new Fl_Output(110+2*WB, 2*WB+3*BH, 100, BH, "Visible Lines");
+        stat_value[21] = new Fl_Output(110+2*WB, 2*WB+4*BH, 100, BH, "Visible Triangles");
+        stat_value[22] = new Fl_Output(110+2*WB, 2*WB+5*BH, 100, BH, "Visible Tetrahedra");
         o->end();
       }
       o->end();
@@ -1030,6 +1137,7 @@ void GUI::opt_statistics(){
       stat_value[i]->labelsize(CTX.fontsize);
       stat_value[i]->type(FL_HORIZONTAL);
       stat_value[i]->align(FL_ALIGN_LEFT);
+      stat_value[i]->value(0);
     }
 
     { 
@@ -1038,20 +1146,22 @@ void GUI::opt_statistics(){
       o->callback(cancel_cb, (void*)stat_window);
     }
     { 
-      Fl_Return_Button* o = new Fl_Return_Button(width-60-WB, height-BH-WB, 60, BH, "OK");
+      Fl_Button* o = new Fl_Button(width-60-WB, height-BH-WB, 60, BH, "update");
       o->labelsize(CTX.fontsize);
-      o->callback(ok_cb);
+      o->callback(opt_statistics_update_cb);
     }
 
     stat_window->end();
+    set_statistics();
     stat_window->show();
   }
   else{
     if(stat_window->shown())
       stat_window->hide();
-    else
-      stat_window->show();
-    
+    else{
+      set_statistics();
+      stat_window->show();     
+    }
   }
 
 }
@@ -1060,7 +1170,7 @@ void GUI::opt_statistics(){
 
 #include "Help.h"
 
-void GUI::help_short(){
+void GUI::create_help_window(){
   static int init_help_short = 0;
 
   if(!init_help_short){
@@ -1104,7 +1214,7 @@ void GUI::help_short(){
 
 // Create the about window
 
-void GUI::help_about(){
+void GUI::create_about_window(){
   static int init_help_about = 0;
 
   if(!init_help_about){
@@ -1151,7 +1261,7 @@ void GUI::help_about(){
 
 // Create the window for view options
 
-void GUI::opt_view(){
+void GUI::create_view_window(){
   static int init_opt_view = 0;
 
   if(!init_opt_view){
@@ -1238,34 +1348,33 @@ void GUI::opt_view(){
 	view_value[2]->step(1);
         o->end();
       }
-      // Offset
+      // Offset and Raise
       { 
-	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Offset");
+	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Offset and raise");
 	o->labelsize(CTX.fontsize);
         o->hide();
 	view_value[3] = new Fl_Value_Input(2*WB, 2*WB+ BH, 100, BH, "X");
         view_value[4] = new Fl_Value_Input(2*WB, 2*WB+2*BH, 100, BH, "Y");
 	view_value[5] = new Fl_Value_Input(2*WB, 2*WB+3*BH, 100, BH, "Z");
-	for(int i=3 ; i<6 ; i++){
+	view_value[6] = new Fl_Value_Input(2*WB, 2*WB+ BH, 100, BH, "X");
+        view_value[7] = new Fl_Value_Input(2*WB, 2*WB+2*BH, 100, BH, "Y");
+	view_value[8] = new Fl_Value_Input(2*WB, 2*WB+3*BH, 100, BH, "Z");
+	for(int i=3 ; i<9 ; i++){
 	  view_value[i]->labelsize(CTX.fontsize);
 	  view_value[i]->type(FL_HORIZONTAL);
 	  view_value[i]->align(FL_ALIGN_RIGHT);
 	}	
 	o->end();
       }
-      // Raise
+      // Time step
       { 
-	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Raise");
+	Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Time step");
 	o->labelsize(CTX.fontsize);
         o->hide();
-	view_value[6] = new Fl_Value_Input(2*WB, 2*WB+ BH, 100, BH, "X");
-        view_value[7] = new Fl_Value_Input(2*WB, 2*WB+2*BH, 100, BH, "Y");
-	view_value[8] = new Fl_Value_Input(2*WB, 2*WB+3*BH, 100, BH, "Z");
-	for(int i=6 ; i<9 ; i++){
-	  view_value[i]->labelsize(CTX.fontsize);
-	  view_value[i]->type(FL_HORIZONTAL);
-	  view_value[i]->align(FL_ALIGN_RIGHT);
-	}	
+	view_value[9] = new Fl_Value_Input(2*WB, 2*WB+ BH, 100, BH, "Time step");
+	view_value[9]->labelsize(CTX.fontsize);
+	view_value[9]->type(FL_HORIZONTAL);
+	view_value[9]->align(FL_ALIGN_RIGHT);
 	o->end();
       }
       o->end();
@@ -1294,3 +1403,4 @@ void GUI::opt_view(){
   }
 
 }
+
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index 98efd4bd3b..b61cc2451d 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -18,7 +18,7 @@
 #include <FL/Fl_Menu_Button.H>
 #include <FL/Fl_Check_Button.H>
 #include <FL/Fl_Value_Input.H>
-#include <FL/Fl_Value_Output.H>
+#include <FL/Fl_Output.H>
 #include <FL/Fl_Multiline_Output.H>
 #include <FL/Fl_Browser.H>
 #include <FL/Fl_Bitmap.H>
@@ -124,12 +124,12 @@ class GUI{
   Fl_Value_Input   *post_value[20] ;
 
   // statistics window
-  Fl_Value_Output  *stat_value[40] ;
+  Fl_Output        *stat_value[50] ;
 
   // view options window
   Fl_Check_Button  *view_butt[20] ;
-  Fl_Value_Input   *view_value[10] ;
-  Fl_Input         *view_input[10] ;
+  Fl_Value_Input   *view_value[20] ;
+  Fl_Input         *view_input[20] ;
 
 public:
 
@@ -145,18 +145,17 @@ public:
   int  get_context();
   void set_anim(int mode);
   void set_status(char *msg, int num);
-
-  // create option windows
-  void opt_general();
-  void opt_geometry();
-  void opt_mesh();
-  void opt_post();
-  void opt_statistics();
-  void opt_view();
-
-  // create help windows
-  void help_short();
-  void help_about();
+  void set_statistics();
+
+  // create additional windows
+  void create_general_options_window();
+  void create_geometry_options_window();
+  void create_mesh_options_window();
+  void create_post_options_window();
+  void create_statistics_window();
+  void create_view_window();
+  void create_help_window();
+  void create_about_window();
 
 };
 
diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp
index 3c4a2ca9e9..5fbfe6e1fe 100644
--- a/Fltk/Opengl.cpp
+++ b/Fltk/Opengl.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl.cpp,v 1.3 2001-01-09 13:28:44 geuzaine Exp $
+// $Id: Opengl.cpp,v 1.4 2001-01-09 15:45:03 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -234,7 +234,7 @@ int Opengl_Window::handle(int event) {
   switch (event) {
 
   /* -------------------------------------------------------------
-     K e y s 
+     S h o r t c u t s
      ------------------------------------------------------------- */
 
   case FL_SHORTCUT:
@@ -244,34 +244,6 @@ int Opengl_Window::handle(int event) {
     */
     return 0;
 
-  case FL_ENTER :
-  case FL_LEAVE :
-    ButtonPressed = 0;
-    Modifier = 0;
-    return Fl_Gl_Window::handle(event);
-    
-  case FL_FOCUS:
-    return 1;
-
-  case FL_UNFOCUS:
-    return 1;
-
-  case FL_KEYBOARD:
-    
-    switch(Fl::event_key()){
-    case FL_Control_L : case FL_Control_R : 
-      printf("got a ctrl\n");
-      Modifier = 1; 
-      return 1;
-    case FL_Alt_L : case FL_Alt_R : 
-    case FL_Meta_L : case FL_Meta_R : 
-      Modifier = 2; 
-      return 1;
-    default:
-      return Fl_Gl_Window::handle(event);
-    }
-    break;
-    
   /* -------------------------------------------------------------
      B u t t o n P r e s s
      ------------------------------------------------------------- */
@@ -469,8 +441,7 @@ int Opengl_Window::handle(int event) {
       O t h er
      ------------------------------------------------------------- */
 
-  default:
-    // pass other events to the base class...
+  default: // pass other events to the base class...
     return Fl_Gl_Window::handle(event);
 
   }
diff --git a/Geo/Visibility.cpp b/Geo/Visibility.cpp
new file mode 100644
index 0000000000..4988ad53e4
--- /dev/null
+++ b/Geo/Visibility.cpp
@@ -0,0 +1,92 @@
+
+#include "Gmsh.h"
+#include "Geo.h"
+#include "CAD.h"
+#include "Mesh.h"
+#include "DataBase.h"
+
+extern Mesh *THEM;
+
+/* Gestion des entites visibles */
+
+Tree_T  *EntitesVisibles=NULL;
+int      SHOW_ALL_ENTITIES;
+
+typedef struct{
+ int Entite;
+ int Visible;
+}EntiteVisible;
+
+int compareEntiteVisible(const void *a, const void *b){
+  EntiteVisible *q,*w;
+  q = (EntiteVisible*)a;
+  w = (EntiteVisible*)b;
+  return(q->Entite-w->Entite);
+}
+
+int EntiteEstElleVisible(int iEnt){
+  EntiteVisible e;
+  e.Entite = iEnt;
+  if(Tree_Query(EntitesVisibles,&e))
+    return e.Visible;
+  return 1;
+}
+
+void ToutesLesEntitesRelatives(int iEnt, Tree_T *Tree, int add_rem){
+  int i;
+  EntiteVisible e;
+
+  Surface *s;
+  Volume *v;
+  Curve *c;
+
+  if((c = FindCurve(iEnt,THEM))){
+  }
+  else if((s = FindSurface(iEnt,THEM))){
+    for(i=0;i<List_Nbr(s->s.Generatrices);i++){
+      List_Read(s->s.Generatrices,i,&c);
+      e.Entite = abs(c->Num);
+      e.Visible = add_rem;
+      Tree_Replace(Tree,&e);
+    }
+  }
+  else if((v = FindVolume(iEnt,THEM))){
+    for(i=0;i<List_Nbr(v->Surfaces);i++){
+      List_Read(v->Surfaces,i,&s);
+      e.Entite = abs(s->Num);
+      e.Visible = add_rem;
+      Tree_Replace(Tree,&e);
+    }
+  }
+
+  e.Entite = abs(iEnt);
+  e.Visible = add_rem;
+  Tree_Replace(Tree,&e);
+}
+
+void RemplirEntitesVisibles (int add_rem){
+  int i;
+  Volume *v;
+  Surface *s;
+  Curve *c;
+
+  List_T *ListVolumes = Tree2List (THEM->Volumes);
+  List_T *ListSurfaces = Tree2List (THEM->Surfaces);
+  List_T *ListCurves = Tree2List (THEM->Curves);
+  EntitesVisibles = Tree_Create(sizeof(EntiteVisible),compareEntiteVisible);
+  for(i=0;i<List_Nbr(ListVolumes);i++){
+    List_Read(ListVolumes,i,&v);
+    ToutesLesEntitesRelatives(v->Num,EntitesVisibles,add_rem);
+  }
+  for(i=0;i<List_Nbr(ListSurfaces);i++){
+    List_Read(ListSurfaces,i,&s);
+    ToutesLesEntitesRelatives(s->Num,EntitesVisibles,add_rem);
+  }
+  for(i=0;i<List_Nbr(ListCurves);i++){
+    List_Read(ListCurves,i,&c);
+    ToutesLesEntitesRelatives(c->Num,EntitesVisibles,add_rem);
+  }
+  List_Delete(ListVolumes);
+  List_Delete(ListSurfaces);
+  List_Delete(ListCurves);
+}
diff --git a/Geo/Visibility.h b/Geo/Visibility.h
new file mode 100644
index 0000000000..9be0d6db62
--- /dev/null
+++ b/Geo/Visibility.h
@@ -0,0 +1,11 @@
+#ifndef _VISIBILITY_H_
+#define _VISIBILITY_H_
+
+int EntiteEstElleVisible(int iEnt);
+void ToutesLesEntitesRelatives(int iEnt, Tree_T *Tree, int add_rem);
+void RemplirEntitesVisibles (int add_rem);
+
+extern Tree_T *EntitesVisibles;
+extern int     SHOW_ALL_ENTITIES;
+
+#endif
diff --git a/Graphics/CreateFile.h b/Graphics/CreateFile.h
new file mode 100644
index 0000000000..4cda9b838e
--- /dev/null
+++ b/Graphics/CreateFile.h
@@ -0,0 +1,6 @@
+#ifndef _CREATE_FILE_H_
+#define _CREATE_FILE_H_
+
+void CreateFile (char *name, int format) ;
+
+#endif
-- 
GitLab