35 #if defined (HAVE_CONFIG_H)
61 class gnuplot_graphics_toolkit :
public octave::base_graphics_toolkit
65 gnuplot_graphics_toolkit (octave::interpreter& interp)
68 static bool warned =
false;
73 (
"Octave:gnuplot-graphics",
74 "using the gnuplot graphics toolkit is discouraged\n\
76 The gnuplot graphics toolkit is not actively maintained and has a number\n\
77 of limitations that are unlikely to be fixed. Communication with gnuplot\n\
78 uses a one-directional pipe and limited information is passed back to the\n\
79 Octave interpreter so most changes made interactively in the plot window\n\
80 will not be reflected in the graphics properties managed by Octave. For\n\
81 example, if the plot window is closed with a mouse click, Octave will not\n\
82 be notified and will not update its internal list of open figure windows.\n\
83 The qt toolkit is recommended instead.\n");
89 OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE (gnuplot_graphics_toolkit)
91 ~gnuplot_graphics_toolkit () =
default;
93 bool is_valid ()
const {
return true; }
97 return go.
isa (
"figure");
102 if (go.
isa (
"figure"))
113 if (go.
isa (
"figure"))
136 static bool drawnow_executing =
false;
139 if (! drawnow_executing)
141 octave::unwind_protect_var<bool> restore_var (drawnow_executing,
true);
145 m_interpreter.feval (
"__gnuplot_drawnow__", args);
150 const std::string& file,
151 const std::string& debug_file)
const
154 if (! debug_file.empty ())
155 args(3) = debug_file;
159 m_interpreter.feval (
"__gnuplot_drawnow__", args);
168 double get_screen_resolution ()
const
171 Matrix get_screen_size ()
const
172 {
return Matrix (1, 2, 0.0); }
176 if (m_interpreter.mislocked (
"__init_gnuplot__"))
177 m_interpreter.munlock (
"__init_gnuplot__");
194 if (fids.
numel () > 1)
198 if (fids.
numel () > 2)
204 octave::interpreter& m_interpreter;
211 const std::string path = octave::sys::env::getenv (
"PATH");
219 if (tmp(0).is_string () && ! tmp(0).isempty ())
221 std::string gnuplot_binary = tmp(0).string_value ();
226 octave::sys::file_stat fs (gnuplot_path);
228 if (! fs.exists () && ! exeext.empty ())
234 fs = octave::sys::file_stat (gnuplot_path);
237 retval = fs.exists ();
240 catch (
const octave::execution_exception&)
256 if (! have_gnuplot_binary (interp))
257 error (
"__init_gnuplot__: the gnuplot program is not available, see 'gnuplot_binary'");
258 else if (! interp.
mislocked (
"__init_gnuplot__"))
277 return ovl (have_gnuplot_binary (interp));
285 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type numel() const
Number of elements in the array.
base_properties & get_properties()
bool isa(const std::string &go_name) const
graphics_handle get_handle() const
void load_toolkit(const graphics_toolkit &tk)
void mlock(bool skip_first=false) const
gtk_manager & get_gtk_manager()
bool mislocked(bool skip_first=false) const
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
void recover_from_exception()
octave_value as_octave_value() const
Matrix matrix_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFMETHOD_DLD(name, interp_name, args_name, nargout_name, doc)
Macro to define an at run time dynamically loadable builtin method.
void warning_with_id(const char *id, const char *fmt,...)
void() error(const char *fmt,...)
octave_value_list Fpclose(octave::interpreter &interp, const octave_value_list &args, int)
std::string search_path_for_file(const std::string &path, const string_vector &names)
octave_value_list Ffflush(octave::interpreter &interp, const octave_value_list &args, int)
octave_value_list Fwaitpid(const octave_value_list &args, int)
octave_value_list Ffputs(octave::interpreter &interp, const octave_value_list &args, int)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.