Mercurial > hg > octave-lyh
changeset 10857:2224236440c0
add more terminal types to gl2ps-renderer
author | Shai Ayal <shaiay@users.sourceforge.net> |
---|---|
date | Thu, 05 Aug 2010 20:53:24 +0300 |
parents | dea165ff6d74 |
children | bf000a56a985 |
files | src/ChangeLog src/DLD-FUNCTIONS/fltk_backend.cc src/gl2ps-renderer.cc src/gl2ps-renderer.h |
diffstat | 4 files changed, 40 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-08-05 Shai Ayal <shaiay@users.sourceforge.net> + + * gl2ps-renderer.cc (draw): Add support for more terminal types. + * DLD-FUNCTIONS/fltk_backend.cc: Likewise. + 2010-08-04 John W. Eaton <jwe@octave.org> * mex.cc (mxArray_number (const char *)): Create empty string if @@ -28,7 +33,7 @@ * DLD-FUNCTIONS/amd.cc, DLD-FUNCTIONS/balance.cc, DLD-FUNCTIONS/besselj.cc, DLD-FUNCTIONS/betainc.cc, DLD-FUNCTIONS/ccolamd.cc, DLD-FUNCTIONS/cellfun.cc, - DLD-FUNCTIONS/chol.cc, DLD-FUNCTIONS/colamd.cc, DLD-FUNCTIONS/daspk.cc, + DLD-FUNCTIONS/chol.cc, DLD-FUNCTIONS/colamd.cc, DLD-FUNCTIONS/daspk.cc, DLD-FUNCTIONS/dasrt.cc, DLD-FUNCTIONS/dot.cc, DLD-FUNCTIONS/eigs.cc, DLD-FUNCTIONS/fftw.cc, DLD-FUNCTIONS/filter.cc, DLD-FUNCTIONS/lookup.cc, DLD-FUNCTIONS/lsode.cc, DLD-FUNCTIONS/lu.cc,
--- a/src/DLD-FUNCTIONS/fltk_backend.cc +++ b/src/DLD-FUNCTIONS/fltk_backend.cc @@ -105,9 +105,10 @@ bool zoom (void) { return in_zoom; } void set_zoom_box (const Matrix& zb) { zoom_box = zb; } - void print (const std::string& filename) + void print (const std::string& filename, const std::string& term) { print_filename = filename; + print_term = term; } private: @@ -118,6 +119,7 @@ Matrix zoom_box; std::string print_filename; + std::string print_term; void setup_viewport (int ww, int hh) { @@ -136,7 +138,7 @@ if (! print_filename.empty ()) { - opengl_renderer *rend = new glps_renderer (print_filename); + opengl_renderer *rend = new glps_renderer (print_filename, print_term); rend->draw (gh_manager::lookup (number)); print_filename = ""; delete rend; @@ -330,9 +332,9 @@ // FIXME -- this could change. double number (void) { return fp.get___myhandle__ ().value (); } - void print (const std::string& fname) + void print (const std::string& fname, const std::string& term) { - canvas->print (fname); + canvas->print (fname, term); // Print immediately so the output file will exist when the drawnow // command is done. @@ -935,10 +937,10 @@ return get_size (hnd2idx (gh)); } - static void print (const graphics_handle& gh , const std::string& filename) + static void print (const graphics_handle& gh , const std::string& filename, const std::string& term) { if (instance_ok ()) - instance->do_print (hnd2idx(gh), filename); + instance->do_print (hnd2idx(gh), filename, term); } private: @@ -1037,12 +1039,12 @@ return sz; } - void do_print (int idx, const std::string& filename) + void do_print (int idx, const std::string& filename, const std::string& term) { wm_iterator win; if ((win = windows.find (idx)) != windows.end ()) { - win->second->print (filename); + win->second->print (filename, term); } } @@ -1201,11 +1203,11 @@ } void print_figure (const graphics_object& go, - const std::string& /*term*/, + const std::string& term, const std::string& file, bool /*mono*/, const std::string& /*debug_file*/) const { - figure_manager::print (go.get_handle (), file); + figure_manager::print (go.get_handle (), file, term); } Matrix get_canvas_size (const graphics_handle& fh) const
--- a/src/gl2ps-renderer.cc +++ b/src/gl2ps-renderer.cc @@ -49,14 +49,31 @@ glGetIntegerv (GL_VIEWPORT, viewport); + GLint gl2ps_term; + if (term.find ("eps") != std::string::npos) gl2ps_term = GL2PS_EPS; + else if (term.find ("pdf") != std::string::npos) gl2ps_term = GL2PS_PDF; + else if (term.find ("svg") != std::string::npos) gl2ps_term = GL2PS_SVG; + else if (term.find ("ps") != std::string::npos) gl2ps_term = GL2PS_PS; + else if (term.find ("pgf") != std::string::npos) gl2ps_term = GL2PS_PGF; + else if (term.find ("tex") != std::string::npos) gl2ps_term = GL2PS_TEX; + else + { + error ("gl2ps-renderer:: Unknown terminal"); + return; + } + + GLint gl2ps_text = 0; + if (term.find ("notxt") != std::string::npos) gl2ps_text = GL2PS_NO_TEXT; + while (state == GL2PS_OVERFLOW) { buffsize += 1024*1024; gl2psBeginPage ("glps_renderer figure", "Octave", viewport, - GL2PS_EPS, GL2PS_BSP_SORT, + gl2ps_term, GL2PS_BSP_SORT, (GL2PS_SILENT | GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING | GL2PS_OCCLUSION_CULL - | GL2PS_BEST_ROOT), GL_RGBA, 0, NULL, 0, 0, 0, + | GL2PS_BEST_ROOT | gl2ps_text), + GL_RGBA, 0, NULL, 0, 0, 0, buffsize, fp, filename.c_str () ); opengl_renderer::draw (go);
--- a/src/gl2ps-renderer.h +++ b/src/gl2ps-renderer.h @@ -31,8 +31,8 @@ glps_renderer : public opengl_renderer { public: - glps_renderer (const std::string& _filename) - : opengl_renderer () , filename (_filename) { } + glps_renderer (const std::string& _filename, const std::string& _term) + : opengl_renderer () , filename (_filename), term (_term) { } ~glps_renderer (void) { } @@ -75,6 +75,7 @@ private: std::string filename; + caseless_str term; double fontsize; std::string fontname; };