diff --git a/Adapt/nrutil.cpp b/Adapt/nrutil.cpp index c4140f61126fbd2af0ee1484eb64e5c06921009f..39b174257845459cd298d037d18c55e9b64f874c 100644 --- a/Adapt/nrutil.cpp +++ b/Adapt/nrutil.cpp @@ -1,9 +1,11 @@ -// $Id: nrutil.cpp,v 1.4 2001-01-08 08:05:40 geuzaine Exp $ +// $Id: nrutil.cpp,v 1.5 2001-11-19 13:43:33 geuzaine Exp $ #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <malloc.h> +#include "Gmsh.h" + #define NR_END 1 #define FREE_ARG char* @@ -11,10 +13,13 @@ void nrerror(char error_text[]) /* Numerical Recipes standard error handler */ { + Msg(GERROR, "%s", error_text); + /* fprintf(stderr,"Numerical Recipes run-time error...\n"); fprintf(stderr,"%s\n",error_text); fprintf(stderr,"...now exiting to system...\n"); exit(1); + */ } float *vector(long nl, long nh) diff --git a/Common/Options.cpp b/Common/Options.cpp index 9a8c58659833b11c19036b8db24c57421a401cfd..df3d24bcb21bfa79804ca0961e244741468eeebc 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.62 2001-11-19 09:29:18 geuzaine Exp $ +// $Id: Options.cpp,v 1.63 2001-11-19 13:43:33 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -94,6 +94,7 @@ void Init_Options(int num){ CTX.post.draw = 1 ; CTX.post.list = NULL ; CTX.post.force_num = 0 ; + CTX.print.gl_fonts = 1; CTX.threads_lock = 0 ; //very primitive locking during mesh generation CTX.mesh.histogram = 0 ; CTX.mesh.oldxtrude = CTX.mesh.oldxtrude_recombine = 0; //old extrusion mesh generator diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 8929e4d7990fad84f52176a6ae2c9e767a348176..468b797bf506d529ed2bb8cccbd0f4bcecc77704 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.94 2001-11-19 09:29:18 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.95 2001-11-19 13:43:33 geuzaine Exp $ #include <sys/types.h> #include <signal.h> @@ -276,6 +276,11 @@ void file_save_as_pstex_accurate_cb(CALLBACK_ARGS) { CTX.print.eps_quality = old; } } +void file_save_as_jpegtex_cb(CALLBACK_ARGS) { + char *newfile; + if((newfile = fl_file_chooser("Save LaTeX file (Jpeg part)", "*", NULL))) + CreateOutputFile(newfile, CTX.print.format = FORMAT_JPEGTEX); +} void file_save_as_tex_cb(CALLBACK_ARGS) { char *newfile; if((newfile = fl_file_chooser("Save LaTeX file (TeX part)", "*", NULL))) diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h index 4b3aac5ff70650a722670e6f8722c50335c691b1..e25902d56eb93252c77c3182f049f7c6fb52d278 100644 --- a/Fltk/Callbacks.h +++ b/Fltk/Callbacks.h @@ -33,6 +33,7 @@ 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_jpegtex_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) ; diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 091c015fa0e5789fe8c3250d9fdc12c655e95d82..bc6db91fe20ce36a1dfd5cf7ec9575600fca87b4 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.129 2001-11-19 09:29:18 geuzaine Exp $ +// $Id: GUI.cpp,v 1.130 2001-11-19 13:43:33 geuzaine Exp $ // To make the interface as visually consistent as possible, please: // - use the IW, BB, BH, BW and WB values @@ -66,8 +66,9 @@ Fl_Menu_Item m_menubar_table[] = { {"Image", 0, 0, 0, FL_SUBMENU}, {"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, 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, Jpeg part...", 0, (Fl_Callback *)file_save_as_jpegtex_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}, diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index e35fb47cd6bef99ea0d29d2c74259944658b0abe..d4aa7518a9f666ae9135ac1f59d2cc463962159c 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.24 2001-11-19 09:29:18 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.25 2001-11-19 13:43:33 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -52,16 +52,13 @@ void DrawUI(void){ void Draw_String(char *s){ - if(CTX.stream == TO_FILE){ - if(!CTX.print.gl_fonts){ - gl2psText(s,CTX.print.eps_font,CTX.print.eps_font_size); - return ; - } + if(CTX.print.gl_fonts){ + gl_font(FL_HELVETICA, CTX.gl_fontsize); + gl_draw(s); + } + else{ // ps, pstex or jpegtex output + gl2psText(s,CTX.print.eps_font,CTX.print.eps_font_size); } - - gl_font(FL_HELVETICA, CTX.gl_fontsize); - gl_draw(s); - } /* ------------------------------------------------------------------------ diff --git a/Graphics/CreateFile.cpp b/Graphics/CreateFile.cpp index 9a2151702d95feeafd0087c13fde0bd8aebb5fcc..a1122481665152eb0d40dd42599e75b79fb6c3ab 100644 --- a/Graphics/CreateFile.cpp +++ b/Graphics/CreateFile.cpp @@ -1,4 +1,4 @@ -// $Id: CreateFile.cpp,v 1.24 2001-11-19 10:43:16 geuzaine Exp $ +// $Id: CreateFile.cpp,v 1.25 2001-11-19 13:43:33 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -32,8 +32,6 @@ void CreateOutputFile (char *name, int format) { if(!name || !strlen(name)) return; - CTX.print.gl_fonts = 1; - switch(format){ case FORMAT_AUTO : @@ -56,6 +54,7 @@ void CreateOutputFile (char *name, int format) { 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,".jpegtex")) CreateOutputFile(name, FORMAT_JPEGTEX); 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); @@ -84,11 +83,14 @@ void CreateOutputFile (char *name, int format) { break; case FORMAT_JPEG : + case FORMAT_JPEGTEX : if(!(fp = fopen(name,"wb"))) { Msg(GERROR, "Unable to open file '%s'", name); return; } + if(format == FORMAT_JPEGTEX) CTX.print.gl_fonts = 0; FillBuffer(); + CTX.print.gl_fonts = 1; create_jpeg(fp, CTX.viewport[2]-CTX.viewport[0], CTX.viewport[3]-CTX.viewport[1], CTX.print.jpeg_quality); @@ -149,7 +151,6 @@ void CreateOutputFile (char *name, int format) { Msg(GERROR, "Unable to open file '%s'", name); return; } - CTX.print.gl_fonts = 0; size3d = 0 ; res = GL2PS_OVERFLOW ; while(res == GL2PS_OVERFLOW){ @@ -162,14 +163,15 @@ void CreateOutputFile (char *name, int format) { (format==FORMAT_PSTEX ? GL2PS_NO_TEXT : 0), GL_RGBA, 0, NULL, size3d, fp, name); CTX.stream = TO_FILE ; + CTX.print.gl_fonts = 0; FillBuffer(); + CTX.print.gl_fonts = 1; CTX.stream = TO_SCREEN ; res = gl2psEndPage(); } Msg(INFO, "EPS creation complete '%s'", name); Msg(STATUS2, "Wrote '%s'", name); fclose(fp); - CTX.print.gl_fonts = 1; break ; case FORMAT_TEX : @@ -183,8 +185,8 @@ void CreateOutputFile (char *name, int format) { CTX.stream = TO_FILE ; CTX.print.gl_fonts = 0; FillBuffer(); - CTX.stream = TO_SCREEN ; CTX.print.gl_fonts = 1; + CTX.stream = TO_SCREEN ; res = gl2psEndPage(); Msg(INFO, "TEX creation complete '%s'", name); Msg(STATUS2, "Wrote '%s'", name); diff --git a/Graphics/Graph2D.cpp b/Graphics/Graph2D.cpp index c06687be07d5a9395d9a525542274b7cb8402e0b..a7d63fae6c12174a56c82722832b481339ff6258 100644 --- a/Graphics/Graph2D.cpp +++ b/Graphics/Graph2D.cpp @@ -1,4 +1,4 @@ -// $Id: Graph2D.cpp,v 1.11 2001-11-14 14:39:39 geuzaine Exp $ +// $Id: Graph2D.cpp,v 1.12 2001-11-19 13:43:33 geuzaine Exp $ #include "Gmsh.h" #include "GmshUI.h" @@ -160,7 +160,7 @@ static void Draw_Graph2D(Post_View *v, if(v->ShowScale){ glColor4ubv((GLubyte*)&CTX.color.text); sprintf(label, v->Format, (i==nb)?ValMin:(ValMax-i*dv)); - if(CTX.stream == TO_FILE) + if(!CTX.print.gl_fonts) glRasterPos2d(xtop-gl_width(label)-3*tic,ytop-i*dy-font_a/3.); else glRasterPos2d(xtop-gl_width(label)-tic,ytop-i*dy-font_a/3.);