diff --git a/Common/Options.cpp b/Common/Options.cpp
index 207e026fc7c5fe1d39a63814b1cc17cef5898442..4e827780d055e949a0cf5a396bfa1f5e5970a9e2 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.93 2002-11-16 08:29:14 geuzaine Exp $
+// $Id: Options.cpp,v 1.94 2002-11-16 21:53:23 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -39,27 +39,7 @@ extern Post_View  *Post_ViewReference;
 
 // General routines
 
-void Init_Options(int num){
-  char *tmp;
-
-  // Home directory
-#if !defined(WIN32) // Some WinNT systems have bad HOME variables...
-  if((tmp = getenv("HOME")))      strcpy(CTX.home_dir, tmp);
-  else 
-#endif
-  if((tmp = getenv("TMP")))       strcpy(CTX.home_dir, tmp);
-  else if((tmp = getenv("TEMP"))) strcpy(CTX.home_dir, tmp);
-  else                            strcpy(CTX.home_dir, "");
-  if(strlen(CTX.home_dir)){
-#if defined(WIN32) && !defined(__CYGWIN__)
-    strcat(CTX.home_dir, "\\");
-#else
-    strcat(CTX.home_dir, "/");
-#endif
-  }
-
-  // Reference view storing default options
-  Post_ViewReference = (Post_View*)Malloc(sizeof(Post_View)) ;
+void Init_Options_Safe(int num){
   Post_ViewReference->CT.size = 255;
   Post_ViewReference->CT.ipar[COLORTABLE_MODE] = COLORTABLE_RGB;
   ColorTable_InitParam(1, &Post_ViewReference->CT, 1, 1);
@@ -91,6 +71,31 @@ void Init_Options(int num){
   Set_DefaultColorOptions(num, PostProcessingOptions_Color, CTX.color_scheme);
   Set_DefaultColorOptions(num, ViewOptions_Color, CTX.color_scheme);
   Set_DefaultColorOptions(num, PrintOptions_Color, CTX.color_scheme);
+}
+
+void Init_Options(int num){
+  char *tmp;
+
+  // Home directory
+#if !defined(WIN32) // Some WinNT systems have bad HOME variables...
+  if((tmp = getenv("HOME")))      strcpy(CTX.home_dir, tmp);
+  else 
+#endif
+  if((tmp = getenv("TMP")))       strcpy(CTX.home_dir, tmp);
+  else if((tmp = getenv("TEMP"))) strcpy(CTX.home_dir, tmp);
+  else                            strcpy(CTX.home_dir, "");
+  if(strlen(CTX.home_dir)){
+#if defined(WIN32) && !defined(__CYGWIN__)
+    strcat(CTX.home_dir, "\\");
+#else
+    strcat(CTX.home_dir, "/");
+#endif
+  }
+
+  // Reference view storing default options
+  Post_ViewReference = (Post_View*)Malloc(sizeof(Post_View)) ;
+
+  Init_Options_Safe(num);
 
   // The following defaults cannot be set by the user 
   CTX.batch = 0 ;
@@ -119,6 +124,19 @@ void Init_Options(int num){
   CTX.mesh.check_duplicates = 0; //check for duplicate nodes in Read_Mesh
 }
 
+void ReInit_Options(int num){
+  List_T *l = CTX.post.list;
+  CTX.post.list=NULL; // horrible trick so that the opt_view_XXX will
+		      // act on the reference view
+  Init_Options_Safe(num);
+  CTX.post.list = l;
+
+  for(int i=0; i<List_Nbr(CTX.post.list) ; i++){
+    Post_View *v = (Post_View*)List_Pointer(CTX.post.list,i);
+    CopyViewOptions(Post_ViewReference, v);
+  }
+}
+
 void Init_Options_GUI(int num){
   Set_StringOptions_GUI(num, GeneralOptions_String);
   Set_StringOptions_GUI(num, GeometryOptions_String);
diff --git a/Common/Options.h b/Common/Options.h
index 86f5be71b402b7edc13a2fec22bfa07ff5c605da..39276cabc6ee6f7e2d44f9a6fa939fb7404f0005 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -536,6 +536,7 @@ typedef struct {
 
 void Init_Options (int num);
 void Init_Options_GUI (int num);
+void ReInit_Options (int num);
 void Print_Options(int num, int level, char *filename);
 
 StringXString * Get_StringOptionCategory(char * cat);
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index e515e290461926a19b8dc01301b3ff9c6962c4f4..d3ef2a54c9d3bab3afd41b6601982f1034e93138 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.151 2002-11-16 08:29:15 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.152 2002-11-16 21:53:24 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -126,8 +126,11 @@ int file_chooser_get_filter(){
 
 int AddViewInUI(int i, char *Name, int Num){
   if(i > NB_BUTT_MAX -1) return 1;
-  if(WID && (WID->get_context() == 3))
-    WID->set_context(menu_post,0);
+  if(WID){
+    if(WID->get_context() == 3)
+      WID->set_context(menu_post,0);
+    WID->reset_option_browser();
+  }
   return 0;
 }
 
@@ -596,16 +599,57 @@ void file_quit_cb(CALLBACK_ARGS) {
   Exit(0);
 }
 
-// Option General Menu
 
-void opt_general_cb(CALLBACK_ARGS) {
+// Option Menu
+
+void options_cb(CALLBACK_ARGS) {
+  WID->create_option_window();
+}
+
+void options_browser_cb(CALLBACK_ARGS) {
+  switch(WID->opt_browser->value()){
+  case 0 : break;
+  case 1 : WID->create_general_options_window(); break;
+  case 2 : WID->create_geometry_options_window(); break;
+  case 3 : WID->create_mesh_options_window(); break;
+  case 4 : WID->create_solver_options_window(); break;
+  case 5 : WID->create_post_options_window(); break;
+  default : WID->create_view_options_window(WID->opt_browser->value()-6); break;
+  }
+}
+
+void options_save_cb(CALLBACK_ARGS) {
+  Print_Options(0,GMSH_OPTIONSRC, CTX.optionsrc_filename); 
+}
+
+#include <unistd.h>
+void options_restore_defaults_cb(CALLBACK_ARGS) {
+  unlink(CTX.optionsrc_filename);
+  ReInit_Options(0);
+  Init_Options_GUI(0);
+  Draw();
+}
+
+void options_ok_cb(CALLBACK_ARGS) {
+  general_options_ok_cb(w,data);
+  geometry_options_ok_cb(w,data);
+  mesh_options_ok_cb(w,data);
+  solver_options_ok_cb(w,data);
+  post_options_ok_cb(w,data);
+  view_options_ok_cb(w, (void*)WID->view_number);
+  Draw();
+}
+
+// General options
+
+void general_options_cb(CALLBACK_ARGS) {
   WID->create_general_options_window();
 }
-void opt_general_color_scheme_cb(CALLBACK_ARGS){
+void general_options_color_scheme_cb(CALLBACK_ARGS){
   opt_general_color_scheme(0,GMSH_SET, WID->gen_value[0]->value());
   Draw();
 }
-void opt_general_ok_cb(CALLBACK_ARGS){
+void general_options_ok_cb(CALLBACK_ARGS){
   opt_general_axes(0, GMSH_SET, WID->gen_butt[0]->value());
   opt_general_small_axes(0, GMSH_SET, WID->gen_butt[1]->value());
   opt_general_fast_redraw(0, GMSH_SET, WID->gen_butt[2]->value());
@@ -638,20 +682,18 @@ void opt_general_ok_cb(CALLBACK_ARGS){
   opt_general_error_filename(0, GMSH_SET, (char*)WID->gen_input[2]->value());
   opt_general_options_filename(0, GMSH_SET, (char*)WID->gen_input[3]->value());
   opt_general_editor(0, GMSH_SET, (char*)WID->gen_input[4]->value());
-
-  Draw();
 }
 
-// Option Geometry Menu
+// Geometry options
 
-void opt_geometry_cb(CALLBACK_ARGS) {
+void geometry_options_cb(CALLBACK_ARGS) {
   WID->create_geometry_options_window();
 }
-void opt_geometry_color_scheme_cb(CALLBACK_ARGS){
+void geometry_options_color_scheme_cb(CALLBACK_ARGS){
   opt_geometry_color_scheme(0,GMSH_SET, WID->geo_value[2]->value());
   Draw();
 }
-void opt_geometry_ok_cb(CALLBACK_ARGS) {
+void geometry_options_ok_cb(CALLBACK_ARGS) {
   opt_geometry_points(0, GMSH_SET, WID->geo_butt[0]->value());
   opt_geometry_lines(0, GMSH_SET, WID->geo_butt[1]->value());
   opt_geometry_surfaces(0, GMSH_SET, WID->geo_butt[2]->value());
@@ -670,19 +712,18 @@ void opt_geometry_ok_cb(CALLBACK_ARGS) {
 
   opt_geometry_point_type(0, GMSH_SET, WID->geo_choice[0]->value());
   opt_geometry_line_type(0, GMSH_SET, WID->geo_choice[1]->value());
-  Draw();
 }
 
-// Option Mesh Menu
+// Mesh options
 
-void opt_mesh_cb(CALLBACK_ARGS) {
+void mesh_options_cb(CALLBACK_ARGS) {
   WID->create_mesh_options_window();
 }
-void opt_mesh_color_scheme_cb(CALLBACK_ARGS){
+void mesh_options_color_scheme_cb(CALLBACK_ARGS){
   opt_mesh_color_scheme(0,GMSH_SET, WID->mesh_value[12]->value());
   Draw();
 }
-void opt_mesh_ok_cb(CALLBACK_ARGS) {
+void mesh_options_ok_cb(CALLBACK_ARGS) {
   opt_mesh_algo(0, GMSH_SET, 
 		WID->mesh_butt[0]->value()?DELAUNAY_ISO:
 		WID->mesh_butt[1]->value()?DELAUNAY_SHEWCHUK:
@@ -720,24 +761,22 @@ void opt_mesh_ok_cb(CALLBACK_ARGS) {
 
   opt_mesh_point_type(0, GMSH_SET, WID->mesh_choice[0]->value());
   opt_mesh_line_type(0, GMSH_SET, WID->mesh_choice[1]->value());
-
-  Draw();
 }
 
-// Option Solver Menu
+// Solver options
 
-void opt_solver_cb(CALLBACK_ARGS) {
+void solver_options_cb(CALLBACK_ARGS) {
   WID->create_solver_options_window();
 }
-void opt_solver_ok_cb(CALLBACK_ARGS) {
+void solver_options_ok_cb(CALLBACK_ARGS) {
 }
 
-// Option Post Menu
+// Post options
 
-void opt_post_cb(CALLBACK_ARGS) {
+void post_options_cb(CALLBACK_ARGS) {
   WID->create_post_options_window();
 }
-void opt_post_ok_cb(CALLBACK_ARGS) {
+void post_options_ok_cb(CALLBACK_ARGS) {
   opt_post_link(0, GMSH_SET, 
 		WID->post_butt[0]->value()?0:
 		WID->post_butt[1]->value()?1:
@@ -748,18 +787,17 @@ void opt_post_ok_cb(CALLBACK_ARGS) {
   opt_post_anim_cycle(0, GMSH_SET, WID->post_butt[6]->value());
 
   opt_post_anim_delay(0, GMSH_SET, WID->post_value[0]->value());
-  Draw();
 }
 
-// Option Statistics Menu
+// Statistics Menu
 
-void opt_statistics_cb(CALLBACK_ARGS) {
+void statistics_cb(CALLBACK_ARGS) {
   WID->create_statistics_window();
 }
-void opt_statistics_update_cb(CALLBACK_ARGS) {
+void statistics_update_cb(CALLBACK_ARGS) {
   WID->set_statistics();
 }
-void opt_statistics_histogram_cb(CALLBACK_ARGS) {
+void statistics_histogram_cb(CALLBACK_ARGS) {
   int i, type=(long int)data;
 
   Print_Histogram(THEM->Histogram[type]);
@@ -778,12 +816,12 @@ void opt_statistics_histogram_cb(CALLBACK_ARGS) {
   Draw(); 
 }
 
-// Option Messages Menu
+// Messages Menu
 
-void opt_message_cb(CALLBACK_ARGS) {
+void message_cb(CALLBACK_ARGS) {
   WID->create_message_window();
 }
-void opt_message_copy_cb(CALLBACK_ARGS) {
+void message_copy_cb(CALLBACK_ARGS) {
 #if (FL_MAJOR_VERSION == 1) && (FL_MINOR_VERSION == 0)
   // Fl::copy does not exist in older versions of fltk
 #else
@@ -805,10 +843,10 @@ void opt_message_copy_cb(CALLBACK_ARGS) {
   Fl::copy(buff, strlen(buff), 0);
 #endif
 }
-void opt_message_clear_cb(CALLBACK_ARGS) {
+void message_clear_cb(CALLBACK_ARGS) {
   WID->msg_browser->clear();
 }
-void opt_message_save_cb(CALLBACK_ARGS) {
+void message_save_cb(CALLBACK_ARGS) {
  test:
   if(file_chooser(0,"Save messages", "*", 0)){
     char *name = file_chooser_get_name(1);
@@ -824,18 +862,15 @@ void opt_message_save_cb(CALLBACK_ARGS) {
     WID->save_message(name); 
   }
 }
-void opt_save_cb(CALLBACK_ARGS) {
-  Print_Options(0,GMSH_OPTIONSRC, CTX.optionsrc_filename); 
-}
 
 // Option Visibility Menu
 
 #if (FL_MAJOR_VERSION == 2) // disabled for fltk 2 at the moment
 void select_vis_browser(int mode){}
-void opt_visibility_cb(CALLBACK_ARGS) {}
-void opt_visibility_ok_cb(CALLBACK_ARGS) {}
-void opt_visibility_sort_cb(CALLBACK_ARGS){}
-void opt_visibility_number_cb(CALLBACK_ARGS){}
+void visibility_cb(CALLBACK_ARGS) {}
+void visibility_ok_cb(CALLBACK_ARGS) {}
+void visibility_sort_cb(CALLBACK_ARGS){}
+void visibility_number_cb(CALLBACK_ARGS){}
 #else
 void select_vis_browser(int mode){
   int i;
@@ -849,7 +884,7 @@ void select_vis_browser(int mode){
   }
 }
 
-void opt_visibility_cb(CALLBACK_ARGS) {
+void visibility_cb(CALLBACK_ARGS) {
   int i, type, mode;
   List_T *list;
   Entity *e;
@@ -876,7 +911,7 @@ void opt_visibility_cb(CALLBACK_ARGS) {
   select_vis_browser(mode);
 }
 
-void opt_visibility_ok_cb(CALLBACK_ARGS) {
+void visibility_ok_cb(CALLBACK_ARGS) {
   int i, mode;
   Entity *e;
 
@@ -925,7 +960,7 @@ void opt_visibility_ok_cb(CALLBACK_ARGS) {
   Draw();
 }
 
-void opt_visibility_sort_cb(CALLBACK_ARGS){
+void visibility_sort_cb(CALLBACK_ARGS){
   int i, val = (long int)data, selectall;
 
   if(!val){
@@ -943,11 +978,11 @@ void opt_visibility_sort_cb(CALLBACK_ARGS){
   }
   else{
     SetVisibilitySort(val);
-    opt_visibility_cb(NULL,NULL);
+    visibility_cb(NULL,NULL);
   }
 }
 
-void opt_visibility_number_cb(CALLBACK_ARGS){
+void visibility_number_cb(CALLBACK_ARGS){
   int pos, mode, type = WID->vis_input_mode->value();
   char *str = (char*)((Fl_Input*)w)->value(); 
 
@@ -959,7 +994,7 @@ void opt_visibility_number_cb(CALLBACK_ARGS){
 
   SetVisibilityByNumber(str, type, mode);
   pos = WID->vis_browser->position();
-  opt_visibility_cb(NULL,NULL);
+  visibility_cb(NULL,NULL);
   WID->vis_browser->position(pos);
 
   Draw();
@@ -2521,8 +2556,6 @@ void view_options_ok_cb(CALLBACK_ARGS){
     if(WID->view_choice[i]) WID->view_choice[i]->clear_changed();
     WID->view_colorbar_window->clear_changed();
   }
-
-  Draw();
 }
 
 // Contextual windows for geometry
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index ee2415ee1f64e80d5ae441d24a59693d443a0029..cf7ba2f1efe6804d0f247f5918c520b0c82c48cb 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -66,55 +66,75 @@ void file_save_as_ppm_cb(CALLBACK_ARGS) ;
 void file_save_as_yuv_cb(CALLBACK_ARGS) ;
 void file_quit_cb(CALLBACK_ARGS) ;
 
-// Option General Menu
+// Option Menu
 
-void opt_general_cb(CALLBACK_ARGS) ;
-void opt_general_color_scheme_cb(CALLBACK_ARGS) ;
-void opt_general_ok_cb(CALLBACK_ARGS) ;
+void options_cb(CALLBACK_ARGS) ;
+void options_browser_cb(CALLBACK_ARGS) ;
+void options_save_cb(CALLBACK_ARGS) ;
+void options_restore_defaults_cb(CALLBACK_ARGS) ;
+void options_ok_cb(CALLBACK_ARGS) ;
 
-// Option Geometry Menu
+void general_options_cb(CALLBACK_ARGS) ;
+void general_options_color_scheme_cb(CALLBACK_ARGS) ;
+void general_options_ok_cb(CALLBACK_ARGS) ;
 
-void opt_geometry_cb(CALLBACK_ARGS) ;
-void opt_geometry_color_scheme_cb(CALLBACK_ARGS) ;
-void opt_geometry_ok_cb(CALLBACK_ARGS) ;
+void geometry_options_cb(CALLBACK_ARGS) ;
+void geometry_options_color_scheme_cb(CALLBACK_ARGS) ;
+void geometry_options_ok_cb(CALLBACK_ARGS) ;
 
-// Option Mesh Menu
+void mesh_options_cb(CALLBACK_ARGS) ;
+void mesh_options_color_scheme_cb(CALLBACK_ARGS) ;
+void mesh_options_ok_cb(CALLBACK_ARGS) ;
 
-void opt_mesh_cb(CALLBACK_ARGS) ;
-void opt_mesh_color_scheme_cb(CALLBACK_ARGS) ;
-void opt_mesh_ok_cb(CALLBACK_ARGS) ;
+void solver_options_cb(CALLBACK_ARGS) ;
+void solver_options_ok_cb(CALLBACK_ARGS) ;
 
-// Option Solver Menu
+void post_options_cb(CALLBACK_ARGS) ;
+void post_options_ok_cb(CALLBACK_ARGS) ;
 
-void opt_solver_cb(CALLBACK_ARGS) ;
-void opt_solver_ok_cb(CALLBACK_ARGS) ;
-
-// Option Post Menu
-
-void opt_post_cb(CALLBACK_ARGS) ;
-void opt_post_ok_cb(CALLBACK_ARGS) ;
-
-// Option Statistics Menu
+void view_toggle_cb(CALLBACK_ARGS) ;
+void view_reload_cb(CALLBACK_ARGS) ;
+void view_reload_all_cb(CALLBACK_ARGS) ;
+void view_reload_visible_cb(CALLBACK_ARGS) ;
+void view_remove_cb(CALLBACK_ARGS) ;
+void view_remove_all_cb(CALLBACK_ARGS) ;
+void view_remove_visible_cb(CALLBACK_ARGS) ;
+void view_remove_invisible_cb(CALLBACK_ARGS) ;
+void view_save_ascii_cb(CALLBACK_ARGS) ;
+void view_save_binary_cb(CALLBACK_ARGS) ;
+void view_duplicate_cb(CALLBACK_ARGS) ;
+void view_duplicate_with_options_cb(CALLBACK_ARGS) ;
+void view_merge_all_cb(CALLBACK_ARGS) ;
+void view_merge_visible_cb(CALLBACK_ARGS) ;
+void view_applybgmesh_cb(CALLBACK_ARGS) ;
+void view_options_cb(CALLBACK_ARGS) ;
+void view_plugin_cb(CALLBACK_ARGS) ;
+void view_options_plugin_cb(CALLBACK_ARGS) ;
+void view_options_custom_cb(CALLBACK_ARGS) ;
+void view_options_timestep_cb(CALLBACK_ARGS) ;
+void view_options_timestep_decr_cb(CALLBACK_ARGS);
+void view_options_timestep_incr_cb(CALLBACK_ARGS);
+void view_options_ok_cb(CALLBACK_ARGS) ;
 
-void opt_statistics_cb(CALLBACK_ARGS) ;
-void opt_statistics_update_cb(CALLBACK_ARGS) ;
-void opt_statistics_histogram_cb(CALLBACK_ARGS) ;
+// Statistics Menu
 
-// Option Message Menu
+void statistics_cb(CALLBACK_ARGS) ;
+void statistics_update_cb(CALLBACK_ARGS) ;
+void statistics_histogram_cb(CALLBACK_ARGS) ;
 
-void opt_message_cb(CALLBACK_ARGS) ;
-void opt_message_copy_cb(CALLBACK_ARGS) ;
-void opt_message_clear_cb(CALLBACK_ARGS) ;
-void opt_message_save_cb(CALLBACK_ARGS) ;
+// Message Menu
 
-// Option Visibility Menu
+void message_cb(CALLBACK_ARGS) ;
+void message_copy_cb(CALLBACK_ARGS) ;
+void message_clear_cb(CALLBACK_ARGS) ;
+void message_save_cb(CALLBACK_ARGS) ;
 
-void opt_visibility_cb(CALLBACK_ARGS) ;
-void opt_visibility_sort_cb(CALLBACK_ARGS) ;
-void opt_visibility_number_cb(CALLBACK_ARGS);
-void opt_visibility_ok_cb(CALLBACK_ARGS) ;
+// Visibility Menu
 
-void opt_save_cb(CALLBACK_ARGS) ;
+void visibility_cb(CALLBACK_ARGS) ;
+void visibility_sort_cb(CALLBACK_ARGS) ;
+void visibility_number_cb(CALLBACK_ARGS);
+void visibility_ok_cb(CALLBACK_ARGS) ;
 
 // Help Menu
 
@@ -237,31 +257,5 @@ void solver_kill_cb(CALLBACK_ARGS);
 void solver_choose_executable_cb(CALLBACK_ARGS);
 void solver_ok_cb(CALLBACK_ARGS);
 
-// Dynamic post menus
-
-void view_toggle_cb(CALLBACK_ARGS) ;
-void view_reload_cb(CALLBACK_ARGS) ;
-void view_reload_all_cb(CALLBACK_ARGS) ;
-void view_reload_visible_cb(CALLBACK_ARGS) ;
-void view_remove_cb(CALLBACK_ARGS) ;
-void view_remove_all_cb(CALLBACK_ARGS) ;
-void view_remove_visible_cb(CALLBACK_ARGS) ;
-void view_remove_invisible_cb(CALLBACK_ARGS) ;
-void view_save_ascii_cb(CALLBACK_ARGS) ;
-void view_save_binary_cb(CALLBACK_ARGS) ;
-void view_duplicate_cb(CALLBACK_ARGS) ;
-void view_duplicate_with_options_cb(CALLBACK_ARGS) ;
-void view_merge_all_cb(CALLBACK_ARGS) ;
-void view_merge_visible_cb(CALLBACK_ARGS) ;
-void view_applybgmesh_cb(CALLBACK_ARGS) ;
-void view_options_cb(CALLBACK_ARGS) ;
-void view_plugin_cb(CALLBACK_ARGS) ;
-void view_options_plugin_cb(CALLBACK_ARGS) ;
-void view_options_custom_cb(CALLBACK_ARGS) ;
-void view_options_timestep_cb(CALLBACK_ARGS) ;
-void view_options_timestep_decr_cb(CALLBACK_ARGS);
-void view_options_timestep_incr_cb(CALLBACK_ARGS);
-void view_options_ok_cb(CALLBACK_ARGS) ;
-
 #endif
 
diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp
index 498190f2ec83a164b325aa29b20198fc08711bb6..879fbe4f26eb85e4f764d74e7855389bae2c447d 100644
--- a/Fltk/Colorbar_Window.cpp
+++ b/Fltk/Colorbar_Window.cpp
@@ -1,4 +1,4 @@
-// $Id: Colorbar_Window.cpp,v 1.27 2002-08-28 21:40:06 geuzaine Exp $
+// $Id: Colorbar_Window.cpp,v 1.28 2002-11-16 21:53:24 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -281,7 +281,7 @@ void Colorbar_Window::redraw_range(int a, int b){
      fl_draw("Ctrl+mouse1", xx0,yy0+(i+1)*font_height); 
      fl_draw(    "draw alpha channel", xx1,yy0+(i+1)*font_height); i++;
      fl_draw("c, p, r", xx0,yy0+(i+1)*font_height); 
-     fl_draw(    "copy, paste or reset current colormap", xx1,yy0+(i+1)*font_height); i++;
+     fl_draw(    "copy, paste or reset colormap", xx1,yy0+(i+1)*font_height); i++;
      fl_draw("m", xx0,yy0+(i+1)*font_height); 
      fl_draw(    "toggle RGB/HSV mode", xx1,yy0+(i+1)*font_height); i++;
      fl_draw("left, right", xx0,yy0+(i+1)*font_height); 
@@ -289,7 +289,7 @@ void Colorbar_Window::redraw_range(int a, int b){
      fl_draw("up, down", xx0,yy0+(i+1)*font_height); 
      fl_draw(    "modify color curvature", xx1,yy0+(i+1)*font_height); i++;
      fl_draw("Ctrl+up, Ctrl+down", xx0,yy0+(i+1)*font_height); 
-     fl_draw(    "increase or decrease alpha channel", xx1,yy0+(i+1)*font_height); i++;
+     fl_draw(    "incr. or decr. alpha channel", xx1,yy0+(i+1)*font_height); i++;
      fl_draw("i, Ctrl+i", xx0,yy0+(i+1)*font_height); 
      fl_draw(    "invert x or y range", xx1,yy0+(i+1)*font_height); i++;
      fl_draw("b, Ctrl+b", xx0,yy0+(i+1)*font_height); 
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index f9fcbca69b901fdeeb6cfd2e88a847b6672b5cb0..fafd5b0adc138ccefe99622bb101d3e600ac361b 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.213 2002-11-16 08:29:15 geuzaine Exp $
+// $Id: GUI.cpp,v 1.214 2002-11-16 21:53:24 geuzaine Exp $
 //
 // Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
 //
@@ -116,18 +116,14 @@ Fl_Menu_Item m_menubar_table[] = {
 #else
     {"Save as...",       FL_CTRL+FL_SHIFT+'s', (Fl_Callback *)file_save_as_cb, 0, FL_MENU_DIVIDER},
 #endif
-    {"Visibility...",    FL_SHIFT+'v', (Fl_Callback *)opt_visibility_cb, 0},
-    {"Messages...",      FL_SHIFT+'l', (Fl_Callback *)opt_message_cb, 0},
-    {"Statistics...",    FL_SHIFT+'i', (Fl_Callback *)opt_statistics_cb, 0, FL_MENU_DIVIDER},
     {"Quit",             FL_CTRL+'q', (Fl_Callback *)file_quit_cb, 0},
     {0},
-  {"Options",0,0,0,FL_SUBMENU},
-    {"General...",         FL_SHIFT+'o', (Fl_Callback *)opt_general_cb, 0, FL_MENU_DIVIDER},
-    {"Geometry...",        FL_SHIFT+'g', (Fl_Callback *)opt_geometry_cb, 0},
-    {"Mesh...",            FL_SHIFT+'m', (Fl_Callback *)opt_mesh_cb, 0},
-    {"Solver...",          FL_SHIFT+'s', (Fl_Callback *)opt_solver_cb, 0},
-    {"Post-processing...", FL_SHIFT+'p', (Fl_Callback *)opt_post_cb, 0, FL_MENU_DIVIDER},
-    {"Save options now",   0,            (Fl_Callback *)opt_save_cb, 0},
+
+  {"Tools",0,0,0,FL_SUBMENU},
+    {"Options...",       FL_SHIFT+'o', (Fl_Callback *)options_cb, 0},
+    {"Visibility...",    FL_SHIFT+'v', (Fl_Callback *)visibility_cb, 0},
+    {"Statistics...",    FL_SHIFT+'i', (Fl_Callback *)statistics_cb, 0, FL_MENU_DIVIDER},
+    {"Message console...",       FL_SHIFT+'l', (Fl_Callback *)message_cb, 0},
     {0},
   {"Help",0,0,0,FL_SUBMENU},
     {"Current options...",       0, (Fl_Callback *)status_xyz1p_cb, (void*)4},
@@ -419,6 +415,26 @@ int GUI::global_shortcuts(int event){
     quit_selection = 1;
     return 1;
   }
+  else if(Fl::test_shortcut(FL_SHIFT+'n')){
+    general_options_cb(0,0);
+    return 1;
+  }
+  else if(Fl::test_shortcut(FL_SHIFT+'g')){
+    geometry_options_cb(0,0);
+    return 1;
+  }
+  else if(Fl::test_shortcut(FL_SHIFT+'m')){
+    mesh_options_cb(0,0);
+    return 1;
+  }
+  else if(Fl::test_shortcut(FL_SHIFT+'s')){
+    solver_options_cb(0,0);
+    return 1;
+  }
+  else if(Fl::test_shortcut(FL_SHIFT+'p')){
+    post_options_cb(0,0);
+    return 1;
+  }
   else if(Fl::test_shortcut(FL_CTRL+FL_SHIFT+'d')){
     opt_post_anim_delay(0,GMSH_SET|GMSH_GUI,opt_post_anim_delay(0,GMSH_GET,0) + 0.01);
     return 1;
@@ -596,16 +612,11 @@ GUI::GUI(int argc, char **argv) {
   // initialize static windows
   m_window = NULL;
   g_window = NULL;
-  gen_window = NULL;
-  geo_window = NULL;
-  mesh_window = NULL;
-  solver_window = NULL;
-  post_window = NULL;
+  opt_window = NULL;
   stat_window = NULL;
   msg_window = NULL;
   vis_window = NULL;
   about_window = NULL;
-  view_window = NULL;
   context_geometry_window = NULL;
   context_mesh_window = NULL;
 
@@ -651,12 +662,7 @@ GUI::GUI(int argc, char **argv) {
   m_window->show(1, argv);
   g_window->show(1, argv);
 
-  create_general_options_window();
-  create_geometry_options_window();
-  create_mesh_options_window();
-  create_solver_options_window();
-  create_post_options_window();
-  create_view_options_window(-1);
+  create_option_window();
   create_message_window();
   create_visibility_window();
   create_about_window();
@@ -1132,27 +1138,128 @@ void GUI::redraw_overlay(){
   g_opengl_window->redraw_overlay();
 }
 
-// Create the window for general options
+// Create the option window
+
+void GUI::hide_option_subwindows(){
+  gen_window->hide();
+  geo_window->hide();
+  mesh_window->hide();
+  solver_window->hide();
+  post_window->hide();
+  view_window->hide();
+}
 
 void GUI::create_general_options_window(){
+  create_option_window();
+  hide_option_subwindows();
+  gen_window->show();
+  opt_browser->value(1);
+}
+
+void GUI::create_geometry_options_window(){
+  create_option_window();
+  hide_option_subwindows();
+  geo_window->show();
+  opt_browser->value(2);
+}
+ 
+void GUI::create_mesh_options_window(){
+  create_option_window();
+  hide_option_subwindows();
+  mesh_window->show();
+  opt_browser->value(3);
+}
+
+void GUI::create_solver_options_window(){
+  create_option_window();
+  hide_option_subwindows();
+  solver_window->show();
+  opt_browser->value(4);
+}
+
+void GUI::create_post_options_window(){
+  create_option_window();
+  hide_option_subwindows();
+  post_window->show();
+  opt_browser->value(5);
+}
+
+void GUI::create_view_options_window(int num){
+  create_option_window();
+  hide_option_subwindows();
+  update_view_window(num);
+  view_window->show();
+  opt_browser->value(6+num);
+}
+
+void GUI::reset_option_browser(){
+  int i, select;
+  char str[128];
+  select = opt_browser->value();
+  opt_browser->clear();
+  opt_browser->add("General");
+  opt_browser->add("Geometry");
+  opt_browser->add("Mesh");
+  opt_browser->add("Solver");
+  opt_browser->add("Post-processing");
+  for(i = 0 ; i < List_Nbr(CTX.post.list) ; i++) {
+    if(i == NB_BUTT_MAX) break;
+    Post_View *v = (Post_View*)List_Pointer(CTX.post.list,i);
+    sprintf(str, "View %d (%s)", i, v->Name);
+    opt_browser->add(str);
+  }
+  if(select<=opt_browser->size())
+    opt_browser->value(select);
+}
+
+void GUI::create_option_window(){
   int i;
-  
-  if(gen_window){
-    gen_window->show();
+  int width = 40*CTX.fontsize;
+  int height = 13*BH ;
+  int BROWSERW = 110;
+
+  if(opt_window){
+    opt_window->show();
     return;
   }
-    
-  int width = 25*CTX.fontsize;
-  int height = 5*WB+12*BH ;
-  int BW = width-4*WB;
+
+  opt_window = new Fl_Window(width,height);
+  opt_window->box(WINDOW_BOX);
+  opt_window->label("Options");
+
+  // Buttons
   
-  gen_window = new Fl_Window(width,height);
-  gen_window->box(WINDOW_BOX);
-  gen_window->label("General options");
   { 
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+    Fl_Return_Button* o = new Fl_Return_Button(width-3*BB-3*WB, height-BH-WB, BB, BH, "Apply");
+    o->callback(options_ok_cb);
+  }
+  { 
+    Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Save");
+    o->callback(options_save_cb);
+  }
+  { 
+    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
+    o->callback(cancel_cb, (void*)opt_window);
+  }
+  
+  // Selection browser
+
+  opt_browser = new Fl_Hold_Browser(WB,WB,BROWSERW-WB,height-3*WB-BH);
+  reset_option_browser();
+  opt_browser->callback(options_browser_cb);
+  opt_browser->value(1);
+
+  width -= BROWSERW;
+  int BW = width-4*WB;
+  height -= WB+BH;
+
+  // General options
+
+  gen_window = new Fl_Window(BROWSERW,0,width,height,"General options");
+  { 
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-2*WB);
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Display");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Display");
       gen_butt[0] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Show moving axes");
       gen_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW, BH, "Show small axes");
       gen_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW, BH, "Enable fast redraw");
@@ -1174,7 +1281,7 @@ void GUI::create_general_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Output");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Output");
       gen_butt[7] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Print messages on terminal");
       gen_butt[8] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW, BH, "Save session information on exit");
       gen_butt[9] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW, BH, "Save options on exit");
@@ -1189,7 +1296,6 @@ void GUI::create_general_options_window(){
       gen_butt[14]->down_box(TOGGLE_BOX);
       gen_butt[14]->selection_color(TOGGLE_COLOR);
 
-
       gen_value[5] = new Fl_Value_Input(2*WB, 2*WB+5*BH, IW, BH, "Message verbosity");
       gen_value[5]->minimum(0); 
       gen_value[5]->maximum(10); 
@@ -1203,10 +1309,14 @@ void GUI::create_general_options_window(){
       for(i=0 ; i<5 ; i++){
 	gen_input[i]->align(FL_ALIGN_RIGHT);
       }
+
+      Fl_Button* b0 = new Fl_Button(width-2*BB-2*WB, 2*WB+9*BH, 2*BB, BH, "Restore default options");
+      b0->callback(options_restore_defaults_cb);
+
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Aspect");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Aspect");
       o->hide();
       gen_butt[10] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Orthographic projection");
       gen_butt[11] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW, BH, "Perspective projection");
@@ -1229,16 +1339,16 @@ void GUI::create_general_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Colors");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Colors");
       o->hide();
       gen_value[0] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Predefined color scheme");
       gen_value[0]->minimum(0); 
       gen_value[0]->maximum(2); 
       gen_value[0]->step(1);
       gen_value[0]->align(FL_ALIGN_RIGHT);
-      gen_value[0]->callback(opt_general_color_scheme_cb);
+      gen_value[0]->callback(general_options_color_scheme_cb);
       
-      Fl_Scroll* s = new Fl_Scroll(2*WB, 3*WB+2*BH, IW+20, height-3*WB-4*BH);
+      Fl_Scroll* s = new Fl_Scroll(2*WB, 3*WB+2*BH, IW+20, height-5*WB-2*BH);
       i = 0;
       while(GeneralOptions_Color[i].str){
 	gen_col[i] = new Fl_Button(2*WB, 3*WB+(2+i)*BH, IW, BH, GeneralOptions_Color[i].str);
@@ -1249,7 +1359,7 @@ void GUI::create_general_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Light");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Light");
       o->hide();
       gen_value[1] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Material shininess");
       gen_value[1]->minimum(0); 
@@ -1278,44 +1388,16 @@ void GUI::create_general_options_window(){
     }
     o->end();
   }
-  
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
-    o->callback(opt_general_ok_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)gen_window);
-  }
-  
-  if(CTX.center_windows)
-    gen_window->position(m_window->x()+m_window->w()/2-width/2,
-			 m_window->y()+9*BH-height/2);
   gen_window->end();
-  
-}
-
-// Create the window for geometry options
 
-void GUI::create_geometry_options_window(){
-  int i;
-  
-  if(geo_window){
-    geo_window->show();
-    return;
-  }
+  // Geometry options
     
-  int width = 25*CTX.fontsize;
-  int height = 5*WB+10*BH ;
-  int BW = width-4*WB;
-  
-  geo_window = new Fl_Window(width,height);
-  geo_window->box(WINDOW_BOX);
-  geo_window->label("Geometry options");
+  geo_window = new Fl_Window(BROWSERW,0,width,height,"Geometry options");
+  geo_window->hide();
   { 
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-2*WB);
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "General");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "General");
       o->hide();
       geo_butt[8] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Auto coherence (suppress duplicates)");
       geo_butt[8]->type(FL_TOGGLE_BUTTON);
@@ -1324,7 +1406,7 @@ void GUI::create_geometry_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Visibility");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Visibility");
       geo_butt[0] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW/2-WB, BH, "Points");
       geo_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW/2-WB, BH, "Curves");
       geo_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW/2-WB, BH, "Surfaces");
@@ -1353,7 +1435,7 @@ void GUI::create_geometry_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Aspect");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Aspect");
       o->hide();
       geo_value[3] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Point size");
       geo_value[3]->minimum(0.1);
@@ -1384,16 +1466,16 @@ void GUI::create_geometry_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Colors");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Colors");
       o->hide();
       geo_value[2] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Predefined color scheme");
       geo_value[2]->minimum(0); 
       geo_value[2]->maximum(2); 
       geo_value[2]->step(1);
       geo_value[2]->align(FL_ALIGN_RIGHT);
-      geo_value[2]->callback(opt_geometry_color_scheme_cb);
+      geo_value[2]->callback(geometry_options_color_scheme_cb);
       
-      Fl_Scroll* s = new Fl_Scroll(2*WB, 3*WB+2*BH, IW+20, height-3*WB-4*BH);
+      Fl_Scroll* s = new Fl_Scroll(2*WB, 3*WB+2*BH, IW+20, height-5*WB-2*BH);
       i = 0;
       while(GeometryOptions_Color[i].str){
 	geo_col[i] = new Fl_Button(2*WB, 3*WB+(2+i)*BH, IW, BH, GeometryOptions_Color[i].str);
@@ -1405,44 +1487,16 @@ void GUI::create_geometry_options_window(){
     }
     o->end();
   }
-  
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
-    o->callback(opt_geometry_ok_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)geo_window);
-  }
-  
-  if(CTX.center_windows)
-    geo_window->position(m_window->x()+m_window->w()/2-width/2,
-			 m_window->y()+9*BH-height/2);
   geo_window->end();
-  
-}
 
-// Create the window for mesh options
-
-void GUI::create_mesh_options_window(){
-  int i;
-  
-  if(mesh_window){
-    mesh_window->show();
-    return;
-  }
-    
-  int width = 25*CTX.fontsize;
-  int height = 5*WB+10*BH ;
-  int BW = width-4*WB;
+  // Mesh options
   
-  mesh_window = new Fl_Window(width,height);
-  mesh_window->box(WINDOW_BOX);
-  mesh_window->label("Mesh options");
+  mesh_window = new Fl_Window(BROWSERW,0,width,height,"Mesh options");
+  mesh_window->hide();
   { 
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-2*WB);
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "General");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "General");
       o->hide();
       
       mesh_value[0] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Number of smoothing steps");
@@ -1479,7 +1533,7 @@ void GUI::create_mesh_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "2D");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "2D");
       o->hide();
       
       mesh_butt[0] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Old isotropic algorithm");
@@ -1498,7 +1552,7 @@ void GUI::create_mesh_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Visibility");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Visibility");
       mesh_butt[6] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW/2-WB, BH, "Points");
       mesh_butt[7] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW/2-WB, BH, "Lines");
       mesh_butt[8] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW/2-WB, BH, "Surfaces");
@@ -1541,7 +1595,7 @@ void GUI::create_mesh_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Aspect");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Aspect");
       o->hide();
       mesh_butt[14] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Wireframe");
       mesh_butt[15] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW, BH, "Hidden lines");
@@ -1578,7 +1632,7 @@ void GUI::create_mesh_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Colors");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Colors");
       o->hide();
       mesh_butt[17] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Switch color by entity");
       mesh_butt[17]->type(FL_TOGGLE_BUTTON);
@@ -1590,9 +1644,9 @@ void GUI::create_mesh_options_window(){
       mesh_value[12]->maximum(2); 
       mesh_value[12]->step(1);
       mesh_value[12]->align(FL_ALIGN_RIGHT);
-      mesh_value[12]->callback(opt_mesh_color_scheme_cb);
+      mesh_value[12]->callback(mesh_options_color_scheme_cb);
       
-      Fl_Scroll* s = new Fl_Scroll(2*WB, 3*WB+3*BH, IW+20, height-3*WB-5*BH);
+      Fl_Scroll* s = new Fl_Scroll(2*WB, 3*WB+3*BH, IW+20, height-5*WB-3*BH);
       i = 0;
       while(MeshOptions_Color[i].str){
 	mesh_col[i] = new Fl_Button(2*WB, 3*WB+(3+i)*BH, IW, BH, MeshOptions_Color[i].str);
@@ -1604,97 +1658,36 @@ void GUI::create_mesh_options_window(){
     }
     o->end();
   }
-  
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
-    o->callback(opt_mesh_ok_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)mesh_window);
-  }
-  
-  if(CTX.center_windows)
-    mesh_window->position(m_window->x()+m_window->w()/2-width/2,
-			  m_window->y()+9*BH-height/2);
   mesh_window->end();
-  
-}
-
-// Create the window for solver options
-
-void GUI::create_solver_options_window(){
 
-  if(solver_window){
-    solver_window->show();
-    return;
-  }
-
-  int width = 20*CTX.fontsize;
-  int height = 5*WB+8*BH ;
+  // Solver options
 
-  solver_window = new Fl_Window(width,height);
-  solver_window->box(WINDOW_BOX);
-  solver_window->label("Solver options");
+  solver_window = new Fl_Window(BROWSERW,0,width,height,"Solver options");
+  solver_window->hide();
   { 
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-2*WB);
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Solvers");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Solver");
 
       Fl_Box *text =  new Fl_Box(FL_NO_BOX, 2*WB, 3*WB+1*BH, width-4*WB, 2*BH,
 				 "There are no global solver options available yet.\n\n"
 				 "To define your own solver interface, edit the option file.");
       text->align(FL_ALIGN_LEFT|FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
-      /*
-	int BW = width-4*WB;
-	solver_butt[0] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Use Unix sockets");
-	solver_butt[0]->type(FL_TOGGLE_BUTTON);
-	solver_butt[0]->down_box(TOGGLE_BOX);
-	solver_butt[0]->selection_color(TOGGLE_COLOR);
-      */
       o->end();
     }
     o->end();
   }
   
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
-    o->callback(opt_solver_ok_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)solver_window);
-  }
-  
-  if(CTX.center_windows)
-    solver_window->position(m_window->x()+m_window->w()/2-width/2,
-			    m_window->y()+9*BH-height/2);
   solver_window->end();
   
-}
+  // Post-processing options
 
-
-// Create the window for post-processing options
-
-void GUI::create_post_options_window(){
-  int i;
-
-  if(post_window){
-    post_window->show();
-    return;
-  }
-
-  int width = 25*CTX.fontsize;
-  int height = 5*WB+10*BH ;
-  int BW = width-4*WB;
-  
-  post_window = new Fl_Window(width,height);
-  post_window->box(WINDOW_BOX);
-  post_window->label("Post-processing options");
+  post_window = new Fl_Window(BROWSERW,0,width,height,"Post-processing options");
+  post_window->hide();
   { 
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-2*WB);
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Views");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Views");
       post_butt[0] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Independent views");
       post_butt[1] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW, BH, "Apply next changes to all visible views");
       post_butt[2] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW, BH, "Apply next changes to all views");
@@ -1705,15 +1698,17 @@ void GUI::create_post_options_window(){
 	post_butt[i]->down_box(RADIO_BOX);
 	post_butt[i]->selection_color(RADIO_COLOR);
       }
+      /*
       Fl_Box *text =  new Fl_Box(FL_NO_BOX, 2*WB, 3*WB+6*BH, width-4*WB, 2*BH,
 				 "Individual view options are available "
 				 "by clicking on the arrow next to each "
 				 "view button in the post-processing menu");
       text->align(FL_ALIGN_LEFT|FL_ALIGN_TOP|FL_ALIGN_INSIDE|FL_ALIGN_WRAP);
+      */
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Smoothing");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Smoothing");
       post_butt[5] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW, BH, "Smooth views during merge");
       post_butt[5]->type(FL_TOGGLE_BUTTON);
       post_butt[5]->down_box(TOGGLE_BOX);
@@ -1721,7 +1716,7 @@ void GUI::create_post_options_window(){
       o->end();
     }
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Animation");
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Animation");
       o->hide();
       post_value[0] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Delay");
       post_value[0]->minimum(0);
@@ -1738,1039 +1733,995 @@ void GUI::create_post_options_window(){
     o->end();
   }
   
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
-    o->callback(opt_post_ok_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)post_window);
-  }
-  
-  if(CTX.center_windows)
-    post_window->position(m_window->x()+m_window->w()/2-width/2,
-			  m_window->y()+9*BH-height/2);
   post_window->end();
-  
-}
 
-// Create the window for the statistics
-
-void GUI::create_statistics_window(){
-  int i, num=0;
+  // View options
 
-  if(stat_window){
-    if(!stat_window->shown()) set_statistics();
-    stat_window->show();
-    return;
+  // WARNING! Don't forget to add the set_changed_cb() callback to any new widget!
+  // initialise all buttons to NULL (see the clear_changed() in view_options_ok_cb)
+  for(i=0; i<VIEW_OPT_BUTT; i++){
+    view_butt[i] = NULL;
+    view_value[i] = NULL;
+    view_input[i] = NULL;
+    view_choice[i] = NULL;
   }
-
-  int width = 26*CTX.fontsize;
-  int height = 5*WB+17*BH ;
+  view_number = -1 ;
   
-  stat_window = new Fl_Window(width,height);
-  stat_window->box(WINDOW_BOX);
-  stat_window->label("Statistics");
-  {
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
-    { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Geometry");
-      o->hide();
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+1*BH, IW, BH, "Points");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+2*BH, IW, BH, "Curves");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+3*BH, IW, BH, "Surfaces");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+4*BH, IW, BH, "Volumes");
-      o->end();
-    }
+  view_window = new Fl_Window(BROWSERW,0,width,height,"View options");
+  view_window->hide();
+  { 
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-2*WB);
+    // General
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Mesh");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+1*BH, IW, BH, "Nodes on curves");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+2*BH, IW, BH, "Nodes on surfaces");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+3*BH, IW, BH, "Nodes in volumes");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+4*BH, IW, BH, "Triangles");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+5*BH, IW, BH, "Quadrangles");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+6*BH, IW, BH, "Tetrahedra");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+7*BH, IW, BH, "Hexahedra");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+8*BH, IW, BH, "Prisms");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+9*BH, IW, BH, "Pyramids");
-      
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+10*BH, IW, BH, "Time for 1D mesh");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+11*BH, IW, BH, "Time for 2D mesh");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+12*BH, IW, BH, "Time for 3D mesh");
+      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "General");
       
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+13*BH, IW, BH, "Gamma factor");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+14*BH, IW, BH, "Eta factor");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+15*BH, IW, BH, "Rho factor");
+      view_butt[1] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW/2-WB, BH, "3D view");
+      view_butt[2] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW/2-WB, BH, "2D space table");
+      view_butt[3] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW/2-WB, BH, "2D time table");
+      for(i=1 ; i<=3 ; i++){
+	view_butt[i]->type(FL_RADIO_BUTTON);
+	view_butt[i]->down_box(RADIO_BOX);
+	view_butt[i]->selection_color(RADIO_COLOR);
+	view_butt[i]->callback(set_changed_cb, 0);
+      }
       
-      Fl_Button* b0 = new Fl_Button(width-BB-2*WB, 2*WB+13*BH, BB, BH, "Graph");
-      b0->callback(opt_statistics_histogram_cb, (void*)0);
-      Fl_Button* b1 = new Fl_Button(width-BB-2*WB, 2*WB+14*BH, BB, BH, "Graph");
-      b1->callback(opt_statistics_histogram_cb, (void*)1);
-      Fl_Button* b2 = new Fl_Button(width-BB-2*WB, 2*WB+15*BH, BB, BH, "Graph");
-      b2->callback(opt_statistics_histogram_cb, (void*)2);
+      view_input[0] = new Fl_Input(2*WB, 2*WB+4*BH, IW, BH, "Name");
+      view_input[1] = new Fl_Input(2*WB, 2*WB+5*BH, IW, BH, "Format");
+      for(i=0 ; i<=1 ; i++){
+	view_input[i]->align(FL_ALIGN_RIGHT);
+	view_input[i]->callback(set_changed_cb, 0);
+      }
+
+      int sw=(int)(1.5*CTX.fontsize);
+      view_butt_rep[0] = new Fl_Repeat_Button(2*WB, 2*WB+6*BH, sw, BH, "-");
+      //no set_changed since has its own callback
+      view_butt_rep[1] = new Fl_Repeat_Button(2*WB+IW-sw, 2*WB+6*BH, sw, BH, "+");
+      //no set_changed since has its own callback
+      view_value[50] = new Fl_Value_Input(2*WB+sw, 2*WB+6*BH, IW-2*sw, BH);
+      view_value[50]->align(FL_ALIGN_RIGHT);
+      view_value[50]->minimum(0); 
+      view_value[50]->maximum(0); 
+      view_value[50]->step(1);
+      //no set_changed since has its own callback
+      Fl_Box *a = new Fl_Box(2*WB+IW, 2*WB+6*BH, IW/2, BH, "Step");
+      a->box(FL_NO_BOX);
+      a->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+
+      view_value[20] = new Fl_Value_Input(2*WB, 2*WB+7*BH, IW/2, BH);
+      view_value[21] = new Fl_Value_Input(2*WB+IW/2, 2*WB+7*BH, IW/2, BH, "Position");
+      view_value[22] = new Fl_Value_Input(2*WB, 2*WB+8*BH, IW/2, BH);
+      view_value[23] = new Fl_Value_Input(2*WB+IW/2, 2*WB+8*BH, IW/2, BH, "Size");
+      for(i=20 ; i<=23 ; i++){
+	view_value[i]->align(FL_ALIGN_RIGHT);
+	view_value[i]->callback(set_changed_cb, 0);
+      }
+
+      view_butt[8] = new Fl_Check_Button(width/2, 2*WB+1*BH, BW/2-WB, BH, "Show time");
+      view_butt[5] = new Fl_Check_Button(width/2, 2*WB+2*BH, BW/2-WB, BH, "Show annotations");
+      view_butt[4] = new Fl_Check_Button(width/2, 2*WB+3*BH, BW/2-WB, BH, "Show scale");
+      view_butt[6] = new Fl_Check_Button(width/2, 2*WB+4*BH, BW/2-WB, BH, "Transparent scale");
+      view_butt[7] = new Fl_Check_Button(width/2, 2*WB+5*BH, BW/2-WB, BH, "Auto position");
+      for(i=4 ; i<=8 ; i++){
+	view_butt[i]->type(FL_TOGGLE_BUTTON);
+	view_butt[i]->down_box(TOGGLE_BOX);
+	view_butt[i]->selection_color(TOGGLE_COLOR);
+	view_butt[i]->callback(set_changed_cb, 0);
+      }
       
       o->end();
     }
+    // 3D
     { 
-      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Post-processing");
-      o->hide();
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+1*BH, IW, BH, "Views");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+2*BH, IW, BH, "Visible points");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+3*BH, IW, BH, "Visible lines");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+4*BH, IW, BH, "Visible triangles");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+5*BH, IW, BH, "Visible quadrangles");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+6*BH, IW, BH, "Visible tetrahedra");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+7*BH, IW, BH, "Visible hexahedra");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+8*BH, IW, BH, "Visible prisms");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+9*BH, IW, BH, "Visible pyramids");
-      stat_value[num++] = new Fl_Output(2*WB, 2*WB+10*BH, IW, BH, "Visible strings");
-      o->end();
+      view_3d = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "3D");
+      view_3d->hide();
+      
+      view_butt[10] = new Fl_Check_Button(width/2, 2*WB+1*BH, BW/2-WB, BH, "Show elements");
+      view_butt[11] = new Fl_Check_Button(width/2, 2*WB+2*BH, BW/2-WB, BH, "Enable lighting");
+      view_butt[12] = new Fl_Check_Button(width/2, 2*WB+3*BH, BW/2-WB, BH, "Smooth normals");	
+      for(i=10 ; i<=12 ; i++){
+	view_butt[i]->type(FL_TOGGLE_BUTTON);
+	view_butt[i]->down_box(TOGGLE_BOX);
+	view_butt[i]->selection_color(TOGGLE_COLOR);
+	view_butt[i]->callback(set_changed_cb, 0);
+      }
+      view_value[10] = new Fl_Value_Input(width/2, 2*WB+4*BH, IW, BH, "Angle");
+      view_value[10]->minimum(0.); 
+      view_value[10]->step(1.); 
+      view_value[10]->maximum(180.); 
+      view_value[11] = new Fl_Value_Input(width/2, 2*WB+5*BH, IW, BH, "Boundary");
+      view_value[11]->minimum(0); 
+      view_value[11]->step(1); 
+      view_value[11]->maximum(3); 
+      view_value[12] = new Fl_Value_Input(width/2, 2*WB+6*BH, IW, BH, "Explode");
+      view_value[12]->minimum(0.); 
+      view_value[12]->step(0.01); 
+      view_value[12]->maximum(1.); 
+      for(i=10 ; i<=12 ; i++){
+	view_value[i]->align(FL_ALIGN_RIGHT);
+	view_value[i]->callback(set_changed_cb, 0);
+      }
+      
+      view_butt[13] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW/2-WB, BH, "Show points");
+      view_butt[14] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW/2-WB, BH, "Show lines");
+      view_butt[15] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW/2-WB, BH, "Show triangles");
+      view_butt[16] = new Fl_Check_Button(2*WB, 2*WB+4*BH, BW/2-WB, BH, "Show quadrangles");
+      view_butt[17] = new Fl_Check_Button(2*WB, 2*WB+5*BH, BW/2-WB, BH, "Show tetrahedra");
+      view_butt[18] = new Fl_Check_Button(2*WB, 2*WB+6*BH, BW/2-WB, BH, "Show hexahedra");
+      view_butt[19] = new Fl_Check_Button(2*WB, 2*WB+7*BH, BW/2-WB, BH, "Show prisms");
+      view_butt[20] = new Fl_Check_Button(2*WB, 2*WB+8*BH, BW/2-WB, BH, "Show pyramids");
+      view_butt[21] = new Fl_Check_Button(width/2, 2*WB+7*BH, BW/2-WB, BH, "Show scalar values");
+      view_butt[22] = new Fl_Check_Button(width/2, 2*WB+8*BH, BW/2-WB, BH, "Show vector values");
+      view_butt[23] = new Fl_Check_Button(width/2, 2*WB+9*BH, BW/2-WB, BH, "Show tensor values");
+      for(i=13 ; i<=23 ; i++){
+	view_butt[i]->type(FL_TOGGLE_BUTTON);
+	view_butt[i]->down_box(TOGGLE_BOX);
+	view_butt[i]->selection_color(TOGGLE_COLOR);
+	view_butt[i]->callback(set_changed_cb, 0);
+      }
+      
+      view_3d->end();
     }
-    o->end();
-  }
-  
-  for(i=0 ; i<num ; i++){
-    stat_value[i]->align(FL_ALIGN_RIGHT);
-    stat_value[i]->value(0);
-  }
-  
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Update");
-    o->callback(opt_statistics_update_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)stat_window);
-  }
-  
-  if(CTX.center_windows)
-    stat_window->position(m_window->x()+m_window->w()/2-width/2,
-			  m_window->y()+9*BH-height/2);
-  stat_window->end();
+    // 2D
+    { 
+      view_2d = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "2D");
+      view_2d->hide();
+      
+      view_input[2] = new Fl_Input(2*WB, 2*WB+1*BH, IW, BH, "Abscissa name");
+      view_input[2]->align(FL_ALIGN_RIGHT);
+      view_input[2]->callback(set_changed_cb, 0);
 
-  stat_window->show();
-  set_statistics();
-  stat_window->redraw();
+      view_input[3] = new Fl_Input(2*WB, 2*WB+2*BH, IW, BH, "Abscissa format");
+      view_input[3]->align(FL_ALIGN_RIGHT);
+      view_input[3]->callback(set_changed_cb, 0);
+      
+      view_value[25] = new Fl_Value_Input(2*WB, 2*WB+ 3*BH, IW, BH, "Abscissa points");
+      view_value[25]->minimum(0.); 
+      view_value[25]->step(1); 
+      view_value[25]->maximum(256); 
+      view_value[26] = new Fl_Value_Input(2*WB, 2*WB+ 4*BH, IW, BH, "Grid mode");
+      view_value[26]->minimum(0.); 
+      view_value[26]->step(1); 
+      view_value[26]->maximum(3); 
+      for(i=25 ; i<=26 ; i++){
+	view_value[i]->align(FL_ALIGN_RIGHT);
+	view_value[i]->callback(set_changed_cb, 0);
+      }
+      
+      view_2d->end();
+    }
+    // Range
+    { 
+      view_range = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Range");
+      view_range->hide();
+      
+      view_value[30] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Intervals");
+      view_value[30]->align(FL_ALIGN_RIGHT);
+      view_value[30]->minimum(1); 
+      view_value[30]->maximum(256); 
+      view_value[30]->step(1);
+      view_value[30]->callback(set_changed_cb, 0);
 
-}
+      static Fl_Menu_Item menu_iso[] = {
+	{"Iso-values",        0, 0, 0},
+	{"Filled iso-values", 0, 0, 0},
+	{"Continuous map",    0, 0, 0},
+	{"Numeric values",    0, 0, 0},
+	{0}
+      };
+      view_choice[0] = new Fl_Choice(2*WB, 2*WB+2*BH, IW, BH, "Intervals type");
+      view_choice[0]->menu(menu_iso);
+      view_choice[0]->align(FL_ALIGN_RIGHT);
+      view_choice[0]->callback(set_changed_cb, 0);
 
-void GUI::set_statistics(){
+      view_butt[34] = new Fl_Check_Button(2*WB, 2*WB+3*BH, IW, BH, "Custom range");
+      view_butt[34]->type(FL_TOGGLE_BUTTON);
+      view_butt[34]->down_box(TOGGLE_BOX);
+      view_butt[34]->selection_color(TOGGLE_COLOR);
+      //no set_changed since customrange has its own callback
+      
+      view_value[31] = new Fl_Value_Input(2*WB, 2*WB+4*BH, IW, BH, "Minimum");
+      view_value[32] = new Fl_Value_Input(2*WB, 2*WB+5*BH, IW, BH, "Maximum");
+      for(i=31 ; i<=32 ; i++){
+	view_value[i]->align(FL_ALIGN_RIGHT);
+	view_value[i]->callback(set_changed_cb, 0);
+      }
 
-  int i,num=0;
-  static double  s[50], p[20];
-  static char    label[50][256];
+      static Fl_Menu_Item menu_scale[] = {
+	{"Linear",             0, 0, 0},
+	{"Logarithmic",        0, 0, 0},
+	{"Double logarithmic", 0, 0, 0},
+	{0}
+      };
+      view_choice[1] = new Fl_Choice(2*WB, 2*WB+6*BH, IW, BH, "Scale");
+      view_choice[1]->menu(menu_scale);
+      view_choice[1]->align(FL_ALIGN_RIGHT);
+      view_choice[1]->callback(set_changed_cb, 0);
+      
+      view_butt[38] = new Fl_Check_Button(2*WB, 2*WB+7*BH, IW, BH, "Saturate values");
+      view_butt[38]->type(FL_TOGGLE_BUTTON);
+      view_butt[38]->down_box(TOGGLE_BOX);
+      view_butt[38]->selection_color(TOGGLE_COLOR);
+      view_butt[38]->callback(set_changed_cb, 0);
+      
+      view_range->end();
+    }
+    // Offset and Raise
+    { 
+      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Offset");
+      o->hide();
+      view_value[40] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "X offset");
+      view_value[41] = new Fl_Value_Input(2*WB, 2*WB+2*BH, IW, BH, "Y offset");
+      view_value[42] = new Fl_Value_Input(2*WB, 2*WB+3*BH, IW, BH, "Z offset");
+      view_value[43] = new Fl_Value_Input(width/2, 2*WB+1*BH, IW, BH, "X raise");
+      view_value[44] = new Fl_Value_Input(width/2, 2*WB+2*BH, IW, BH, "Y raise");
+      view_value[45] = new Fl_Value_Input(width/2, 2*WB+3*BH, IW, BH, "Z raise");
+      for(i=40 ; i<=45 ; i++){
+	view_value[i]->align(FL_ALIGN_RIGHT);
+	view_value[i]->callback(set_changed_cb, 0);
+      }	
+      o->end();
+    }
+    // Aspect
+    { 
+      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB-BH, "Aspect");
+      o->hide();
+      
+      view_value[61] = new Fl_Value_Input(2*WB, 2*WB+ 1*BH, IW, BH, "Point size");
+      view_value[61]->minimum(0.1); 
+      view_value[61]->maximum(50);
+      view_value[61]->step(0.1);
+      view_value[61]->align(FL_ALIGN_RIGHT);
+      view_value[61]->callback(set_changed_cb, 0);
 
-  GetStatistics(s);
+      view_choice[5] = new Fl_Choice(2*WB, 2*WB+ 2*BH, IW, BH, "Point display");
+      view_choice[5]->menu(menu_point_display);
+      view_choice[5]->align(FL_ALIGN_RIGHT);
+      view_choice[5]->callback(set_changed_cb, 0);
+      
+      view_value[62] = new Fl_Value_Input(2*WB, 2*WB+ 3*BH, IW, BH, "Line width");
+      view_value[62]->minimum(0.1); 
+      view_value[62]->maximum(50);
+      view_value[62]->step(0.1);
+      view_value[62]->align(FL_ALIGN_RIGHT);
+      view_value[62]->callback(set_changed_cb, 0);
 
-  // geom
-  sprintf(label[num], "%g", s[0]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[1]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[2]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[3]); stat_value[num]->value(label[num]); num++;
+      view_choice[6] = new Fl_Choice(2*WB, 2*WB+ 4*BH, IW, BH, "Line display");
+      view_choice[6]->menu(menu_line_display);
+      view_choice[6]->align(FL_ALIGN_RIGHT);
+      view_choice[6]->callback(set_changed_cb, 0);
 
-  // mesh
-  sprintf(label[num], "%g", s[4]);  stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[5]);  stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[6]);  stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[7]-s[8]); 
-                                    stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[8]);  stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[9]);  stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[10]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[11]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[12]); stat_value[num]->value(label[num]); num++;
+      {
+	view_vector = new Fl_Group(2*WB, 2*WB+ 4*BH, width/2, 5*BH, 0);
 
-  sprintf(label[num], "%g", s[13]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[14]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g", s[15]); stat_value[num]->value(label[num]); num++;
+	view_value[60] = new Fl_Value_Input(2*WB, 2*WB+5*BH, IW, BH, "Vector size");
+	view_value[60]->minimum(0); 
+	view_value[60]->align(FL_ALIGN_RIGHT);
+	view_value[60]->callback(set_changed_cb, 0);
 
-  sprintf(label[num], "%.4g (%.4g->%.4g)", s[17], s[19], s[18]); 
-                                    stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%.4g (%.4g->%.4g)", s[20], s[22], s[21]); 
-                                    stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%.4g (%.4g->%.4g)", s[23], s[25], s[24]);
-                                    stat_value[num]->value(label[num]); num++;
+	static Fl_Menu_Item menu_vectype[] = {
+	  {"Line",         0, 0, 0},
+	  {"Arrow",        0, 0, 0},
+	  {"Pyramid",      0, 0, 0},
+	  {"Cone",         0, 0, 0},
+	  {"Displacement", 0, 0, 0},
+	  {0}
+	};
+	view_choice[2] = new Fl_Choice(2*WB, 2*WB+6*BH, IW, BH, "Vector display");
+	view_choice[2]->menu(menu_vectype);
+	view_choice[2]->align(FL_ALIGN_RIGHT);
+	view_choice[2]->callback(set_changed_cb, 0);
 
-  // post
-  p[0] = List_Nbr(CTX.post.list) ;
-  sprintf(label[num], "%g", p[0]); stat_value[num]->value(label[num]); num++;
-  p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7] = p[8] = p[9] = 0 ;
-  p[10] = p[11] = p[12] = p[13] = p[14] = p[15] = p[16] = p[17] = p[18] = 0 ;
-  for(i=0 ; i<List_Nbr(CTX.post.list) ; i++){
-    Post_View *v = (Post_View*)List_Pointer(CTX.post.list, i);
-    p[1] += v->NbSP + v->NbVP + v->NbTP;
-    p[2] += v->NbSL + v->NbVL + v->NbTL;
-    p[3] += v->NbST + v->NbVT + v->NbTT;
-    p[4] += v->NbSQ + v->NbVQ + v->NbTQ;
-    p[5] += v->NbSS + v->NbVS + v->NbTS;
-    p[6] += v->NbSH + v->NbVH + v->NbTH;
-    p[7] += v->NbSI + v->NbVI + v->NbTI;
-    p[8] += v->NbSY + v->NbVY + v->NbTY;
-    p[9] += v->NbT2 + v->NbT3;
-    if(v->Visible){
-      if(v->DrawPoints)	p[10] += (v->DrawScalars ? v->NbSP : 0) + 
-			         (v->DrawVectors ? v->NbVP : 0) + 
-			         (v->DrawTensors ? v->NbTP : 0) ;
-      if(v->DrawLines) p[11] += (v->DrawScalars ? v->NbSL : 0) + 
-			        (v->DrawVectors ? v->NbVL : 0) + 
-			        (v->DrawTensors ? v->NbTL : 0) ;
-      if(v->DrawTriangles) p[12] += (v->DrawScalars ? v->NbST : 0) + 
-			            (v->DrawVectors ? v->NbVT : 0) + 
-			            (v->DrawTensors ? v->NbTT : 0) ;
-      if(v->DrawQuadrangles) p[13] += (v->DrawScalars ? v->NbSQ : 0) + 
-			              (v->DrawVectors ? v->NbVQ : 0) + 
-			              (v->DrawTensors ? v->NbTQ : 0) ;
-      if(v->DrawTetrahedra) p[14] += (v->DrawScalars ? v->NbSS : 0) + 
-			             (v->DrawVectors ? v->NbVS : 0) + 
-   			             (v->DrawTensors ? v->NbTS : 0) ;
-      if(v->DrawHexahedra) p[15] += (v->DrawScalars ? v->NbSH : 0) + 
-			            (v->DrawVectors ? v->NbVH : 0) + 
-   			            (v->DrawTensors ? v->NbTH : 0) ;
-      if(v->DrawPrisms) p[16] += (v->DrawScalars ? v->NbSI : 0) + 
-			         (v->DrawVectors ? v->NbVI : 0) + 
-   			         (v->DrawTensors ? v->NbTI : 0) ;
-      if(v->DrawPyramids) p[17] += (v->DrawScalars ? v->NbSY : 0) + 
-			           (v->DrawVectors ? v->NbVY : 0) + 
-   			           (v->DrawTensors ? v->NbTY : 0) ;
-      if(v->DrawStrings) p[18] += v->NbT2 + v->NbT3 ;
-    }
-  }
-  sprintf(label[num], "%g/%g", p[10],p[1]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[11],p[2]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[12],p[3]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[13],p[4]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[14],p[5]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[15],p[6]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[16],p[7]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[17],p[8]); stat_value[num]->value(label[num]); num++;
-  sprintf(label[num], "%g/%g", p[18],p[9]); stat_value[num]->value(label[num]); num++;
-}
-
-
-// Create the window for the plugins
-
-void GUI::add_multiline_in_browser(Fl_Browser *o, char* prefix, char *str){
-  int start = 0, len;
-  char *buff;
-  if(!str || !strlen(str) || !strcmp(str, "\n")){
-    o->add("");
-    return;
-  }
-  for(unsigned int i=0 ; i<strlen(str) ; i++){
-    if(i==strlen(str)-1 || str[i]=='\n'){
-      len = i-start+(str[i]=='\n'?0:1);
-      buff = new char[len+strlen(prefix)+2];
-      strcpy(buff, prefix);
-      strncat(buff, &str[start], len);
-      buff[len+strlen(prefix)]='\0';
-      o->add(buff);
-      start = i+1;
-    }
-  }
-}
-
-PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p){
-  char buffer[1024],namep[1024],copyright[256],author[256],help[1024];
-
-  // get plugin info
-
-  int n = p->getNbOptions();
-  p->getName(namep);
-  p->getInfos(author,copyright,help);
-
-  // create window
-
-  int width = 20*CTX.fontsize;
-  int height = ((n>5?n:5)+2)*BH + 5*WB;
-
-  PluginDialogBox *pdb = new PluginDialogBox;
-  pdb->main_window = new Fl_Window(width,height);
-  pdb->main_window->box(WINDOW_BOX);
-  sprintf(buffer,"%s Plugin",namep);
-  char *nbuffer = new char[strlen(buffer)+1];
-  strcpy(nbuffer,buffer);
-  pdb->main_window->label(nbuffer);
-
-  { 
-    Fl_Tabs *o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-1*BH);
-    { 
-      Fl_Group *g = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Options");
+	static Fl_Menu_Item menu_vecloc[] = {
+	  {"Cell centered",   0, 0, 0},
+	  {"Vertex centered", 0, 0, 0},
+	  {0}
+	};
+	view_choice[3] = new Fl_Choice(2*WB, 2*WB+7*BH, IW, BH, "Vector location");
+	view_choice[3]->menu(menu_vecloc);
+	view_choice[3]->align(FL_ALIGN_RIGHT);
+	view_choice[3]->callback(set_changed_cb, 0);
 
-      if(n > 20)Msg(GERROR, "Plugin has too many parameters");
-      
-      for(int i=0;i<n;i++){
-	StringXNumber *sxn;
-	sxn = p->GetOption(i);
-	pdb->view_value[i] = new Fl_Value_Input(2*WB, 2*WB+(i+1)*BH, IW, BH, sxn->str);
-	pdb->view_value[i]->align(FL_ALIGN_RIGHT);
-	pdb->view_value[i]->value(sxn->def);
+	static Fl_Menu_Item menu_tensor[] = {
+	  {"Von-Mises",    0, 0, 0},
+	  {"Eigenvectors", 0, 0, 0},
+	  {0}
+	};
+	view_choice[4] = new Fl_Choice(2*WB, 2*WB+8*BH, IW, BH, "Tensor display");
+	view_choice[4]->menu(menu_tensor);
+	view_choice[4]->align(FL_ALIGN_RIGHT);
+	view_choice[4]->callback(set_changed_cb, 0);
+	
+	view_vector->end();
       }
-
-      g->end();
+      
+      o->end();
     }
+    // Colors
     { 
-      Fl_Group *g = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "About");
-
-      Fl_Browser *o = new Fl_Browser(2*WB, 2*WB+1*BH, width-4*WB, height-5*WB-2*BH);
-
-      o->add("");
-      add_multiline_in_browser(o, "@c@b@.", namep);
-      o->add("");
-      add_multiline_in_browser(o, "", help);
-      o->add("");
-      add_multiline_in_browser(o, "Author(s): ", author);
-      add_multiline_in_browser(o, "Copyright: ", copyright);
-      
-      g->end();
+      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-2*WB, "Colors");
+      o->hide();
+      view_colorbar_window = new Colorbar_Window(2*WB, 2*WB+BH, width-4*WB, height-4*WB-BH);
+      view_colorbar_window->end();
+      //no set_changed since colorbarwindow has its own callbacks
+      o->end();
     }
     o->end();
   }
-
-  pdb->run_button = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Run");
-
-  Fl_Button* cancel = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-  cancel->callback(cancel_cb, (void*)pdb->main_window);
-
-  pdb->main_window->resizable(new Fl_Box(2*WB,2*WB+BH,10,10));
+  
+  view_window->end();
+  
 
   if(CTX.center_windows)
-    pdb->main_window->position(m_window->x()+m_window->w()/2-width/2,
-			       m_window->y()+9*BH-height/2);
-
-  pdb->main_window->end();  
-
-  return pdb;
+    opt_window->position(m_window->x()+m_window->w()/2-(width+BROWSERW)/2,
+			 m_window->y()+9*BH-height/2);
+  opt_window->end();
 }
 
-// Create the window for the messages
+void GUI::update_view_window(int num){
+  int i;
+  double val;
 
-void GUI::create_message_window(){
+  view_number = num ;
+  Post_View *v = (Post_View*)List_Pointer(CTX.post.list, num);
 
-  if(msg_window){
-    if(msg_window->shown())
-      msg_window->redraw();
-    else
-      msg_window->show();
-    return;
-  }
-  
-  int width = CTX.msg_size[0];
-  int height = CTX.msg_size[1];
-  
-  msg_window = new Fl_Window(width,height);
-  msg_window->box(WINDOW_BOX);
-  msg_window->label("Messages");
-  
-  msg_browser = new Fl_Browser(WB, WB, width-2*WB, height-3*WB-BH);
-  msg_browser->textfont(FL_COURIER);
-  msg_browser->type(FL_MULTI_BROWSER);
-  msg_browser->callback(opt_message_copy_cb);
-  
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-3*BB-3*WB, height-BH-WB, BB, BH, "Save");
-    o->callback(opt_message_save_cb);
-  }
-  { 
-    Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Clear");
-    o->callback(opt_message_clear_cb);
+  // general
+  opt_view_name(num, GMSH_GUI, NULL);
+  opt_view_format(num, GMSH_GUI, NULL);
+  opt_view_type(num, GMSH_GUI, 0);
+  opt_view_show_scale(num, GMSH_GUI, 0);
+  opt_view_draw_strings(num, GMSH_GUI, 0);
+  opt_view_transparent_scale(num, GMSH_GUI, 0);
+  opt_view_auto_position(num, GMSH_GUI, 0);
+  if(v->NbSP){
+    view_butt[2]->activate();
+    view_butt[3]->activate();
   }
-  { 
-    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)msg_window);
+  else{
+    view_butt[2]->deactivate();
+    view_butt[3]->deactivate();
   }
-  
-  msg_window->resizable(new Fl_Box(WB,WB, 100,10));
-  msg_window->size_range(WB+100 + 3*BB+4*WB,100);
-  
-  msg_window->position(CTX.msg_position[0], CTX.msg_position[1]);
-  msg_window->end();
-  
-}
-
-void GUI::add_message(char *msg){
-  for(int i=0 ; i<(int)strlen(msg) ; i++) if(msg[i]=='\n') msg[i] = ' ';
-  msg_browser->add(msg,0);
-  msg_browser->bottomline(msg_browser->size());
-}
-
-void GUI::save_message(char *filename){
-  FILE *fp;
+  opt_view_position0(num, GMSH_GUI, 0);
+  opt_view_position1(num, GMSH_GUI, 0);
+  opt_view_size0(num, GMSH_GUI, 0);
+  opt_view_size1(num, GMSH_GUI, 0);
 
-  if(!(fp = fopen(filename,"w"))) {
-    Msg(GERROR, "Unable to open file '%s'", filename); 
-    return;
+  //3D
+  if(v->TextOnly){
+    view_3d->deactivate();
+    view_range->deactivate();
+    view_butt[1]->deactivate();
   }
-  for(int i = 1 ; i<=msg_browser->size() ; i++){
-    const char *c=msg_browser->text(i);
-    if(c[0]=='@') fprintf(fp, "%s\n", &c[3]);
-    else fprintf(fp, "%s\n", c);
+  else{
+    view_3d->activate();
+    view_range->activate();
+    view_butt[1]->activate();
   }
+  opt_view_show_element(num, GMSH_GUI, 0);
+  opt_view_light(num, GMSH_GUI, 0);
+  opt_view_smooth_normals(num, GMSH_GUI, 0);
+  opt_view_angle_smooth_normals(num, GMSH_GUI, 0);
+  opt_view_boundary(num, GMSH_GUI, 0);
+  opt_view_explode(num, GMSH_GUI, 0);
+  opt_view_draw_points(num, GMSH_GUI, 0);
+  opt_view_draw_lines(num, GMSH_GUI, 0);
+  opt_view_draw_triangles(num, GMSH_GUI, 0);
+  opt_view_draw_quadrangles(num, GMSH_GUI, 0);
+  opt_view_draw_tetrahedra(num, GMSH_GUI, 0);
+  opt_view_draw_hexahedra(num, GMSH_GUI, 0);
+  opt_view_draw_prisms(num, GMSH_GUI, 0);
+  opt_view_draw_pyramids(num, GMSH_GUI, 0);
+  opt_view_draw_scalars(num, GMSH_GUI, 0);
+  opt_view_draw_vectors(num, GMSH_GUI, 0);
+  opt_view_draw_tensors(num, GMSH_GUI, 0);
 
-  Msg(INFO, "Log creation complete '%s'", filename);
-  Msg(STATUS2, "Wrote '%s'", filename);
-  fclose(fp);
-}
-
-void GUI::fatal_error(char *filename){
-  fl_alert("A fatal error has occurred, which will force Gmsh to exit "
-	   "(all messages have been saved in the error log file '%s')", filename);
-}
-
-// Create the visibility window
+  //2D
+  if(v->NbSP)
+    view_2d->activate();
+  else
+    view_2d->deactivate();
+  opt_view_abscissa_name(num, GMSH_GUI, NULL);
+  opt_view_abscissa_format(num, GMSH_GUI, NULL);
+  opt_view_nb_abscissa(num, GMSH_GUI, 0);
+  opt_view_grid(num, GMSH_GUI, 0);
 
-void GUI::reset_visibility(){
-  if(vis_window){
-    vis_browser->clear();
-    if(vis_window->shown()) 
-      opt_visibility_cb(NULL,NULL);
+  // range
+  opt_view_nb_iso(num, GMSH_GUI, 0);
+  opt_view_intervals_type(num, GMSH_GUI, 0);
+  opt_view_range_type(num, GMSH_GUI, 0);
+  view_butt[34]->callback(view_options_custom_cb, (void*)num);
+  view_options_custom_cb(0,0);
+  view_butt[34]->clear_changed();
+  opt_view_custom_min(num, GMSH_GUI, 0);
+  opt_view_custom_max(num, GMSH_GUI, 0);
+  for(i=31 ; i<=32 ; i++){
+    view_value[i]->minimum(v->CustomMin); 
+    view_value[i]->maximum(v->CustomMax); 
   }
-}
-
-void GUI::create_visibility_window(){
+  opt_view_scale_type(num, GMSH_GUI, 0);
+  opt_view_saturate_values(num, GMSH_GUI, 0);
 
-  if(vis_window){
-    vis_window->show();
-    return;
+  // offset/raise
+  opt_view_offset0(num, GMSH_GUI, 0);
+  opt_view_offset1(num, GMSH_GUI, 0);
+  opt_view_offset2(num, GMSH_GUI, 0);
+  opt_view_raise0(num, GMSH_GUI, 0);
+  opt_view_raise1(num, GMSH_GUI, 0);
+  opt_view_raise2(num, GMSH_GUI, 0);
+  val = 10.*CTX.lc ;
+  for(i=40 ; i<=45 ; i++){
+    view_value[i]->step(val,1000); 
+    view_value[i]->minimum(-val); 
+    view_value[i]->maximum(val); 
   }
 
-  static int cols[5] = {15,95,95,180,0};  
-  static Fl_Menu_Item type_table[] = {
-    {"Elementary",  0, (Fl_Callback *)opt_visibility_cb},
-    {"Physical",    0, (Fl_Callback *)opt_visibility_cb},
-    {0}
-  };
-  static Fl_Menu_Item browser_mode_table[] = {
-    {"Geometry+Mesh",  0, (Fl_Callback *)opt_visibility_cb},
-    {"Geometry",       0, (Fl_Callback *)opt_visibility_cb},
-    {"Mesh",           0, (Fl_Callback *)opt_visibility_cb},
-    {0}
-  };
-  static Fl_Menu_Item input_mode_table[] = {
-    {"Node",     0, 0},
-    {"Element",  0, 0},
-    {"Point",    0, 0},
-    {"Curve",    0, 0},
-    {"Surface",  0, 0},
-    {"Volume",   0, 0},
-    {0}
-  };
-
-  int width = cols[0]+cols[1]+cols[2]+cols[3]+2*WB;
-  int height = 15*BH ;
-  
-  vis_window = new Fl_Window(width,height);
-  vis_window->box(WINDOW_BOX);
-  vis_window->label("Visibility");
-  
-  int brw = width-2*WB;
-
-  vis_type = new Fl_Choice(1*WB,1*WB+0*BH,brw/3,BH);
-  vis_type->menu(type_table);
-  
-  vis_browser_mode = new Fl_Choice(2*WB+(brw-2*WB)/3,1*WB+0*BH,(brw-2*WB)/3,BH);
-  vis_browser_mode->menu(browser_mode_table);
-  
-  vis_butt[0] = new Fl_Check_Button(3*WB+2*(brw-2*WB)/3, 1*WB+0*BH, (brw-2*WB)/3, BH, "Recursive");
-  vis_butt[0]->type(FL_TOGGLE_BUTTON);
-  vis_butt[0]->down_box(TOGGLE_BOX);
-  vis_butt[0]->selection_color(TOGGLE_COLOR);
-  vis_butt[0]->value(1);
-
-  Fl_Button* o0 = new Fl_Button(1*WB, 2*WB+1*BH, cols[0], BH, "*");
-  o0->callback(opt_visibility_sort_cb, (void*)0);
+  // timestep
+  if(v->NbTimeStep==1){
+    view_value[50]->deactivate();
+    view_butt_rep[0]->deactivate();
+    view_butt_rep[1]->deactivate();
+    view_butt[8]->deactivate();
+  }
+  else{
+    view_value[50]->activate();
+    view_butt_rep[0]->activate();
+    view_butt_rep[1]->activate();
+    view_butt[8]->activate();
+  }
+  view_value[50]->callback(view_options_timestep_cb, (void*)num);
+  view_value[50]->maximum(v->NbTimeStep-1); 
+  view_butt_rep[0]->callback(view_options_timestep_decr_cb, (void*)num);
+  view_butt_rep[1]->callback(view_options_timestep_incr_cb, (void*)num);
+  opt_view_timestep(num, GMSH_GUI, 0);
+  opt_view_show_time(num, GMSH_GUI, 0);
 
-  Fl_Button* o1 = new Fl_Button(1*WB+cols[0], 2*WB+1*BH, cols[1], BH, "Type");
-  //Fl_Box *a = new Fl_Box(FL_NO_BOX, 1*WB+15+cols[0]-15-20, 2*WB+1*BH, 15, BH, "@#UpArrow");
-  //a->labeltype(FL_SYMBOL_LABEL);
-  o1->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
-  o1->callback(opt_visibility_sort_cb, (void*)1);
+  // aspect
+  if(v->ScalarOnly) view_vector->deactivate();
+  else view_vector->activate();
+  opt_view_point_size(num, GMSH_GUI, 0);
+  opt_view_point_type(num, GMSH_GUI, 0);
+  opt_view_line_width(num, GMSH_GUI, 0);
+  opt_view_line_type(num, GMSH_GUI, 0);
+  opt_view_arrow_type(num, GMSH_GUI, 0);
+  opt_view_arrow_scale(num, GMSH_GUI, 0);
+  opt_view_arrow_location(num, GMSH_GUI, 0);
+  opt_view_tensor_type(num, GMSH_GUI, 0);
 
-  Fl_Button* o2 = new Fl_Button(1*WB+cols[0]+cols[1], 2*WB+1*BH, cols[2], BH, "Number");
-  o2->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
-  o2->callback(opt_visibility_sort_cb, (void*)2);
+  // colors
+  view_colorbar_window->update(v->Name, v->Min, v->Max, &v->CT, &v->Changed);
 
-  Fl_Button* o3 = new Fl_Button(1*WB+cols[0]+cols[1]+cols[2], 2*WB+1*BH, cols[3], BH, "Name");
-  o3->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
-  o3->callback(opt_visibility_sort_cb, (void*)3);
+}
 
-  vis_browser = new Fl_Browser(1*WB, 2*WB+2*BH, brw, height-5*WB-4*BH);
-  vis_browser->textfont(FL_COURIER);
-  vis_browser->type(FL_MULTI_BROWSER);
-  vis_browser->column_widths(cols);
+// Create the window for the statistics
 
-  vis_window->resizable(new Fl_Box(width-3*WB-2*BB-10,3*WB+2*BH+10, 10,10));
-  vis_window->size_range(width, 5*BH+5*WB);
+void GUI::create_statistics_window(){
+  int i, num=0;
 
-  vis_input = new Fl_Input(1*WB, height-2*WB-2*BH, (brw-2*WB)/3, BH);
-  vis_input->callback(opt_visibility_number_cb);
-  vis_input->when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED);
+  if(stat_window){
+    if(!stat_window->shown()) set_statistics();
+    stat_window->show();
+    return;
+  }
 
-  vis_input_mode = new Fl_Choice(2*WB+(brw-2*WB)/3, height-2*WB-2*BH, (brw-2*WB)/3, BH);
-  vis_input_mode->menu(input_mode_table);
+  int width = 26*CTX.fontsize;
+  int height = 5*WB+17*BH ;
+  
+  stat_window = new Fl_Window(width,height);
+  stat_window->box(WINDOW_BOX);
+  stat_window->label("Statistics");
+  {
+    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
+    { 
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Geometry");
+      o->hide();
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+1*BH, IW, BH, "Points");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+2*BH, IW, BH, "Curves");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+3*BH, IW, BH, "Surfaces");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+4*BH, IW, BH, "Volumes");
+      o->end();
+    }
+    { 
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Mesh");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+1*BH, IW, BH, "Nodes on curves");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+2*BH, IW, BH, "Nodes on surfaces");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+3*BH, IW, BH, "Nodes in volumes");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+4*BH, IW, BH, "Triangles");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+5*BH, IW, BH, "Quadrangles");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+6*BH, IW, BH, "Tetrahedra");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+7*BH, IW, BH, "Hexahedra");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+8*BH, IW, BH, "Prisms");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+9*BH, IW, BH, "Pyramids");
+      
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+10*BH, IW, BH, "Time for 1D mesh");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+11*BH, IW, BH, "Time for 2D mesh");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+12*BH, IW, BH, "Time for 3D mesh");
+      
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+13*BH, IW, BH, "Gamma factor");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+14*BH, IW, BH, "Eta factor");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+15*BH, IW, BH, "Rho factor");
+      
+      Fl_Button* b0 = new Fl_Button(width-BB-2*WB, 2*WB+13*BH, BB, BH, "Graph");
+      b0->callback(statistics_histogram_cb, (void*)0);
+      Fl_Button* b1 = new Fl_Button(width-BB-2*WB, 2*WB+14*BH, BB, BH, "Graph");
+      b1->callback(statistics_histogram_cb, (void*)1);
+      Fl_Button* b2 = new Fl_Button(width-BB-2*WB, 2*WB+15*BH, BB, BH, "Graph");
+      b2->callback(statistics_histogram_cb, (void*)2);
+      
+      o->end();
+    }
+    { 
+      Fl_Group* o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Post-processing");
+      o->hide();
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+1*BH, IW, BH, "Views");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+2*BH, IW, BH, "Visible points");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+3*BH, IW, BH, "Visible lines");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+4*BH, IW, BH, "Visible triangles");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+5*BH, IW, BH, "Visible quadrangles");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+6*BH, IW, BH, "Visible tetrahedra");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+7*BH, IW, BH, "Visible hexahedra");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+8*BH, IW, BH, "Visible prisms");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+9*BH, IW, BH, "Visible pyramids");
+      stat_value[num++] = new Fl_Output(2*WB, 2*WB+10*BH, IW, BH, "Visible strings");
+      o->end();
+    }
+    o->end();
+  }
+  
+  for(i=0 ; i<num ; i++){
+    stat_value[i]->align(FL_ALIGN_RIGHT);
+    stat_value[i]->value(0);
+  }
   
   { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
-    o->callback(opt_visibility_ok_cb);
+    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Update");
+    o->callback(statistics_update_cb);
   }
   { 
     Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)vis_window);
+    o->callback(cancel_cb, (void*)stat_window);
   }
-
+  
   if(CTX.center_windows)
-    vis_window->position(m_window->x()+m_window->w()/2-width/2,
-			 m_window->y()+9*BH-height/2);
-  vis_window->end();
-}
+    stat_window->position(m_window->x()+m_window->w()/2-width/2,
+			  m_window->y()+9*BH-height/2);
+  stat_window->end();
 
-// Create the about window
+  stat_window->show();
+  set_statistics();
+  stat_window->redraw();
 
-void GUI::create_about_window(){
-  char buffer[1024];
+}
 
-  if(about_window){
-    about_window->show();
-    return;
-  }
+void GUI::set_statistics(){
 
-  int width = 40*CTX.fontsize;
-  int height = 10*BH ;
-  
-  about_window = new Fl_Window(width,height);
-  about_window->box(WINDOW_BOX);
-  about_window->label("About Gmsh");
-  
-  {
-    Fl_Box *o = new Fl_Box(2*WB, WB, about_width, height-3*WB-BH);
-    about_bmp = new Fl_Bitmap(about_bits,about_width,about_height);
-    about_bmp->label(o);
+  int i,num=0;
+  static double  s[50], p[20];
+  static char    label[50][256];
+
+  GetStatistics(s);
+
+  // geom
+  sprintf(label[num], "%g", s[0]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[1]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[2]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[3]); stat_value[num]->value(label[num]); num++;
+
+  // mesh
+  sprintf(label[num], "%g", s[4]);  stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[5]);  stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[6]);  stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[7]-s[8]); 
+                                    stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[8]);  stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[9]);  stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[10]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[11]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[12]); stat_value[num]->value(label[num]); num++;
+
+  sprintf(label[num], "%g", s[13]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[14]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g", s[15]); stat_value[num]->value(label[num]); num++;
+
+  sprintf(label[num], "%.4g (%.4g->%.4g)", s[17], s[19], s[18]); 
+                                    stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%.4g (%.4g->%.4g)", s[20], s[22], s[21]); 
+                                    stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%.4g (%.4g->%.4g)", s[23], s[25], s[24]);
+                                    stat_value[num]->value(label[num]); num++;
+
+  // post
+  p[0] = List_Nbr(CTX.post.list) ;
+  sprintf(label[num], "%g", p[0]); stat_value[num]->value(label[num]); num++;
+  p[1] = p[2] = p[3] = p[4] = p[5] = p[6] = p[7] = p[8] = p[9] = 0 ;
+  p[10] = p[11] = p[12] = p[13] = p[14] = p[15] = p[16] = p[17] = p[18] = 0 ;
+  for(i=0 ; i<List_Nbr(CTX.post.list) ; i++){
+    Post_View *v = (Post_View*)List_Pointer(CTX.post.list, i);
+    p[1] += v->NbSP + v->NbVP + v->NbTP;
+    p[2] += v->NbSL + v->NbVL + v->NbTL;
+    p[3] += v->NbST + v->NbVT + v->NbTT;
+    p[4] += v->NbSQ + v->NbVQ + v->NbTQ;
+    p[5] += v->NbSS + v->NbVS + v->NbTS;
+    p[6] += v->NbSH + v->NbVH + v->NbTH;
+    p[7] += v->NbSI + v->NbVI + v->NbTI;
+    p[8] += v->NbSY + v->NbVY + v->NbTY;
+    p[9] += v->NbT2 + v->NbT3;
+    if(v->Visible){
+      if(v->DrawPoints)	p[10] += (v->DrawScalars ? v->NbSP : 0) + 
+			         (v->DrawVectors ? v->NbVP : 0) + 
+			         (v->DrawTensors ? v->NbTP : 0) ;
+      if(v->DrawLines) p[11] += (v->DrawScalars ? v->NbSL : 0) + 
+			        (v->DrawVectors ? v->NbVL : 0) + 
+			        (v->DrawTensors ? v->NbTL : 0) ;
+      if(v->DrawTriangles) p[12] += (v->DrawScalars ? v->NbST : 0) + 
+			            (v->DrawVectors ? v->NbVT : 0) + 
+			            (v->DrawTensors ? v->NbTT : 0) ;
+      if(v->DrawQuadrangles) p[13] += (v->DrawScalars ? v->NbSQ : 0) + 
+			              (v->DrawVectors ? v->NbVQ : 0) + 
+			              (v->DrawTensors ? v->NbTQ : 0) ;
+      if(v->DrawTetrahedra) p[14] += (v->DrawScalars ? v->NbSS : 0) + 
+			             (v->DrawVectors ? v->NbVS : 0) + 
+   			             (v->DrawTensors ? v->NbTS : 0) ;
+      if(v->DrawHexahedra) p[15] += (v->DrawScalars ? v->NbSH : 0) + 
+			            (v->DrawVectors ? v->NbVH : 0) + 
+   			            (v->DrawTensors ? v->NbTH : 0) ;
+      if(v->DrawPrisms) p[16] += (v->DrawScalars ? v->NbSI : 0) + 
+			         (v->DrawVectors ? v->NbVI : 0) + 
+   			         (v->DrawTensors ? v->NbTI : 0) ;
+      if(v->DrawPyramids) p[17] += (v->DrawScalars ? v->NbSY : 0) + 
+			           (v->DrawVectors ? v->NbVY : 0) + 
+   			           (v->DrawTensors ? v->NbTY : 0) ;
+      if(v->DrawStrings) p[18] += v->NbT2 + v->NbT3 ;
+    }
   }
-  
-  {
-    Fl_Browser *o = new Fl_Browser(WB+80, WB, width-2*WB-80, height-3*WB-BH);
-    o->add("");
-    o->add("@c@b@.Gmsh");
-    o->add("@c@.A three-dimensional finite element mesh generator");
-    o->add("@c@.with built-in pre- and post-processing facilities");
-    o->add("");
-    o->add("@c@.Copyright (c) 1997-2002");
-    o->add("@c@.Christophe Geuzaine and Jean-Fran�ois Remacle");
-    o->add("");
-    o->add("@c@.Please send all questions and bug reports to");
-    o->add("@c@b@.gmsh@geuz.org");
-    o->add("");
-    sprintf(buffer, "@c@.Version: %d.%d.%d", GMSH_MAJOR_VERSION, 
-	    GMSH_MINOR_VERSION, GMSH_PATCH_VERSION); o->add(buffer);
-    sprintf(buffer, "@c@.Build date: %s", GMSH_DATE); o->add(buffer);
-    sprintf(buffer, "@c@.Build OS: %s", GMSH_OS); o->add(buffer);
-    sprintf(buffer, "@c@.Graphical user interface toolkit: FLTK %d.%d.%d",
-	    FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION); o->add(buffer);
-    sprintf(buffer, "@c@.Build host: %s", GMSH_HOST); o->add(buffer);
-    sprintf(buffer, "@c@.Packaged by: %s", GMSH_PACKAGER); o->add(buffer);
-    o->add("");
-    o->add("@c@.Visit http://www.geuz.org/gmsh/ for more information");
+  sprintf(label[num], "%g/%g", p[10],p[1]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[11],p[2]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[12],p[3]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[13],p[4]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[14],p[5]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[15],p[6]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[16],p[7]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[17],p[8]); stat_value[num]->value(label[num]); num++;
+  sprintf(label[num], "%g/%g", p[18],p[9]); stat_value[num]->value(label[num]); num++;
+}
+
+
+// Create the window for the plugins
+
+void GUI::add_multiline_in_browser(Fl_Browser *o, char* prefix, char *str){
+  int start = 0, len;
+  char *buff;
+  if(!str || !strlen(str) || !strcmp(str, "\n")){
     o->add("");
+    return;
   }
-  
-  { 
-    Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK");
-    o->callback(cancel_cb, (void*)about_window);
+  for(unsigned int i=0 ; i<strlen(str) ; i++){
+    if(i==strlen(str)-1 || str[i]=='\n'){
+      len = i-start+(str[i]=='\n'?0:1);
+      buff = new char[len+strlen(prefix)+2];
+      strcpy(buff, prefix);
+      strncat(buff, &str[start], len);
+      buff[len+strlen(prefix)]='\0';
+      o->add(buff);
+      start = i+1;
+    }
   }
-  
-  if(CTX.center_windows)
-    about_window->position(m_window->x()+m_window->w()/2-width/2,
-			   m_window->y()+9*BH-height/2);
-  about_window->end();
-  
 }
 
-// Create the window for view options
+PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p){
+  char buffer[1024],namep[1024],copyright[256],author[256],help[1024];
 
-// WARNING! Don't forget to add the set_changed_cb() callback to any new widget!
+  // get plugin info
 
-void GUI::create_view_options_window(int num){
-  int i;
+  int n = p->getNbOptions();
+  p->getName(namep);
+  p->getInfos(author,copyright,help);
 
-  if(view_window){
-    update_view_window(num);
-    view_window->show();
-    return;
-  }
+  // create window
 
-  int width = 34*CTX.fontsize;
-  int height = 5*WB+11*BH;
-  int BW = width-4*WB;
+  int width = 20*CTX.fontsize;
+  int height = ((n>5?n:5)+2)*BH + 5*WB;
+
+  PluginDialogBox *pdb = new PluginDialogBox;
+  pdb->main_window = new Fl_Window(width,height);
+  pdb->main_window->box(WINDOW_BOX);
+  sprintf(buffer,"%s Plugin",namep);
+  char *nbuffer = new char[strlen(buffer)+1];
+  strcpy(nbuffer,buffer);
+  pdb->main_window->label(nbuffer);
 
-  // initialise all buttons to NULL (see the clear_changed() in opt_view_options_bd)
-  for(i=0; i<VIEW_OPT_BUTT; i++){
-    view_butt[i] = NULL;
-    view_value[i] = NULL;
-    view_input[i] = NULL;
-    view_choice[i] = NULL;
-  }
-  
-  view_window = new Fl_Window(width,height);
-  view_window->box(WINDOW_BOX);
-  
   { 
-    Fl_Tabs* o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-BH);
-    // General
+    Fl_Tabs *o = new Fl_Tabs(WB, WB, width-2*WB, height-3*WB-1*BH);
     { 
-      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "General");
+      Fl_Group *g = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Options");
+
+      if(n > 20)Msg(GERROR, "Plugin has too many parameters");
       
-      view_butt[1] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW/2-WB, BH, "3D view");
-      view_butt[2] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW/2-WB, BH, "2D space table");
-      view_butt[3] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW/2-WB, BH, "2D time table");
-      for(i=1 ; i<=3 ; i++){
-	view_butt[i]->type(FL_RADIO_BUTTON);
-	view_butt[i]->down_box(RADIO_BOX);
-	view_butt[i]->selection_color(RADIO_COLOR);
-	view_butt[i]->callback(set_changed_cb, 0);
+      for(int i=0;i<n;i++){
+	StringXNumber *sxn;
+	sxn = p->GetOption(i);
+	pdb->view_value[i] = new Fl_Value_Input(2*WB, 2*WB+(i+1)*BH, IW, BH, sxn->str);
+	pdb->view_value[i]->align(FL_ALIGN_RIGHT);
+	pdb->view_value[i]->value(sxn->def);
       }
+
+      g->end();
+    }
+    { 
+      Fl_Group *g = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "About");
+
+      Fl_Browser *o = new Fl_Browser(2*WB, 2*WB+1*BH, width-4*WB, height-5*WB-2*BH);
+
+      o->add("");
+      add_multiline_in_browser(o, "@c@b@.", namep);
+      o->add("");
+      add_multiline_in_browser(o, "", help);
+      o->add("");
+      add_multiline_in_browser(o, "Author(s): ", author);
+      add_multiline_in_browser(o, "Copyright: ", copyright);
       
-      view_input[0] = new Fl_Input(2*WB, 2*WB+4*BH, IW, BH, "Name");
-      view_input[1] = new Fl_Input(2*WB, 2*WB+5*BH, IW, BH, "Format");
-      for(i=0 ; i<=1 ; i++){
-	view_input[i]->align(FL_ALIGN_RIGHT);
-	view_input[i]->callback(set_changed_cb, 0);
-      }
+      g->end();
+    }
+    o->end();
+  }
 
-      int sw=(int)(1.5*CTX.fontsize);
-      view_butt_rep[0] = new Fl_Repeat_Button(2*WB, 2*WB+6*BH, sw, BH, "-");
-      //no set_changed since has its own callback
-      view_butt_rep[1] = new Fl_Repeat_Button(2*WB+IW-sw, 2*WB+6*BH, sw, BH, "+");
-      //no set_changed since has its own callback
-      view_value[50] = new Fl_Value_Input(2*WB+sw, 2*WB+6*BH, IW-2*sw, BH);
-      view_value[50]->align(FL_ALIGN_RIGHT);
-      view_value[50]->minimum(0); 
-      view_value[50]->maximum(0); 
-      view_value[50]->step(1);
-      //no set_changed since has its own callback
-      Fl_Box *a = new Fl_Box(2*WB+IW, 2*WB+6*BH, IW/2, BH, "Time step");
-      a->box(FL_NO_BOX);
-      a->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+  pdb->run_button = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Run");
 
+  Fl_Button* cancel = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
+  cancel->callback(cancel_cb, (void*)pdb->main_window);
 
-      view_value[20] = new Fl_Value_Input(2*WB, 2*WB+7*BH, IW/2, BH);
-      view_value[21] = new Fl_Value_Input(2*WB+IW/2, 2*WB+7*BH, IW/2, BH, "Position");
-      view_value[22] = new Fl_Value_Input(2*WB, 2*WB+8*BH, IW/2, BH);
-      view_value[23] = new Fl_Value_Input(2*WB+IW/2, 2*WB+8*BH, IW/2, BH, "Size");
-      for(i=20 ; i<=23 ; i++){
-	view_value[i]->align(FL_ALIGN_RIGHT);
-	view_value[i]->callback(set_changed_cb, 0);
-      }
+  pdb->main_window->resizable(new Fl_Box(2*WB,2*WB+BH,10,10));
 
+  if(CTX.center_windows)
+    pdb->main_window->position(m_window->x()+m_window->w()/2-width/2,
+			       m_window->y()+9*BH-height/2);
 
-      view_butt[8] = new Fl_Check_Button(width/2, 2*WB+1*BH, BW/2-WB, BH, "Show time");
-      view_butt[5] = new Fl_Check_Button(width/2, 2*WB+2*BH, BW/2-WB, BH, "Show annotations");
-      view_butt[4] = new Fl_Check_Button(width/2, 2*WB+3*BH, BW/2-WB, BH, "Show scale");
-      view_butt[6] = new Fl_Check_Button(width/2, 2*WB+4*BH, BW/2-WB, BH, "Transparent scale");
-      view_butt[7] = new Fl_Check_Button(width/2, 2*WB+5*BH, BW/2-WB, BH, "Scale/2D graph auto position");
-      for(i=4 ; i<=8 ; i++){
-	view_butt[i]->type(FL_TOGGLE_BUTTON);
-	view_butt[i]->down_box(TOGGLE_BOX);
-	view_butt[i]->selection_color(TOGGLE_COLOR);
-	view_butt[i]->callback(set_changed_cb, 0);
-      }
-      
-      
-      o->end();
-    }
-    // 3D
-    { 
-      view_3d = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "3D");
-      view_3d->hide();
-      
-      view_butt[10] = new Fl_Check_Button(width/2, 2*WB+1*BH, BW/2-WB, BH, "Show elements");
-      view_butt[11] = new Fl_Check_Button(width/2, 2*WB+2*BH, BW/2-WB, BH, "Enable lighting");
-      view_butt[12] = new Fl_Check_Button(width/2, 2*WB+3*BH, BW/2-WB, BH, "Smooth normals");	
-      for(i=10 ; i<=12 ; i++){
-	view_butt[i]->type(FL_TOGGLE_BUTTON);
-	view_butt[i]->down_box(TOGGLE_BOX);
-	view_butt[i]->selection_color(TOGGLE_COLOR);
-	view_butt[i]->callback(set_changed_cb, 0);
-      }
-      view_value[10] = new Fl_Value_Input(width/2, 2*WB+4*BH, IW, BH, "Angle");
-      view_value[10]->minimum(0.); 
-      view_value[10]->step(1.); 
-      view_value[10]->maximum(180.); 
-      view_value[11] = new Fl_Value_Input(width/2, 2*WB+5*BH, IW, BH, "Boundary");
-      view_value[11]->minimum(0); 
-      view_value[11]->step(1); 
-      view_value[11]->maximum(3); 
-      view_value[12] = new Fl_Value_Input(width/2, 2*WB+6*BH, IW, BH, "Explode");
-      view_value[12]->minimum(0.); 
-      view_value[12]->step(0.01); 
-      view_value[12]->maximum(1.); 
-      for(i=10 ; i<=12 ; i++){
-	view_value[i]->align(FL_ALIGN_RIGHT);
-	view_value[i]->callback(set_changed_cb, 0);
-      }
-      
-      view_butt[13] = new Fl_Check_Button(2*WB, 2*WB+1*BH, BW/2-WB, BH, "Show points");
-      view_butt[14] = new Fl_Check_Button(2*WB, 2*WB+2*BH, BW/2-WB, BH, "Show lines");
-      view_butt[15] = new Fl_Check_Button(2*WB, 2*WB+3*BH, BW/2-WB, BH, "Show triangles");
-      view_butt[16] = new Fl_Check_Button(2*WB, 2*WB+4*BH, BW/2-WB, BH, "Show quadrangles");
-      view_butt[17] = new Fl_Check_Button(2*WB, 2*WB+5*BH, BW/2-WB, BH, "Show tetrahedra");
-      view_butt[18] = new Fl_Check_Button(2*WB, 2*WB+6*BH, BW/2-WB, BH, "Show hexahedra");
-      view_butt[19] = new Fl_Check_Button(2*WB, 2*WB+7*BH, BW/2-WB, BH, "Show prisms");
-      view_butt[20] = new Fl_Check_Button(2*WB, 2*WB+8*BH, BW/2-WB, BH, "Show pyramids");
-      view_butt[21] = new Fl_Check_Button(width/2, 2*WB+7*BH, BW/2-WB, BH, "Show scalar values");
-      view_butt[22] = new Fl_Check_Button(width/2, 2*WB+8*BH, BW/2-WB, BH, "Show vector values");
-      view_butt[23] = new Fl_Check_Button(width/2, 2*WB+9*BH, BW/2-WB, BH, "Show tensor values");
-      for(i=13 ; i<=23 ; i++){
-	view_butt[i]->type(FL_TOGGLE_BUTTON);
-	view_butt[i]->down_box(TOGGLE_BOX);
-	view_butt[i]->selection_color(TOGGLE_COLOR);
-	view_butt[i]->callback(set_changed_cb, 0);
-      }
-      
-      view_3d->end();
-    }
-    // 2D
-    { 
-      view_2d = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "2D");
-      view_2d->hide();
-      
-      view_input[2] = new Fl_Input(2*WB, 2*WB+1*BH, IW, BH, "Abscissa name");
-      view_input[2]->align(FL_ALIGN_RIGHT);
-      view_input[2]->callback(set_changed_cb, 0);
+  pdb->main_window->end();  
 
-      view_input[3] = new Fl_Input(2*WB, 2*WB+2*BH, IW, BH, "Abscissa format");
-      view_input[3]->align(FL_ALIGN_RIGHT);
-      view_input[3]->callback(set_changed_cb, 0);
-      
-      view_value[25] = new Fl_Value_Input(2*WB, 2*WB+ 3*BH, IW, BH, "Abscissa points");
-      view_value[25]->minimum(0.); 
-      view_value[25]->step(1); 
-      view_value[25]->maximum(256); 
-      view_value[26] = new Fl_Value_Input(2*WB, 2*WB+ 4*BH, IW, BH, "Grid mode");
-      view_value[26]->minimum(0.); 
-      view_value[26]->step(1); 
-      view_value[26]->maximum(3); 
-      for(i=25 ; i<=26 ; i++){
-	view_value[i]->align(FL_ALIGN_RIGHT);
-	view_value[i]->callback(set_changed_cb, 0);
-      }
-      
-      view_2d->end();
-    }
-    // Range
-    { 
-      view_range = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Range");
-      view_range->hide();
-      
-      view_value[30] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "Intervals");
-      view_value[30]->align(FL_ALIGN_RIGHT);
-      view_value[30]->minimum(1); 
-      view_value[30]->maximum(256); 
-      view_value[30]->step(1);
-      view_value[30]->callback(set_changed_cb, 0);
+  return pdb;
+}
 
-      static Fl_Menu_Item menu_iso[] = {
-	{"Iso-values",        0, 0, 0},
-	{"Filled iso-values", 0, 0, 0},
-	{"Continuous map",    0, 0, 0},
-	{"Numeric values",    0, 0, 0},
-	{0}
-      };
-      view_choice[0] = new Fl_Choice(2*WB, 2*WB+2*BH, IW, BH, "Intervals type");
-      view_choice[0]->menu(menu_iso);
-      view_choice[0]->align(FL_ALIGN_RIGHT);
-      view_choice[0]->callback(set_changed_cb, 0);
+// Create the window for the messages
 
-      view_butt[34] = new Fl_Check_Button(2*WB, 2*WB+3*BH, IW, BH, "Custom range");
-      view_butt[34]->type(FL_TOGGLE_BUTTON);
-      view_butt[34]->down_box(TOGGLE_BOX);
-      view_butt[34]->selection_color(TOGGLE_COLOR);
-      //no set_changed since customrange has its own callback
-      
-      view_value[31] = new Fl_Value_Input(2*WB, 2*WB+4*BH, IW, BH, "Minimum");
-      view_value[32] = new Fl_Value_Input(2*WB, 2*WB+5*BH, IW, BH, "Maximum");
-      for(i=31 ; i<=32 ; i++){
-	view_value[i]->align(FL_ALIGN_RIGHT);
-	view_value[i]->callback(set_changed_cb, 0);
-      }
+void GUI::create_message_window(){
 
-      static Fl_Menu_Item menu_scale[] = {
-	{"Linear",             0, 0, 0},
-	{"Logarithmic",        0, 0, 0},
-	{"Double logarithmic", 0, 0, 0},
-	{0}
-      };
-      view_choice[1] = new Fl_Choice(2*WB, 2*WB+6*BH, IW, BH, "Scale");
-      view_choice[1]->menu(menu_scale);
-      view_choice[1]->align(FL_ALIGN_RIGHT);
-      view_choice[1]->callback(set_changed_cb, 0);
-      
-      view_butt[38] = new Fl_Check_Button(2*WB, 2*WB+7*BH, IW, BH, "Saturate values");
-      view_butt[38]->type(FL_TOGGLE_BUTTON);
-      view_butt[38]->down_box(TOGGLE_BOX);
-      view_butt[38]->selection_color(TOGGLE_COLOR);
-      view_butt[38]->callback(set_changed_cb, 0);
-      
-      view_range->end();
-    }
-    // Offset and Raise
-    { 
-      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Offset");
-      o->hide();
-      view_value[40] = new Fl_Value_Input(2*WB, 2*WB+1*BH, IW, BH, "X offset");
-      view_value[41] = new Fl_Value_Input(2*WB, 2*WB+2*BH, IW, BH, "Y offset");
-      view_value[42] = new Fl_Value_Input(2*WB, 2*WB+3*BH, IW, BH, "Z offset");
-      view_value[43] = new Fl_Value_Input(width/2, 2*WB+1*BH, IW, BH, "X raise");
-      view_value[44] = new Fl_Value_Input(width/2, 2*WB+2*BH, IW, BH, "Y raise");
-      view_value[45] = new Fl_Value_Input(width/2, 2*WB+3*BH, IW, BH, "Z raise");
-      for(i=40 ; i<=45 ; i++){
-	view_value[i]->align(FL_ALIGN_RIGHT);
-	view_value[i]->callback(set_changed_cb, 0);
-      }	
-      o->end();
-    }
-    // Aspect
-    { 
-      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Aspect");
-      o->hide();
-      
-      view_value[61] = new Fl_Value_Input(2*WB, 2*WB+ 1*BH, IW, BH, "Point size");
-      view_value[61]->minimum(0.1); 
-      view_value[61]->maximum(50);
-      view_value[61]->step(0.1);
-      view_value[61]->align(FL_ALIGN_RIGHT);
-      view_value[61]->callback(set_changed_cb, 0);
+  if(msg_window){
+    if(msg_window->shown())
+      msg_window->redraw();
+    else
+      msg_window->show();
+    return;
+  }
+  
+  int width = CTX.msg_size[0];
+  int height = CTX.msg_size[1];
+  
+  msg_window = new Fl_Window(width,height);
+  msg_window->box(WINDOW_BOX);
+  msg_window->label("Messages");
+  
+  msg_browser = new Fl_Browser(WB, WB, width-2*WB, height-3*WB-BH);
+  msg_browser->textfont(FL_COURIER);
+  msg_browser->type(FL_MULTI_BROWSER);
+  msg_browser->callback(message_copy_cb);
+  
+  { 
+    Fl_Return_Button* o = new Fl_Return_Button(width-3*BB-3*WB, height-BH-WB, BB, BH, "Save");
+    o->callback(message_save_cb);
+  }
+  { 
+    Fl_Button* o = new Fl_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Clear");
+    o->callback(message_clear_cb);
+  }
+  { 
+    Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
+    o->callback(cancel_cb, (void*)msg_window);
+  }
+  
+  msg_window->resizable(new Fl_Box(WB,WB, 100,10));
+  msg_window->size_range(WB+100 + 3*BB+4*WB,100);
+  
+  msg_window->position(CTX.msg_position[0], CTX.msg_position[1]);
+  msg_window->end();
+  
+}
 
-      view_choice[5] = new Fl_Choice(2*WB, 2*WB+ 2*BH, IW, BH, "Point display");
-      view_choice[5]->menu(menu_point_display);
-      view_choice[5]->align(FL_ALIGN_RIGHT);
-      view_choice[5]->callback(set_changed_cb, 0);
-      
-      view_value[62] = new Fl_Value_Input(2*WB, 2*WB+ 3*BH, IW, BH, "Line width");
-      view_value[62]->minimum(0.1); 
-      view_value[62]->maximum(50);
-      view_value[62]->step(0.1);
-      view_value[62]->align(FL_ALIGN_RIGHT);
-      view_value[62]->callback(set_changed_cb, 0);
+void GUI::add_message(char *msg){
+  for(int i=0 ; i<(int)strlen(msg) ; i++) if(msg[i]=='\n') msg[i] = ' ';
+  msg_browser->add(msg,0);
+  msg_browser->bottomline(msg_browser->size());
+}
 
-      view_choice[6] = new Fl_Choice(2*WB, 2*WB+ 4*BH, IW, BH, "Line display");
-      view_choice[6]->menu(menu_line_display);
-      view_choice[6]->align(FL_ALIGN_RIGHT);
-      view_choice[6]->callback(set_changed_cb, 0);
+void GUI::save_message(char *filename){
+  FILE *fp;
+
+  if(!(fp = fopen(filename,"w"))) {
+    Msg(GERROR, "Unable to open file '%s'", filename); 
+    return;
+  }
+  for(int i = 1 ; i<=msg_browser->size() ; i++){
+    const char *c=msg_browser->text(i);
+    if(c[0]=='@') fprintf(fp, "%s\n", &c[3]);
+    else fprintf(fp, "%s\n", c);
+  }
+
+  Msg(INFO, "Log creation complete '%s'", filename);
+  Msg(STATUS2, "Wrote '%s'", filename);
+  fclose(fp);
+}
+
+void GUI::fatal_error(char *filename){
+  fl_alert("A fatal error has occurred, which will force Gmsh to exit "
+	   "(all messages have been saved in the error log file '%s')", filename);
+}
+
+// Create the visibility window
+
+void GUI::reset_visibility(){
+  if(vis_window){
+    vis_browser->clear();
+    if(vis_window->shown()) 
+      visibility_cb(NULL,NULL);
+  }
+}
+
+void GUI::create_visibility_window(){
+
+  if(vis_window){
+    vis_window->show();
+    return;
+  }
+
+  static int cols[5] = {15,95,95,180,0};  
+  static Fl_Menu_Item type_table[] = {
+    {"Elementary",  0, (Fl_Callback *)visibility_cb},
+    {"Physical",    0, (Fl_Callback *)visibility_cb},
+    {0}
+  };
+  static Fl_Menu_Item browser_mode_table[] = {
+    {"Geometry+Mesh",  0, (Fl_Callback *)visibility_cb},
+    {"Geometry",       0, (Fl_Callback *)visibility_cb},
+    {"Mesh",           0, (Fl_Callback *)visibility_cb},
+    {0}
+  };
+  static Fl_Menu_Item input_mode_table[] = {
+    {"Node",     0, 0},
+    {"Element",  0, 0},
+    {"Point",    0, 0},
+    {"Curve",    0, 0},
+    {"Surface",  0, 0},
+    {"Volume",   0, 0},
+    {0}
+  };
+
+  int width = cols[0]+cols[1]+cols[2]+cols[3]+2*WB;
+  int height = 15*BH ;
+  
+  vis_window = new Fl_Window(width,height);
+  vis_window->box(WINDOW_BOX);
+  vis_window->label("Visibility");
+  
+  int brw = width-2*WB;
+
+  vis_type = new Fl_Choice(1*WB,1*WB+0*BH,brw/3,BH);
+  vis_type->menu(type_table);
+  
+  vis_browser_mode = new Fl_Choice(2*WB+(brw-2*WB)/3,1*WB+0*BH,(brw-2*WB)/3,BH);
+  vis_browser_mode->menu(browser_mode_table);
+  
+  vis_butt[0] = new Fl_Check_Button(3*WB+2*(brw-2*WB)/3, 1*WB+0*BH, (brw-2*WB)/3, BH, "Recursive");
+  vis_butt[0]->type(FL_TOGGLE_BUTTON);
+  vis_butt[0]->down_box(TOGGLE_BOX);
+  vis_butt[0]->selection_color(TOGGLE_COLOR);
+  vis_butt[0]->value(1);
+
+  Fl_Button* o0 = new Fl_Button(1*WB, 2*WB+1*BH, cols[0], BH, "*");
+  o0->callback(visibility_sort_cb, (void*)0);
+
+  Fl_Button* o1 = new Fl_Button(1*WB+cols[0], 2*WB+1*BH, cols[1], BH, "Type");
+  //Fl_Box *a = new Fl_Box(FL_NO_BOX, 1*WB+15+cols[0]-15-20, 2*WB+1*BH, 15, BH, "@#UpArrow");
+  //a->labeltype(FL_SYMBOL_LABEL);
+  o1->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+  o1->callback(visibility_sort_cb, (void*)1);
 
-      {
-	view_vector = new Fl_Group(2*WB, 2*WB+ 4*BH, width/2, 5*BH, 0);
+  Fl_Button* o2 = new Fl_Button(1*WB+cols[0]+cols[1], 2*WB+1*BH, cols[2], BH, "Number");
+  o2->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+  o2->callback(visibility_sort_cb, (void*)2);
 
-	view_value[60] = new Fl_Value_Input(2*WB, 2*WB+5*BH, IW, BH, "Vector size");
-	view_value[60]->minimum(0); 
-	view_value[60]->align(FL_ALIGN_RIGHT);
-	view_value[60]->callback(set_changed_cb, 0);
+  Fl_Button* o3 = new Fl_Button(1*WB+cols[0]+cols[1]+cols[2], 2*WB+1*BH, cols[3], BH, "Name");
+  o3->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
+  o3->callback(visibility_sort_cb, (void*)3);
 
-	static Fl_Menu_Item menu_vectype[] = {
-	  {"Line",         0, 0, 0},
-	  {"Arrow",        0, 0, 0},
-	  {"Pyramid",      0, 0, 0},
-	  {"Cone",         0, 0, 0},
-	  {"Displacement", 0, 0, 0},
-	  {0}
-	};
-	view_choice[2] = new Fl_Choice(2*WB, 2*WB+6*BH, IW, BH, "Vector display");
-	view_choice[2]->menu(menu_vectype);
-	view_choice[2]->align(FL_ALIGN_RIGHT);
-	view_choice[2]->callback(set_changed_cb, 0);
+  vis_browser = new Fl_Browser(1*WB, 2*WB+2*BH, brw, height-5*WB-4*BH);
+  vis_browser->textfont(FL_COURIER);
+  vis_browser->type(FL_MULTI_BROWSER);
+  vis_browser->column_widths(cols);
 
-	static Fl_Menu_Item menu_vecloc[] = {
-	  {"Cell centered",   0, 0, 0},
-	  {"Vertex centered", 0, 0, 0},
-	  {0}
-	};
-	view_choice[3] = new Fl_Choice(2*WB, 2*WB+7*BH, IW, BH, "Vector location");
-	view_choice[3]->menu(menu_vecloc);
-	view_choice[3]->align(FL_ALIGN_RIGHT);
-	view_choice[3]->callback(set_changed_cb, 0);
+  vis_window->resizable(new Fl_Box(width-3*WB-2*BB-10,3*WB+2*BH+10, 10,10));
+  vis_window->size_range(width, 5*BH+5*WB);
 
-	static Fl_Menu_Item menu_tensor[] = {
-	  {"Von-Mises",    0, 0, 0},
-	  {"Eigenvectors", 0, 0, 0},
-	  {0}
-	};
-	view_choice[4] = new Fl_Choice(2*WB, 2*WB+8*BH, IW, BH, "Tensor display");
-	view_choice[4]->menu(menu_tensor);
-	view_choice[4]->align(FL_ALIGN_RIGHT);
-	view_choice[4]->callback(set_changed_cb, 0);
-	
-	view_vector->end();
-      }
-      
-      o->end();
-    }
-    // Colors
-    { 
-      Fl_Group *o = new Fl_Group(WB, WB+BH, width-2*WB, height-3*WB-2*BH, "Colors");
-      o->hide();
-      view_colorbar_window = new Colorbar_Window(2*WB, 2*WB+1*BH,
-						 width-4*WB, height-5*WB-2*BH);
-      view_colorbar_window->end();
-      //no set_changed since colorbarwindow has its own callbacks
-      o->end();
-    }
-    o->end();
-  }
+  vis_input = new Fl_Input(1*WB, height-2*WB-2*BH, (brw-2*WB)/3, BH);
+  vis_input->callback(visibility_number_cb);
+  vis_input->when(FL_WHEN_ENTER_KEY|FL_WHEN_NOT_CHANGED);
+
+  vis_input_mode = new Fl_Choice(2*WB+(brw-2*WB)/3, height-2*WB-2*BH, (brw-2*WB)/3, BH);
+  vis_input_mode->menu(input_mode_table);
   
   { 
-    view_ok = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
+    Fl_Return_Button* o = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Apply");
+    o->callback(visibility_ok_cb);
   }
   { 
     Fl_Button* o = new Fl_Button(width-BB-WB, height-BH-WB, BB, BH, "Cancel");
-    o->callback(cancel_cb, (void*)view_window);
+    o->callback(cancel_cb, (void*)vis_window);
   }
-  
+
   if(CTX.center_windows)
-    view_window->position(m_window->x()+m_window->w()/2-width/2,
-			  m_window->y()+9*BH-height/2);
-  
-  view_window->end();
-  
+    vis_window->position(m_window->x()+m_window->w()/2-width/2,
+			 m_window->y()+9*BH-height/2);
+  vis_window->end();
 }
 
-void GUI::update_view_window(int num){
-  int i;
-  double val;
-
-  view_number = num ;
-  Post_View *v = (Post_View*)List_Pointer(CTX.post.list, num);
-
-  static char buffer[1024];
-  sprintf(buffer, "Options for \"%s\" (\"%s\")", v->Name, v->FileName);
-  view_window->label(buffer);
-
-  // general
-  opt_view_name(num, GMSH_GUI, NULL);
-  opt_view_format(num, GMSH_GUI, NULL);
-  opt_view_type(num, GMSH_GUI, 0);
-  opt_view_show_scale(num, GMSH_GUI, 0);
-  opt_view_draw_strings(num, GMSH_GUI, 0);
-  opt_view_transparent_scale(num, GMSH_GUI, 0);
-  opt_view_auto_position(num, GMSH_GUI, 0);
-  if(v->NbSP){
-    view_butt[2]->activate();
-    view_butt[3]->activate();
-  }
-  else{
-    view_butt[2]->deactivate();
-    view_butt[3]->deactivate();
-  }
-  opt_view_position0(num, GMSH_GUI, 0);
-  opt_view_position1(num, GMSH_GUI, 0);
-  opt_view_size0(num, GMSH_GUI, 0);
-  opt_view_size1(num, GMSH_GUI, 0);
-
-  //3D
-  if(v->TextOnly){
-    view_3d->deactivate();
-    view_range->deactivate();
-    view_butt[1]->deactivate();
-  }
-  else{
-    view_3d->activate();
-    view_range->activate();
-    view_butt[1]->activate();
-  }
-  opt_view_show_element(num, GMSH_GUI, 0);
-  opt_view_light(num, GMSH_GUI, 0);
-  opt_view_smooth_normals(num, GMSH_GUI, 0);
-  opt_view_angle_smooth_normals(num, GMSH_GUI, 0);
-  opt_view_boundary(num, GMSH_GUI, 0);
-  opt_view_explode(num, GMSH_GUI, 0);
-  opt_view_draw_points(num, GMSH_GUI, 0);
-  opt_view_draw_lines(num, GMSH_GUI, 0);
-  opt_view_draw_triangles(num, GMSH_GUI, 0);
-  opt_view_draw_quadrangles(num, GMSH_GUI, 0);
-  opt_view_draw_tetrahedra(num, GMSH_GUI, 0);
-  opt_view_draw_hexahedra(num, GMSH_GUI, 0);
-  opt_view_draw_prisms(num, GMSH_GUI, 0);
-  opt_view_draw_pyramids(num, GMSH_GUI, 0);
-  opt_view_draw_scalars(num, GMSH_GUI, 0);
-  opt_view_draw_vectors(num, GMSH_GUI, 0);
-  opt_view_draw_tensors(num, GMSH_GUI, 0);
+// Create the about window
 
-  //2D
-  if(v->NbSP)
-    view_2d->activate();
-  else
-    view_2d->deactivate();
-  opt_view_abscissa_name(num, GMSH_GUI, NULL);
-  opt_view_abscissa_format(num, GMSH_GUI, NULL);
-  opt_view_nb_abscissa(num, GMSH_GUI, 0);
-  opt_view_grid(num, GMSH_GUI, 0);
+void GUI::create_about_window(){
+  char buffer[1024];
 
-  // range
-  opt_view_nb_iso(num, GMSH_GUI, 0);
-  opt_view_intervals_type(num, GMSH_GUI, 0);
-  opt_view_range_type(num, GMSH_GUI, 0);
-  view_butt[34]->callback(view_options_custom_cb, (void*)num);
-  view_options_custom_cb(0,0);
-  view_butt[34]->clear_changed();
-  opt_view_custom_min(num, GMSH_GUI, 0);
-  opt_view_custom_max(num, GMSH_GUI, 0);
-  for(i=31 ; i<=32 ; i++){
-    view_value[i]->minimum(v->CustomMin); 
-    view_value[i]->maximum(v->CustomMax); 
+  if(about_window){
+    about_window->show();
+    return;
   }
-  opt_view_scale_type(num, GMSH_GUI, 0);
-  opt_view_saturate_values(num, GMSH_GUI, 0);
 
-  // offset/raise
-  opt_view_offset0(num, GMSH_GUI, 0);
-  opt_view_offset1(num, GMSH_GUI, 0);
-  opt_view_offset2(num, GMSH_GUI, 0);
-  opt_view_raise0(num, GMSH_GUI, 0);
-  opt_view_raise1(num, GMSH_GUI, 0);
-  opt_view_raise2(num, GMSH_GUI, 0);
-  val = 10.*CTX.lc ;
-  for(i=40 ; i<=45 ; i++){
-    view_value[i]->step(val,1000); 
-    view_value[i]->minimum(-val); 
-    view_value[i]->maximum(val); 
+  int width = 40*CTX.fontsize;
+  int height = 10*BH ;
+  
+  about_window = new Fl_Window(width,height);
+  about_window->box(WINDOW_BOX);
+  about_window->label("About Gmsh");
+  
+  {
+    Fl_Box *o = new Fl_Box(2*WB, WB, about_width, height-3*WB-BH);
+    about_bmp = new Fl_Bitmap(about_bits,about_width,about_height);
+    about_bmp->label(o);
   }
-
-  // timestep
-  if(v->NbTimeStep==1){
-    view_value[50]->deactivate();
-    view_butt_rep[0]->deactivate();
-    view_butt_rep[1]->deactivate();
-    view_butt[8]->deactivate();
+  
+  {
+    Fl_Browser *o = new Fl_Browser(WB+80, WB, width-2*WB-80, height-3*WB-BH);
+    o->add("");
+    o->add("@c@b@.Gmsh");
+    o->add("@c@.A three-dimensional finite element mesh generator");
+    o->add("@c@.with built-in pre- and post-processing facilities");
+    o->add("");
+    o->add("@c@.Copyright (c) 1997-2002");
+    o->add("@c@.Christophe Geuzaine and Jean-Fran�ois Remacle");
+    o->add("");
+    o->add("@c@.Please send all questions and bug reports to");
+    o->add("@c@b@.gmsh@geuz.org");
+    o->add("");
+    sprintf(buffer, "@c@.Version: %d.%d.%d", GMSH_MAJOR_VERSION, 
+	    GMSH_MINOR_VERSION, GMSH_PATCH_VERSION); o->add(buffer);
+    sprintf(buffer, "@c@.Build date: %s", GMSH_DATE); o->add(buffer);
+    sprintf(buffer, "@c@.Build OS: %s", GMSH_OS); o->add(buffer);
+    sprintf(buffer, "@c@.Graphical user interface toolkit: FLTK %d.%d.%d",
+	    FL_MAJOR_VERSION, FL_MINOR_VERSION, FL_PATCH_VERSION); o->add(buffer);
+    sprintf(buffer, "@c@.Build host: %s", GMSH_HOST); o->add(buffer);
+    sprintf(buffer, "@c@.Packaged by: %s", GMSH_PACKAGER); o->add(buffer);
+    o->add("");
+    o->add("@c@.Visit http://www.geuz.org/gmsh/ for more information");
+    o->add("");
   }
-  else{
-    view_value[50]->activate();
-    view_butt_rep[0]->activate();
-    view_butt_rep[1]->activate();
-    view_butt[8]->activate();
+  
+  { 
+    Fl_Return_Button* o = new Fl_Return_Button(width-BB-WB, height-BH-WB, BB, BH, "OK");
+    o->callback(cancel_cb, (void*)about_window);
   }
-  view_value[50]->callback(view_options_timestep_cb, (void*)num);
-  view_value[50]->maximum(v->NbTimeStep-1); 
-  view_butt_rep[0]->callback(view_options_timestep_decr_cb, (void*)num);
-  view_butt_rep[1]->callback(view_options_timestep_incr_cb, (void*)num);
-  opt_view_timestep(num, GMSH_GUI, 0);
-  opt_view_show_time(num, GMSH_GUI, 0);
-
-  // aspect
-  if(v->ScalarOnly) view_vector->deactivate();
-  else view_vector->activate();
-  opt_view_point_size(num, GMSH_GUI, 0);
-  opt_view_point_type(num, GMSH_GUI, 0);
-  opt_view_line_width(num, GMSH_GUI, 0);
-  opt_view_line_type(num, GMSH_GUI, 0);
-  opt_view_arrow_type(num, GMSH_GUI, 0);
-  opt_view_arrow_scale(num, GMSH_GUI, 0);
-  opt_view_arrow_location(num, GMSH_GUI, 0);
-  opt_view_tensor_type(num, GMSH_GUI, 0);
-
-  // colors
-  view_colorbar_window->update(v->Name, v->Min, v->Max, &v->CT, &v->Changed);
-
-  // OK
-  view_ok->callback(view_options_ok_cb, (void*)num);
+  
+  if(CTX.center_windows)
+    about_window->position(m_window->x()+m_window->w()/2-width/2,
+			   m_window->y()+9*BH-height/2);
+  about_window->end();
+  
 }
 
+
 // Create the window for geometry context dependant definitions
 
 void GUI::create_geometry_context_window(int num){
diff --git a/Fltk/GUI.h b/Fltk/GUI.h
index d1695892d20db0fd027bcb3cfef174c8a6b22d5b..8d5ba59ee8ea744445a712a57b6eb84ea6122852 100644
--- a/Fltk/GUI.h
+++ b/Fltk/GUI.h
@@ -41,6 +41,7 @@
 #include <FL/Fl_Multiline_Output.H>
 #include <FL/Fl_Bitmap.H>
 #include <FL/Fl_Browser.H>
+#include <FL/Fl_Hold_Browser.H>
 #include <FL/x.H>
 #include <FL/Fl_Color_Chooser.H>
 #include <FL/fl_ask.H>
@@ -150,14 +151,18 @@ public:
   Fl_Button        *g_status_butt[7] ;
   Fl_Box           *g_status_label[3] ;
 
-  // general options window
+  // Option window
+  Fl_Window        *opt_window ;
+  Fl_Hold_Browser  *opt_browser ;
+
+  // general options
   Fl_Window        *gen_window ;
   Fl_Check_Button  *gen_butt[20] ;
   Fl_Value_Input   *gen_value[10] ;
   Fl_Button        *gen_col[50] ;
   Fl_Input         *gen_input[10] ;
 
-  // geometry options window
+  // geometry options
   Fl_Window        *geo_window ;
   Fl_Check_Button  *geo_butt[10] ;
   Fl_Input         *geo_input ;
@@ -165,7 +170,7 @@ public:
   Fl_Button        *geo_col[50] ;
   Fl_Choice        *geo_choice[5] ;
   
-  // mesh options window
+  // mesh options
   Fl_Window        *mesh_window ;
   Fl_Check_Button  *mesh_butt[20] ;
   Fl_Input         *mesh_input ;
@@ -173,16 +178,30 @@ public:
   Fl_Button        *mesh_col[50] ;
   Fl_Choice        *mesh_choice[5] ;
 
-  // solver options window
+  // solver options
   Fl_Window        *solver_window ;
   Fl_Check_Button  *solver_butt[20] ;
   Fl_Value_Input   *solver_value[20] ;
 
-  // post-processing options window
+  // post-processing options
   Fl_Window        *post_window ;
   Fl_Check_Button  *post_butt[20] ;
   Fl_Value_Input   *post_value[20] ;
 
+  // view options
+  int view_number ;
+  Fl_Window        *view_window ;
+  Fl_Group         *view_3d, *view_2d, *view_range, *view_vector ;
+#define VIEW_OPT_BUTT 100
+  Fl_Check_Button  *view_butt[VIEW_OPT_BUTT] ;
+  Fl_Value_Input   *view_value[VIEW_OPT_BUTT] ;
+  Fl_Input         *view_input[VIEW_OPT_BUTT] ;
+  Fl_Repeat_Button *view_butt_rep[VIEW_OPT_BUTT] ;
+  Fl_Choice        *view_choice[VIEW_OPT_BUTT] ;
+
+  Colorbar_Window  *view_colorbar_window ;
+  Fl_Return_Button *view_ok ;
+
   // statistics window
   Fl_Window        *stat_window ;
   Fl_Output        *stat_value[50] ;
@@ -201,20 +220,6 @@ public:
   // about window
   Fl_Window        *about_window ;
 
-  // view options window
-  int view_number ;
-  Fl_Window        *view_window ;
-  Fl_Group         *view_3d, *view_2d, *view_range, *view_vector ;
-#define VIEW_OPT_BUTT 100
-  Fl_Check_Button  *view_butt[VIEW_OPT_BUTT] ;
-  Fl_Value_Input   *view_value[VIEW_OPT_BUTT] ;
-  Fl_Input         *view_input[VIEW_OPT_BUTT] ;
-  Fl_Repeat_Button *view_butt_rep[VIEW_OPT_BUTT] ;
-  Fl_Choice        *view_choice[VIEW_OPT_BUTT] ;
-
-  Colorbar_Window  *view_colorbar_window ;
-  Fl_Return_Button *view_ok ;
-  
   // geometry context window
   Fl_Window        *context_geometry_window ;
   Fl_Input         *context_geometry_input[30] ;
@@ -233,6 +238,8 @@ public:
   // create the windows
   void create_menu_window(int argc, char **argv);
   void create_graphic_window(int argc, char **argv);
+  void create_option_window();
+  void hide_option_subwindows();
   void create_general_options_window();
   void create_geometry_options_window();
   void create_mesh_options_window();
@@ -273,6 +280,7 @@ public:
   int  global_shortcuts(int event);
   int  arrow_shortcuts();
   void reset_visibility();
+  void reset_option_browser();
   int  selection, try_selection, quit_selection, end_selection;
 
 };
diff --git a/doc/FAQ b/doc/FAQ
index ef974038088e0420e150b3fc6d9a19e681ef288a..a2785016444c9cf0c3fcce0b9875ef9d370d78a9 100644
--- a/doc/FAQ
+++ b/doc/FAQ
@@ -1,4 +1,4 @@
-GMSH FREQUENTLY ASKED QUESTIONS ($Date: 2002-11-13 19:33:10 $)
+GMSH FREQUENTLY ASKED QUESTIONS ($Date: 2002-11-16 21:53:24 $)
 
 1. GENERAL
 ==========
@@ -92,7 +92,7 @@ problem:
 
 Try the new isotropic algorithm:
 - on the command line: gmsh -algo tri
-- in the interface: Options->Mesh->2D->New isotropic algorithm
+- in the interface: Tools->Options->Mesh->2D->New isotropic algorithm
 - in input files: Mesh.Algorithm = 3
 The old 2D algorithm will disappear once all its features are
 integrated in the new one, so please don't send bug reports on the
@@ -139,7 +139,7 @@ The swapping algorithm is not very clever at the moment. Try to change
 the surface mesh a bit, or recombine your mesh to generate prisms or
 hexahedra.
 
-5.8) File->Visibility does not seem to work with extruded meshes.
+5.8) Tools->Visibility does not seem to work with extruded meshes.
 
 This a known problem (due to the fact that numbers are explicitly
 assigned to mesh entities in the extrude commands, which destroys
diff --git a/doc/VERSIONS b/doc/VERSIONS
index e630e55e716a031461b06c890605ade17afb9ca3..6f50e09b48d2d8dacedeb760cd313f04f8fb62e3 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,8 +1,9 @@
-$Date: 2002-11-08 19:16:57 $
+$Date: 2002-11-16 21:53:24 $
 
-New in 1.36: Enhance view duplication (one can now use "Duplicata
-View[num]" in the input file); enhance discoverability of the view
-option menu; new 3D point display; small bug fixes ("Print" format in
+New in 1.36: Enhanced view duplication (one can now use "Duplicata
+View[num]" in the input file); Merged all option dialogs in a new
+general option window; enhanced discoverability of the view option
+menus; new 3D point display; small bug fixes ("Print" format in
 parser, post-processing statistics, smooth normals, etc.);
 
 New in 1.35: Graphical user interface upgraded to FLTK 1.1 (tooltips,
diff --git a/tutorial/README b/tutorial/README
index 15a143fe901882ad976f24d9b60c4ca5f564bf50..bcbbfc0d660c6da3f0641b4488136493b19e97fa 100644
--- a/tutorial/README
+++ b/tutorial/README
@@ -1,4 +1,4 @@
-$Id: README,v 1.16 2002-09-11 18:29:56 geuzaine Exp $
+$Id: README,v 1.17 2002-11-16 21:53:24 geuzaine Exp $
 
 Here are the examples in the Gmsh tutorial. These examples are
 commented (both C and C++-style comments can be used in Gmsh input
@@ -85,20 +85,19 @@ the following command:
 
 In the Post-Processing module (select 'Post_Processing' in the module
 menu), two view buttons will appear, respectively labeled "a scalar
-map" and "a vector map". A left mouse click toggles the visibility of
-the selected view. A right mouse click provides access to the view's
-options. If you want the modifications made to one view to affect also
-all the other views, select the 'Apply next changes to all views' or
-'Force same options for all views' option in the
-'Options->Post-processing' menu.
+map" and "a vector map". A mouse click on the name will toggle the
+visibility of the selected view, while a click on the arrow button on
+the right will provide access to the view's options. If you want the
+modifications made to one view to affect also all the other views,
+select the 'Apply next changes to all views' or 'Force same options
+for all views' option in the 'Tools->Options->Post-processing' menu.
 
 [NOTE: All the options specified interactively can also be directly
 specified in the ascii input files. All available options, with their
 current values, can be saved into a file by selecting 'File->Save
 as->Gmsh options', or simply viewed by pressing the '?' button in the
 status bar. To save the current options as your default preferences
-for all future Gmsh sessions, use the 'Options->Save options now'
-menu.]
+for all future Gmsh sessions, use the 'Tools->Options->Save' button.]
 
 
 OK, that's all, folks. Enjoy the tutorial.
diff --git a/tutorial/t3.geo b/tutorial/t3.geo
index 4cc3547ebddd8f1bccaff06e4c9fcd07c632fcab..0e590118fe9412487157d4afa93e48dd52f8199f 100644
--- a/tutorial/t3.geo
+++ b/tutorial/t3.geo
@@ -76,4 +76,4 @@ Geometry.Color.Surfaces = Geometry.Color.Points;
 // will dump all current options to the terminal. To save all
 // available options to a file, use the 'File->Save as->Gmsh options'
 // menu. To save the current options as the default options for all
-// future Gmsh sessions, use the 'Options->Save options now' menu.
+// future Gmsh sessions, use the 'Tools->Options->Save' button.