From dcd889048d9ad2dee30417292584fbf2571391fd Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 19 Nov 2001 09:29:18 +0000
Subject: [PATCH] New version numbering (major.minor.patch); Interface polish
 (buttons should not be resized when the size of the window is changed); gl2ps
 update (not finished);

---
 Box/Main.cpp             |   8 ++-
 Common/Bitmaps.h         |   3 +-
 Common/GetOptions.cpp    |  15 ++++-
 Common/Options.cpp       |   4 +-
 Common/Views.cpp         |   4 +-
 Fltk/Callbacks.cpp       |  38 ++++++++---
 Fltk/Callbacks.h         |   7 +-
 Fltk/GUI.cpp             | 134 +++++++++++++++++++++------------------
 Fltk/Main.cpp            |  10 +--
 Fltk/Opengl.cpp          |   4 +-
 Geo/Print_Geo.cpp        |   4 +-
 Graphics/CreateFile.cpp  |  46 ++++++++++----
 Graphics/PostSimplex.cpp |   5 +-
 Graphics/gl2ps.cpp       | 134 +++++++++++++++++++++++++++++----------
 Graphics/gl2ps.h         |  21 ++++--
 Makefile                 |  28 +++++---
 Mesh/Create.cpp          |   4 +-
 Mesh/Mesh.h              |   4 +-
 Mesh/Print_Mesh.cpp      |   8 +--
 doc/gmsh.1               |   4 +-
 doc/gmsh.html            |  18 +++---
 utils/build_machines     |   6 +-
 utils/gmsh.spec          |   9 +--
 23 files changed, 336 insertions(+), 182 deletions(-)

diff --git a/Box/Main.cpp b/Box/Main.cpp
index e12dd1121c..073c4a0789 100644
--- a/Box/Main.cpp
+++ b/Box/Main.cpp
@@ -1,4 +1,4 @@
-// $Id: Main.cpp,v 1.11 2001-10-29 08:52:19 geuzaine Exp $
+// $Id: Main.cpp,v 1.12 2001-11-19 09:29:18 geuzaine Exp $
 
 #include <signal.h>
 #include "ParUtil.h"
@@ -49,12 +49,14 @@ void Info (int level, char *arg0){
     ParUtil::Instance()->Exit();
   case 1:
     if(ParUtil::Instance()->master())
-      fprintf(stderr, "%.2f\n", GMSH_VERSION);
+      fprintf(stderr, "%d.%d.%d\n", GMSH_MAJOR_VERSION, GMSH_MINOR_VERSION, 
+	      GMSH_PATCH_VERSION);
     ParUtil::Instance()->Exit();
   case 2:
     if(ParUtil::Instance()->master())
       {
-	fprintf(stderr, "%s%.2f\n", gmsh_version, GMSH_VERSION);
+	fprintf(stderr, "%s%d.%d.%d\n", gmsh_version, GMSH_MAJOR_VERSION, 
+		GMSH_MINOR_VERSION, GMSH_PATCH_VERSION);
 	fprintf(stderr, "%s\n", gmsh_os);
 	fprintf(stderr, "%s\n", gmsh_date);
 	fprintf(stderr, "%s\n", gmsh_host);
diff --git a/Common/Bitmaps.h b/Common/Bitmaps.h
index fa89f7c7a8..fd78a65d29 100644
--- a/Common/Bitmaps.h
+++ b/Common/Bitmaps.h
@@ -108,12 +108,13 @@ static char about_bits[] = {
  0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0xfe};
 
 // 'Abort' bitmap
-
+/* disabled until mesh thread is back
 #define abort_width 13
 #define abort_height 13
 static char abort_bits[] = {
  0x00,0xe0,0x40,0xe0,0x40,0xe0,0x50,0xe1,0x48,0xe2,0x44,0xe4,0x44,0xe4,0x44,
  0xe4,0x04,0xe4,0x04,0xe4,0x08,0xe2,0xf0,0xe1,0x00,0xe0};
+*/
 
 // 'Play button' bitmap
 
diff --git a/Common/GetOptions.cpp b/Common/GetOptions.cpp
index 5a2f0813e4..44ac269c80 100644
--- a/Common/GetOptions.cpp
+++ b/Common/GetOptions.cpp
@@ -1,4 +1,4 @@
-// $Id: GetOptions.cpp,v 1.41 2001-10-29 08:52:19 geuzaine Exp $
+// $Id: GetOptions.cpp,v 1.42 2001-11-19 09:29:18 geuzaine Exp $
 
 #include <unistd.h>
 #include "Gmsh.h"
@@ -13,6 +13,13 @@
 #include "OpenFile.h"
 #include "Parser.h"
 
+#ifndef GMSH_MAJOR_VERSION
+#error 
+#error Common/GmshVersion.h is not up-to-date. 
+#error Please run 'make tag'.
+#error
+#endif
+
 extern Context_T  CTX;
 
 char  *TheFileNameTab[MAX_OPEN_FILES];
@@ -309,12 +316,14 @@ void Get_Options (int argc, char *argv[], int *nbfiles) {
       }
       else if(!strcmp(argv[i]+1, "version") || 
               !strcmp(argv[i]+1, "-version")){
-        fprintf(stderr, "%.2f\n", GMSH_VERSION);
+        fprintf(stderr, "%d.%d.%d\n", GMSH_MAJOR_VERSION, GMSH_MINOR_VERSION, 
+		GMSH_PATCH_VERSION);
         exit(1);
       }
       else if(!strcmp(argv[i]+1, "info") || 
               !strcmp(argv[i]+1, "-info")){
-        fprintf(stderr, "%s%.2f\n", gmsh_version, GMSH_VERSION);
+        fprintf(stderr, "%s%d.%d.%d\n", gmsh_version, GMSH_MAJOR_VERSION, 
+	      GMSH_MINOR_VERSION, GMSH_PATCH_VERSION);
         fprintf(stderr, "%s\n", gmsh_os);
 #if _FLTK
         fprintf(stderr, "%sFLTK %d.%d.%d\n", gmsh_gui, FL_MAJOR_VERSION, 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index a4b009b579..9a8c586598 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.61 2001-11-14 14:39:39 geuzaine Exp $
+// $Id: Options.cpp,v 1.62 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -145,7 +145,7 @@ void Print_Options(int num, int level, char *filename){
   if(filename){
     file = fopen(filename,"w");
     if(!file){
-      Msg(WARNING, "Unable to open file '%s'", filename);
+      Msg(GERROR, "Unable to open file '%s'", filename);
       return;
     }
   }
diff --git a/Common/Views.cpp b/Common/Views.cpp
index 017ca0af34..f1814f7a95 100644
--- a/Common/Views.cpp
+++ b/Common/Views.cpp
@@ -1,4 +1,4 @@
-// $Id: Views.cpp,v 1.59 2001-11-05 08:37:43 geuzaine Exp $
+// $Id: Views.cpp,v 1.60 2001-11-19 09:29:18 geuzaine Exp $
 
 #include <set>
 #include "Gmsh.h"
@@ -678,7 +678,7 @@ void Write_View(int Flag_BIN, Post_View *v, char *filename){
   if(filename){
     file = fopen(filename,"w");
     if(!file){
-      Msg(WARNING, "Unable to open file '%s'", filename);
+      Msg(GERROR, "Unable to open file '%s'", filename);
       return;
     }
   }
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 41a5a19f2a..8929e4d799 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.93 2001-11-14 14:39:39 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.94 2001-11-19 09:29:18 geuzaine Exp $
 
 #include <sys/types.h>
 #include <signal.h>
@@ -240,30 +240,52 @@ void file_save_as_gref_cb(CALLBACK_ARGS) {
   if((newfile = fl_file_chooser("Save GREF file", "*", NULL)))
     CreateOutputFile(newfile, CTX.print.format = CTX.mesh.format = FORMAT_GREF); 
 }
-void file_save_as_eps_simple_cb(CALLBACK_ARGS) {
+void file_save_as_ps_simple_cb(CALLBACK_ARGS) {
   char *newfile;
-  if((newfile = fl_file_chooser("Save EPS file", "*", NULL))){
+  if((newfile = fl_file_chooser("Save PS file", "*", NULL))){
     int old = CTX.print.eps_quality;
     CTX.print.eps_quality = 1; 
-    CreateOutputFile(newfile, CTX.print.format = FORMAT_EPS); 
+    CreateOutputFile(newfile, CTX.print.format = FORMAT_PS); 
     CTX.print.eps_quality = old; 
   }
 }
-void file_save_as_eps_accurate_cb(CALLBACK_ARGS) {
+void file_save_as_ps_accurate_cb(CALLBACK_ARGS) {
   char *newfile;
-  if((newfile = fl_file_chooser("Save EPS file", "*", NULL))){
+  if((newfile = fl_file_chooser("Save PS file", "*", NULL))){
     int old = CTX.print.eps_quality;
     CTX.print.eps_quality = 2; 
-    CreateOutputFile(newfile, CTX.print.format = FORMAT_EPS); 
+    CreateOutputFile(newfile, CTX.print.format = FORMAT_PS); 
     CTX.print.eps_quality = old; 
   }
 }
+void file_save_as_pstex_simple_cb(CALLBACK_ARGS) {
+  char *newfile;
+  if((newfile = fl_file_chooser("Save LaTeX file (PS part)", "*", NULL))){
+    int old = CTX.print.eps_quality;
+    CTX.print.eps_quality = 1; 
+    CreateOutputFile(newfile, CTX.print.format = FORMAT_PSTEX); 
+    CTX.print.eps_quality = old; 
+  }
+}
+void file_save_as_pstex_accurate_cb(CALLBACK_ARGS) {
+  char *newfile;
+  if((newfile = fl_file_chooser("Save LaTeX file (PS part)", "*", NULL))){
+    int old = CTX.print.eps_quality;
+    CTX.print.eps_quality = 2; 
+    CreateOutputFile(newfile, CTX.print.format = FORMAT_PSTEX); 
+    CTX.print.eps_quality = old; 
+  }
+}
+void file_save_as_tex_cb(CALLBACK_ARGS) {
+  char *newfile;
+  if((newfile = fl_file_chooser("Save LaTeX file (TeX part)", "*", NULL)))
+    CreateOutputFile(newfile, CTX.print.format = FORMAT_TEX); 
+}
 void file_save_as_jpeg_cb(CALLBACK_ARGS) {
   char *newfile;
   if((newfile = fl_file_chooser("Save JPEG file", "*", NULL)))
     CreateOutputFile(newfile, CTX.print.format = FORMAT_JPEG); 
 }
-
 void file_save_as_gif_cb(CALLBACK_ARGS) {
   char *newfile;
   if((newfile = fl_file_chooser("Save GIF file", "*", NULL))){
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index 1657d23840..4b3aac5ff7 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -29,8 +29,11 @@ void file_save_as_msh_cb(CALLBACK_ARGS) ;
 void file_save_as_msh_all_cb(CALLBACK_ARGS) ;
 void file_save_as_unv_cb(CALLBACK_ARGS) ;
 void file_save_as_gref_cb(CALLBACK_ARGS) ;
-void file_save_as_eps_simple_cb(CALLBACK_ARGS) ;
-void file_save_as_eps_accurate_cb(CALLBACK_ARGS) ;
+void file_save_as_ps_simple_cb(CALLBACK_ARGS) ;
+void file_save_as_ps_accurate_cb(CALLBACK_ARGS) ;
+void file_save_as_pstex_simple_cb(CALLBACK_ARGS) ;
+void file_save_as_pstex_accurate_cb(CALLBACK_ARGS) ;
+void file_save_as_tex_cb(CALLBACK_ARGS) ;
 void file_save_as_jpeg_cb(CALLBACK_ARGS) ;
 void file_save_as_gif_cb(CALLBACK_ARGS) ;
 void file_save_as_gif_dithered_cb(CALLBACK_ARGS) ;
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 462d9148b3..091c015fa0 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.128 2001-11-14 14:39:39 geuzaine Exp $
+// $Id: GUI.cpp,v 1.129 2001-11-19 09:29:18 geuzaine Exp $
 
 // To make the interface as visually consistent as possible, please:
 // - use the IW, BB, BH, BW and WB values
@@ -64,14 +64,17 @@ Fl_Menu_Item m_menubar_table[] = {
          {"Gref mesh format (gref)...",        0, (Fl_Callback *)file_save_as_gref_cb, 0},
          {0},
       {"Image",  0, 0, 0, FL_SUBMENU},
-         {"PostScript fast (ps)...",  0, (Fl_Callback *)file_save_as_eps_simple_cb, 0},
-         {"PostScript accurate...",   0, (Fl_Callback *)file_save_as_eps_accurate_cb, 0},
-         {"Jpeg (jpg)...",            0, (Fl_Callback *)file_save_as_jpeg_cb, 0},
-         {"GIF (gif)...",             0, (Fl_Callback *)file_save_as_gif_cb, 0},
-         {"GIF dithered...",          0, (Fl_Callback *)file_save_as_gif_dithered_cb, 0},
-         {"GIF transparent...",       0, (Fl_Callback *)file_save_as_gif_transparent_cb, 0},
-         {"PPM (ppm)...",             0, (Fl_Callback *)file_save_as_ppm_cb, 0},
-         {"UCB YUV (yuv)...",         0, (Fl_Callback *)file_save_as_yuv_cb, 0},
+         {"PostScript, fast (ps)...",  0, (Fl_Callback *)file_save_as_ps_simple_cb, 0},
+         {"PostScript, accurate...",   0, (Fl_Callback *)file_save_as_ps_accurate_cb, 0},
+         {"LaTeX, PS part, fast...",      0, (Fl_Callback *)file_save_as_pstex_simple_cb, 0},
+         {"LaTeX, PS part, accurate...",  0, (Fl_Callback *)file_save_as_pstex_accurate_cb, 0},
+         {"LaTeX, TeX part (tex)...",  0, (Fl_Callback *)file_save_as_tex_cb, 0},
+         {"Jpeg (jpg)...",             0, (Fl_Callback *)file_save_as_jpeg_cb, 0},
+         {"GIF (gif)...",              0, (Fl_Callback *)file_save_as_gif_cb, 0},
+         {"GIF, dithered...",          0, (Fl_Callback *)file_save_as_gif_dithered_cb, 0},
+         {"GIF, transparent...",       0, (Fl_Callback *)file_save_as_gif_transparent_cb, 0},
+         {"PPM (ppm)...",              0, (Fl_Callback *)file_save_as_ppm_cb, 0},
+         {"UCB YUV (yuv)...",          0, (Fl_Callback *)file_save_as_yuv_cb, 0},
          {0},
       {0},
     {"Messages...",      FL_SHIFT+'l', (Fl_Callback *)opt_message_cb, 0},
@@ -816,55 +819,59 @@ void GUI::create_graphic_window(int argc, char **argv){
     g_opengl_window->mode(FL_RGB | FL_DEPTH | FL_SINGLE);
   }
   g_opengl_window->end();
+
+  Fl_Box *bottom = new Fl_Box(0,glheight,width,sh);
+  bottom->box(FL_THIN_UP_BOX);
+
+  x = 2;
+  
+  g_status_butt[0] = new Fl_Button(x,glheight+2,sw,sh-4,"X"); x+=sw;
+  g_status_butt[0]->callback(status_xyz1p_cb, (void*)0);
+  //g_status_butt[0]->tooltip("Set X view");
+  g_status_butt[1] = new Fl_Button(x,glheight+2,sw,sh-4,"Y"); x+=sw;
+  g_status_butt[1]->callback(status_xyz1p_cb, (void*)1);
+  //g_status_butt[1]->tooltip("Set Y view");
+  g_status_butt[2] = new Fl_Button(x,glheight+2,sw,sh-4,"Z"); x+=sw;
+  g_status_butt[2]->callback(status_xyz1p_cb, (void*)2);
+  //g_status_butt[2]->tooltip("Set Z view");
+  g_status_butt[3] = new Fl_Button(x,glheight+2,2*CTX.fontsize,sh-4,"1:1"); x+=2*CTX.fontsize;
+  g_status_butt[3]->callback(status_xyz1p_cb, (void*)3);
+  //g_status_butt[3]->tooltip("Set unit scale");
+  g_status_butt[4] = new Fl_Button(x,glheight+2,sw,sh-4,"?"); x+=sw;
+  g_status_butt[4]->callback(status_xyz1p_cb, (void*)4);
+  //g_status_butt[4]->tooltip("Show current options");
+  g_status_butt[5] = new Fl_Button(x,glheight+2,sw,sh-4); x+=sw;
+  g_status_butt[5]->callback(status_play_cb);
+  start_bmp = new Fl_Bitmap(start_bits,start_width,start_height);
+  start_bmp->label(g_status_butt[5]);
+  stop_bmp = new Fl_Bitmap(stop_bits,stop_width,stop_height);
+  g_status_butt[5]->deactivate();
+  //g_status_butt[5]->tooltip("Play/pause animation");
+  /*
+  g_status_butt[6] = new Fl_Button(x,glheight+2,sw,sh-4); x+=sw;
+  g_status_butt[6]->callback(status_cancel_cb);
+  abort_bmp = new Fl_Bitmap(abort_bits,abort_width,abort_height);
+  abort_bmp->label(g_status_butt[6]);
+  g_status_butt[6]->deactivate();
+  */
+  for(i = 0 ; i<6/*7*/ ; i++){
+    g_status_butt[i]->box(FL_FLAT_BOX);
+    g_status_butt[i]->selection_color(FL_WHITE);
+    g_status_butt[i]->labelsize(CTX.fontsize);
+    g_status_butt[i]->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
+  }
+  
+  g_status_label[0] = new Fl_Box(x,glheight+2,(width-x)/3,sh-4);
+  g_status_label[1] = new Fl_Box(x+(width-x)/3,glheight+2,(width-x)/3,sh-4);
+  g_status_label[2] = new Fl_Box(x+2*(width-x)/3,glheight+2,(width-x)/3-2,sh-4);
+  for(i = 0 ; i<3 ; i++){
+    g_status_label[i]->box(FL_FLAT_BOX);
+    g_status_label[i]->labelsize(CTX.fontsize);
+    g_status_label[i]->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
+  }
+  
+  g_window->resizable(new Fl_Box(x,0,width-x,glheight));
   
-  {
-    Fl_Group *o = new Fl_Group(0,glheight,width,sh);
-    o->box(FL_THIN_UP_BOX);
-    
-    x = 2;
-    
-    g_status_butt[0] = new Fl_Button(x,glheight+2,sw,sh-4,"X"); x+=sw;
-    g_status_butt[0]->callback(status_xyz1p_cb, (void*)0);
-    //g_status_butt[0]->tooltip("Set X view");
-    g_status_butt[1] = new Fl_Button(x,glheight+2,sw,sh-4,"Y"); x+=sw;
-    g_status_butt[1]->callback(status_xyz1p_cb, (void*)1);
-    g_status_butt[2] = new Fl_Button(x,glheight+2,sw,sh-4,"Z"); x+=sw;
-    g_status_butt[2]->callback(status_xyz1p_cb, (void*)2);
-    g_status_butt[3] = new Fl_Button(x,glheight+2,2*CTX.fontsize,sh-4,"1:1"); x+=2*CTX.fontsize;
-    g_status_butt[3]->callback(status_xyz1p_cb, (void*)3);
-    g_status_butt[4] = new Fl_Button(x,glheight+2,sw,sh-4,"?"); x+=sw;
-    g_status_butt[4]->callback(status_xyz1p_cb, (void*)4);
-    g_status_butt[5] = new Fl_Button(x,glheight+2,sw,sh-4); x+=sw;
-    g_status_butt[5]->callback(status_play_cb);
-    start_bmp = new Fl_Bitmap(start_bits,start_width,start_height);
-    start_bmp->label(g_status_butt[5]);
-    stop_bmp = new Fl_Bitmap(stop_bits,stop_width,stop_height);
-    g_status_butt[5]->deactivate();
-    g_status_butt[6] = new Fl_Button(x,glheight+2,sw,sh-4); x+=sw;
-    g_status_butt[6]->callback(status_cancel_cb);
-    abort_bmp = new Fl_Bitmap(abort_bits,abort_width,abort_height);
-    abort_bmp->label(g_status_butt[6]);
-    g_status_butt[6]->deactivate();
-    for(i = 0 ; i<7 ; i++){
-      g_status_butt[i]->box(FL_FLAT_BOX);
-      g_status_butt[i]->selection_color(FL_WHITE);
-      g_status_butt[i]->labelsize(CTX.fontsize);
-      g_status_butt[i]->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
-    }
-    
-    g_status_label[0] = new Fl_Box(x,glheight+2,(width-x)/3,sh-4);
-    g_status_label[1] = new Fl_Box(x+(width-x)/3,glheight+2,(width-x)/3,sh-4);
-    g_status_label[2] = new Fl_Box(x+2*(width-x)/3,glheight+2,(width-x)/3-2,sh-4);
-    for(i = 0 ; i<3 ; i++){
-      g_status_label[i]->box(FL_FLAT_BOX);
-      g_status_label[i]->labelsize(CTX.fontsize);
-      g_status_label[i]->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP);
-    }
-    
-    o->end();
-  }
-  
-  g_window->resizable(g_opengl_window);
   g_window->position(CTX.gl_position[0],CTX.gl_position[1]);
   g_window->end();   
 }
@@ -1829,8 +1836,6 @@ PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p){
       add_multiline_in_browser(o, "Copyright: ", copyright);
       o->textsize(CTX.fontsize);
       
-      pdb->main_window->resizable(o);
-
       g->end();
     }
     o->end();
@@ -1843,6 +1848,8 @@ PluginDialogBox * GUI::create_plugin_window(GMSH_Plugin *p){
   pdb->run_button = new Fl_Return_Button(width-2*BB-2*WB, height-BH-WB, BB, BH, "Run");
   pdb->run_button->labelsize(CTX.fontsize);
 
+  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);
@@ -1891,7 +1898,8 @@ void GUI::create_message_window(){
     o->callback(cancel_cb, (void*)msg_window);
   }
   
-  msg_window->resizable(msg_browser);
+  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();
@@ -1907,7 +1915,7 @@ void GUI::save_message(char *filename){
   FILE *fp;
 
   if(!(fp = fopen(filename,"w"))) {
-    Msg(WARNING, "Unable to open file '%s'", filename); 
+    Msg(GERROR, "Unable to open file '%s'", filename); 
     return;
   }
   for(int i = 1 ; i<=msg_browser->size() ; i++){
@@ -1966,7 +1974,8 @@ void GUI::create_about_window(){
     o->add("@c@b@.gmsh@geuz.org");
 #endif
     o->add("");
-    sprintf(buffer, "@c@.Version: %.2f", GMSH_VERSION); o->add(buffer);
+    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",
@@ -2352,7 +2361,6 @@ void GUI::create_view_options_window(int num){
     view_window->position(m_window->x()+m_window->w()/2-width/2,
 			  m_window->y()+9*BH-height/2);
   
-  //view_window->resizable(view_colorbar_window);
   view_window->end();
   
 }
diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp
index 9671c54bd4..97785aff17 100644
--- a/Fltk/Main.cpp
+++ b/Fltk/Main.cpp
@@ -1,4 +1,4 @@
-// $Id: Main.cpp,v 1.34 2001-10-30 08:18:50 geuzaine Exp $
+// $Id: Main.cpp,v 1.35 2001-11-19 09:29:18 geuzaine Exp $
 
 #include <signal.h>
 #include <time.h>
@@ -58,8 +58,9 @@ int main(int argc, char *argv[]){
     CTX.terminal = 1;
 
   if(CTX.verbosity && CTX.terminal)
-    fprintf(stderr, "%s, version %.2f, started %s\n", 
-	    gmsh_progname, GMSH_VERSION, currtime);
+    fprintf(stderr, "%s, version %d.%d.%d, started %s\n", 
+	    gmsh_progname, GMSH_MAJOR_VERSION, GMSH_MINOR_VERSION, 
+	    GMSH_PATCH_VERSION, currtime);
 
   // Register Default Plugins (in test ...)
   if(CTX.default_plugins)
@@ -133,7 +134,8 @@ int main(int argc, char *argv[]){
   // Say welcome!
 
   Msg(STATUS3N, "Ready");
-  Msg(STATUS1, "Gmsh %.2f", GMSH_VERSION);
+  Msg(STATUS1, "Gmsh %d.%d.%d", GMSH_MAJOR_VERSION, GMSH_MINOR_VERSION, 
+      GMSH_PATCH_VERSION);
 
   // Log the following for bug reports
   
diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp
index 05ef5557dc..e35fb47cd6 100644
--- a/Fltk/Opengl.cpp
+++ b/Fltk/Opengl.cpp
@@ -1,4 +1,4 @@
-// $Id: Opengl.cpp,v 1.23 2001-10-30 08:18:50 geuzaine Exp $
+// $Id: Opengl.cpp,v 1.24 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -53,7 +53,7 @@ void DrawUI(void){
 void Draw_String(char *s){
 
   if(CTX.stream == TO_FILE){
-    if(!CTX.print.gl_fonts && CTX.print.eps_quality > 0){
+    if(!CTX.print.gl_fonts){
       gl2psText(s,CTX.print.eps_font,CTX.print.eps_font_size);
       return ;
     }
diff --git a/Geo/Print_Geo.cpp b/Geo/Print_Geo.cpp
index a5e1efb255..18f86568fa 100644
--- a/Geo/Print_Geo.cpp
+++ b/Geo/Print_Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: Print_Geo.cpp,v 1.22 2001-11-05 08:36:49 geuzaine Exp $
+// $Id: Print_Geo.cpp,v 1.23 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Geo.h"
@@ -234,7 +234,7 @@ void Print_Geo(Mesh *M, char *filename){
   if(filename){
     FOUT = fopen(filename,"w");
     if(!FOUT){
-      Msg(WARNING, "Unable to open file '%s'", filename);
+      Msg(GERROR, "Unable to open file '%s'", filename);
       return;
     }
   }
diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp
index fe89687f01..b9750a0e94 100644
--- a/Graphics/CreateFile.cpp
+++ b/Graphics/CreateFile.cpp
@@ -1,4 +1,4 @@
-// $Id: CreateFile.cpp,v 1.22 2001-11-13 08:11:21 geuzaine Exp $
+// $Id: CreateFile.cpp,v 1.23 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -52,8 +52,10 @@ void CreateOutputFile (char *name, int format) {
     else if(!strcmp(ext,".gif")) CreateOutputFile(name, FORMAT_GIF);
     else if(!strcmp(ext,".jpg")) CreateOutputFile(name, FORMAT_JPEG);
     else if(!strcmp(ext,".jpeg")) CreateOutputFile(name, FORMAT_JPEG);
-    else if(!strcmp(ext,".ps")) CreateOutputFile(name, FORMAT_EPS);
-    else if(!strcmp(ext,".eps")) CreateOutputFile(name, FORMAT_EPS);
+    else if(!strcmp(ext,".ps")) CreateOutputFile(name, FORMAT_PS);
+    else if(!strcmp(ext,".eps")) CreateOutputFile(name, FORMAT_PS);
+    else if(!strcmp(ext,".tex")) CreateOutputFile(name, FORMAT_TEX);
+    else if(!strcmp(ext,".pstex")) CreateOutputFile(name, FORMAT_PSTEX);
     else if(!strcmp(ext,".ppm")) CreateOutputFile(name, FORMAT_PPM);
     else if(!strcmp(ext,".yuv")) CreateOutputFile(name, FORMAT_YUV);
     else if(!strcmp(ext,".gref")) CreateOutputFile(name, FORMAT_GREF);
@@ -83,7 +85,7 @@ void CreateOutputFile (char *name, int format) {
 
   case FORMAT_JPEG :
     if(!(fp = fopen(name,"wb"))) {
-      Msg(WARNING, "Unable to open file '%s'", name); 
+      Msg(GERROR, "Unable to open file '%s'", name); 
       return;
     }
     FillBuffer();
@@ -97,7 +99,7 @@ void CreateOutputFile (char *name, int format) {
 
   case FORMAT_GIF :
     if(!(fp = fopen(name,"wb"))) {
-      Msg(WARNING, "Unable to open file '%s'", name); 
+      Msg(GERROR, "Unable to open file '%s'", name); 
       return;
     }
     FillBuffer();
@@ -117,7 +119,7 @@ void CreateOutputFile (char *name, int format) {
 
   case FORMAT_PPM :
     if(!(fp = fopen(name,"wb"))) {
-      Msg(WARNING, "Unable to open file '%s'", name); 
+      Msg(GERROR, "Unable to open file '%s'", name); 
       return;
     }
     FillBuffer();
@@ -130,7 +132,7 @@ void CreateOutputFile (char *name, int format) {
 
   case FORMAT_YUV :
     if(!(fp = fopen(name,"wb"))) {
-      Msg(WARNING, "Unable to open file '%s'", name); 
+      Msg(GERROR, "Unable to open file '%s'", name); 
       return;
     }
     FillBuffer();
@@ -141,9 +143,10 @@ void CreateOutputFile (char *name, int format) {
     fclose(fp);
     break;
 
-  case FORMAT_EPS :
+  case FORMAT_PS :
+  case FORMAT_PSTEX :
     if(!(fp = fopen(name,"w"))) {
-      Msg(WARNING, "Unable to open file '%s'", name); 
+      Msg(GERROR, "Unable to open file '%s'", name); 
       return;
     }
     CTX.print.gl_fonts = 0;
@@ -152,9 +155,11 @@ void CreateOutputFile (char *name, int format) {
     while(res == GL2PS_OVERFLOW){
       size3d += 2048*2048 ;
       gl2psBeginPage(CTX.base_filename, "Gmsh", 
+		     GL2PS_PS,
 		     (CTX.print.eps_quality == 1 ? GL2PS_SIMPLE_SORT : GL2PS_BSP_SORT),
 		     GL2PS_SIMPLE_LINE_OFFSET | 
-		     (CTX.print.eps_background ? GL2PS_DRAW_BACKGROUND : 0),
+		     (CTX.print.eps_background ? GL2PS_DRAW_BACKGROUND : 0) |
+		     (format==FORMAT_PSTEX ? GL2PS_NO_TEXT : 0),
 		     GL_RGBA, 0, NULL, size3d, fp);
       CTX.stream = TO_FILE ;
       FillBuffer();
@@ -166,7 +171,26 @@ void CreateOutputFile (char *name, int format) {
     fclose(fp);
     CTX.print.gl_fonts = 1;
     break ;
-    
+
+  case FORMAT_TEX :
+    if(!(fp = fopen(name,"w"))) {
+      Msg(GERROR, "Unable to open file '%s'", name); 
+      return;
+    }
+    gl2psBeginPage(CTX.base_filename, "Gmsh", 
+		   GL2PS_TEX, GL2PS_NO_SORT, 0, 
+		   GL_RGBA, 0, NULL, 1, fp);
+    CTX.stream = TO_FILE ;
+    CTX.print.gl_fonts = 0;
+    FillBuffer();
+    CTX.stream = TO_SCREEN ;
+    CTX.print.gl_fonts = 1;
+    res = gl2psEndPage();
+    Msg(INFO, "TEX creation complete '%s'", name);
+    Msg(STATUS2, "Wrote '%s'", name);
+    fclose(fp);
+    break;
+
   default :
     Msg(WARNING, "Unknown print format");
     break;
diff --git a/Graphics/PostSimplex.cpp b/Graphics/PostSimplex.cpp
index 3c85a266a6..85acc5d55c 100644
--- a/Graphics/PostSimplex.cpp
+++ b/Graphics/PostSimplex.cpp
@@ -1,4 +1,4 @@
-// $Id: PostSimplex.cpp,v 1.30 2001-08-23 17:19:06 geuzaine Exp $
+// $Id: PostSimplex.cpp,v 1.31 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "GmshUI.h"
@@ -257,7 +257,8 @@ void Draw_ScalarTriangle(Post_View *View, int preproNormals,
 	  norms[3*i+2] = nn[2];
 	  if(!View->get_normal(X[i]+Raise[0][i],Y[i]+Raise[1][i],Z[i]+Raise[2][i],
 			       norms[3*i],norms[3*i+1],norms[3*i+2])){
-	    Msg(WARNING, "Oups, did not find smoothed normal");
+	    //don't print this (unless we fix draw_vector_triangle with displacement)
+	    //Msg(WARNING, "Oups, did not find smoothed normal");
 	  }
 	}
       }
diff --git a/Graphics/gl2ps.cpp b/Graphics/gl2ps.cpp
index 5ae4ce015b..400a351fe5 100644
--- a/Graphics/gl2ps.cpp
+++ b/Graphics/gl2ps.cpp
@@ -1,10 +1,10 @@
 #include "Gmsh.h"
 #include "GmshUI.h"
 /*
- * GL2PS, an OpenGL to Postscript Printing Library
+ * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2001  Christophe Geuzaine 
  *
- * $Id: gl2ps.cpp,v 1.29 2001-10-08 22:27:19 geuzaine Exp $
+ * $Id: gl2ps.cpp,v 1.30 2001-11-19 09:29:18 geuzaine Exp $
  *
  * E-mail: Christophe.Geuzaine@AdValvas.be
  * URL: http://www.geuz.org/gl2ps/
@@ -31,7 +31,6 @@
 #include <math.h>
 #include <stdarg.h>
 #include <time.h>
-
 #include "gl2ps.h"
 
 /* The static gl2ps context. gl2ps is not thread safe (we should
@@ -834,7 +833,7 @@ GLvoid  gl2psBuildPolygonBoundary(GL2PSbsptree *tree){
 
 GLvoid gl2psAddPolyPrimitive(GLshort type, GLshort numverts, 
 			     GL2PSvertex *verts, GLint offset, 
-			     GLshort dash, GLshort width,
+			     GLshort dash, GLfloat width,
 			     GLshort boundary){
   GLshort         i;
   GLfloat         factor, units, area, dZ, dZdX, dZdY, maxdZ;
@@ -936,7 +935,8 @@ GLint gl2psGetVertex(GL2PSvertex *v, GLfloat *p){
 
 GLint gl2psParseFeedbackBuffer(GLvoid){
   GLint        i, used, count, v, vtot, offset=0;
-  GLshort      boundary, flag, dash=0, psize=1, lwidth=1;
+  GLshort      boundary, flag, dash=0;
+  GLfloat      lwidth=1., psize=1.;
   GLfloat     *current;
   GL2PSvertex  vertices[3];
 
@@ -1028,12 +1028,12 @@ GLint gl2psParseFeedbackBuffer(GLvoid){
       case GL2PS_SET_POINT_SIZE : 
 	current+=2; 
 	used-=2; 
-	psize=(GLint)current[1];
+	psize=current[1];
 	break;
       case GL2PS_SET_LINE_WIDTH : 
 	current+=2; 
 	used-=2; 
-	lwidth=(GLint)current[1];
+	lwidth=current[1];
 	break;
       }
       current += 2; 
@@ -1050,11 +1050,23 @@ GLint gl2psParseFeedbackBuffer(GLvoid){
   return GL2PS_SUCCESS;
 }
 
+GLboolean gl2psVertsSameColor(const GL2PSprimitive *prim){
+  int i;
+  for(i=1; i<prim->numverts; i++){
+    if(prim->verts[0].rgba[0] != prim->verts[i].rgba[0] || 
+       prim->verts[0].rgba[1] != prim->verts[i].rgba[1] || 
+       prim->verts[0].rgba[2] != prim->verts[i].rgba[2]) {
+      return 0;
+    }
+  }
+  return 1;
+}
+
 /* The postscript routines. Other (vector) image formats should be
    easy to generate by creating the three corresponding routines for
    the new format. */
 
-GLvoid gl2psPrintPostscriptHeader(GLvoid){
+GLvoid gl2psPrintPostScriptHeader(GLvoid){
   GLint   viewport[4], index;
   GLfloat rgba[4];
   time_t  now;
@@ -1079,10 +1091,10 @@ GLvoid gl2psPrintPostscriptHeader(GLvoid){
   fprintf(gl2ps.stream, 
 	  "%%!PS-Adobe-3.0\n"
 	  "%%%%Title: %s\n"
-	  "%%%%Creator: GL2PS, an OpenGL to Postscript Printing Library, v. %g\n"
+	  "%%%%Creator: GL2PS, an OpenGL to PostScript Printing Library, v. %g\n"
 	  "%%%%For: %s\n"
 	  "%%%%CreationDate: %s"
-	  "%%%%LanguageLevel: 2\n"
+	  "%%%%LanguageLevel: 3\n"
 	  "%%%%DocumentData: Clean7Bit\n"
 	  "%%%%Pages: 1\n"
 	  "%%%%PageOrder: Ascend\n"
@@ -1103,17 +1115,17 @@ GLvoid gl2psPrintPostscriptHeader(GLvoid){
 	  "/S  { FC moveto show } BD\n"
 	  "/P  { newpath 0.0 360.0 arc closepath fill } BD\n"
 	  "/L  { newpath moveto lineto stroke } BD\n"
-	  "/SL { /b1 exch def /g1 exch def /r1 exch def /y1 exch def\n"
-	  "      /x1 exch def /b2 exch def /g2 exch def /r2 exch def /y2 exch def\n"
-	  "      /x2 exch def b2 b1 sub abs 0.01 gt g2 g1 sub abs 0.005 gt r2 r1 sub\n"
-	  "      abs 0.008 gt or or { /bm b1 b2 add 0.5 mul def /gm g1 g2 add 0.5 mul def\n"
-	  "      /rm r1 r2 add 0.5 mul def /ym y1 y2 add 0.5 mul def /xm x1 x2 add\n"
-	  "      0.5 mul def x1 y1 r1 g1 b1 xm ym rm gm bm SL xm ym rm gm bm x2 y2 r2\n"
-	  "      g2 b2 SL } { x1 y1 x2 y2 r1 g1 b1 C L } ifelse } BD\n"
+	  "/SL { C moveto C lineto stroke } BD\n"
 	  "/T  { newpath moveto lineto lineto closepath fill } BD\n"
-	  "/ST { /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
+	  "/STshfill { /b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
 	  "      /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
 	  "      /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"
+	  "      gsave << /ShadingType 4 /ColorSpace [/DeviceRGB]\n"
+	  "      /DataSource [ 0 x1 y1 r1 g1 b1 0 x2 y2 r2 g2 b2 0 x3 y3 r3 g3 b3 ] >>\n"
+	  "      shfill grestore } BD\n"
+	  "/STnoshfill {/b1 exch def /g1 exch def /r1 exch def /y1 exch def /x1 exch def\n"
+	  "      /b2 exch def /g2 exch def /r2 exch def /y2 exch def /x2 exch def\n"
+	  "      /b3 exch def /g3 exch def /r3 exch def /y3 exch def /x3 exch def\n"    
 	  "      b2 b1 sub abs 0.05 gt g2 g1 sub abs 0.017 gt r2 r1 sub abs 0.032 gt\n"
 	  "      b3 b1 sub abs 0.05 gt g3 g1 sub abs 0.017 gt r3 r1 sub abs 0.032 gt\n"
 	  "      b2 b3 sub abs 0.05 gt g2 g3 sub abs 0.017 gt r2 r3 sub abs 0.032 gt\n"
@@ -1127,7 +1139,9 @@ GLvoid gl2psPrintPostscriptHeader(GLvoid){
 	  "      r12 g12 b12 x13 y13 r13 g13 b13 x2 y2 r2 g2 b2 x12 y12 r12 g12 b12\n"
 	  "      x32 y32 r32 g32 b32 x3 y3 r3 g3 b3 x32 y32 r32 g32 b32 x13 y13 r13\n"
 	  "      g13 b13 x32 y32 r32 g32 b32 x12 y12 r12 g12 b12 x13 y13 r13 g13 b13\n"
-	  "      ST ST ST ST } { x1 y1 x2 y2 x3 y3 r1 g1 b1 C T } ifelse } BD\n"
+	  "      STnoshfill STnoshfill STnoshfill STnoshfill }\n" 
+	  "      { r1 g1 b1 C x1 y1 x2 y2 x3 y3 T } ifelse } def\n"
+	  "/shfill where { pop /ST { STshfill } BD } { /ST { STnoshfill } BD } ifelse\n"
 	  "end\n"
 	  "%%%%EndProlog\n"
 	  "%%%%BeginSetup\n"
@@ -1173,9 +1187,12 @@ GLvoid gl2psPrintPostscriptHeader(GLvoid){
     fprintf(gl2ps.stream, "%g %g %g C\n", rgba[0], rgba[1], rgba[2]);	\
   }
 
-GLvoid gl2psPrintPostscriptPrimitive(GLvoid *a, GLvoid *b){
+#define CLEARCOLOR rgba[0] = rgba[1] = rgba[2] = -1.
+
+
+GLvoid gl2psPrintPostScriptPrimitive(GLvoid *a, GLvoid *b){
   static GL2PSrgba rgba={-1.,-1.,-1.,-1.};
-  static int linewidth=-1;
+  static float linewidth=-1.;
 
   GL2PSprimitive *prim;
 
@@ -1202,7 +1219,8 @@ GLvoid gl2psPrintPostscriptPrimitive(GLvoid *a, GLvoid *b){
     }
     if(prim->dash)
       fprintf(gl2ps.stream, "[%d] 0 setdash\n", prim->dash);
-    if(gl2ps.shade){
+    if(gl2ps.shade && !gl2psVertsSameColor(prim)){
+      CLEARCOLOR;
       fprintf(gl2ps.stream, "%g %g %g %g %g %g %g %g %g %g SL\n",
 	      prim->verts[1].xyz[0], prim->verts[1].xyz[1],
 	      prim->verts[1].rgba[0], prim->verts[1].rgba[1],
@@ -1220,7 +1238,8 @@ GLvoid gl2psPrintPostscriptPrimitive(GLvoid *a, GLvoid *b){
       fprintf(gl2ps.stream, "[] 0 setdash\n");
     break;
   case GL2PS_TRIANGLE :
-    if(gl2ps.shade){
+    if(gl2ps.shade && !gl2psVertsSameColor(prim)){
+      CLEARCOLOR;
       fprintf(gl2ps.stream, "%g %g %g %g %g %g %g %g %g %g %g %g %g %g %g ST\n",
 	      prim->verts[2].xyz[0], prim->verts[2].xyz[1],
 	      prim->verts[2].rgba[0], prim->verts[2].rgba[1],
@@ -1248,7 +1267,7 @@ GLvoid gl2psPrintPostscriptPrimitive(GLvoid *a, GLvoid *b){
   }
 }
 
-void gl2psPrintPostscriptFooter(GLvoid){
+void gl2psPrintPostScriptFooter(GLvoid){
   fprintf(gl2ps.stream,
 	  "grestore\n"
 	  "showpage\n"
@@ -1259,14 +1278,50 @@ void gl2psPrintPostscriptFooter(GLvoid){
 	  "%%%%EOF\n");
 }
 
+/* The LaTeX routines. */
+
+GLvoid gl2psPrintTeXHeader(GLvoid){
+  GLint   viewport[4];
+
+  glGetIntegerv(GL_VIEWPORT, viewport);
+
+  fprintf(gl2ps.stream, 
+	  "\\begin{picture}(0,0)\n"
+	  "\\includegraphics{}\n"
+	  "\\end{picture}\n"
+	  "\\setlength{\\unitlength}{1pt}\n"
+	  "\\begin{picture}(%d,%d)(%d,%d)\n",
+	  10,10,10,10);
+}
+
+GLvoid gl2psPrintTeXPrimitive(GLvoid *a, GLvoid *b){
+  GL2PSprimitive *prim;
+
+  prim = *(GL2PSprimitive**) a;
+
+  switch(prim->type){
+  case GL2PS_TEXT :
+    fprintf(gl2ps.stream, "\\put(%g,%g){\\makebox(0,0)[lb]{%s}}\n",
+	    prim->verts[0].xyz[0], prim->verts[0].xyz[1], prim->text->str);
+    break;
+  default :
+    break;
+  }
+}
+
+void gl2psPrintTeXFooter(GLvoid){
+  fprintf(gl2ps.stream, "\\end{picture}\n");
+}
+
 
 /* The public routines */
 
-GLvoid gl2psBeginPage(char *title, char *producer, GLint sort, GLint options, 
+GLvoid gl2psBeginPage(char *title, char *producer, 
+		      GLint format, GLint sort, GLint options, 
 		      GLint colormode, GLint colorsize, GL2PSrgba *colormap,
 		      GLint buffersize, FILE *stream){
 
-  gl2ps.format = GL2PS_EPS; /* a new arg should be introduced to select the format */
+  gl2ps.format = format;
   gl2ps.title = title;
   gl2ps.producer = producer;
   gl2ps.sort = sort;
@@ -1312,19 +1367,28 @@ GLint gl2psEndPage(GLvoid){
   glGetIntegerv(GL_SHADE_MODEL, &shademodel);
   gl2ps.shade = (shademodel == GL_SMOOTH);
 
-  res = gl2psParseFeedbackBuffer();
+  if(gl2ps.format & GL2PS_TEX)
+    res = GL2PS_SUCCESS;
+  else
+    res = gl2psParseFeedbackBuffer();
 
   if(gl2ps.feedback) gl2psFree(gl2ps.feedback);
 
   if(res == GL2PS_SUCCESS){
 
     switch(gl2ps.format){
-      /* other vector formats should go here */
-    case GL2PS_EPS :
+    case GL2PS_TEX :
+      phead = gl2psPrintTeXHeader;
+      pprim = gl2psPrintTeXPrimitive;
+      pfoot = gl2psPrintTeXFooter;
+      break;
+    case GL2PS_PS :
+      phead = gl2psPrintPostScriptHeader;
+      pprim = gl2psPrintPostScriptPrimitive;
+      pfoot = gl2psPrintPostScriptFooter;
+      break;
     default :
-      phead = gl2psPrintPostscriptHeader;
-      pprim = gl2psPrintPostscriptPrimitive;
-      pfoot = gl2psPrintPostscriptFooter;
+      gl2psMsg(GL2PS_ERROR, "Unknown format");
       break;
     }
 
@@ -1348,10 +1412,10 @@ GLint gl2psEndPage(GLvoid){
       gl2psBuildBspTree(root, gl2ps.primitives);
       if(gl2ps.boundary) gl2psBuildPolygonBoundary(root);
       if(gl2ps.options & GL2PS_OCCLUSION_CULL){
-	gl2psTraverseBspTree(root, eye, -GL2PS_EPSILON, gl2psLess,
+	gl2psTraverseBspTree(root, eye, -(float)GL2PS_EPSILON, gl2psLess,
 			     gl2psAddInImage);
       }
-      gl2psTraverseBspTree(root, eye, GL2PS_EPSILON, gl2psGreater, 
+      gl2psTraverseBspTree(root, eye, (float)GL2PS_EPSILON, gl2psGreater, 
 			   pprim);
       gl2psFreeBspTree(root);
       res = GL2PS_SUCCESS;
@@ -1374,6 +1438,8 @@ GLvoid gl2psText(char *str, char *fontname, GLint fontsize){
   GL2PSprimitive  *prim;
   GLint           len;
 
+  if(gl2ps.options & GL2PS_NO_TEXT) return;
+
   prim = (GL2PSprimitive *)gl2psMalloc(sizeof(GL2PSprimitive));
   prim->type = GL2PS_TEXT;
   prim->boundary = 0;
diff --git a/Graphics/gl2ps.h b/Graphics/gl2ps.h
index 44c5f81283..605354cbf0 100644
--- a/Graphics/gl2ps.h
+++ b/Graphics/gl2ps.h
@@ -1,8 +1,8 @@
 /*
- * GL2PS, an OpenGL to Postscript Printing Library
+ * GL2PS, an OpenGL to PostScript Printing Library
  * Copyright (C) 1999-2001  Christophe Geuzaine
  *
- * $Id: gl2ps.h,v 1.13 2001-10-08 21:48:19 geuzaine Exp $
+ * $Id: gl2ps.h,v 1.14 2001-11-19 09:29:18 geuzaine Exp $
  *
  * E-mail: Christophe.Geuzaine@AdValvas.be
  * URL: http://www.geuz.org/gl2ps/
@@ -28,14 +28,19 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+
+#ifdef WIN32
+#include <windows.h>
+#endif
 #include <GL/gl.h>
 
-#define GL2PS_VERSION                    0.42
+#define GL2PS_VERSION                    0.5
 #define GL2PS_NONE                       0
 
 /* Output file format */
 
-#define GL2PS_EPS                        1
+#define GL2PS_PS                         1
+#define GL2PS_TEX                        2
 
 /* Sorting algorithms */
 
@@ -50,6 +55,7 @@
 #define GL2PS_SILENT                     (1<<2)
 #define GL2PS_BEST_ROOT                  (1<<3)
 #define GL2PS_OCCLUSION_CULL             (1<<4)
+#define GL2PS_NO_TEXT                    (1<<5)
 
 /* Arguments for gl2psEnable/gl2psDisable */
 
@@ -136,8 +142,8 @@ typedef struct {
 } GL2PSstring;
 
 typedef struct {
-  GLshort type, numverts, boundary, dash, width;
-  GLfloat depth;
+  GLshort type, numverts, boundary, dash;
+  GLfloat width, depth;
   GL2PSvertex *verts;
   GL2PSstring *text;
 } GL2PSprimitive;
@@ -155,7 +161,8 @@ typedef struct {
 
 /* public functions */
 
-GLvoid gl2psBeginPage(char *title, char *producer, GLint sort, GLint options, 
+GLvoid gl2psBeginPage(char *title, char *producer, 
+		      GLint format, GLint sort, GLint options, 
 		      GLint colormode, GLint colorsize, GL2PSrgba *colormap, 
 		      GLint buffersize, FILE * stream);
 GLint  gl2psEndPage(GLvoid);
diff --git a/Makefile b/Makefile
index ccf492b54c..93d1df7f6a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
-# $Id: Makefile,v 1.162 2001-11-14 19:00:05 geuzaine Exp $
+# $Id: Makefile,v 1.163 2001-11-19 09:29:18 geuzaine Exp $
 
-GMSH_RELEASE = 1.30
+GMSH_MAJOR_VERSION = 1
+GMSH_MINOR_VERSION = 30
+GMSH_PATCH_VERSION = 3
 
 MAKE = make
 CXX = c++
@@ -32,6 +34,7 @@ GMSH_BOX_LIB = -L$(GMSH_LIB_DIR) -lBox -lParser -lMesh -lGeo -lAdapt\
 GMSH_FLTK_LIB = -L$(GMSH_LIB_DIR) -lFltk -lParser -lGraphics -lMesh\
                 -lGeo -lAdapt -lCommon -lDataStr -lJpeg -lPlugin -lParallel -lTriangle
 
+GMSH_RELEASE = $(GMSH_MAJOR_VERSION).$(GMSH_MINOR_VERSION).$(GMSH_PATCH_VERSION)
 GMSH_ARCHIVE = $(GMSH_ARCHIVE_DIR)/gmsh-`date "+%Y.%m.%d"`
 GMSH_SRCRPM = gmsh-$(GMSH_RELEASE)
 GMSH_UNAME = `uname`
@@ -125,7 +128,12 @@ nodepend:
 
 tag:
 	$(RM) $(RMFLAGS) Common/GmshVersion.h
-	echo "#define GMSH_VERSION  $(GMSH_RELEASE)" >  Common/GmshVersion.h
+	echo "#define GMSH_MAJOR_VERSION $(GMSH_MAJOR_VERSION)" >  Common/GmshVersion.h
+	echo "#define GMSH_MINOR_VERSION $(GMSH_MINOR_VERSION)" >> Common/GmshVersion.h
+	echo "#define GMSH_PATCH_VERSION $(GMSH_PATCH_VERSION)" >> Common/GmshVersion.h
+	echo "#define GMSH_VERSION  ((double)GMSH_MAJOR_VERSION + \\" >> Common/GmshVersion.h
+	echo "                0.01 * (double)GMSH_MINOR_VERSION + \\" >> Common/GmshVersion.h
+	echo "              0.0001 * (double)GMSH_PATCH_VERSION)"     >> Common/GmshVersion.h
 	echo "#define GMSH_DATE     \"`date`\""      >> Common/GmshVersion.h
 	echo "#define GMSH_HOST     \"`hostname`\""  >> Common/GmshVersion.h
 	echo "#define GMSH_PACKAGER \"`whoami`\""    >> Common/GmshVersion.h
@@ -133,7 +141,7 @@ tag:
 
 initialtag:
 	@if [ ! -r Common/GmshVersion.h ]; then \
-        $(MAKE) tag ; \
+          $(MAKE) tag ; \
         fi
 
 tags:
@@ -141,8 +149,8 @@ tags:
 	htags
 
 tgz:
-	if (test -f $(GMSH_ARCHIVE).tar.gz); \
-	then mv -f $(GMSH_ARCHIVE).tar.gz $(GMSH_ARCHIVE).tar.gz~; \
+	if (test -f $(GMSH_ARCHIVE).tar.gz); then \
+	  mv -f $(GMSH_ARCHIVE).tar.gz $(GMSH_ARCHIVE).tar.gz~; \
 	fi
 	tar cvf $(GMSH_ARCHIVE).tar $(GMSH_SOURCES)
 	gzip $(GMSH_ARCHIVE).tar
@@ -267,13 +275,13 @@ compile_fltk1:
            "OS_FLAGS=-D_LITTLE_ENDIAN" \
            "VERSION_FLAGS=-D_FLTK" \
            "GL_INCLUDE=" \
-           "GUI_INCLUDE=-I$(HOME)/SOURCES/fltk-1.1.0b5" \
+           "GUI_INCLUDE=-I$(HOME)/SOURCES/fltk-1.1" \
         ); done
 link_fltk1:
 	$(CXX) -o $(GMSH_BIN_DIR)/gmsh $(GMSH_FLTK_LIB)\
-                 $(HOME)/SOURCES/fltk-1.1.0b5/lib/libfltk_gl.a\
+                 $(HOME)/SOURCES/fltk-1.1/lib/libfltk_gl.a\
                  $(OPENGL_LIB) \
-                 $(HOME)/SOURCES/fltk-1.1.0b5/lib/libfltk.a \
+                 $(HOME)/SOURCES/fltk-1.1/lib/libfltk.a \
                  -L/usr/X11R6/lib $(X11_LIB) -lm
 fltk1: compile_fltk1 link_fltk1
 
@@ -318,7 +326,7 @@ link_linux_gcc-2.95:
 linux_gcc-2.95: tag compile_linux_gcc-2.95 link_linux_gcc-2.95 strip_bin
 rpm: src
 	mv $(GMSH_SRCRPM).tar.gz /usr/src/redhat/SOURCES
-	rpm -bb utils/gmsh.spec
+	rpm -bb --define 'gmshversion $(GMSH_RELEASE)' utils/gmsh.spec
 	cp /usr/src/redhat/RPMS/i386/$(GMSH_SRCRPM)-?.i386.rpm .
 	cp /usr/src/redhat/BUILD/$(GMSH_SRCRPM)/gmsh-$(GMSH_RELEASE)-$(GMSH_UNAME).tgz .
 
diff --git a/Mesh/Create.cpp b/Mesh/Create.cpp
index fa15641a2e..c821bd3c70 100644
--- a/Mesh/Create.cpp
+++ b/Mesh/Create.cpp
@@ -1,4 +1,4 @@
-// $Id: Create.cpp,v 1.27 2001-11-16 19:35:26 remacle Exp $
+// $Id: Create.cpp,v 1.28 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -183,7 +183,7 @@ void Add_EdgeLoop (int Num, List_T * intlist, Mesh * M){
 }
 
 void End_Curve (Curve * c){
-  double det, R2, mat[3][3], R, A3, A1, A4;
+  double R2, mat[3][3], R, A3, A1, A4;
   Vertex *v[5], v1, v3, v4;
   double dd[3], qq[3], AX, f1, f2, DP, dir32[3], dir12[3], n[3], m[3], dir42[3];
   double rhs[2], sys[2][2], sol[2];
diff --git a/Mesh/Mesh.h b/Mesh/Mesh.h
index acdffdc247..c79edb5bff 100644
--- a/Mesh/Mesh.h
+++ b/Mesh/Mesh.h
@@ -10,7 +10,7 @@
 #define FORMAT_UNV     2
 #define FORMAT_GREF    3
 #define FORMAT_XPM     4
-#define FORMAT_EPS     5
+#define FORMAT_PS      5
 #define FORMAT_BMP     6
 #define FORMAT_GIF     7
 #define FORMAT_GEO     8
@@ -20,6 +20,8 @@
 #define FORMAT_YUV     12
 #define FORMAT_SMS     14
 #define FORMAT_OPT     15
+#define FORMAT_PSTEX   16
+#define FORMAT_TEX     17
 
 #define CONV_VALUE    0.8
 
diff --git a/Mesh/Print_Mesh.cpp b/Mesh/Print_Mesh.cpp
index 4a5e7493e4..7d480e8d76 100644
--- a/Mesh/Print_Mesh.cpp
+++ b/Mesh/Print_Mesh.cpp
@@ -1,4 +1,4 @@
-// $Id: Print_Mesh.cpp,v 1.31 2001-10-06 09:21:04 geuzaine Exp $
+// $Id: Print_Mesh.cpp,v 1.32 2001-11-19 09:29:18 geuzaine Exp $
 
 #include "Gmsh.h"
 #include "Numeric.h"
@@ -1188,7 +1188,7 @@ void Print_Mesh (Mesh * M, char *c, int Type){
     c ? strcpy (name, c) : strcat (name, ".msh");
     mshfile = fopen (name, "w");
     if (!mshfile){
-      Msg(WARNING, "Unable to open file '%s'", name);
+      Msg(GERROR, "Unable to open file '%s'", name);
       return;
     }
     Msg(INFO, "Writing file '%s'", name);
@@ -1203,7 +1203,7 @@ void Print_Mesh (Mesh * M, char *c, int Type){
     c ? strcpy (name, c) : strcat (name, ".unv");
     unvfile = fopen (name, "w");
     if (!unvfile){
-      Msg(WARNING, "Unable to open file '%s'", name);
+      Msg(GERROR, "Unable to open file '%s'", name);
       return;
     }
     Msg(INFO, "Writing file '%s'", name);
@@ -1226,7 +1226,7 @@ void Print_Mesh (Mesh * M, char *c, int Type){
     Tree_T *TRE = Tree_Create (sizeof (Vertex *), compareFrozen);
     Greffile = fopen (name, "w");
     if (!Greffile){
-      Msg(WARNING, "Unable to open file '%s'", name);
+      Msg(GERROR, "Unable to open file '%s'", name);
       return;
     }
     Msg(INFO, "Writing file '%s'", name);
diff --git a/doc/gmsh.1 b/doc/gmsh.1
index 56ebac25c2..bc8ab1d40b 100644
--- a/doc/gmsh.1
+++ b/doc/gmsh.1
@@ -5,7 +5,7 @@
 .\" Copyright (c) 2000-2001 J.-F. Remacle, C. Geuzaine
 .\" 
 .\" ======================================================================
-.TH Gmsh 1 "12 November 2001" "Version 1.30" "Gmsh Manual Pages"
+.TH Gmsh 1 "12 November 2001" "Gmsh > 1.30" "Gmsh Manual Pages"
 .UC 4
 .\" ======================================================================
 .SH NAME
@@ -225,6 +225,6 @@ Remacle (Remacle@scorec.rpi.edu).
 .SH SEE ALSO
 .BR getdp (1),
 .br
-Gmsh examples (\fI/usr/doc/gmsh-1.30/\fR),
+Gmsh examples (\fI/usr/doc/gmsh-*/\fR),
 .br
 Gmsh homepage (\fIhttp://www.geuz.org/gmsh/\fR).
diff --git a/doc/gmsh.html b/doc/gmsh.html
index 14b111d69d..6d79c7a295 100644
--- a/doc/gmsh.html
+++ b/doc/gmsh.html
@@ -27,7 +27,7 @@ generator with built-in pre- and post-processing facilities</h1>
 <p>
 <h3 align="center">Christophe Geuzaine and Jean-François Remacle</h3>
 <p>
-<h3 align=center>Version <a href="doc/VERSIONS">1.30</a>, 15 November 2001</h3>
+<h3 align=center>Version <a href="doc/VERSIONS">1.30.3</a>, 16 November 2001</h3>
 <p>
 
 <h2>Description</h2>
@@ -185,14 +185,14 @@ name="opengl-footmark"><sup>1</sup></a>. The only thing required if
 you use Gmsh is to mention it in your work. The tutorial and demo
 files are included in the archives.
 <ul>
-<li><A href="/gmsh/bin/gmsh-1.30-Windows.zip">Windows zip archive (95/98/NT)</A>
-<li><A href="/gmsh/bin/gmsh-1.30-2.i386.rpm">Linux RPM (Red Hat 6.2 and compatible, i386, glibc 2.1)</A> 
-<li><A href="/gmsh/bin/gmsh-1.30-Linux.tgz">Linux tarball (i386, glibc 2.1)</A> 
-<li><A href="/gmsh/bin/gmsh-1.30-OSF1.tgz">Compaq Tru64 tarball (OSF 4.0)</A> 
-<li><A href="/gmsh/bin/gmsh-1.30-SunOS.tgz">Sun tarball (SunOS 5.5)</A> 
-<li><A href="/gmsh/bin/gmsh-1.30-AIX.tgz">IBM tarball (AIX)</A> 
-<li><A href="/gmsh/bin/gmsh-1.30-IRIX.tgz">SGI IRIX tarball (IRIX 6.5)</A> 
-<li><A href="/gmsh/bin/gmsh-1.30-HP-UX.tgz">HP tarball (HPUX 10.20)</A>
+<li><A href="/gmsh/bin/gmsh-1.30.3-Windows.zip">Windows zip archive (95/98/NT)</A>
+<li><A href="/gmsh/bin/gmsh-1.30.3-1.i386.rpm">Linux RPM (Red Hat 6.2 and compatible, i386, glibc 2.1)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30.3-Linux.tgz">Linux tarball (i386, glibc 2.1)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30.3-OSF1.tgz">Compaq Tru64 tarball (OSF 4.0)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30.3-SunOS.tgz">Sun tarball (SunOS 5.5)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30.3-AIX.tgz">IBM tarball (AIX)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30.3-IRIX.tgz">SGI IRIX tarball (IRIX 6.5)</A> 
+<li><A href="/gmsh/bin/gmsh-1.30.3-HP-UX.tgz">HP tarball (HPUX 10.20)</A>
 </ul>
 
 <p>
diff --git a/utils/build_machines b/utils/build_machines
index b1541519fa..a4f735a98b 100644
--- a/utils/build_machines
+++ b/utils/build_machines
@@ -9,8 +9,6 @@ AIX     sp2s.ulg.ac.be
 
 Where to change the version number?
 1) Makfile
-2) utils/gmsh.spec (2 occurrences)
-3) doc/gmsh.1 (2 occurrences)
-4) doc/VERSIONS (1 occurrence)
-5) www/gmsh.html (several occurrences)
+2) doc/VERSIONS
+3) www/gmsh.html
 
diff --git a/utils/gmsh.spec b/utils/gmsh.spec
index 921da7f174..7be65b3cab 100644
--- a/utils/gmsh.spec
+++ b/utils/gmsh.spec
@@ -1,8 +1,9 @@
 Summary: A 3D mesh generator with pre- and post-processing facilities
 Name: gmsh
-Version: 1.30
-Source: gmsh-1.30.tar.gz
-Release: 2
+# Version: 1.0
+Version: %{gmshversion}
+Source: gmsh-%{version}.tar.gz
+Release: 1
 Copyright: distributable
 Group: Applications/Engineering
 URL: http://www.geuz.org/gmsh/
@@ -29,7 +30,7 @@ and/or post-processor.
 
 %build
 make linux_gcc-2.95
-#make linux
+# make linux
 make distrib
 make utilities
 rm -rf CVS */CVS */*/CVS
-- 
GitLab