/* Copyright (C) 2008 Michael Goffioul This file is part of Octave. Octave is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Octave is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Octave; see the file COPYING. If not, see . */ #ifdef HAVE_CONFIG_H #include #endif #include "graphics-backend.h" #include "symtab.h" #include "parse.h" class gnuplot_backend : public base_graphics_backend { public: gnuplot_backend (void) : base_graphics_backend ("gnuplot") { } ~gnuplot_backend (void) { } void close_figure (const figure::properties& props) const { if (! props.get___plot_stream__ ().is_empty()) { octave_value_list args; args(1) = "\nquit;\n"; args(0) = props.get___plot_stream__ (); feval ("fputs", args); args.resize (1); feval ("fflush", args); feval ("pclose", args); } } Matrix get_canvas_size (const graphics_handle& fh) const { return Matrix (1, 2, 0.0); } Matrix get_figure_position (const graphics_handle& fh) const { return Matrix (1, 4, 0.0); } }; graphics_backend graphics_backend::default_backend (void) { if (available_backends.size () == 0) register_backend (new gnuplot_backend ()); return available_backends["gnuplot"]; } std::map graphics_backend::available_backends;