Mercurial > hg > octave-terminal
changeset 7439:1867156fc552
[project @ 2008-02-02 07:56:53 by jwe]
author | jwe |
---|---|
date | Sat, 02 Feb 2008 07:56:53 +0000 |
parents | 6873fe003323 |
children | 4e3b073e910e |
files | src/ChangeLog src/graphics.h.in |
diffstat | 2 files changed, 49 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-02-02 Shai Ayal <shaiay@users.sourceforge.net> + + * graphics.h.in (graphics_backend::find_backend): New function. + (class figure): Add __backend__ property and set method. + 2008-02-02 John W. Eaton <jwe@octave.org> * help.cc (do_type): Don't print dyamically loaded function files.
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -1193,11 +1193,23 @@ static void unregister_backend (const std::string& name) { available_backends.erase (name); } + static graphics_backend find_backend (const std::string& name) + { + const_available_backends_iterator p = available_backends.find (name); + + if (p != available_backends.end ()) + return p->second; + else + return default_backend (); + } + private: base_graphics_backend *rep; -private: static std::map<std::string, graphics_backend> available_backends; + + typedef std::map<std::string, graphics_backend>::iterator available_backends_iterator; + typedef std::map<std::string, graphics_backend>::const_iterator const_available_backends_iterator; }; // --------------------------------------------------------------------- @@ -2022,7 +2034,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. @@ -2078,6 +2119,7 @@ string_property xvisual , "" radio_property xvisualmode , "{auto}|manual" callback_property buttondownfcn , Matrix () + string_property __backend__ s , "gnuplot" END_PROPERTIES protected: