# HG changeset patch # User jwe # Date 1196307604 0 # Node ID 86d0b16f2bb2f91820ba01b9d66a6f5ea28486de # Parent 4612ef369abb38f94f878ac5f9338cbbbdd3877f [project @ 2007-11-29 03:40:04 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,17 @@ 2007-11-28 John W. Eaton + * 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 . diff --git a/src/genprops.awk b/src/genprops.awk --- a/src/genprops.awk +++ b/src/genprops.awk @@ -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; diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -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"); // --------------------------------------------------------------------- diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -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