changeset 7214:86d0b16f2bb2

[project @ 2007-11-29 03:40:04 by jwe]
author jwe
date Thu, 29 Nov 2007 03:40:04 +0000
parents 4612ef369abb
children dd88d61d443f
files src/ChangeLog src/genprops.awk src/graphics.cc src/graphics.h.in
diffstat 4 files changed, 85 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Nov 29 01:57:11 2007 +0000
+++ b/src/ChangeLog	Thu Nov 29 03:40:04 2007 +0000
@@ -1,8 +1,17 @@
 2007-11-28  John W. Eaton  <jwe@octave.org>
 
+	* graphics.cc (base_properties::update_axis_limits,
+	axes::update_axis_limits): New functions.
 	* graphics.h.in (class data_property): New class.
+	(graphics_object::update_axis_limits): New function.
+	(base_graphics_object::update_axis_limits): New virtual function.
+	(base_properties::update_axis_limits, axes::update_axis_limits):
+	Provide decls.
 	(class line, class image, class patch, class surface): Use it
-	instead of octave_value for data properties.
+	instead of octave_value for data properties.  Tag data properties
+	with "l" modifier.
+	(class axes): Tag scale properties with "l" modifier.
+	* genprops.awk: Handle "l" modifier.
 
 	* mkbuiltins: Emit #include "builtins.h" for the builtins.cc file.
 	From Christoph Mayer <Christoph.Mayer@dlr.de>.
--- a/src/genprops.awk	Thu Nov 29 01:57:11 2007 +0000
+++ b/src/genprops.awk	Thu Nov 29 03:40:04 2007 +0000
@@ -94,6 +94,12 @@
 ##       constructor, which creates a new radio_property and so cannot
 ##       preserve the old list of possible values.
 ##
+##   l:  Add the line
+##
+##         update_axis_limits ("NAME");
+##
+##       to the type-specific set function.
+##
 ##   m:  Add the line
 ##
 ##         set_NAMEmode ("manual");
@@ -140,6 +146,8 @@
 	  {
 	      printf ("\n  {\n    if (! error_state)\n      {\n        %s = val;\n",
 		      name[i]);
+	      if (limits[i])
+		  printf ("        update_axis_limits (\"%s\");\n", name[i]);
 	      if (mode[i])
 		  printf ("        set_%smode (\"manual\");\n", name[i]);
 	      printf ("        mark_modified ();\n      }\n  }\n\n");
@@ -205,6 +213,7 @@
       type[idx] = $(field++);
       name[idx] = $(field++);
 
+      limits[idx] = 0;
       mode[idx] = 0;
       emit_get[idx] = "defn";
       emit_set[idx] = "defn";
@@ -217,6 +226,9 @@
         {
 	    quals = $field;
 
+	    if (index (quals, "l"))
+		limits[idx] = 1;
+
 	    if (index (quals, "m"))
 		mode[idx] = 1;
 
--- a/src/graphics.cc	Thu Nov 29 01:57:11 2007 +0000
+++ b/src/graphics.cc	Thu Nov 29 03:40:04 2007 +0000
@@ -759,6 +759,17 @@
 }
 
 void
+base_properties::update_axis_limits (const std::string& axis_type) const
+{
+  graphics_handle h = (type == "axes") ? __myhandle__ : parent;
+
+  graphics_object obj = gh_manager::get_object (h);
+
+  if (obj.isa ("axes"))
+    obj.update_axis_limits (axis_type);
+}
+
+void
 base_properties::delete_children (void)
 {
   octave_idx_type n = children.numel ();
@@ -1780,6 +1791,11 @@
   return retval;
 }
 
+void
+axes::update_axis_limits (const std::string& /* axis_type */)
+{
+}
+
 std::string axes::properties::go_name ("axes");
 
 // ---------------------------------------------------------------------
--- a/src/graphics.h.in	Thu Nov 29 01:57:11 2007 +0000
+++ b/src/graphics.h.in	Thu Nov 29 03:40:04 2007 +0000
@@ -666,6 +666,11 @@
 
   void reparent (const graphics_handle& new_parent) { parent = new_parent; }
 
+  // Update data limits for AXIS_TYPE (xdata, ydata, etc.) in the parent
+  // axes object.
+
+  void update_axis_limits (const std::string& axis_type) const;
+
   virtual void delete_children (void);
 
 protected:
@@ -774,6 +779,11 @@
     return properties;
   }
 
+  virtual void update_axis_limits (const std::string& axis_type)
+  {
+    error ("base_graphics_object::update_axis_limits: invalid graphics object");
+  }
+
   virtual bool valid_object (void) const { return false; }
 
   virtual std::string type (void) const { return "unknown"; }
@@ -829,10 +839,7 @@
     rep->override_defaults (obj);
   }
 
-  void set_from_list (property_list& plist)
-  {
-    rep->set_from_list (plist);
-  }
+  void set_from_list (property_list& plist) { rep->set_from_list (plist); }
 
   void set (const caseless_str& name, const octave_value& val)
   {
@@ -841,15 +848,9 @@
 
   void set (const octave_value_list& args);
 
-  void set_defaults (const std::string& mode)
-  {
-    rep->set_defaults (mode);
-  }
-
-  octave_value get (void) const
-  {
-    return rep->get ();
-  }
+  void set_defaults (const std::string& mode) { rep->set_defaults (mode); }
+
+  octave_value get (void) const { return rep->get (); }
 
   octave_value get (const caseless_str& name) const
   {
@@ -878,11 +879,11 @@
 
   graphics_handle get_parent (void) const { return rep->get_parent (); }
 
-  void remove_child (const graphics_handle& h) { return rep->remove_child (h); }
-
-  void adopt (const graphics_handle& h) { return rep->adopt (h); }
-
-  void reparent (const graphics_handle& h) { return rep->reparent (h); }
+  void remove_child (const graphics_handle& h) { rep->remove_child (h); }
+
+  void adopt (const graphics_handle& h) { rep->adopt (h); }
+
+  void reparent (const graphics_handle& h) { rep->reparent (h); }
 
   void defaults (void) const { rep->defaults (); }
 
@@ -890,6 +891,11 @@
 
   base_properties& get_properties (void) { return rep->get_properties (); }
 
+  void update_axis_limits (const std::string& axis_type)
+  {
+    rep->update_axis_limits (axis_type);
+  }
+
   bool valid_object (void) const { return rep->valid_object (); }
 
   operator bool (void) const { return rep->valid_object (); }
@@ -1252,9 +1258,9 @@
       color_property xcolor
       color_property ycolor
       color_property zcolor
-      octave_value xscale
-      octave_value yscale
-      octave_value zscale
+      octave_value xscale l
+      octave_value yscale l
+      octave_value zscale l
       octave_value xdir
       octave_value ydir
       octave_value zdir
@@ -1358,6 +1364,8 @@
 
   void defaults (void) const { gripe_not_implemented ("axes::defaults"); }
 
+  void update_axis_limits (const std::string& axis_type);
+
   bool valid_object (void) const { return true; }
 
 private:
@@ -1390,13 +1398,13 @@
     // properties declarations.
 
     BEGIN_PROPERTIES
-      data_property xdata
-      data_property ydata
-      data_property zdata
-      data_property ldata
-      data_property udata
-      data_property xldata
-      data_property xudata
+      data_property xdata l
+      data_property ydata l
+      data_property zdata l
+      data_property ldata l
+      data_property udata l
+      data_property xldata l
+      data_property xudata l
       color_property color
       octave_value linestyle
       octave_value linewidth
@@ -1595,9 +1603,9 @@
     // properties declarations.
 
     BEGIN_PROPERTIES
-      data_property xdata
-      data_property ydata
-      data_property cdata
+      data_property xdata l
+      data_property ydata l
+      data_property cdata l
     END_PROPERTIES
 
     static std::string go_name;
@@ -1687,10 +1695,10 @@
     // properties declarations.
 
     BEGIN_PROPERTIES
-      data_property xdata
-      data_property ydata
-      data_property zdata
-      data_property cdata
+      data_property xdata l
+      data_property ydata l
+      data_property zdata l
+      data_property cdata l
       octave_value faces
       octave_value vertices
       color_property facecolor a
@@ -1793,10 +1801,10 @@
     // properties declarations.
 
     BEGIN_PROPERTIES
-      data_property xdata
-      data_property ydata
-      data_property zdata
-      data_property cdata
+      data_property xdata l
+      data_property ydata l
+      data_property zdata l
+      data_property cdata l
       color_property facecolor a
       octave_value facealpha
       color_property edgecolor a