changeset 7847:40b16e04172a

Make backend switching work.
author Michael Goffioul <michael.goffioul@gmail.com>
date Wed, 27 Feb 2008 14:59:00 +0100
parents d7737a4268b7
children 6bb2bbc2bf45
files src/ChangeLog src/graphics.cc src/graphics.h.in
diffstat 3 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Feb 27 11:28:22 2008 +0100
+++ b/src/ChangeLog	Wed Feb 27 14:59:00 2008 +0100
@@ -27,6 +27,14 @@
 
 2008-06-04  Michael Goffioul <michael.goffioul@gmail.com>
 
+	* graphics.h.in (root_figure::get_default): Use factory defaults when
+	no explicit default value exists.
+	(figure::properties::set___backend__): Reset __plot_stream__ to empty
+	value.
+	* graphics.cc (gh_manager::gh_manager): Call
+	graphics_backend::default_backend to make sure the default backend is
+	initialized.
+
 	* graphics.h.in (patch::properties::edgealpha,
 	surface::properties::facealpha, surface::properties::edgealpha): Fix
 	typos in property names.
--- a/src/graphics.cc	Wed Feb 27 11:28:22 2008 +0100
+++ b/src/graphics.cc	Wed Feb 27 14:59:00 2008 +0100
@@ -2980,6 +2980,9 @@
     next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0))
 {
   handle_map[0] = graphics_object (new root_figure ());
+
+  // Make sure the default backend is registered.
+  graphics_backend::default_backend ();
 }
 
 graphics_handle
--- a/src/graphics.h.in	Wed Feb 27 11:28:22 2008 +0100
+++ b/src/graphics.h.in	Wed Feb 27 14:59:00 2008 +0100
@@ -2210,7 +2210,13 @@
     octave_value retval = default_properties.lookup (name);
 
     if (retval.is_undefined ())
-      error ("get: invalid default property `%s'", name.c_str ());
+      {
+	// no default property found, use factory default
+	retval = factory_properties.lookup (name);
+
+	if (retval.is_undefined ())
+	  error ("get: invalid default property `%s'", name.c_str ());
+      }
 
     return retval;
   }
@@ -2274,6 +2280,7 @@
       close (false);
       backend = b; 
       __backend__ = b.get_name ();
+      __plot_stream__ = Matrix ();
       mark_modified ();
     }