Index: graphics.h.in =================================================================== RCS file: /cvs/octave/src/graphics.h.in,v retrieving revision 1.50 diff -u -r1.50 graphics.h.in --- graphics.h.in 28 Jan 2008 22:42:19 -0000 1.50 +++ graphics.h.in 1 Feb 2008 07:04:03 -0000 @@ -1193,6 +1193,14 @@ static void unregister_backend (const std::string& name) { available_backends.erase (name); } + static graphics_backend find_backend (const std::string& name) + { + if (available_backends.find (name) != available_backends.end ()) + return available_backends[name]; + else + return default_backend (); + } + private: base_graphics_backend *rep; @@ -2021,7 +2029,36 @@ return backend; } - void set_backend (const graphics_backend& b) { backend = b; } + void set_backend (const graphics_backend& b) + { + close (false); + backend = b; + __backend__ = b.get_name (); + mark_modified (); + } + + void set___backend__ (const octave_value& val) + { + if (! error_state) + { + if (val.is_string ()) + { + std::string nm = val.string_value (); + graphics_backend b = graphics_backend::find_backend (nm); + if (b.get_name () != nm) + { + error ("figure::__backend__ : illegal backend"); + } + else + { + set_backend (b); + mark_modified (); + } + } + else + error ("__backend__ must be a string"); + } + } // See the genprops.awk script for an explanation of the // properties declarations. @@ -2077,6 +2114,7 @@ string_property xvisual , "" radio_property xvisualmode , "{auto}|manual" callback_property buttondownfcn , Matrix () + string_property __backend__ s , "gnuplot" END_PROPERTIES protected: