23 #if ! defined (octave_graphics_h)
24 #define octave_graphics_h 1
26 #include "octave-config.h"
50 #if ! defined (OCTAVE_DEFAULT_FONTNAME)
51 #define OCTAVE_DEFAULT_FONTNAME "*"
67 error (
"invalid axis scale");
72 error (
"invalid axis scale");
75 virtual double scale (
double)
const
77 error (
"invalid axis scale");
82 error (
"invalid axis scale");
134 {
return log10 (d); }
137 {
return pow (10.0, d); }
143 void do_scale (
const double *src,
double *dest,
int n)
const
145 for (
int i = 0;
i < n;
i++)
146 dest[
i] = log10 (src[
i]);
174 {
return -log10 (-d); }
177 {
return -
pow (10.0, -d); }
183 void do_scale (
const double *src,
double *dest,
int n)
const
185 for (
int i = 0;
i < n;
i++)
186 dest[
i] = -log10 (-src[
i]);
244 else if (s ==
"neglog")
246 else if (s ==
"linear")
299 virtual bool is_radio (
void)
const {
return false; }
308 bool do_notify_toolkit =
true);
312 error (
"get: invalid property \"%s\"",
name.c_str ());
317 error (
"values_as_string: invalid property \"%s\"",
name.c_str ());
322 error (
"values_as_cell: invalid property \"%s\"",
name.c_str ());
347 for (i = 0; i < l.
length (); i++)
349 if (v.internal_rep () == l(i).internal_rep ())
357 for (
int j = i; j < l.
length () - 1; j++)
371 for (
int i = l.
length () - 1;
i >= 0 ;
i--)
373 for (
int j = 0; j < lp.
length (); j++)
375 if (l(
i).internal_rep () == lp(j).internal_rep ())
396 error (
"set: invalid property \"%s\"",
name.c_str ());
401 typedef std::map<listener_mode, octave_value_list>::iterator
403 typedef std::map<listener_mode, octave_value_list>::const_iterator
444 error (
"set: invalid string property value for \"%s\"",
479 if (new_pos == std::string::npos)
492 const Cell&
c,
const char& sep =
'|',
497 error (
"set: invalid order property value for \"%s\"",
503 strings[
i] =
c(
i).string_value ();
558 while (pos != std::string::npos)
560 size_t new_pos = new_str.find_first_of (
separator, pos);
562 if (new_pos == std::string::npos)
564 strings.
append (new_str.substr (pos));
568 strings.
append (new_str.substr (pos, new_pos - pos));
576 if (strings[
i] !=
str[
i])
605 if (! replace && strings[
i] !=
str[
i])
632 if (strings[
i] !=
str[
i])
649 error (
"set: invalid string property value for \"%s\"",
683 std::ostringstream buf;
705 double d =
c(
i).double_value ();
707 std::ostringstream buf;
777 double d =
c(
i).double_value ();
779 std::ostringstream buf;
795 catch (octave::execution_exception&
e)
797 error (e,
"set: invalid string property value for \"%s\"",
807 std::ostringstream buf;
851 error (
"invalid value = %s", val.c_str ());
860 size_t len = val.length ();
866 if (possible_val.compare (val, len))
868 if (len == possible_val.length ())
873 match = possible_val;
879 first_match = possible_val;
953 error (
"set: invalid value for radio property \"%s\"",
961 error (
"set: invalid value for radio property \"%s\" (value = %s)",
966 if (s.length () != match.length ())
968 "%s: allowing %s to match %s value %s",
969 "set", s.c_str (),
get_name ().c_str (),
1001 error (
"invalid color specification: %s", str.c_str ());
1024 {
return ! (*
this ==
c); }
1032 for (
int i = 0;
i < 3;
i++)
1035 error (
"invalid RGB color specification");
1112 error (
"color has no RGB value");
1120 error (
"color has no radio value");
1179 error (
"set: invalid value for double property \"%s\"",
1253 error (
"%s: property has no radio value");
1357 error (
"invalid value for array property \"%s\"",
1453 if (
dv(0) > 1 &&
dv(1) == 1)
1651 if (hchild == old_gh)
1653 hchild = new_gh.
value ();
1658 error (
"children_list::renumber: child not found!");
1675 catch (octave::execution_exception&
e)
1677 error (e,
"set: children must be an array of graphics handles");
1685 bool add_hidden =
true;
1689 if (visible_kids.
numel () == new_kids.
numel ())
1705 error (
"set: new children must be a permutation of existing children");
1714 children_list.clear ();
1721 children_list.push_back (tmp.
xelem (
i));
1730 children_list.clear ();
1732 children_list.push_front (val.
xelem (
i));
1737 children_list.clear ();
1738 children_list =
val;
1748 for (
const auto& hchild : children_list)
1756 for (
auto it = children_list.begin (); it != children_list.end (); it++)
1760 children_list.erase (it);
1769 children_list.push_front (val);
1808 error (
"invalid value for callback property \"%s\"",
1849 {
return rep->
ok (); }
1882 bool do_notify_toolkit =
true)
1883 {
return rep->
set (val, do_run, do_notify_toolkit); }
1961 for (it = (*this).begin (); it != (*this).end (); it++)
1962 if (pname == (*it).first)
1965 return (*this).end ();
1972 for (it = (*this).begin (); it != (*this).end (); it++)
1973 if (pname == (*it).first)
1976 return (*this).end ();
1983 const_iterator it =
find (pname);
1985 if (it != (*this).end ())
1986 retval = (*it).second;
1993 iterator it =
find (pname);
1995 if (it == (*this).end ())
1998 return (*this).back ().second;
2001 return (*it).second;
2006 iterator it =
find (pname);
2007 if (it != (*this).end ())
2013 std::vector<pval_pair>::erase (it);
2092 return Matrix (1, 2, 0.0);
2104 return Matrix (1, 2, 0.0);
2146 error (
"%s: invalid graphics toolkit", fname.c_str ());
2319 error (
"unable to create gh_manager!");
2339 typedef std::set<std::string>::const_iterator
2342 typedef std::map<std::string, graphics_toolkit>::iterator
2345 typedef std::map<std::string, graphics_toolkit>::const_iterator
2356 loaded_toolkits[tk.
get_name ()] = tk;
2361 loaded_toolkits.erase (name);
2368 if (p != loaded_toolkits.end ())
2376 Cell m (1, available_toolkits.size ());
2379 for (
const auto& tkit : available_toolkits)
2387 Cell m (1, loaded_toolkits.size ());
2390 for (
const auto& nm_tkit_p : loaded_toolkits)
2391 m(i++) = nm_tkit_p.first;
2398 while (! loaded_toolkits.empty ())
2407 if (loaded_toolkits.find (name) != loaded_toolkits.end ())
2431 void mark_modified (
void);
2449 all_props[
name] =
p;
2480 if (children.remove_child (h.
value ()))
2482 children.run_listeners ();
2489 children.adopt (h.
value ());
2490 children.run_listeners ();
2499 {
return Matrix (1, 4, 0.0); }
2501 virtual void update_boundingbox (
void);
2503 virtual void update_autopos (
const std::string& elem_type);
2517 return children.get_children ();
2522 return children.get_all ();
2527 return children.get_hidden ();
2539 virtual void update_axis_limits (
const std::string& axis_type)
const;
2541 virtual void update_axis_limits (
const std::string& axis_type,
2544 virtual void update_uicontextmenu (
void)
const;
2548 children.delete_children (
clear);
2553 children.renumber (old_gh, new_gh);
2582 std::set<std::string> dynamic_property_names (
void)
const;
2587 std::set<std::string> dynamic_properties;
2597 BEGIN_BASE_PROPERTIES
2607 bool_property hittest , "on
"
2608 bool_property interruptible , "on
"
2609 handle_property parent fs , p
2610 bool_property selected , "off
"
2611 bool_property selectionhighlight , "on
"
2612 string_property tag s , ""
2613 string_property type frs , ty
2614 handle_property uicontextmenu u , graphics_handle ()
2615 any_property userdata , Matrix ()
2616 bool_property visible , "on
"
2617 // additional (Octave-specific) properties
2618 bool_property __modified__ s , "on
"
2619 graphics_handle __myhandle__ fhrs , mh
2623 struct cmp_caseless_str
2625 bool operator () (const caseless_str& a, const caseless_str& b) const
2628 std::transform (a1.begin (), a1.end (), a1.begin (), tolower);
2630 std::transform (b1.begin (), b1.end (), b1.begin (), tolower);
2636 std::map<caseless_str, property, cmp_caseless_str> all_props;
2639 void insert_static_property (const std::string& name, base_property& p)
2640 { insert_property (name, property (&p, true)); }
2642 virtual void init (void) { }
2645 class OCTINTERP_API base_graphics_object
2648 friend class graphics_object;
2650 base_graphics_object (void) : count (1), toolkit_flag (false) { }
2652 virtual ~base_graphics_object (void) { }
2654 virtual void mark_modified (void)
2656 if (! valid_object ())
2659 get_properties ().mark_modified ();
2662 virtual void override_defaults (base_graphics_object& obj)
2664 if (! valid_object ())
2666 get_properties ().override_defaults (obj);
2669 void build_user_defaults_map (property_list::pval_map_type &def,
2670 const std::string go_name) const;
2672 virtual void set_from_list (property_list& plist)
2674 if (! valid_object ())
2677 get_properties ().set_from_list (*this, plist);
2680 virtual void set (const caseless_str& pname, const octave_value& pval)
2682 if (! valid_object ())
2685 get_properties ().set (pname, pval);
2688 virtual void set_defaults (const std::string&)
2693 virtual octave_value get (bool all = false) const
2695 if (! valid_object ())
2698 return get_properties ().get (all);
2701 virtual octave_value get (const caseless_str& pname) const
2703 if (! valid_object ())
2706 return get_properties ().get (pname);
2709 virtual octave_value get_default (const caseless_str&) const;
2711 virtual octave_value get_factory_default (const caseless_str&) const;
2713 virtual octave_value get_defaults (void) const
2718 virtual property_list get_defaults_list (void) const
2720 if (! valid_object ())
2723 return property_list ();
2726 virtual octave_value get_factory_defaults (void) const
2731 virtual property_list get_factory_defaults_list (void) const
2736 virtual bool has_readonly_property (const caseless_str& pname) const
2738 return base_properties::has_readonly_property (pname);
2741 virtual std::string values_as_string (void);
2743 virtual std::string value_as_string (const std::string& prop);
2745 virtual octave_scalar_map values_as_struct (void);
2747 virtual graphics_handle get_parent (void) const
2749 if (! valid_object ())
2752 return get_properties ().get_parent ();
2755 graphics_handle get_handle (void) const
2757 if (! valid_object ())
2760 return get_properties ().get___myhandle__ ();
2763 virtual void remove_child (const graphics_handle& h)
2765 if (! valid_object ())
2768 get_properties ().remove_child (h);
2771 virtual void adopt (const graphics_handle& h)
2773 if (! valid_object ())
2776 get_properties ().adopt (h);
2779 virtual void reparent (const graphics_handle& np)
2781 if (! valid_object ())
2784 get_properties ().reparent (np);
2787 virtual void defaults (void) const
2789 if (! valid_object ())
2792 std::string msg = (type () + "::defaults
");
2793 err_not_implemented (msg.c_str ());
2796 virtual base_properties& get_properties (void)
2798 static base_properties properties;
2803 virtual const base_properties& get_properties (void) const
2805 static base_properties properties;
2810 virtual void update_axis_limits (const std::string& axis_type);
2812 virtual void update_axis_limits (const std::string& axis_type,
2813 const graphics_handle& h);
2815 virtual bool valid_object (void) const { return false; }
2817 bool valid_toolkit_object (void) const { return toolkit_flag; }
2819 virtual std::string type (void) const
2821 return (valid_object () ? get_properties ().graphics_object_name ()
2825 bool isa (const std::string& go_name) const
2827 return type () == go_name;
2830 virtual graphics_toolkit get_toolkit (void) const
2832 if (! valid_object ())
2835 return get_properties ().get_toolkit ();
2838 virtual void add_property_listener (const std::string& nm,
2839 const octave_value& v,
2840 listener_mode mode = POSTSET)
2842 if (valid_object ())
2843 get_properties ().add_listener (nm, v, mode);
2846 virtual void delete_property_listener (const std::string& nm,
2847 const octave_value& v,
2848 listener_mode mode = POSTSET)
2850 if (valid_object ())
2851 get_properties ().delete_listener (nm, v, mode);
2854 virtual void remove_all_listeners (void);
2856 virtual void reset_default_properties (void);
2859 virtual void initialize (const graphics_object& go)
2862 toolkit_flag = get_toolkit ().initialize (go);
2865 virtual void finalize (const graphics_object& go)
2869 get_toolkit ().finalize (go);
2870 toolkit_flag = false;
2874 virtual void update (const graphics_object& go, int id)
2877 get_toolkit ().update (go, id);
2881 // A reference count.
2882 octave_refcount<int> count;
2884 // A flag telling whether this object is a valid object
2885 // in the backend context.
2890 base_graphics_object (const base_graphics_object&) : count (0) { }
2892 base_graphics_object& operator = (const base_graphics_object&)
2898 class OCTINTERP_API graphics_object
2901 graphics_object (void) : rep (new base_graphics_object ()) { }
2903 graphics_object (base_graphics_object *new_rep)
2906 graphics_object (const graphics_object& obj) : rep (obj.rep)
2911 graphics_object& operator = (const graphics_object& obj)
2915 if (--rep->count == 0)
2925 ~graphics_object (void)
2927 if (--rep->count == 0)
2931 void mark_modified (void) { rep->mark_modified (); }
2933 void override_defaults (base_graphics_object& obj)
2935 rep->override_defaults (obj);
2938 void override_defaults (void)
2940 rep->override_defaults (*rep);
2943 void build_user_defaults_map (property_list::pval_map_type &def,
2944 const std::string go_name) const
2946 rep->build_user_defaults_map (def, go_name);
2949 void set_from_list (property_list& plist) { rep->set_from_list (plist); }
2951 void set (const caseless_str& name, const octave_value& val)
2953 rep->set (name, val);
2956 void set (const octave_value_list& args);
2958 void set (const Array<std::string>& names, const Cell& values,
2959 octave_idx_type row);
2961 void set (const octave_map& m);
2963 void set_value_or_default (const caseless_str& name,
2964 const octave_value& val);
2966 void set_defaults (const std::string& mode) { rep->set_defaults (mode); }
2968 octave_value get (bool all = false) const { return rep->get (all); }
2970 octave_value get (const caseless_str& name) const
2972 return name.compare ("default")
2974 : (name.compare ("factory
")
2975 ? get_factory_defaults () : rep->get (name));
2978 octave_value get (const std::string& name) const
2980 return get (caseless_str (name));
2983 octave_value get (const char *name) const
2985 return get (caseless_str (name));
2988 octave_value get_default (const caseless_str& name) const
2990 return rep->get_default (name);
2993 octave_value get_factory_default (const caseless_str& name) const
2995 return rep->get_factory_default (name);
2998 octave_value get_defaults (void) const { return rep->get_defaults (); }
3000 property_list get_defaults_list (void) const
3002 return rep->get_defaults_list ();
3005 octave_value get_factory_defaults (void) const
3007 return rep->get_factory_defaults ();
3010 property_list get_factory_defaults_list (void) const
3012 return rep->get_factory_defaults_list ();
3015 bool has_readonly_property (const caseless_str& pname) const
3017 return rep->has_readonly_property (pname);
3020 std::string values_as_string (void) { return rep->values_as_string (); }
3022 std::string value_as_string (const std::string& prop)
3024 return rep->value_as_string (prop);
3027 octave_map values_as_struct (void) { return rep->values_as_struct (); }
3029 graphics_handle get_parent (void) const { return rep->get_parent (); }
3031 graphics_handle get_handle (void) const { return rep->get_handle (); }
3033 graphics_object get_ancestor (const std::string& type) const;
3035 void remove_child (const graphics_handle& h) { rep->remove_child (h); }
3037 void adopt (const graphics_handle& h) { rep->adopt (h); }
3039 void reparent (const graphics_handle& h) { rep->reparent (h); }
3041 void defaults (void) const { rep->defaults (); }
3043 bool isa (const std::string& go_name) const { return rep->isa (go_name); }
3045 base_properties& get_properties (void) { return rep->get_properties (); }
3047 const base_properties& get_properties (void) const
3049 return rep->get_properties ();
3052 void update_axis_limits (const std::string& axis_type)
3054 rep->update_axis_limits (axis_type);
3057 void update_axis_limits (const std::string& axis_type,
3058 const graphics_handle& h)
3060 rep->update_axis_limits (axis_type, h);
3063 bool valid_object (void) const { return rep->valid_object (); }
3065 std::string type (void) const { return rep->type (); }
3067 operator bool (void) const { return rep->valid_object (); }
3069 // FIXME: these functions should be generated automatically by the
3070 // genprops.awk script.
3072 // EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS
3074 octave_value get_alim (void) const
3075 { return get_properties ().get_alim (); }
3077 octave_value get_clim (void) const
3078 { return get_properties ().get_clim (); }
3080 octave_value get_xlim (void) const
3081 { return get_properties ().get_xlim (); }
3083 octave_value get_ylim (void) const
3084 { return get_properties ().get_ylim (); }
3086 octave_value get_zlim (void) const
3087 { return get_properties ().get_zlim (); }
3089 bool is_aliminclude (void) const
3090 { return get_properties ().is_aliminclude (); }
3092 bool is_climinclude (void) const
3093 { return get_properties ().is_climinclude (); }
3095 bool is_xliminclude (void) const
3096 { return get_properties ().is_xliminclude (); }
3098 bool is_yliminclude (void) const
3099 { return get_properties ().is_yliminclude (); }
3101 bool is_zliminclude (void) const
3102 { return get_properties ().is_zliminclude (); }
3104 bool is_handle_visible (void) const
3105 { return get_properties ().is_handle_visible (); }
3107 graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); }
3109 void add_property_listener (const std::string& nm, const octave_value& v,
3110 listener_mode mode = POSTSET)
3111 { rep->add_property_listener (nm, v, mode); }
3113 void delete_property_listener (const std::string& nm, const octave_value& v,
3114 listener_mode mode = POSTSET)
3115 { rep->delete_property_listener (nm, v, mode); }
3117 void initialize (void) { rep->initialize (*this); }
3119 void finalize (void) { rep->finalize (*this); }
3121 void update (int id) { rep->update (*this, id); }
3123 void reset_default_properties (void)
3124 { rep->reset_default_properties (); }
3127 base_graphics_object *rep;
3130 // ---------------------------------------------------------------------
3132 class OCTINTERP_API root_figure : public base_graphics_object
3135 class OCTINTERP_API properties : public base_properties
3138 void remove_child (const graphics_handle& h);
3140 Matrix get_boundingbox (bool internal = false,
3141 const Matrix& parent_pix_size = Matrix ()) const;
3143 // See the genprops.awk script for an explanation of the
3144 // properties declarations.
3146 // FIXME: Properties that still don't have callbacks are:
3147 // monitorpositions, pointerlocation, pointerwindow.
3148 // Note that these properties are not yet used by Octave, so setting
3149 // them will have no effect.
3151 // FIXME: The commandwindowsize property has been deprecated in Matlab
3152 // and is now available through matlab.desktop.comandwindow.size.
3153 // Until Octave has something similar, keep this property in root.
3155 // Programming note: Keep property list sorted if new ones are added.
3157 BEGIN_PROPERTIES (root_figure, root)
3158 handle_property callbackobject Sr , graphics_handle ()
3159 array_property commandwindowsize r , Matrix (1, 2, 0)
3160 handle_property currentfigure S , graphics_handle ()
3161 string_property fixedwidthfontname , "Courier
"
3162 array_property monitorpositions r , default_screensize ()
3163 array_property pointerlocation , Matrix (1, 2, 0)
3164 double_property pointerwindow r , 0.0
3165 double_property screendepth r , default_screendepth ()
3166 double_property screenpixelsperinch r , default_screenpixelsperinch ()
3167 array_property screensize r , default_screensize ()
3168 bool_property showhiddenhandles , "off
"
3169 radio_property units U , "inches|centimeters|normalized|points|{pixels}
"
3173 std::list<graphics_handle> cbo_stack;
3178 properties xproperties;
3183 : xproperties (0, graphics_handle ()), default_properties () { }
3185 ~root_figure (void) { }
3187 void mark_modified (void) { }
3189 void override_defaults (base_graphics_object& obj)
3191 // Now override with our defaults. If the default_properties
3192 // list includes the properties for all defaults (line,
3193 // surface, etc.) then we don't have to know the type of OBJ
3194 // here, we just call its set function and let it decide which
3195 // properties from the list to use.
3196 obj.set_from_list (default_properties);
3199 void set (const caseless_str& name, const octave_value& value)
3201 if (name.compare ("default", 7))
3202 // strip "default", pass rest to function that will
3203 // parse the remainder and add the element to the
3204 // default_properties map.
3205 default_properties.set (name.substr (7), value);
3207 xproperties.set (name, value);
3210 octave_value get (const caseless_str& name) const
3212 octave_value retval;
3214 if (name.compare ("default", 7))
3215 return get_default (name.substr (7));
3216 else if (name.compare ("factory
", 7))
3217 return get_factory_default (name.substr (7));
3219 retval = xproperties.get (name);
3224 octave_value get_default (const caseless_str& name) const
3226 octave_value retval = default_properties.lookup (name);
3228 if (retval.is_undefined ())
3230 // no default property found, use factory default
3231 retval = factory_properties.lookup (name);
3233 if (retval.is_undefined ())
3234 error ("get: invalid
default property '%s'", name.c_str ());
3240 octave_value get_factory_default (const caseless_str& name) const
3242 octave_value retval = factory_properties.lookup (name);
3244 if (retval.is_undefined ())
3245 error ("get: invalid factory
default property '%s'", name.c_str ());
3250 octave_value get_defaults (void) const
3252 return default_properties.as_struct ("default");
3255 property_list get_defaults_list (void) const
3257 return default_properties;
3260 octave_value get_factory_defaults (void) const
3262 return factory_properties.as_struct ("factory
");
3265 property_list get_factory_defaults_list (void) const
3267 return factory_properties;
3270 base_properties& get_properties (void) { return xproperties; }
3272 const base_properties& get_properties (void) const { return xproperties; }
3274 bool valid_object (void) const { return true; }
3276 void reset_default_properties (void);
3278 bool has_readonly_property (const caseless_str& pname) const
3280 bool retval = xproperties.has_readonly_property (pname);
3282 retval = base_properties::has_readonly_property (pname);
3287 property_list default_properties;
3289 static property_list factory_properties;
3291 static property_list::plist_map_type init_factory_properties (void);
3294 // ---------------------------------------------------------------------
3296 class OCTINTERP_API figure : public base_graphics_object
3299 class OCTINTERP_API properties : public base_properties
3302 void init_integerhandle (const octave_value& val)
3304 integerhandle = val;
3307 void remove_child (const graphics_handle& h);
3309 void set_visible (const octave_value& val);
3311 graphics_toolkit get_toolkit (void) const
3314 toolkit = gtk_manager::get_toolkit ();
3319 void set_toolkit (const graphics_toolkit& b);
3321 void set___graphics_toolkit__ (const octave_value& val)
3323 if (! val.is_string ())
3324 error ("set___graphics_toolkit__ must be
a string");
3326 std::string nm = val.string_value ();
3327 graphics_toolkit b = gtk_manager::find_toolkit (nm);
3329 if (b.get_name () != nm)
3330 error ("set___graphics_toolkit__: invalid graphics toolkit
");
3332 if (nm != get___graphics_toolkit__ ())
3339 void adopt (const graphics_handle& h);
3341 void set_position (const octave_value& val,
3342 bool do_notify_toolkit = true);
3344 void set_outerposition (const octave_value& val,
3345 bool do_notify_toolkit = true);
3347 Matrix get_boundingbox (bool internal = false,
3348 const Matrix& parent_pix_size = Matrix ()) const;
3350 void set_boundingbox (const Matrix& bb, bool internal = false,
3351 bool do_notify_toolkit = true);
3353 Matrix map_from_boundingbox (double x, double y) const;
3355 Matrix map_to_boundingbox (double x, double y) const;
3357 void update_units (const caseless_str& old_units);
3359 void update_paperunits (const caseless_str& old_paperunits);
3361 std::string get_title (void) const;
3363 // See the genprops.awk script for an explanation of the
3364 // properties declarations.
3365 // FIXME: Several properties have been deleted from Matlab.
3366 // We should either immediately remove them or figure out a way
3367 // to deprecate them for a release or two.
3368 // Obsolete properties: doublebuffer, mincolormap, wvisual, wvisualmode,
3369 // xdisplay, xvisual, xvisualmode
3371 // Programming note: Keep property list sorted if new ones are added.
3373 BEGIN_PROPERTIES (figure)
3374 array_property alphamap , Matrix (64, 1, 1)
3375 callback_property buttondownfcn , Matrix ()
3376 callback_property closerequestfcn , "closereq
"
3377 color_property color , color_property (color_values (1, 1, 1), radio_values ("none
"))
3378 array_property colormap , viridis_colormap ()
3379 handle_property currentaxes S , graphics_handle ()
3380 string_property currentcharacter r , ""
3381 handle_property currentobject r , graphics_handle ()
3382 array_property currentpoint r , Matrix (2, 1, 0)
3383 bool_property dockcontrols , "off
"
3384 string_property filename , ""
3385 bool_property graphicssmoothing , "on
"
3386 bool_property integerhandle S , "on
"
3387 bool_property inverthardcopy , "on
"
3388 callback_property keypressfcn , Matrix ()
3389 callback_property keyreleasefcn , Matrix ()
3390 radio_property menubar , "{
figure}|none
"
3391 string_property name , ""
3392 // FIXME: Need RO property which returns current figure number.
3393 // double_property number r ,
3394 radio_property nextplot , "{add}|
new|
replace|replacechildren
"
3395 bool_property numbertitle , "on
"
3396 array_property outerposition s , Matrix (1, 4, -1.0)
3397 radio_property paperorientation U , "{portrait}|landscape
"
3398 array_property paperposition m , default_figure_paperposition ()
3399 // FIXME: Matlab default is "auto", but this messes up hgsave BIST test.
3400 radio_property paperpositionmode au , "auto|{manual}
"
3401 array_property papersize U , default_figure_papersize ()
3402 radio_property papertype SU , "{usletter}|uslegal|a0|a1|
a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-
a|arch-
b|arch-
c|arch-
d|arch-
e|
a|
b|
c|
d|
e|tabloid|<custom>
"
3403 radio_property paperunits Su , "{inches}|centimeters|normalized|points
"
3404 radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|
left|top|
right|bottom|circle|
cross|fleur|custom|hand
"
3405 array_property pointershapecdata , Matrix (16, 16, 0)
3406 array_property pointershapehotspot , Matrix (1, 2, 0)
3407 array_property position s , default_figure_position ()
3408 radio_property renderer m , "{opengl}|painters
"
3409 radio_property renderermode , "{
auto}|manual
"
3410 bool_property resize , "on
"
3411 // FIXME: resizefcn has been deprecated by Matlab, and
3412 // replaced with sizechangedfcn
3413 // Eventually this will need to be hidden, and then removed.
3414 callback_property resizefcn , Matrix ()
3415 radio_property selectiontype , "{normal}|extend|alt|open
"
3416 callback_property sizechangedfcn , Matrix ()
3417 radio_property toolbar , "{
auto}|
figure|none
"
3418 radio_property units Su , "{pixels}|normalized|inches|centimeters|points|characters
"
3419 callback_property windowbuttondownfcn , Matrix ()
3420 callback_property windowbuttonmotionfcn , Matrix ()
3421 callback_property windowbuttonupfcn , Matrix ()
3422 callback_property windowkeypressfcn , Matrix ()
3423 callback_property windowkeyreleasefcn , Matrix ()
3424 callback_property windowscrollwheelfcn , Matrix ()
3425 radio_property windowstyle , "{normal}|modal|docked
"
3426 // Octave-specific properties
3427 mutable string_property __gl_extensions__ hr , ""
3428 mutable string_property __gl_renderer__ hr , ""
3429 mutable string_property __gl_vendor__ hr , ""
3430 mutable string_property __gl_version__ hr , ""
3431 string_property __graphics_toolkit__ hs , gtk_manager::default_toolkit ()
3432 any_property __guidata__ h , Matrix ()
3433 radio_property __mouse_mode__ hS , "{none}|pan|rotate|select|
text|zoom
"
3434 any_property __pan_mode__ h , Matrix ()
3435 any_property __plot_stream__ h , Matrix ()
3436 any_property __rotate_mode__ h , Matrix ()
3437 any_property __zoom_mode__ h , Matrix ()
3439 // Obsolete properties: doublebuffer, mincolormap, wvisual, wvisualmode,
3440 // xdisplay, xvisual, xvisualmode
3441 // FIXME: Remove in version 4.6
3442 bool_property doublebuffer h , "on
"
3443 double_property mincolormap h , 64
3444 string_property wvisual hm , ""
3445 radio_property wvisualmode h , "{
auto}|manual
"
3446 string_property xdisplay h , ""
3447 string_property xvisual hm , ""
3448 radio_property xvisualmode h , "{
auto}|manual
"
3454 alphamap.add_constraint (dim_vector (-1, 1));
3455 colormap.add_constraint (dim_vector (-1, 3));
3456 outerposition.add_constraint (dim_vector (1, 4));
3457 paperposition.add_constraint (dim_vector (1, 4));
3458 papersize.add_constraint (dim_vector (1, 2));
3459 pointershapecdata.add_constraint (dim_vector (16, 16));
3460 pointershapehotspot.add_constraint (dim_vector (1, 2));
3461 position.add_constraint (dim_vector (1, 4));
3465 Matrix get_auto_paperposition (void);
3467 void update_paperpositionmode (void)
3469 if (paperpositionmode.is ("auto"))
3470 paperposition.set (get_auto_paperposition ());
3473 mutable graphics_toolkit toolkit;
3477 properties xproperties;
3480 figure (const graphics_handle& mh, const graphics_handle& p)
3481 : base_graphics_object (), xproperties (mh, p), default_properties ()
3486 void override_defaults (base_graphics_object& obj)
3488 // Allow parent (root figure) to override first (properties knows how
3489 // to find the parent object).
3490 xproperties.override_defaults (obj);
3492 // Now override with our defaults. If the default_properties
3493 // list includes the properties for all defaults (line,
3494 // surface, etc.) then we don't have to know the type of OBJ
3495 // here, we just call its set function and let it decide which
3496 // properties from the list to use.
3497 obj.set_from_list (default_properties);
3500 void set (const caseless_str& name, const octave_value& value)
3502 if (name.compare ("default", 7))
3503 // strip "default", pass rest to function that will
3504 // parse the remainder and add the element to the
3505 // default_properties map.
3506 default_properties.set (name.substr (7), value);
3508 xproperties.set (name, value);
3511 octave_value get (const caseless_str& name) const
3513 octave_value retval;
3515 if (name.compare ("default", 7))
3516 retval = get_default (name.substr (7));
3518 retval = xproperties.get (name);
3523 octave_value get_default (const caseless_str& name) const;
3525 octave_value get_defaults (void) const
3527 return default_properties.as_struct ("default");
3530 property_list get_defaults_list (void) const
3532 return default_properties;
3535 base_properties& get_properties (void) { return xproperties; }
3537 const base_properties& get_properties (void) const { return xproperties; }
3539 bool valid_object (void) const { return true; }
3541 void reset_default_properties (void);
3543 bool has_readonly_property (const caseless_str& pname) const
3545 bool retval = xproperties.has_readonly_property (pname);
3547 retval = base_properties::has_readonly_property (pname);
3552 property_list default_properties;
3555 // ---------------------------------------------------------------------
3557 class OCTINTERP_API graphics_xform
3560 graphics_xform (void)
3561 : xform (xform_eye ()), xform_inv (xform_eye ()),
3562 sx ("linear
"), sy ("linear
"), sz ("linear
"), zlim (1, 2, 0.0)
3567 graphics_xform (const Matrix& xm, const Matrix& xim,
3568 const scaler& x, const scaler& y, const scaler& z,
3570 : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { }
3572 graphics_xform (const graphics_xform& g)
3573 : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx),
3574 sy (g.sy), sz (g.sz), zlim (g.zlim) { }
3576 ~graphics_xform (void) { }
3578 graphics_xform& operator = (const graphics_xform& g)
3581 xform_inv = g.xform_inv;
3590 static ColumnVector xform_vector (double x, double y, double z);
3592 static Matrix xform_eye (void);
3594 ColumnVector transform (double x, double y, double z,
3595 bool use_scale = true) const;
3597 ColumnVector untransform (double x, double y, double z,
3598 bool use_scale = true) const;
3600 ColumnVector untransform (double x, double y, bool use_scale = true) const
3601 { return untransform (x, y, (zlim(0)+zlim(1))/2, use_scale); }
3603 Matrix xscale (const Matrix& m) const { return sx.scale (m); }
3604 Matrix yscale (const Matrix& m) const { return sy.scale (m); }
3605 Matrix zscale (const Matrix& m) const { return sz.scale (m); }
3607 Matrix scale (const Matrix& m) const
3609 bool has_z = (m.columns () > 2);
3611 if (sx.is_linear () && sy.is_linear ()
3612 && (! has_z || sz.is_linear ()))
3615 Matrix retval (m.dims ());
3619 for (int i = 0; i < r; i++)
3621 retval(i,0) = sx.scale (m(i,0));
3622 retval(i,1) = sy.scale (m(i,1));
3624 retval(i,2) = sz.scale (m(i,2));
3645 class OCTINTERP_API axes : public base_graphics_object
3648 class OCTINTERP_API properties : public base_properties
3651 void set_defaults (base_graphics_object& obj, const std::string& mode);
3653 void remove_child (const graphics_handle& h);
3655 const scaler& get_x_scaler (void) const { return sx; }
3656 const scaler& get_y_scaler (void) const { return sy; }
3657 const scaler& get_z_scaler (void) const { return sz; }
3659 Matrix get_boundingbox (bool internal = false,
3660 const Matrix& parent_pix_size = Matrix ()) const;
3661 Matrix get_extent (bool with_text = false,
3662 bool only_text_height=false) const;
3664 double get_fontsize_points (double box_pix_height = 0) const;
3666 void update_boundingbox (void)
3668 if (units_is ("normalized
"))
3671 base_properties::update_boundingbox ();
3675 void update_camera (void);
3676 void update_axes_layout (void);
3677 void update_aspectratios (void);
3678 void update_transform (void)
3680 update_aspectratios ();
3682 update_axes_layout ();
3685 void sync_positions (void);
3687 void update_autopos (const std::string& elem_type);
3688 void update_xlabel_position (void);
3689 void update_ylabel_position (void);
3690 void update_zlabel_position (void);
3691 void update_title_position (void);
3693 graphics_xform get_transform (void) const
3694 { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); }
3696 Matrix get_transform_matrix (void) const { return x_render; }
3697 Matrix get_inverse_transform_matrix (void) const { return x_render_inv; }
3698 Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; }
3699 Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; }
3700 Matrix get_transform_zlim (void) const { return x_zlim; }
3702 int get_xstate (void) const { return xstate; }
3703 int get_ystate (void) const { return ystate; }
3704 int get_zstate (void) const { return zstate; }
3705 double get_xPlane (void) const { return xPlane; }
3706 double get_xPlaneN (void) const { return xPlaneN; }
3707 double get_yPlane (void) const { return yPlane; }
3708 double get_yPlaneN (void) const { return yPlaneN; }
3709 double get_zPlane (void) const { return zPlane; }
3710 double get_zPlaneN (void) const { return zPlaneN; }
3711 double get_xpTick (void) const { return xpTick; }
3712 double get_xpTickN (void) const { return xpTickN; }
3713 double get_ypTick (void) const { return ypTick; }
3714 double get_ypTickN (void) const { return ypTickN; }
3715 double get_zpTick (void) const { return zpTick; }
3716 double get_zpTickN (void) const { return zpTickN; }
3717 double get_x_min (void) const { return std::min (xPlane, xPlaneN); }
3718 double get_x_max (void) const { return std::max (xPlane, xPlaneN); }
3719 double get_y_min (void) const { return std::min (yPlane, yPlaneN); }
3720 double get_y_max (void) const { return std::max (yPlane, yPlaneN); }
3721 double get_z_min (void) const { return std::min (zPlane, zPlaneN); }
3722 double get_z_max (void) const { return std::max (zPlane, zPlaneN); }
3723 double get_fx (void) const { return fx; }
3724 double get_fy (void) const { return fy; }
3725 double get_fz (void) const { return fz; }
3726 double get_xticklen (void) const { return xticklen; }
3727 double get_yticklen (void) const { return yticklen; }
3728 double get_zticklen (void) const { return zticklen; }
3729 double get_xtickoffset (void) const { return xtickoffset; }
3730 double get_ytickoffset (void) const { return ytickoffset; }
3731 double get_ztickoffset (void) const { return ztickoffset; }
3732 bool get_x2Dtop (void) const { return x2Dtop; }
3733 bool get_y2Dright (void) const { return y2Dright; }
3734 bool get_layer2Dtop (void) const { return layer2Dtop; }
3735 bool get_is2D (void) const { return is2D; }
3736 bool get_xySym (void) const { return xySym; }
3737 bool get_xyzSym (void) const { return xyzSym; }
3738 bool get_zSign (void) const { return zSign; }
3739 bool get_nearhoriz (void) const { return nearhoriz; }
3741 ColumnVector pixel2coord (double px, double py) const
3742 { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); }
3744 ColumnVector coord2pixel (double x, double y, double z) const
3745 { return get_transform ().transform (x, y, z); }
3747 void zoom_about_point (const std::string& mode, double x, double y,
3748 double factor, bool push_to_zoom_stack = true);
3749 void zoom (const std::string& mode, double factor,
3750 bool push_to_zoom_stack = true);
3751 void zoom (const std::string& mode, const Matrix& xl, const Matrix& yl,
3752 bool push_to_zoom_stack = true);
3754 void translate_view (const std::string& mode,
3755 double x0, double x1, double y0, double y1,
3756 bool push_to_zoom_stack = true);
3758 void pan (const std::string& mode, double factor,
3759 bool push_to_zoom_stack = true);
3761 void rotate3d (double x0, double x1, double y0, double y1,
3762 bool push_to_zoom_stack = true);
3764 void rotate_view (double delta_az, double delta_el,
3765 bool push_to_zoom_stack = true);
3768 void push_zoom_stack (void);
3769 void clear_zoom_stack (bool do_unzoom = true);
3771 void update_units (const caseless_str& old_units);
3773 void update_fontunits (const caseless_str& old_fontunits);
3777 Matrix x_render, x_render_inv;
3778 Matrix x_gl_mat1, x_gl_mat2;
3780 std::list<octave_value> zoom_stack;
3783 int xstate, ystate, zstate;
3784 double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN;
3785 double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN;
3787 double xticklen, yticklen, zticklen;
3788 double xtickoffset, ytickoffset, ztickoffset;
3789 bool x2Dtop, y2Dright, layer2Dtop, is2D;
3790 bool xySym, xyzSym, zSign, nearhoriz;
3792 // Text renderer, used for calculation of text (tick labels) size
3793 octave::text_renderer txt_renderer;
3795 void set_text_child (handle_property& h, const std::string& who,
3796 const octave_value& v);
3798 void delete_text_child (handle_property& h);
3800 // See the genprops.awk script for an explanation of the
3801 // properties declarations.
3803 // FIXME: Several properties have been deleted from Matlab.
3804 // We should either immediately remove them or figure out a way
3805 // to deprecate them for a release or two.
3806 // Obsolete properties: drawmode
3808 // Programming note: Keep property list sorted if new ones are added.
3810 BEGIN_PROPERTIES (axes)
3811 radio_property activepositionproperty , "{outerposition}|position
"
3812 row_vector_property alim m , default_lim ()
3813 radio_property alimmode , "{
auto}|manual
"
3814 color_property ambientlightcolor , color_values (1, 1, 1)
3815 bool_property box , "off
"
3816 radio_property boxstyle , "{back}|full
"
3817 array_property cameraposition m , Matrix (1, 3, 0.0)
3818 radio_property camerapositionmode , "{
auto}|manual
"
3819 array_property cameratarget m , Matrix (1, 3, 0.0)
3820 radio_property cameratargetmode , "{
auto}|manual
"
3821 array_property cameraupvector m , Matrix (1, 3, 0.0)
3822 radio_property cameraupvectormode , "{
auto}|manual
"
3823 double_property cameraviewangle m , 6.6086
3824 radio_property cameraviewanglemode , "{
auto}|manual
"
3825 row_vector_property clim m , default_lim ()
3826 radio_property climmode al , "{
auto}|manual
"
3827 radio_property clippingstyle , "{3dbox}|rectangle
"
3828 color_property color , color_property (color_values (1, 1, 1), radio_values ("none
"))
3829 array_property colororder , default_colororder ()
3830 double_property colororderindex , 1.0
3831 array_property currentpoint , Matrix (2, 3, 0.0)
3832 array_property dataaspectratio mu , Matrix (1, 3, 1.0)
3833 radio_property dataaspectratiomode u , "{
auto}|manual
"
3834 radio_property drawmode , "{normal}|fast
"
3835 radio_property fontangle u , "{normal}|italic
"
3836 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
3837 double_property fontsize u , 10
3838 radio_property fontunits SU , "{points}|inches|centimeters|normalized|pixels
"
3839 bool_property fontsmoothing , "on
"
3840 radio_property fontweight u , "{normal}|bold
"
3841 double_property gridalpha m , 0.15
3842 radio_property gridalphamode , "{
auto}|manual
"
3843 color_property gridcolor , color_property (color_values (0.15, 0.15, 0.15), radio_values ("none
"))
3844 radio_property gridcolormode , "{
auto}|manual
"
3845 radio_property gridlinestyle , "{-}|--|:|-.|none
"
3846 double_property labelfontsizemultiplier , 1.1
3847 radio_property layer u , "{bottom}|top
"
3848 // FIXME: should be kind of string array.
3849 any_property linestyleorder S , "-
"
3850 double_property linestyleorderindex , 1.0
3851 double_property linewidth , 0.5
3852 double_property minorgridalpha m , 0.25
3853 radio_property minorgridalphamode , "{
auto}|manual
"
3854 color_property minorgridcolor m , color_property (color_values (0.1, 0.1, 0.1), radio_values ("none
"))
3855 radio_property minorgridcolormode , "{
auto}|manual
"
3856 radio_property minorgridlinestyle , "{:}|-|--|-.|none
"
3857 radio_property nextplot , "{
replace}|add|replacechildren
"
3858 array_property outerposition u , default_axes_outerposition ()
3859 array_property plotboxaspectratio mu , Matrix (1, 3, 1.0)
3860 radio_property plotboxaspectratiomode u , "{
auto}|manual
"
3861 radio_property pickableparts , "{visible}|all|none
"
3862 array_property position u , default_axes_position ()
3863 radio_property projection , "{orthographic}|perspective
"
3864 radio_property sortmethod , "{depth}|childorder
"
3865 radio_property tickdir mu , "{in}|out
"
3866 radio_property tickdirmode u , "{
auto}|manual
"
3867 // FIXME: Added recently to Matlab, should replace interpreter property.
3868 radio_property ticklabelinterpreter , "{tex}|latex|none
"
3869 array_property ticklength u , default_axes_ticklength ()
3870 array_property tightinset r , Matrix (1, 4, 0.0)
3871 handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
3872 double_property titlefontsizemultiplier , 1.1
3873 radio_property titlefontweight , "{bold}|normal
"
3874 // FIXME: uicontextmenu should be moved here.
3875 radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters
"
3876 array_property view u , default_axes_view ()
3877 // FIXME: Remove "zero" in 4.6
3878 radio_property xaxislocation u , "{bottom}|top|origin|
zero"
3879 color_property xcolor mu , color_values (0.15, 0.15, 0.15)
3880 radio_property xcolormode , "{
auto}|manual
"
3881 radio_property xdir u , "{normal}|reverse
"
3882 bool_property xgrid , "off
"
3883 handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
3884 row_vector_property xlim mu , default_lim ()
3885 radio_property xlimmode al , "{
auto}|manual
"
3886 bool_property xminorgrid , "off
"
3887 bool_property xminortick , "off
"
3888 radio_property xscale alu , "{linear}|
log"
3889 row_vector_property xtick mu , default_axes_tick ()
3890 // FIXME: should be kind of string array.
3891 any_property xticklabel S , ""
3892 radio_property xticklabelmode u , "{
auto}|manual
"
3893 double_property xticklabelrotation , 0.0
3894 radio_property xtickmode u , "{
auto}|manual
"
3895 // FIXME: Remove "zero" in 4.6
3897 color_property ycolor mu , color_values (0.15, 0.15, 0.15)
3898 radio_property ycolormode , "{
auto}|manual
"
3899 radio_property ydir u , "{normal}|reverse
"
3900 bool_property ygrid , "off
"
3901 handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
3902 row_vector_property ylim mu , default_lim ()
3903 radio_property ylimmode al , "{
auto}|manual
"
3904 bool_property yminorgrid , "off
"
3905 bool_property yminortick , "off
"
3906 radio_property yscale alu , "{linear}|
log"
3907 row_vector_property ytick mu , default_axes_tick ()
3908 any_property yticklabel S , ""
3909 radio_property yticklabelmode u , "{
auto}|manual
"
3910 double_property yticklabelrotation , 0.0
3911 radio_property ytickmode u , "{
auto}|manual
"
3912 color_property zcolor mu , color_values (0.15, 0.15, 0.15)
3913 radio_property zcolormode , "{
auto}|manual
"
3914 radio_property zdir u , "{normal}|reverse
"
3915 bool_property zgrid , "off
"
3916 handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false)
3917 row_vector_property zlim mu , default_lim ()
3918 radio_property zlimmode al , "{
auto}|manual
"
3919 bool_property zminorgrid , "off
"
3920 bool_property zminortick , "off
"
3921 radio_property zscale alu , "{linear}|
log"
3922 row_vector_property ztick mu , default_axes_tick ()
3923 any_property zticklabel S , ""
3924 radio_property zticklabelmode u , "{
auto}|manual
"
3925 double_property zticklabelrotation , 0.0
3926 radio_property ztickmode u , "{
auto}|manual
"
3927 // Octave-specific properties
3928 double_property mousewheelzoom , 0.5
3929 // hidden properties for alignment of subplots
3930 radio_property autopos_tag h , "{none}|subplot
"
3931 // hidden properties for inset
3932 array_property looseinset hu , Matrix (1, 4, 0.0)
3933 // hidden properties for transformation computation
3934 array_property x_viewtransform h , Matrix (4, 4, 0.0)
3935 array_property x_projectiontransform h , Matrix (4, 4, 0.0)
3936 array_property x_viewporttransform h , Matrix (4, 4, 0.0)
3937 array_property x_normrendertransform h , Matrix (4, 4, 0.0)
3938 array_property x_rendertransform h , Matrix (4, 4, 0.0)
3939 // hidden properties for minor ticks
3940 row_vector_property xmtick h , Matrix ()
3941 row_vector_property ymtick h , Matrix ()
3942 row_vector_property zmtick h , Matrix ()
3943 // hidden property for text rendering
3944 double_property fontsize_points hgr , 0
3953 get_scale (const std::string& scale, const Matrix& lims)
3955 std::string retval = scale;
3957 if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0)
3963 void update_xscale (void)
3965 sx = get_scale (get_xscale (), xlim.get ().matrix_value ());
3968 void update_yscale (void)
3970 sy = get_scale (get_yscale (), ylim.get ().matrix_value ());
3973 void update_zscale (void)
3975 sz = get_scale (get_zscale (), zlim.get ().matrix_value ());
3978 void update_label_color (handle_property label, color_property col);
3979 void update_xcolor (void)
3980 { update_label_color (xlabel, xcolor); }
3982 void update_ycolor (void)
3983 { update_label_color (ylabel, ycolor); }
3985 void update_zcolor (void)
3986 { update_label_color (zlabel, zcolor); }
3988 void update_view (void) { sync_positions (); }
3989 void update_dataaspectratio (void) { sync_positions (); }
3990 void update_dataaspectratiomode (void) { sync_positions (); }
3991 void update_plotboxaspectratio (void) { sync_positions (); }
3992 void update_plotboxaspectratiomode (void) { sync_positions (); }
3994 void update_layer (void) { update_axes_layout (); }
3995 void update_yaxislocation (void)
3997 // FIXME: Remove warning with "zero" in 4.6
3998 if (yaxislocation_is ("zero"))
3999 warning_with_id ("Octave:deprecated-
property",
4000 "Setting
'yaxislocation' to 'zero' is deprecated,
"
4001 "set to 'origin' instead.
");
4003 update_axes_layout ();
4004 update_ylabel_position ();
4006 void update_xaxislocation (void)
4008 // FIXME: Remove warning with "zero
" in 4.6
4009 if (xaxislocation_is ("zero"))
4010 warning_with_id ("Octave:deprecated-
property",
4011 "Setting
'xaxislocation' to 'zero' is deprecated,
"
4012 "set to 'origin' instead.
");
4014 update_axes_layout ();
4015 update_xlabel_position ();
4018 void update_xdir (void) { update_camera (); update_axes_layout (); }
4019 void update_ydir (void) { update_camera (); update_axes_layout (); }
4020 void update_zdir (void) { update_camera (); update_axes_layout (); }
4022 void update_ticklength (void);
4023 void update_tickdir (void) { update_ticklength (); }
4024 void update_tickdirmode (void) { update_ticklength (); }
4026 void update_xtick (void)
4028 if (xticklabelmode.is ("auto
"))
4029 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
4032 void update_ytick (void)
4034 if (yticklabelmode.is ("auto"))
4035 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
4038 void update_ztick (void)
4040 if (zticklabelmode.is ("auto"))
4041 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
4045 void update_xtickmode (void)
4047 if (xtickmode.is ("auto"))
4049 calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"),
4054 void update_ytickmode (void)
4056 if (ytickmode.is ("auto"))
4058 calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"),
4063 void update_ztickmode (void)
4065 if (ztickmode.is ("auto"))
4067 calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"),
4073 void update_xticklabelmode (void)
4075 if (xticklabelmode.is ("auto"))
4076 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
4078 void update_yticklabelmode (void)
4080 if (yticklabelmode.is ("auto"))
4081 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
4083 void update_zticklabelmode (void)
4085 if (zticklabelmode.is ("auto"))
4086 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
4089 void update_font (void);
4090 void update_fontname (void)
4095 void update_fontsize (void)
4100 void update_fontangle (void)
4105 void update_fontweight (void)
4111 void update_outerposition (void)
4113 set_activepositionproperty ("outerposition
");
4114 caseless_str old_units = get_units ();
4115 set_units ("normalized
");
4116 Matrix outerbox = outerposition.get ().matrix_value ();
4117 Matrix innerbox = position.get ().matrix_value ();
4118 Matrix linset = looseinset.get ().matrix_value ();
4119 Matrix tinset = tightinset.get ().matrix_value ();
4120 outerbox(2) = outerbox(2) + outerbox(0);
4121 outerbox(3) = outerbox(3) + outerbox(1);
4122 innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0));
4123 innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1));
4124 innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2));
4125 innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3));
4126 innerbox(2) = innerbox(2) - innerbox(0);
4127 innerbox(3) = innerbox(3) - innerbox(1);
4128 position = innerbox;
4129 set_units (old_units);
4130 update_transform ();
4133 void update_position (void)
4135 set_activepositionproperty ("position
");
4136 caseless_str old_units = get_units ();
4137 set_units ("normalized
");
4138 Matrix outerbox = outerposition.get ().matrix_value ();
4139 Matrix innerbox = position.get ().matrix_value ();
4140 Matrix linset = looseinset.get ().matrix_value ();
4141 Matrix tinset = tightinset.get ().matrix_value ();
4142 innerbox(2) = innerbox(2) + innerbox(0);
4143 innerbox(3) = innerbox(3) + innerbox(1);
4144 outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0));
4145 outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1));
4146 outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2));
4147 outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3));
4148 outerbox(2) = outerbox(2) - outerbox(0);
4149 outerbox(3) = outerbox(3) - outerbox(1);
4150 outerposition = outerbox;
4151 set_units (old_units);
4152 update_transform ();
4155 void update_looseinset (void)
4157 caseless_str old_units = get_units ();
4158 set_units ("normalized
");
4159 Matrix innerbox = position.get ().matrix_value ();
4160 innerbox(2) = innerbox(2) + innerbox(0);
4161 innerbox(3) = innerbox(3) + innerbox(1);
4162 Matrix outerbox = outerposition.get ().matrix_value ();
4163 outerbox(2) = outerbox(2) + outerbox(0);
4164 outerbox(3) = outerbox(3) + outerbox(1);
4165 Matrix linset = looseinset.get ().matrix_value ();
4166 Matrix tinset = tightinset.get ().matrix_value ();
4167 if (activepositionproperty.is ("position
"))
4169 outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0));
4170 outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1));
4171 outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2));
4172 outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3));
4173 outerbox(2) = outerbox(2) - outerbox(0);
4174 outerbox(3) = outerbox(3) - outerbox(1);
4175 outerposition = outerbox;
4179 innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0));
4180 innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1));
4181 innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2));
4182 innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3));
4183 innerbox(2) = innerbox(2) - innerbox(0);
4184 innerbox(3) = innerbox(3) - innerbox(1);
4185 position = innerbox;
4187 set_units (old_units);
4188 update_transform ();
4191 double calc_tick_sep (double minval, double maxval);
4192 void calc_ticks_and_lims (array_property& lims, array_property& ticks,
4193 array_property& mticks,
4194 bool limmode_is_auto, bool is_logscale);
4195 void calc_ticklabels (const array_property& ticks, any_property& labels,
4197 Matrix get_ticklabel_extents (const Matrix& ticks,
4198 const string_vector& ticklabels,
4199 const Matrix& limits);
4201 void fix_limits (array_property& lims)
4203 if (lims.get ().is_empty ())
4206 Matrix l = lims.get ().matrix_value ();
4213 else if (l(0) == l(1))
4221 Matrix calc_tightbox (const Matrix& init_pos);
4224 Matrix get_axis_limits (double xmin, double xmax,
4225 double min_pos, double max_neg,
4230 if (xtickmode.is ("auto"))
4231 calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"),
4233 if (xticklabelmode.is ("auto"))
4234 calc_ticklabels (xtick, xticklabel, xscale.is ("log"));
4240 update_axes_layout ();
4243 void update_ylim (void)
4245 if (ytickmode.is ("auto"))
4246 calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"),
4248 if (yticklabelmode.is ("auto"))
4249 calc_ticklabels (ytick, yticklabel, yscale.is ("log"));
4255 update_axes_layout ();
4258 void update_zlim (void)
4260 if (ztickmode.is ("auto"))
4261 calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"),
4263 if (zticklabelmode.is ("auto"))
4264 calc_ticklabels (ztick, zticklabel, zscale.is ("log"));
4270 update_axes_layout ();
4276 properties xproperties;
4279 axes (const graphics_handle& mh, const graphics_handle& p)
4280 : base_graphics_object (), xproperties (mh, p), default_properties ()
4282 xproperties.update_transform ();
4287 void override_defaults (base_graphics_object& obj)
4289 // Allow parent (figure) to override first (properties knows how
4290 // to find the parent object).
4291 xproperties.override_defaults (obj);
4293 // Now override with our defaults. If the default_properties
4294 // list includes the properties for all defaults (line,
4295 // surface, etc.) then we don't have to know the type of OBJ
4296 // here, we just call its set function and let it decide which
4297 // properties from the list to use.
4298 obj.set_from_list (default_properties);
4301 void set (const caseless_str& name, const octave_value& value)
4303 if (name.compare ("default", 7))
4304 // strip "default", pass rest to function that will
4305 // parse the remainder and add the element to the
4306 // default_properties map.
4307 default_properties.set (name.substr (7), value);
4309 xproperties.set (name, value);
4312 void set_defaults (const std::string& mode)
4314 xproperties.set_defaults (*this, mode);
4317 octave_value get (const caseless_str& name) const
4319 octave_value retval;
4321 // FIXME: finish this.
4322 if (name.compare ("default", 7))
4323 retval = get_default (name.substr (7));
4325 retval = xproperties.get (name);
4330 octave_value get_default (const caseless_str& name) const;
4332 octave_value get_defaults (void) const
4334 return default_properties.as_struct ("default");
4337 property_list get_defaults_list (void) const
4339 return default_properties;
4342 base_properties& get_properties (void) { return xproperties; }
4344 const base_properties& get_properties (void) const { return xproperties; }
4346 void update_axis_limits (const std::string& axis_type);
4348 void update_axis_limits (const std::string& axis_type,
4349 const graphics_handle& h);
4351 bool valid_object (void) const { return true; }
4353 void reset_default_properties (void);
4355 bool has_readonly_property (const caseless_str& pname) const
4357 bool retval = xproperties.has_readonly_property (pname);
4359 retval = base_properties::has_readonly_property (pname);
4364 void initialize (const graphics_object& go);
4367 property_list default_properties;
4370 // ---------------------------------------------------------------------
4372 class OCTINTERP_API line : public base_graphics_object
4375 class OCTINTERP_API properties : public base_properties
4378 // See the genprops.awk script for an explanation of the
4379 // properties declarations.
4380 // Programming note: Keep property list sorted if new ones are added.
4382 BEGIN_PROPERTIES (line)
4383 color_property color , color_property (color_values (0, 0, 0), radio_values ("none
"))
4384 string_property displayname , ""
4385 // FIXME: Remove erasemode property in version 4.6.
4386 radio_property erasemode h , "{normal}|none|xor|background
"
4387 // FIXME: interpreter is not a property of Matlab line objects.
4388 // Octave uses this for legend() with the string displayname.
4389 radio_property interpreter , "{tex}|none|latex
"
4390 radio_property linestyle , "{-}|--|:|-.|none
"
4391 double_property linewidth , 0.5
4392 radio_property marker , "{none}|+|o|*|.|
x|
s|square|
d|diamond|^|v|>|<|
p|pentagram|h|hexagram
"
4393 color_property markeredgecolor , color_property (radio_values ("{
auto}|none
"), color_values (0, 0, 0))
4394 color_property markerfacecolor , color_property (radio_values ("auto|{none}
"), color_values (0, 0, 0))
4395 double_property markersize , 6
4396 row_vector_property xdata u , default_data ()
4397 string_property xdatasource , ""
4398 row_vector_property ydata u , default_data ()
4399 string_property ydatasource , ""
4400 row_vector_property zdata u , Matrix ()
4401 string_property zdatasource , ""
4403 // hidden properties for limit computation
4404 row_vector_property xlim hlr , Matrix ()
4405 row_vector_property ylim hlr , Matrix ()
4406 row_vector_property zlim hlr , Matrix ()
4407 bool_property xliminclude hl , "on
"
4408 bool_property yliminclude hl , "on
"
4409 bool_property zliminclude hl , "off
"
4413 Matrix compute_xlim (void) const;
4414 Matrix compute_ylim (void) const;
4416 void update_xdata (void) { set_xlim (compute_xlim ()); }
4418 void update_ydata (void) { set_ylim (compute_ylim ()); }
4420 void update_zdata (void)
4422 set_zlim (zdata.get_limits ());
4423 set_zliminclude (get_zdata ().numel () > 0);
4428 properties xproperties;
4431 line (const graphics_handle& mh, const graphics_handle& p)
4432 : base_graphics_object (), xproperties (mh, p)
4437 base_properties& get_properties (void) { return xproperties; }
4439 const base_properties& get_properties (void) const { return xproperties; }
4441 bool valid_object (void) const { return true; }
4443 bool has_readonly_property (const caseless_str& pname) const
4445 bool retval = xproperties.has_readonly_property (pname);
4447 retval = base_properties::has_readonly_property (pname);
4452 // ---------------------------------------------------------------------
4454 class OCTINTERP_API text : public base_graphics_object
4457 class OCTINTERP_API properties : public base_properties
4460 double get_fontsize_points (double box_pix_height = 0) const;
4462 void set_position (const octave_value& val)
4464 octave_value new_val (val);
4466 if (new_val.numel () == 2)
4468 dim_vector dv (1, 3);
4470 new_val = new_val.resize (dv, true);
4473 if (position.set (new_val, false))
4475 set_positionmode ("manual
");
4477 position.run_listeners (POSTSET);
4481 set_positionmode ("manual
");
4484 // See the genprops.awk script for an explanation of the
4485 // properties declarations.
4487 BEGIN_PROPERTIES (text)
4488 color_property backgroundcolor , color_property (radio_values ("{none}
"), color_values (1, 1, 1))
4489 color_property color u , color_values (0, 0, 0)
4490 string_property displayname , ""
4491 color_property edgecolor , color_property (radio_values ("{none}
"), color_values (0, 0, 0))
4492 bool_property editing , "off
"
4493 radio_property erasemode h , "{normal}|none|xor|background
"
4494 array_property extent rG , Matrix (1, 4, 0.0)
4495 radio_property fontangle u , "{normal}|italic|oblique
"
4496 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
4497 double_property fontsize u , 10
4498 radio_property fontunits SU , "inches|centimeters|normalized|{points}|pixels
"
4499 radio_property fontweight u , "light|{normal}|demi|bold
"
4500 radio_property horizontalalignment mu , "{
left}|center|
right"
4501 radio_property interpreter u , "{tex}|none|latex
"
4502 radio_property linestyle , "{-}|--|:|-.|none
"
4503 double_property linewidth , 0.5
4504 double_property margin , 2
4505 array_property position smu , Matrix (1, 3, 0.0)
4506 double_property rotation mu , 0
4507 text_label_property string u , ""
4508 radio_property units u , "{data}|pixels|normalized|inches|centimeters|points
"
4509 radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom
"
4511 // hidden properties for limit computation
4512 row_vector_property xlim hlr , Matrix ()
4513 row_vector_property ylim hlr , Matrix ()
4514 row_vector_property zlim hlr , Matrix ()
4515 bool_property xliminclude hl , "off
"
4516 bool_property yliminclude hl , "off
"
4517 bool_property zliminclude hl , "off
"
4518 // hidden properties for auto-positioning
4519 radio_property positionmode hu , "{
auto}|manual
"
4520 radio_property rotationmode hu , "{
auto}|manual
"
4521 radio_property horizontalalignmentmode hu , "{
auto}|manual
"
4522 radio_property verticalalignmentmode hu , "{
auto}|manual
"
4523 radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title
"
4524 // hidden property for text rendering
4525 double_property fontsize_points hgr , 0
4528 Matrix get_data_position (void) const;
4529 Matrix get_extent_matrix (void) const;
4530 const uint8NDArray& get_pixels (void) const { return pixels; }
4532 // Text renderer, used for calculation of text size
4533 octave::text_renderer txt_renderer;
4538 position.add_constraint (dim_vector (1, 3));
4539 cached_units = get_units ();
4544 void update_position (void)
4546 Matrix pos = get_data_position ();
4549 lim = Matrix (1, 3, pos(0));
4550 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2));
4553 lim = Matrix (1, 3, pos(1));
4554 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2));
4557 if (pos.numel () == 3)
4559 lim = Matrix (1, 3, pos(2));
4560 lim(2) = (lim(2) <= 0 ? octave::numeric_limits<double>::Inf () : lim(2));
4561 set_zliminclude ("on
");
4565 set_zliminclude ("off
");
4568 void update_text_extent (void);
4570 void request_autopos (void);
4571 void update_positionmode (void) { request_autopos (); }
4572 void update_rotationmode (void) { request_autopos (); }
4573 void update_horizontalalignmentmode (void) { request_autopos (); }
4574 void update_verticalalignmentmode (void) { request_autopos (); }
4576 void update_font (void);
4577 void update_string (void) { request_autopos (); update_text_extent (); }
4578 void update_rotation (void) { update_text_extent (); }
4579 void update_color (void) { update_font (); update_text_extent (); }
4580 void update_fontname (void) { update_font (); update_text_extent (); }
4581 void update_fontsize (void) { update_font (); update_text_extent (); }
4582 void update_fontangle (void) { update_font (); update_text_extent (); }
4583 void update_fontweight (void) { update_font (); update_text_extent (); }
4584 void update_interpreter (void) { update_text_extent (); }
4585 void update_horizontalalignment (void) { update_text_extent (); }
4586 void update_verticalalignment (void) { update_text_extent (); }
4588 void update_units (void);
4589 void update_fontunits (const caseless_str& old_fontunits);
4592 std::string cached_units;
4593 uint8NDArray pixels;
4597 properties xproperties;
4600 text (const graphics_handle& mh, const graphics_handle& p)
4601 : base_graphics_object (), xproperties (mh, p)
4603 xproperties.set_clipping ("off
");
4608 base_properties& get_properties (void) { return xproperties; }
4610 const base_properties& get_properties (void) const { return xproperties; }
4612 bool valid_object (void) const { return true; }
4614 bool has_readonly_property (const caseless_str& pname) const
4616 bool retval = xproperties.has_readonly_property (pname);
4618 retval = base_properties::has_readonly_property (pname);
4623 // ---------------------------------------------------------------------
4625 class OCTINTERP_API image : public base_graphics_object
4628 class OCTINTERP_API properties : public base_properties
4631 bool is_aliminclude (void) const
4632 { return (aliminclude.is_on () && alphadatamapping.is ("scaled
")); }
4633 std::string get_aliminclude (void) const
4634 { return aliminclude.current_value (); }
4636 bool is_climinclude (void) const
4637 { return (climinclude.is_on () && cdatamapping.is ("scaled
")); }
4638 std::string get_climinclude (void) const
4639 { return climinclude.current_value (); }
4641 octave_value get_color_data (void) const;
4643 void initialize_data (void) { update_cdata (); }
4645 // See the genprops.awk script for an explanation of the
4646 // properties declarations.
4647 // Programming note: Keep property list sorted if new ones are added.
4649 BEGIN_PROPERTIES (image)
4650 array_property alphadata u , Matrix (1, 1, 1.0)
4651 radio_property alphadatamapping al , "{none}|direct|scaled
"
4652 array_property cdata u , default_image_cdata ()
4653 radio_property cdatamapping al , "scaled|{direct}
"
4654 string_property displayname , ""
4655 radio_property erasemode h , "{normal}|none|xor|background
"
4656 row_vector_property xdata mu , Matrix ()
4657 row_vector_property ydata mu , Matrix ()
4658 // hidden properties for limit computation
4659 row_vector_property alim hlr , Matrix ()
4660 row_vector_property clim hlr , Matrix ()
4661 row_vector_property xlim hlr , Matrix ()
4662 row_vector_property ylim hlr , Matrix ()
4663 bool_property aliminclude hlg , "on
"
4664 bool_property climinclude hlg , "on
"
4665 bool_property xliminclude hl , "on
"
4666 bool_property yliminclude hl , "on
"
4667 radio_property xdatamode ha , "{
auto}|manual
"
4668 radio_property ydatamode ha , "{
auto}|manual
"
4674 xdata.add_constraint (2);
4675 xdata.add_constraint (dim_vector (0, 0));
4676 ydata.add_constraint (2);
4677 ydata.add_constraint (dim_vector (0, 0));
4678 cdata.add_constraint ("double");
4679 cdata.add_constraint ("single");
4680 cdata.add_constraint ("logical
");
4681 cdata.add_constraint ("uint8
");
4682 cdata.add_constraint ("uint16");
4683 cdata.add_constraint ("int16");
4684 cdata.add_constraint ("real");
4685 cdata.add_constraint (dim_vector (-1, -1));
4686 cdata.add_constraint (dim_vector (-1, -1, 3));
4687 alphadata.add_constraint (dim_vector (-1, -1));
4688 alphadata.add_constraint ("double");
4689 alphadata.add_constraint ("uint8
");
4693 void update_alphadata (void)
4695 if (alphadatamapping_is ("scaled
"))
4696 set_alim (alphadata.get_limits ());
4698 alim = alphadata.get_limits ();
4701 void update_cdata (void)
4703 if (cdatamapping_is ("scaled
"))
4704 set_clim (cdata.get_limits ());
4706 clim = cdata.get_limits ();
4708 if (xdatamode.is ("auto"))
4711 if (ydatamode.is ("auto"))
4715 void update_xdata (void)
4717 if (xdata.get ().is_empty ())
4718 set_xdatamode ("auto");
4720 if (xdatamode.is ("auto"))
4722 set_xdata (get_auto_xdata ());
4723 set_xdatamode ("auto");
4726 Matrix limits = xdata.get_limits ();
4727 float dp = pixel_xsize ();
4729 limits(0) = limits(0) - dp;
4730 limits(1) = limits(1) + dp;
4734 void update_ydata (void)
4736 if (ydata.get ().is_empty ())
4737 set_ydatamode ("auto");
4739 if (ydatamode.is ("auto"))
4741 set_ydata (get_auto_ydata ());
4742 set_ydatamode ("auto");
4745 Matrix limits = ydata.get_limits ();
4746 float dp = pixel_ysize ();
4748 limits(0) = limits(0) - dp;
4749 limits(1) = limits(1) + dp;
4753 Matrix get_auto_xdata (void)
4755 dim_vector dv = get_cdata ().dims ();
4759 data = Matrix (1, 2, 1);
4765 Matrix get_auto_ydata (void)
4767 dim_vector dv = get_cdata ().dims ();
4771 data = Matrix (1, 2, 1);
4777 float pixel_size (octave_idx_type dim, const Matrix limits)
4779 octave_idx_type l = dim - 1;
4782 if (l > 0 && limits(0) != limits(1))
4783 dp = (limits(1) - limits(0))/(2*l);
4786 if (limits(1) == limits(2))
4789 dp = (limits(1) - limits(0))/2;
4795 float pixel_xsize (void)
4797 return pixel_size ((get_cdata ().dims ())(1), xdata.get_limits ());
4800 float pixel_ysize (void)
4802 return pixel_size ((get_cdata ().dims ())(0), ydata.get_limits ());
4807 properties xproperties;
4810 image (const graphics_handle& mh, const graphics_handle& p)
4811 : base_graphics_object (), xproperties (mh, p)
4813 xproperties.initialize_data ();
4818 base_properties& get_properties (void) { return xproperties; }
4820 const base_properties& get_properties (void) const { return xproperties; }
4822 bool valid_object (void) const { return true; }
4824 bool has_readonly_property (const caseless_str& pname) const
4826 bool retval = xproperties.has_readonly_property (pname);
4828 retval = base_properties::has_readonly_property (pname);
4833 // ---------------------------------------------------------------------
4835 class OCTINTERP_API light : public base_graphics_object
4838 class OCTINTERP_API properties : public base_properties
4840 // See the genprops.awk script for an explanation of the
4841 // properties declarations.
4842 // Programming note: Keep property list sorted if new ones are added.
4844 BEGIN_PROPERTIES (light)
4845 color_property color , color_values (1, 1, 1)
4846 array_property position , default_light_position ()
4847 radio_property style , "{infinite}|local
"
4853 position.add_constraint (dim_vector (1, 3));
4858 properties xproperties;
4861 light (const graphics_handle& mh, const graphics_handle& p)
4862 : base_graphics_object (), xproperties (mh, p)
4867 base_properties& get_properties (void) { return xproperties; }
4869 const base_properties& get_properties (void) const { return xproperties; }
4871 bool valid_object (void) const { return true; }
4873 bool has_readonly_property (const caseless_str& pname) const
4875 bool retval = xproperties.has_readonly_property (pname);
4877 retval = base_properties::has_readonly_property (pname);
4882 // ---------------------------------------------------------------------
4884 class OCTINTERP_API patch : public base_graphics_object
4887 class OCTINTERP_API properties : public base_properties
4890 octave_value get_color_data (void) const;
4892 // Matlab allows incoherent data to be stored into patch properties.
4893 // The patch should then be ignored by the renderer.
4894 bool has_bad_data (std::string &msg) const
4897 return ! msg.empty ();
4900 bool is_aliminclude (void) const
4901 { return (aliminclude.is_on () && alphadatamapping.is ("scaled
")); }
4902 std::string get_aliminclude (void) const
4903 { return aliminclude.current_value (); }
4905 bool is_climinclude (void) const
4906 { return (climinclude.is_on () && cdatamapping.is ("scaled
")); }
4907 std::string get_climinclude (void) const
4908 { return climinclude.current_value (); }
4910 // See the genprops.awk script for an explanation of the
4911 // properties declarations.
4912 // Programming note: Keep property list sorted if new ones are added.
4914 BEGIN_PROPERTIES (patch)
4915 radio_property alphadatamapping l , "none|{scaled}|direct
"
4916 double_property ambientstrength , 0.3
4917 radio_property backfacelighting , "unlit|lit|{reverselit}
"
4918 array_property cdata u , Matrix ()
4919 radio_property cdatamapping l , "{scaled}|direct
"
4920 double_property diffusestrength , 0.6
4921 string_property displayname , ""
4922 double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp
"))
4923 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp
"))
4924 radio_property edgelighting , "{none}|flat|gouraud|phong
"
4925 radio_property erasemode h , "{normal}|none|xor|background
"
4926 double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp
"))
4927 color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp
"))
4928 radio_property facelighting , "none|{flat}|gouraud|phong
"
4929 array_property facenormals m , Matrix ()
4930 radio_property facenormalsmode , "{
auto}|manual
"
4931 array_property faces u , default_patch_faces ()
4932 array_property facevertexalphadata , Matrix ()
4933 array_property facevertexcdata u , Matrix ()
4934 // FIXME: interpreter is not a property of a Matlab patch.
4935 // Octave uses this for legend() with the string displayname.
4936 radio_property interpreter , "{tex}|none|latex
"
4937 radio_property linestyle , "{-}|--|:|-.|none
"
4938 double_property linewidth , 0.5
4939 radio_property marker , "{none}|+|o|*|.|
x|
s|square|
d|diamond|^|v|>|<|
p|pentagram|h|hexagram
"
4940 color_property markeredgecolor , color_property (radio_values ("none|{
auto}|flat
"), color_values (0, 0, 0))
4941 color_property markerfacecolor , color_property (radio_values ("{none}|
auto|flat
"), color_values (0, 0, 0))
4942 double_property markersize , 6
4943 radio_property normalmode hsg , "{
auto}|manual
"
4944 double_property specularcolorreflectance , 1.0
4945 double_property specularexponent , 10.0
4946 double_property specularstrength , 0.9
4947 array_property vertexnormals m , Matrix ()
4948 radio_property vertexnormalsmode , "{
auto}|manual
"
4949 array_property vertices u , default_patch_vertices ()
4950 array_property xdata u , default_patch_xdata ()
4951 array_property ydata u , default_patch_ydata ()
4952 array_property zdata u , Matrix ()
4954 // hidden properties for limit computation
4955 row_vector_property alim hlr , Matrix ()
4956 row_vector_property clim hlr , Matrix ()
4957 row_vector_property xlim hlr , Matrix ()
4958 row_vector_property ylim hlr , Matrix ()
4959 row_vector_property zlim hlr , Matrix ()
4960 bool_property aliminclude hlg , "on
"
4961 bool_property climinclude hlg , "on
"
4962 bool_property xliminclude hl , "on
"
4963 bool_property yliminclude hl , "on
"
4964 bool_property zliminclude hl , "on
"
4970 xdata.add_constraint (dim_vector (-1, -1));
4971 ydata.add_constraint (dim_vector (-1, -1));
4972 zdata.add_constraint (dim_vector (-1, -1));
4973 faces.add_constraint (dim_vector (-1, -1));
4974 vertices.add_constraint (dim_vector (-1, 2));
4975 vertices.add_constraint (dim_vector (-1, 3));
4976 cdata.add_constraint (dim_vector (-1, -1));
4977 cdata.add_constraint (dim_vector (-1, -1, 3));
4978 facevertexcdata.add_constraint (dim_vector (-1, 1));
4979 facevertexcdata.add_constraint (dim_vector (-1, 3));
4980 facevertexalphadata.add_constraint (dim_vector (-1, 1));
4981 facenormals.add_constraint (dim_vector (-1, 3));
4982 facenormals.add_constraint (dim_vector (0, 0));
4983 vertexnormals.add_constraint (dim_vector (-1, 3));
4984 vertexnormals.add_constraint (dim_vector (0, 0));
4988 std::string bad_data_msg;
4990 void update_faces (void) { update_data ();}
4992 void update_vertices (void) { update_data ();}
4994 void update_facevertexcdata (void) { update_data ();}
4996 void update_fvc (void);
4998 void update_xdata (void)
5000 if (get_xdata ().is_empty ())
5002 // For compatibility with matlab behavior,
5003 // if x/ydata are set empty, silently empty other *data and
5004 // faces properties while vertices remain unchanged.
5005 set_ydata (Matrix ());
5006 set_zdata (Matrix ());
5007 set_cdata (Matrix ());
5008 set_faces (Matrix ());
5013 set_xlim (xdata.get_limits ());
5016 void update_ydata (void)
5018 if (get_ydata ().is_empty ())
5020 set_xdata (Matrix ());
5021 set_zdata (Matrix ());
5022 set_cdata (Matrix ());
5023 set_faces (Matrix ());
5028 set_ylim (ydata.get_limits ());
5031 void update_zdata (void)
5034 set_zlim (zdata.get_limits ());
5037 void update_cdata (void)
5041 if (cdatamapping_is ("scaled
"))
5042 set_clim (cdata.get_limits ());
5044 clim = cdata.get_limits ();
5047 void update_data (void);
5049 void set_normalmode (const octave_value& val)
5051 warning_with_id ("Octave:deprecated-
property",
5052 "patch: Property
'normalmode' is deprecated
and will be removed
"
5053 "from
a future version
of Octave. Use
'vertexnormalsmode' instead.
");
5054 set_vertexnormalsmode (val);
5057 std::string get_normalmode (void) const
5059 warning_with_id ("Octave:deprecated-
property",
5060 "patch: Property
'normalmode' is deprecated
and will be removed
"
5061 "from
a future version
of Octave. Use
'vertexnormalsmode' instead.
");
5062 return vertexnormalsmode.current_value ();
5067 properties xproperties;
5070 patch (const graphics_handle& mh, const graphics_handle& p)
5071 : base_graphics_object (), xproperties (mh, p)
5076 base_properties& get_properties (void) { return xproperties; }
5078 const base_properties& get_properties (void) const { return xproperties; }
5080 bool valid_object (void) const { return true; }
5082 bool has_readonly_property (const caseless_str& pname) const
5084 bool retval = xproperties.has_readonly_property (pname);
5086 retval = base_properties::has_readonly_property (pname);
5091 // ---------------------------------------------------------------------
5093 class OCTINTERP_API surface : public base_graphics_object
5096 class OCTINTERP_API properties : public base_properties
5099 octave_value get_color_data (void) const;
5101 bool is_aliminclude (void) const
5102 { return (aliminclude.is_on () && alphadatamapping.is ("scaled
")); }
5103 std::string get_aliminclude (void) const
5104 { return aliminclude.current_value (); }
5106 bool is_climinclude (void) const
5107 { return (climinclude.is_on () && cdatamapping.is ("scaled
")); }
5108 std::string get_climinclude (void) const
5109 { return climinclude.current_value (); }
5111 // See the genprops.awk script for an explanation of the
5112 // properties declarations.
5113 // Programming note: Keep property list sorted if new ones are added.
5115 BEGIN_PROPERTIES (surface)
5116 array_property alphadata u , Matrix (1, 1, 1.0)
5117 radio_property alphadatamapping l , "none|direct|{scaled}
"
5118 double_property ambientstrength , 0.3
5119 radio_property backfacelighting , "unlit|lit|{reverselit}
"
5120 array_property cdata u , default_surface_cdata ()
5121 radio_property cdatamapping al , "{scaled}|direct
"
5122 string_property cdatasource , ""
5123 double_property diffusestrength , 0.6
5124 string_property displayname , ""
5125 double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp
"))
5126 color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp
"))
5127 radio_property edgelighting , "{none}|flat|gouraud|phong
"
5128 radio_property erasemode h , "{normal}|none|xor|background
"
5129 double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap
"))
5130 color_property facecolor , color_property (radio_values ("none|{flat}|interp|texturemap
"), color_values (0, 0, 0))
5131 radio_property facelighting , "none|{flat}|gouraud|phong
"
5132 array_property facenormals m , Matrix ()
5133 radio_property facenormalsmode , "{
auto}|manual
"
5134 // FIXME: interpreter is not a Matlab surface property
5135 // Octave uses this for legend() with the string displayname.
5136 radio_property interpreter , "{tex}|none|latex
"
5137 radio_property linestyle , "{-}|--|:|-.|none
"
5138 double_property linewidth , 0.5
5139 radio_property marker , "{none}|+|o|*|.|
x|
s|square|
d|diamond|^|v|>|<|
p|pentagram|h|hexagram
"
5140 color_property markeredgecolor , color_property (radio_values ("none|{
auto}|flat
"), color_values (0, 0, 0))
5141 color_property markerfacecolor , color_property (radio_values ("{none}|
auto|flat
"), color_values (0, 0, 0))
5142 double_property markersize , 6
5143 radio_property meshstyle , "{both}|
row|
column"
5144 radio_property normalmode hsg , "{
auto}|manual
"
5145 double_property specularcolorreflectance , 1
5146 double_property specularexponent , 10
5147 double_property specularstrength , 0.9
5148 array_property vertexnormals m , Matrix ()
5149 radio_property vertexnormalsmode u , "{
auto}|manual
"
5150 array_property xdata u , default_surface_xdata ()
5151 string_property xdatasource , ""
5152 array_property ydata u , default_surface_ydata ()
5153 string_property ydatasource , ""
5154 array_property zdata u , default_surface_zdata ()
5155 string_property zdatasource , ""
5157 // hidden properties for limit computation
5158 row_vector_property alim hlr , Matrix ()
5159 row_vector_property clim hlr , Matrix ()
5160 row_vector_property xlim hlr , Matrix ()
5161 row_vector_property ylim hlr , Matrix ()
5162 row_vector_property zlim hlr , Matrix ()
5163 bool_property aliminclude hlg , "on
"
5164 bool_property climinclude hlg , "on
"
5165 bool_property xliminclude hl , "on
"
5166 bool_property yliminclude hl , "on
"
5167 bool_property zliminclude hl , "on
"
5173 xdata.add_constraint (dim_vector (-1, -1));
5174 ydata.add_constraint (dim_vector (-1, -1));
5175 zdata.add_constraint (dim_vector (-1, -1));
5176 cdata.add_constraint ("double");
5177 cdata.add_constraint ("single");
5178 cdata.add_constraint (dim_vector (-1, -1));
5179 cdata.add_constraint (dim_vector (-1, -1, 3));
5180 alphadata.add_constraint ("double");
5181 alphadata.add_constraint ("uint8
");
5182 alphadata.add_constraint (dim_vector (-1, -1));
5183 facenormals.add_constraint (dim_vector (-1, -1, 3));
5184 facenormals.add_constraint (dim_vector (0, 0));
5185 vertexnormals.add_constraint (dim_vector (-1, -1, 3));
5186 vertexnormals.add_constraint (dim_vector (0, 0));
5190 void update_alphadata (void)
5192 if (alphadatamapping_is ("scaled
"))
5193 set_alim (alphadata.get_limits ());
5195 alim = alphadata.get_limits ();
5198 void update_cdata (void)
5200 if (cdatamapping_is ("scaled
"))
5201 set_clim (cdata.get_limits ());
5203 clim = cdata.get_limits ();
5206 void update_xdata (void)
5208 update_vertex_normals ();
5209 set_xlim (xdata.get_limits ());
5212 void update_ydata (void)
5214 update_vertex_normals ();
5215 set_ylim (ydata.get_limits ());
5218 void update_zdata (void)
5220 update_vertex_normals ();
5221 set_zlim (zdata.get_limits ());
5224 void update_vertex_normals (void);
5226 void update_vertexnormalsmode (void)
5227 { update_vertex_normals (); }
5229 void set_normalmode (const octave_value& val)
5231 warning_with_id ("Octave:deprecated-
property",
5232 "surface: Property
'normalmode' is deprecated
and will be removed
"
5233 "from
a future version
of Octave. Use
'vertexnormalsmode' instead.
");
5234 set_vertexnormalsmode (val);
5237 std::string get_normalmode (void) const
5239 warning_with_id ("Octave:deprecated-
property",
5240 "surface: Property
'normalmode' is deprecated
and will be removed
"
5241 "from
a future version
of Octave. Use
'vertexnormalsmode' instead.
");
5242 return vertexnormalsmode.current_value ();
5247 properties xproperties;
5250 surface (const graphics_handle& mh, const graphics_handle& p)
5251 : base_graphics_object (), xproperties (mh, p)
5256 base_properties& get_properties (void) { return xproperties; }
5258 const base_properties& get_properties (void) const { return xproperties; }
5260 bool valid_object (void) const { return true; }
5262 bool has_readonly_property (const caseless_str& pname) const
5264 bool retval = xproperties.has_readonly_property (pname);
5266 retval = base_properties::has_readonly_property (pname);
5271 // ---------------------------------------------------------------------
5273 class OCTINTERP_API hggroup : public base_graphics_object
5276 class OCTINTERP_API properties : public base_properties
5279 void remove_child (const graphics_handle& h)
5281 base_properties::remove_child (h);
5285 void adopt (const graphics_handle& h)
5288 base_properties::adopt (h);
5292 // See the genprops.awk script for an explanation of the
5293 // properties declarations.
5294 // Programming note: Keep property list sorted if new ones are added.
5296 BEGIN_PROPERTIES (hggroup)
5297 string_property displayname , ""
5298 radio_property erasemode h , "{normal}|none|xor|background
"
5300 // hidden properties for limit computation
5301 row_vector_property alim hr , Matrix ()
5302 row_vector_property clim hr , Matrix ()
5303 row_vector_property xlim hr , Matrix ()
5304 row_vector_property ylim hr , Matrix ()
5305 row_vector_property zlim hr , Matrix ()
5306 bool_property aliminclude h , "on
"
5307 bool_property climinclude h , "on
"
5308 bool_property xliminclude h , "on
"
5309 bool_property yliminclude h , "on
"
5310 bool_property zliminclude h , "on
"
5314 void update_limits (void) const;
5316 void update_limits (const graphics_handle& h) const;
5325 properties xproperties;
5328 hggroup (const graphics_handle& mh, const graphics_handle& p)
5329 : base_graphics_object (), xproperties (mh, p)
5334 base_properties& get_properties (void) { return xproperties; }
5336 const base_properties& get_properties (void) const { return xproperties; }
5338 bool valid_object (void) const { return true; }
5340 void update_axis_limits (const std::string& axis_type);
5342 void update_axis_limits (const std::string& axis_type,
5343 const graphics_handle& h);
5345 bool has_readonly_property (const caseless_str& pname) const
5347 bool retval = xproperties.has_readonly_property (pname);
5349 retval = base_properties::has_readonly_property (pname);
5355 // ---------------------------------------------------------------------
5357 class OCTINTERP_API uimenu : public base_graphics_object
5360 class OCTINTERP_API properties : public base_properties
5363 void remove_child (const graphics_handle& h)
5365 base_properties::remove_child (h);
5368 void adopt (const graphics_handle& h)
5370 base_properties::adopt (h);
5373 // See the genprops.awk script for an explanation of the
5374 // properties declarations.
5375 // Programming note: Keep property list sorted if new ones are added.
5377 BEGIN_PROPERTIES (uimenu)
5378 any_property __object__ h , Matrix ()
5379 string_property accelerator , ""
5380 callback_property callback , Matrix ()
5381 bool_property checked , "off
"
5382 bool_property enable , "on
"
5383 color_property foregroundcolor , color_values (0, 0, 0)
5384 string_property label , ""
5385 double_property position , 0
5386 bool_property separator , "off
"
5387 // Octave-specific properties
5388 string_property fltk_label h , ""
5397 properties xproperties;
5400 uimenu (const graphics_handle& mh, const graphics_handle& p)
5401 : base_graphics_object (), xproperties (mh, p)
5406 base_properties& get_properties (void) { return xproperties; }
5408 const base_properties& get_properties (void) const { return xproperties; }
5410 bool valid_object (void) const { return true; }
5412 bool has_readonly_property (const caseless_str& pname) const
5414 bool retval = xproperties.has_readonly_property (pname);
5416 retval = base_properties::has_readonly_property (pname);
5422 // ---------------------------------------------------------------------
5424 class OCTINTERP_API uicontextmenu : public base_graphics_object
5427 class OCTINTERP_API properties : public base_properties
5431 void add_dependent_obj (graphics_handle gh)
5432 { dependent_obj_list.push_back (gh); }
5434 // FIXME: the list may contain duplicates.
5435 // Should we return only unique elements?
5436 const std::list<graphics_handle> get_dependent_obj_list (void)
5437 { return dependent_obj_list; }
5439 // See the genprops.awk script for an explanation of the
5440 // properties declarations.
5441 // Programming note: Keep property list sorted if new ones are added.
5443 BEGIN_PROPERTIES (uicontextmenu)
5444 any_property __object__ h , Matrix ()
5445 callback_property callback , Matrix ()
5446 array_property position , Matrix (1, 2, 0.0)
5452 position.add_constraint (dim_vector (1, 2));
5453 position.add_constraint (dim_vector (2, 1));
5454 visible.set (octave_value (false));
5458 // List of objects that might depend on this uicontextmenu object
5459 std::list<graphics_handle> dependent_obj_list;
5463 properties xproperties;
5466 uicontextmenu (const graphics_handle& mh, const graphics_handle& p)
5467 : base_graphics_object (), xproperties (mh, p)
5470 ~uicontextmenu (void);
5472 base_properties& get_properties (void) { return xproperties; }
5474 const base_properties& get_properties (void) const { return xproperties; }
5476 bool valid_object (void) const { return true; }
5478 bool has_readonly_property (const caseless_str& pname) const
5480 bool retval = xproperties.has_readonly_property (pname);
5482 retval = base_properties::has_readonly_property (pname);
5488 // ---------------------------------------------------------------------
5490 class OCTINTERP_API uicontrol : public base_graphics_object
5493 class OCTINTERP_API properties : public base_properties
5496 Matrix get_boundingbox (bool internal = false,
5497 const Matrix& parent_pix_size = Matrix ()) const;
5499 double get_fontsize_points (double box_pix_height = 0) const;
5501 // See the genprops.awk script for an explanation of the
5502 // properties declarations.
5503 // Programming note: Keep property list sorted if new ones are added.
5505 BEGIN_PROPERTIES (uicontrol)
5506 any_property __object__ h , Matrix ()
5507 color_property backgroundcolor , color_values (1, 1, 1)
5508 callback_property callback , Matrix ()
5509 array_property cdata , Matrix ()
5510 bool_property clipping , "on
"
5511 radio_property enable , "{on}|inactive|off
"
5512 array_property extent rG , Matrix (1, 4, 0.0)
5513 radio_property fontangle u , "{normal}|italic|oblique
"
5514 string_property fontname u , OCTAVE_DEFAULT_FONTNAME
5515 double_property fontsize u , 10
5516 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels
"
5517 radio_property fontweight u , "light|{normal}|demi|bold
"
5518 color_property foregroundcolor , color_values (0, 0, 0)
5519 radio_property horizontalalignment , "left|{center}|
right"
5520 callback_property keypressfcn , Matrix ()
5521 double_property listboxtop , 1
5522 double_property max , 1
5523 double_property min , 0
5524 array_property position , default_control_position ()
5525 array_property sliderstep , default_control_sliderstep ()
5526 string_array_property string u , ""
5527 radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|
text|slider|
frame|listbox|popupmenu
"
5528 string_property tooltipstring , ""
5529 radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters
"
5530 row_vector_property value , Matrix (1, 1, 0.0)
5531 radio_property verticalalignment , "top|{middle}|bottom
"
5535 std::string cached_units;
5540 cdata.add_constraint ("double");
5541 cdata.add_constraint ("single");
5542 cdata.add_constraint (dim_vector (-1, -1, 3));
5543 position.add_constraint (dim_vector (1, 4));
5544 sliderstep.add_constraint (dim_vector (1, 2));
5545 cached_units = get_units ();
5548 void update_text_extent (void);
5550 void update_string (void) { update_text_extent (); }
5551 void update_fontname (void) { update_text_extent (); }
5552 void update_fontsize (void) { update_text_extent (); }
5553 void update_fontangle (void) { update_text_extent (); }
5554 void update_fontweight (void) { update_text_extent (); }
5555 void update_fontunits (const caseless_str& old_units);
5557 void update_units (void);
5562 properties xproperties;
5565 uicontrol (const graphics_handle& mh, const graphics_handle& p)
5566 : base_graphics_object (), xproperties (mh, p)
5569 ~uicontrol (void) { }
5571 base_properties& get_properties (void) { return xproperties; }
5573 const base_properties& get_properties (void) const { return xproperties; }
5575 bool valid_object (void) const { return true; }
5577 bool has_readonly_property (const caseless_str& pname) const
5579 bool retval = xproperties.has_readonly_property (pname);
5581 retval = base_properties::has_readonly_property (pname);
5586 // ---------------------------------------------------------------------
5588 class OCTINTERP_API uibuttongroup : public base_graphics_object
5591 class OCTINTERP_API properties : public base_properties
5594 Matrix get_boundingbox (bool internal = false,
5595 const Matrix& parent_pix_size = Matrix ()) const;
5597 double get_fontsize_points (double box_pix_height = 0) const;
5599 // See the genprops.awk script for an explanation of the
5600 // properties declarations.
5601 // Programming note: Keep property list sorted if new ones are added.
5603 BEGIN_PROPERTIES (uibuttongroup)
5604 any_property __object__ h , Matrix ()
5605 color_property backgroundcolor , color_values (1, 1, 1)
5606 radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|
line"
5607 double_property borderwidth , 1
5608 bool_property clipping , "on
"
5609 radio_property fontangle , "{normal}|italic|oblique
"
5610 string_property fontname , OCTAVE_DEFAULT_FONTNAME
5611 double_property fontsize , 10
5612 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels
"
5613 radio_property fontweight , "light|{normal}|demi|bold
"
5614 color_property foregroundcolor , color_values (0, 0, 0)
5615 color_property highlightcolor , color_values (1, 1, 1)
5616 array_property position , default_panel_position ()
5617 callback_property resizefcn , Matrix ()
5618 handle_property selectedobject S , graphics_handle()
5619 callback_property selectionchangedfcn , Matrix()
5620 color_property shadowcolor , color_values (0, 0, 0)
5621 callback_property sizechangedfcn , Matrix ()
5622 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters
"
5623 string_property title , ""
5624 radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom
"
5630 position.add_constraint (dim_vector (1, 4));
5633 // void update_text_extent (void);
5634 // void update_string (void) { update_text_extent (); }
5635 // void update_fontname (void) { update_text_extent (); }
5636 // void update_fontsize (void) { update_text_extent (); }
5637 // void update_fontangle (void) { update_text_extent (); }
5638 // void update_fontweight (void) { update_text_extent (); }
5640 void update_units (const caseless_str& old_units);
5641 void update_fontunits (const caseless_str& old_units);
5646 properties xproperties;
5649 uibuttongroup (const graphics_handle& mh, const graphics_handle& p)
5650 : base_graphics_object (), xproperties (mh, p)
5653 ~uibuttongroup (void) { }
5655 base_properties& get_properties (void) { return xproperties; }
5657 const base_properties& get_properties (void) const { return xproperties; }
5659 bool valid_object (void) const { return true; }
5661 bool has_readonly_property (const caseless_str& pname) const
5663 bool retval = xproperties.has_readonly_property (pname);
5665 retval = base_properties::has_readonly_property (pname);
5671 // ---------------------------------------------------------------------
5673 class OCTINTERP_API uipanel : public base_graphics_object
5676 class OCTINTERP_API properties : public base_properties
5679 Matrix get_boundingbox (bool internal = false,
5680 const Matrix& parent_pix_size = Matrix ()) const;
5682 double get_fontsize_points (double box_pix_height = 0) const;
5684 // See the genprops.awk script for an explanation of the
5685 // properties declarations.
5686 // Programming note: Keep property list sorted if new ones are added.
5688 BEGIN_PROPERTIES (uipanel)
5689 any_property __object__ h , Matrix ()
5690 color_property backgroundcolor , color_values (1, 1, 1)
5691 radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|
line"
5692 double_property borderwidth , 1
5693 radio_property fontangle , "{normal}|italic|oblique
"
5694 string_property fontname , OCTAVE_DEFAULT_FONTNAME
5695 double_property fontsize , 10
5696 radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels
"
5697 radio_property fontweight , "light|{normal}|demi|bold
"
5698 color_property foregroundcolor , color_values (0, 0, 0)
5699 color_property highlightcolor , color_values (1, 1, 1)
5700 array_property position , default_panel_position ()
5701 callback_property resizefcn , Matrix ()
5702 color_property shadowcolor , color_values (0, 0, 0)
5703 string_property title , ""
5704 radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom
"
5705 radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters
"
5711 position.add_constraint (dim_vector (1, 4));
5714 void update_units (const caseless_str& old_units);
5715 void update_fontunits (const caseless_str& old_units);
5720 properties xproperties;
5723 uipanel (const graphics_handle& mh, const graphics_handle& p)
5724 : base_graphics_object (), xproperties (mh, p)
5729 base_properties& get_properties (void) { return xproperties; }
5731 const base_properties& get_properties (void) const { return xproperties; }
5733 bool valid_object (void) const { return true; }
5735 bool has_readonly_property (const caseless_str& pname) const
5737 bool retval = xproperties.has_readonly_property (pname);
5739 retval = base_properties::has_readonly_property (pname);
5744 // ---------------------------------------------------------------------
5746 class OCTINTERP_API uitoolbar : public base_graphics_object
5749 class OCTINTERP_API properties : public base_properties
5752 // See the genprops.awk script for an explanation of the
5753 // properties declarations.
5754 // Programming note: Keep property list sorted if new ones are added.
5756 BEGIN_PROPERTIES (uitoolbar)
5757 any_property __object__ h , Matrix ()
5766 properties xproperties;
5769 uitoolbar (const graphics_handle& mh, const graphics_handle& p)
5770 : base_graphics_object (), xproperties (mh, p), default_properties ()
5773 ~uitoolbar (void) { }
5775 void override_defaults (base_graphics_object& obj)
5777 // Allow parent (figure) to override first (properties knows how
5778 // to find the parent object).
5779 xproperties.override_defaults (obj);
5781 // Now override with our defaults. If the default_properties
5782 // list includes the properties for all defaults (line,
5783 // surface, etc.) then we don't have to know the type of OBJ
5784 // here, we just call its set function and let it decide which
5785 // properties from the list to use.
5786 obj.set_from_list (default_properties);
5789 void set (const caseless_str& name, const octave_value& value)
5791 if (name.compare ("default", 7))
5792 // strip "default", pass rest to function that will
5793 // parse the remainder and add the element to the
5794 // default_properties map.
5795 default_properties.set (name.substr (7), value);
5797 xproperties.set (name, value);
5800 octave_value get (const caseless_str& name) const
5802 octave_value retval;
5804 if (name.compare ("default", 7))
5805 retval = get_default (name.substr (7));
5807 retval = xproperties.get (name);
5812 octave_value get_default (const caseless_str& name) const;
5814 octave_value get_defaults (void) const
5816 return default_properties.as_struct ("default");
5819 property_list get_defaults_list (void) const
5821 return default_properties;
5824 base_properties& get_properties (void) { return xproperties; }
5826 const base_properties& get_properties (void) const { return xproperties; }
5828 bool valid_object (void) const { return true; }
5830 void reset_default_properties (void);
5832 bool has_readonly_property (const caseless_str& pname) const
5834 bool retval = xproperties.has_readonly_property (pname);
5836 retval = base_properties::has_readonly_property (pname);
5841 property_list default_properties;
5844 // ---------------------------------------------------------------------
5846 class OCTINTERP_API uipushtool : public base_graphics_object
5849 class OCTINTERP_API properties : public base_properties
5852 // See the genprops.awk script for an explanation of the
5853 // properties declarations.
5854 // Programming note: Keep property list sorted if new ones are added.
5856 BEGIN_PROPERTIES (uipushtool)
5857 any_property __object__ h , Matrix ()
5858 array_property cdata , Matrix ()
5859 callback_property clickedcallback , Matrix ()
5860 bool_property enable , "on
"
5861 bool_property separator , "off
"
5862 string_property tooltipstring , ""
5868 cdata.add_constraint ("double");
5869 cdata.add_constraint ("single");
5870 cdata.add_constraint (dim_vector (-1, -1, 3));
5875 properties xproperties;
5878 uipushtool (const graphics_handle& mh, const graphics_handle& p)
5879 : base_graphics_object (), xproperties (mh, p)
5882 ~uipushtool (void) { }
5884 base_properties& get_properties (void) { return xproperties; }
5886 const base_properties& get_properties (void) const { return xproperties; }
5888 bool valid_object (void) const { return true; }
5890 bool has_readonly_property (const caseless_str& pname) const
5892 bool retval = xproperties.has_readonly_property (pname);
5894 retval = base_properties::has_readonly_property (pname);
5900 // ---------------------------------------------------------------------
5902 class OCTINTERP_API uitoggletool : public base_graphics_object
5905 class OCTINTERP_API properties : public base_properties
5908 // See the genprops.awk script for an explanation of the
5909 // properties declarations.
5910 // Programming note: Keep property list sorted if new ones are added.
5912 BEGIN_PROPERTIES (uitoggletool)
5913 any_property __object__ h , Matrix ()
5914 array_property cdata , Matrix ()
5915 callback_property clickedcallback , Matrix ()
5916 bool_property enable , "on
"
5917 callback_property offcallback , Matrix ()
5918 callback_property oncallback , Matrix ()
5919 bool_property separator , "off
"
5920 bool_property state , "off
"
5921 string_property tooltipstring , ""
5927 cdata.add_constraint ("double");
5928 cdata.add_constraint ("single");
5929 cdata.add_constraint (dim_vector (-1, -1, 3));
5934 properties xproperties;
5937 uitoggletool (const graphics_handle& mh, const graphics_handle& p)
5938 : base_graphics_object (), xproperties (mh, p)
5941 ~uitoggletool (void) { }
5943 base_properties& get_properties (void) { return xproperties; }
5945 const base_properties& get_properties (void) const { return xproperties; }
5947 bool valid_object (void) const { return true; }
5949 bool has_readonly_property (const caseless_str& pname) const
5951 bool retval = xproperties.has_readonly_property (pname);
5953 retval = base_properties::has_readonly_property (pname);
5959 // ---------------------------------------------------------------------
5962 get_property_from_handle (double handle, const std::string& property,
5963 const std::string& func);
5965 set_property_in_handle (double handle, const std::string& property,
5966 const octave_value& arg, const std::string& func);
5968 // ---------------------------------------------------------------------
5970 class graphics_event;
5976 friend class graphics_event;
5978 base_graphics_event (void) : count (1) { }
5980 virtual ~base_graphics_event (void) { }
5982 virtual void execute (void) = 0;
5985 octave_refcount<int> count;
5992 typedef void (*event_fcn) (void*);
5994 graphics_event (void) : rep (0) { }
5996 graphics_event (const graphics_event& e) : rep (e.rep)
6001 ~graphics_event (void)
6003 if (rep && --rep->count == 0)
6007 graphics_event& operator = (const graphics_event& e)
6011 if (rep && --rep->count == 0)
6023 { if (rep) rep->execute (); }
6025 bool ok (void) const
6026 { return (rep != 0); }
6028 static graphics_event
6029 create_callback_event (const graphics_handle& h,
6030 const std::string& name,
6031 const octave_value& data = Matrix ());
6033 static graphics_event
6034 create_callback_event (const graphics_handle& h,
6035 const octave_value& cb,
6036 const octave_value& data = Matrix ());
6038 static graphics_event
6039 create_function_event (event_fcn fcn, void *data = 0);
6041 static graphics_event
6042 create_set_event (const graphics_handle& h, const std::string& name,
6043 const octave_value& value,
6044 bool notify_toolkit = true);
6046 base_graphics_event *rep;
6049 class OCTINTERP_API gh_manager
6057 static void create_instance (void);
6059 static bool instance_ok (void)
6072 static void cleanup_instance (void) { delete instance; instance = 0; }
6074 static graphics_handle get_handle (bool integer_figure_handle)
6076 return instance_ok ()
6077 ? instance->do_get_handle (integer_figure_handle)
6078 : graphics_handle ();
6081 static void free (const graphics_handle& h)
6084 instance->do_free (h);
6087 static void renumber_figure (const graphics_handle& old_gh,
6088 const graphics_handle& new_gh)
6091 instance->do_renumber_figure (old_gh, new_gh);
6094 static graphics_handle lookup (double val)
6096 return instance_ok () ? instance->do_lookup (val) : graphics_handle ();
6099 static graphics_handle lookup (const octave_value& val)
6101 return val.is_real_scalar ()
6102 ? lookup (val.double_value ()) : graphics_handle ();
6105 static graphics_object get_object (double val)
6107 return get_object (lookup (val));
6110 static graphics_object get_object (const graphics_handle& h)
6112 return instance_ok () ? instance->do_get_object (h) : graphics_object ();
6115 static graphics_handle
6116 make_graphics_handle (const std::string& go_name,
6117 const graphics_handle& parent,
6118 bool integer_figure_handle = false,
6119 bool do_createfcn = true,
6120 bool do_notify_toolkit = true)
6122 return instance_ok ()
6123 ? instance->do_make_graphics_handle (go_name, parent,
6124 integer_figure_handle,
6125 do_createfcn, do_notify_toolkit)
6126 : graphics_handle ();
6129 static graphics_handle make_figure_handle (double val,
6130 bool do_notify_toolkit = true)
6132 return instance_ok ()
6133 ? instance->do_make_figure_handle (val, do_notify_toolkit)
6134 : graphics_handle ();
6137 static void push_figure (const graphics_handle& h)
6140 instance->do_push_figure (h);
6143 static void pop_figure (const graphics_handle& h)
6146 instance->do_pop_figure (h);
6149 static graphics_handle current_figure (void)
6151 return instance_ok ()
6152 ? instance->do_current_figure () : graphics_handle ();
6155 static Matrix handle_list (bool show_hidden = false)
6157 return instance_ok ()
6158 ? instance->do_handle_list (show_hidden) : Matrix ();
6161 static void lock (void)
6164 instance->do_lock ();
6167 static bool try_lock (void)
6170 return instance->do_try_lock ();
6175 static void unlock (void)
6178 instance->do_unlock ();
6181 static Matrix figure_handle_list (bool show_hidden = false)
6183 return instance_ok ()
6184 ? instance->do_figure_handle_list (show_hidden) : Matrix ();
6187 static void execute_listener (const graphics_handle& h,
6188 const octave_value& l)
6191 instance->do_execute_listener (h, l);
6194 static void execute_callback (const graphics_handle& h,
6195 const std::string& name,
6196 const octave_value& data = Matrix ())
6202 gh_manager::auto_lock lock;
6204 graphics_object go = get_object (h);
6206 if (go.valid_object ())
6210 execute_callback (h, cb, data);
6213 static void execute_callback (const graphics_handle& h,
6214 const octave_value& cb,
6215 const octave_value& data = Matrix ())
6218 instance->do_execute_callback (h, cb, data);
6221 static void post_callback (const graphics_handle& h,
6222 const std::string& name,
6223 const octave_value& data = Matrix ())
6226 instance->do_post_callback (h, name, data);
6229 static void post_function (graphics_event::event_fcn fcn, void* data = 0)
6232 instance->do_post_function (fcn, data);
6235 static void post_set (const graphics_handle& h, const std::string& name,
6236 const octave_value& value, bool notify_toolkit = true)
6239 instance->do_post_set (h, name, value, notify_toolkit);
6242 static int process_events (void)
6244 return (instance_ok () ? instance->do_process_events () : 0);
6247 static int flush_events (void)
6249 return (instance_ok () ? instance->do_process_events (true) : 0);
6252 static void enable_event_processing (bool enable = true)
6255 instance->do_enable_event_processing (enable);
6258 static bool is_handle_visible (const graphics_handle& h)
6260 bool retval = false;
6262 graphics_object go = get_object (h);
6264 if (go.valid_object ())
6265 retval = go.is_handle_visible ();
6270 static void close_all_figures (void)
6273 instance->do_close_all_figures ();
6277 class auto_lock : public octave_autolock
6280 auto_lock (bool wait = true)
6281 : octave_autolock (instance_ok ()
6282 ? instance->graphics_lock
6290 auto_lock (const auto_lock&);
6291 auto_lock& operator = (const auto_lock&);
6296 static gh_manager *instance;
6298 typedef std::map<graphics_handle, graphics_object>::iterator iterator;
6299 typedef std::map<graphics_handle, graphics_object>::const_iterator
6302 typedef std::set<graphics_handle>::iterator free_list_iterator;
6303 typedef std::set<graphics_handle>::const_iterator const_free_list_iterator;
6305 typedef std::list<graphics_handle>::iterator figure_list_iterator;
6306 typedef std::list<graphics_handle>::const_iterator const_figure_list_iterator;
6308 // A map of handles to graphics objects.
6309 std::map<graphics_handle, graphics_object> handle_map;
6311 // The available graphics handles.
6312 std::set<graphics_handle> handle_free_list;
6314 // The next handle available if handle_free_list is empty.
6317 // The allocated figure handles. Top of the stack is most recently
6319 std::list<graphics_handle> figure_list;
6321 // The lock for accessing the graphics sytsem.
6322 octave_mutex graphics_lock;
6324 // The list of events queued by graphics toolkits.
6325 std::list<graphics_event> event_queue;
6327 // The stack of callback objects.
6328 std::list<graphics_object> callback_objects;
6330 // A flag telling whether event processing must be constantly on.
6331 int event_processing;
6333 graphics_handle do_get_handle (bool integer_figure_handle);
6335 void do_free (const graphics_handle& h);
6337 void do_renumber_figure (const graphics_handle& old_gh,
6338 const graphics_handle& new_gh);
6340 graphics_handle do_lookup (double val)
6342 iterator p = (octave::math::isnan (val) ? handle_map.end ()
6343 : handle_map.find (val));
6345 return (p != handle_map.end ()) ? p->first : graphics_handle ();
6348 graphics_object do_get_object (const graphics_handle& h)
6350 iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ());
6352 return (p != handle_map.end ()) ? p->second : graphics_object ();
6355 graphics_handle do_make_graphics_handle (const std::string& go_name,
6356 const graphics_handle& p,
6357 bool integer_figure_handle,
6359 bool do_notify_toolkit);
6361 graphics_handle do_make_figure_handle (double val, bool do_notify_toolkit);
6363 Matrix do_handle_list (bool show_hidden)
6365 Matrix retval (1, handle_map.size ());
6367 octave_idx_type i = 0;
6368 for (const auto& h_iter : handle_map)
6370 graphics_handle h = h_iter.first;
6372 if (show_hidden || is_handle_visible (h))
6373 retval(i++) = h.value ();
6376 retval.resize (1, i);
6381 Matrix do_figure_handle_list (bool show_hidden)
6383 Matrix retval (1, figure_list.size ());
6385 octave_idx_type i = 0;
6386 for (const auto& hfig : figure_list)
6388 if (show_hidden || is_handle_visible (hfig))
6389 retval(i++) = hfig.value ();
6392 retval.resize (1, i);
6397 void do_push_figure (const graphics_handle& h);
6399 void do_pop_figure (const graphics_handle& h);
6401 graphics_handle do_current_figure (void) const
6403 graphics_handle retval;
6405 for (const auto& hfig : figure_list)
6407 if (is_handle_visible (hfig))
6414 void do_lock (void) { graphics_lock.lock (); }
6416 bool do_try_lock (void) { return graphics_lock.try_lock (); }
6418 void do_unlock (void) { graphics_lock.unlock (); }
6420 void do_execute_listener (const graphics_handle& h, const octave_value& l);
6422 void do_execute_callback (const graphics_handle& h, const octave_value& cb,
6423 const octave_value& data);
6425 void do_post_callback (const graphics_handle& h, const std::string& name,
6426 const octave_value& data);
6428 void do_post_function (graphics_event::event_fcn fcn, void* fcn_data);
6430 void do_post_set (const graphics_handle& h, const std::string& name,
6431 const octave_value& value, bool notify_toolkit = true);
6433 int do_process_events (bool force = false);
6435 void do_close_all_figures (void);
6437 static void restore_gcbo (void)
6440 instance->do_restore_gcbo ();
6443 void do_restore_gcbo (void);
6445 void do_post_event (const graphics_event& e);
6447 void do_enable_event_processing (bool enable = true);
6450 void get_children_limits (double& min_val, double& max_val,
6451 double& min_pos, double& max_neg,
6452 const Matrix& kids, char limit_type);
6454 OCTINTERP_API int calc_dimensions (const graphics_object& gh);
6456 // This function is NOT equivalent to the scripting language function gcf.
6457 OCTINTERP_API graphics_handle gcf (void);
6459 // This function is NOT equivalent to the scripting language function gca.
6460 OCTINTERP_API graphics_handle gca (void);
6462 OCTINTERP_API void close_all_figures (void);
void validate(void) const
enum double_radio_property::current_enum current_type
void do_register_toolkit(const std::string &name)
bool do_set(const octave_value &newval)
virtual base_property * clone(void) const
const std::string & current_value(void) const
bool is_radio(void) const
void warning_with_id(const char *id, const char *fmt,...)
void do_unload_toolkit(const std::string &name)
Matrix scale(const Matrix &m) const
std::string do_default_toolkit(void)
static void unload_all_toolkits(void)
plist_map_iterator find(const std::string &go_name)
Matrix get_children(void) const
color_property(const std::string &nm, const graphics_handle &h, const color_values &c=color_values(), const radio_values &v=radio_values())
void add_constraint(const std::string &type)
void delete_listener(const octave_value &v=octave_value(), listener_mode mode=POSTSET)
OCTAVE_EXPORT octave_value_list column
virtual void reparent(const graphics_handle &np)
For example cd octave end example noindent changes the current working directory to file
row_vector_property(const std::string &nm, const graphics_handle &h, const octave_value &m)
radio_values & operator=(const radio_values &a)
base_property * clone(void) const
std::string values_as_string(void) const
std::string string_value(void) const
text_label_property(const std::string &s, const graphics_handle &h, const NDArray &nda)
bool is_real_type(void) const
std::string values_as_string(void) const
void set_name(const std::string &name)
OCTINTERP_API bool validate(const octave_value &v)
virtual bool do_set(const octave_value &)
NDArray scale(const NDArray &m) const
octave_idx_type nelem(void) const
color_property(const std::string &nm, const graphics_handle &h, const radio_values &v)
OCTINTERP_API bool is_equal(const octave_value &v) const
enum color_property::current_enum current_type
virtual bool is_climinclude(void) const
Cell values_as_cell(void) const
property(base_property *bp, bool persist=false)
double double_value(void) const
double_radio_property(const std::string &nm, const graphics_handle &h, const std::string &v)
color_property & operator=(const octave_value &val)
base_property * clone(void) const
octave_value reshape(const dim_vector &dv) const
octave_idx_type rows(void) const
static graphics_toolkit get_toolkit(void)
bool_property(const bool_property &p)
static void register_toolkit(const std::string &name)
void erase(const std::string pname)
bool do_set(const octave_value &val)
octave_value full_value(void) const
static Cell available_toolkits_list(void)
base_property * clone(void) const
color_property(const radio_values &v, const color_values &c)
radio_property & operator=(const octave_value &val)
void insert_property(const std::string &name, property p)
virtual bool is_radio(void) const
virtual std::string values_as_string(void) const
octave_value & operator[](const std::string pname)
std::string string_value(void) const
virtual void init_integerhandle(const octave_value &)
virtual bool is_aliminclude(void) const
std::set< caseless_str > possible_vals
std::set< std::string >::const_iterator const_available_toolkits_iterator
octave_idx_type numel(void) const
Number of elements in the array.
OCTAVE_EXPORT octave_value_list uint16
Matrix do_get_all_children(void) const
identity matrix If supplied two scalar respectively For allows like xample val
std::map< listener_mode, octave_value_list >::iterator listener_map_iterator
handle_property(const handle_property &p)
octave_idx_type length(void) const
base_property * clone(void) const
OCTINTERP_API bool do_set(const octave_value &v)
bool is_radio(void) const
double max_neg(void) const
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
base_property(const base_property &p)
virtual ~base_property(void)
bool is_scalar_type(void) const
std::string default_value(void) const
virtual NDArray scale(const NDArray &) const
bool is_defined(void) const
bool operator==(const color_values &c) const
color_values & operator=(const color_values &c)
virtual double scale(double) const
void set_hidden(bool flag)
Cell cell_value(void) const
std::set< std::string > type_constraints
bool operator!=(const color_values &c) const
void set_parent(const graphics_handle &h)
const_iterator find(const std::string pname) const
void reparent(const graphics_handle &new_parent)
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the base of natural logarithms The constant ex $e satisfies the equation log(e)
octave_value lookup(const std::string pname) const
virtual octave_value get_xlim(void) const
OCTINTERP_API void run_listeners(listener_mode mode=POSTSET)
Cell values_as_cell(void) const
virtual octave_value get_alim(void) const
array_property(const std::string &nm, const graphics_handle &h, const octave_value &m)
virtual graphics_toolkit get_toolkit(void) const
const std::string & current_value(void) const
virtual std::string graphics_object_name(void) const
double scale(double d) const
pval_map_type::const_iterator pval_map_const_iterator
void error(const char *fmt,...)
radio_property(const std::string &nm, const graphics_handle &h, const radio_values &v=radio_values())
void do_scale(const double *src, double *dest, int n) const
bool_property & operator=(const octave_value &val)
void set(const caseless_str &name, const octave_value &val)
std::list< dim_vector > size_constraints
virtual double unscale(double) const
virtual Matrix get_boundingbox(bool=false, const Matrix &=Matrix()) const
pval_map_type::iterator pval_map_iterator
base_property * clone(void) const
OCTINTERP_API bool str2rgb(const std::string &str)
property(const property &p)
bool contains(const std::string &val, std::string &match)
base_scaler * clone(void) const
base_property(const std::string &s, const graphics_handle &h)
radio_property(const std::string &nm, const graphics_handle &h, const std::string &v)
static void load_toolkit(const graphics_toolkit &tk)
Cell do_available_toolkits_list(void) const
string_array_property(const std::string &s, const graphics_handle &h, const std::string &val="", const char &sep= '|', const desired_enum &typ=string_t)
numeric fields are padded if necessary Padding is with zeros by default
void add_listener(const octave_value &v, listener_mode mode=POSTSET)
base_property * clone(void) const
Cell values_as_cell(void) const
children_property(const std::string &nm, const graphics_handle &h, const Matrix &val)
bool do_set(const octave_value &v)
virtual void set_from_list(property_list &plist)
double_radio_property & operator=(const octave_value &val)
virtual void delete_children(bool clear=false)
color_values(const color_values &c)
pval_vector pval_map_type
static std::string default_toolkit(void)
in this the arguments are accumulated from left to right
std::string string_value(void) const
NDArray scale(const NDArray &m) const
bool is(const caseless_str &v) const
std::string get_name(void) const
children_property & operator=(const octave_value &val)
std::string row_as_string(octave_idx_type, bool strip_ws=false) const
desired_enum desired_type
virtual property_list get_factory_defaults_list(void) const
graphics_handle current_val
static void unregister_toolkit(const std::string &name)
virtual graphics_handle get_parent(void) const
void resize(octave_idx_type n, const std::string &rfv="")
virtual void set(const caseless_str &pname, const octave_value &pval)
void renumber_child(graphics_handle old_gh, graphics_handle new_gh)
void set_hidden(bool flag)
octave_idx_type rows(void) const
color_values(const std::string &str)
void delete_listener(const octave_value &v=octave_value(), listener_mode mode=POSTSET)
bool validate(const std::string &val, std::string &match)
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
OCTINTERP_API bool do_set(const octave_value &newval)
text_label_property(const std::string &s, const graphics_handle &h, const Cell &c)
string_array_property(const string_array_property &p)
base_property * clone(void) const
bool do_set(const octave_value &v)
double_radio_property(const double_radio_property &p)
bool_property(const std::string &nm, const graphics_handle &h, bool val)
color_property(const std::string &nm, const graphics_handle &h, const color_property &v)
string_array_property & operator=(const octave_value &val)
bool do_set(const octave_value &v)
issues an error eealso single
const octave_base_value & a2
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
any_property(const any_property &p)
OCTAVE_EXPORT octave_value_list search each directory of the loadpath for element of the cell array and return the first that matches If the second optional argument return a cell array containing the list of all files that have the same name in the path If no files are found
virtual void adopt(const graphics_handle &h)
Cell cell_value(void) const
virtual octave_value get(bool all=false) const
callback_property & operator=(const octave_value &val)
base_property * clone(void) const
text_label_property & operator=(const octave_value &val)
void do_scale(const double *src, double *dest, int n) const
virtual ~base_scaler(void)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
base_property * clone(void) const
void do_adopt_child(double val)
Matrix get_hidden(void) const
std::string values_as_string(void) const
Matrix get_limits(void) const
virtual base_scaler * clone() const
Array< std::string > cellstr_value(void) const
double unscale(double d) const
bool is_radio(void) const
any_property & operator=(const octave_value &val)
text_label_property(const text_label_property &p)
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
virtual octave_value get_defaults(void) const
bool_property(const std::string &nm, const graphics_handle &h, const char *val)
virtual octave_value get_clim(void) const
scaler & operator=(const scaler &s)
const std::string & current_value(void) const
double unscale(double d) const
string_array_property(const std::string &s, const graphics_handle &h, const Cell &c, const char &sep= '|', const desired_enum &typ=string_t)
bool is_hidden(void) const
virtual octave_value get_factory_defaults(void) const
static void replace(QString &text, const QRegExp &re, const QString &after)
std::list< double >::iterator children_list_iterator
color_values(double r=0, double g=0, double b=1)
void delete_children(bool clear=false)
property & operator=(const octave_value &val)
graphics_handle get_parent(void) const
virtual octave_value get_zlim(void) const
Matrix get_children(void) const
bool is_sparse_type(void) const
Array< T > sort(int dim=0, sortmode mode=ASCENDING) const
Cell cell_value(void) const
graphics_toolkit do_get_toolkit(void) const
color_property(const std::string &nm, const graphics_handle &h, const std::string &v)
string_vector string_vector_value(void) const
double min_pos(void) const
std::string string_value(bool force=false) const
plist_map_iterator end(void)
std::map< listener_mode, octave_value_list > listener_map
nd deftypefn *octave_map m
virtual Cell values_as_cell(void) const
base_scaler * clone(void) const
virtual ~base_properties(void)
virtual void adopt(const graphics_handle &h)
Matrix scale(const Matrix &m) const
bool set(const octave_value &val, bool do_run=true, bool do_notify_toolkit=true)
octave_refcount< int > count
bool is_double(void) const
bool do_set(const octave_value &v)
void do_delete_children(bool clear)
plist_map_const_iterator begin(void) const
void renumber(graphics_handle old_gh, graphics_handle new_gh)
property_list(const plist_map_type &m=plist_map_type())
bool is_string(void) const
OCTAVE_EXPORT octave_value_list int16
virtual octave_value get(void) const
iterator find(const std::string pname)
const T * data(void) const
void set___modified__(const octave_value &val)
double min_val(void) const
void add_constraint(const dim_vector &dims)
string_vector & append(const std::string &s)
callback_property(const std::string &nm, const graphics_handle &h, const octave_value &m)
Matrix do_get_children(bool return_hidden) const
Cell values_as_cell(void) const
octave_int< T > pow(const octave_int< T > &a, const octave_int< T > &b)
bool do_set(const octave_value &val)
std::list< double > children_list
handle_property(const std::string &nm, const graphics_handle &h, const graphics_handle &val=graphics_handle())
bool is_cellstr(void) const
#define panic_impossible()
void do_init_children(const Matrix &val)
virtual void remove_child(const graphics_handle &h)
virtual base_properties & get_properties(void)
std::map< std::string, graphics_toolkit >::const_iterator const_loaded_toolkits_iterator
static void unload_toolkit(const std::string &name)
virtual void remove_child(const graphics_handle &h)
base_property * clone(void) const
bool is_cellstr(void) const
void set_parent(const graphics_handle &h)
bool is_radio(void) const
bool is_hidden(void) const
void renumber_parent(graphics_handle new_gh)
void do_unregister_toolkit(const std::string &name)
octave_value lookup(const caseless_str &name) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
ColumnVector cross(const ColumnVector &v1, const ColumnVector &v2)
virtual bool is_yliminclude(void) const
double unscale(double d) const
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
void do_load_toolkit(const graphics_toolkit &tk)
dim_vector dims(void) const
callback_property(const callback_property &p)
string_vector string_vector_value(bool pad=false) const
Matrix matrix_value(bool frc_str_conv=false) const
double max_val(void) const
OCTINTERP_API radio_values(const std::string &opt_string="")
Cell do_loaded_toolkits_list(void) const
may be zero for pure relative error test tem the relative tolerance must be greater than or equal to
plist_map_const_iterator end(void) const
row_vector_property(const row_vector_property &p)
OCTINTERP_API void execute(const octave_value &data=octave_value()) const
double_property(const double_property &p)
any_property(const std::string &nm, const graphics_handle &h, const octave_value &m=Matrix())
charMatrix char_matrix_value(bool frc_str_conv=false) const
std::list< double >::const_iterator const_children_list_iterator
Restrict the maximum order of the solution method This option must be between and
std::set< std::string > available_toolkits
std::map< std::string, graphics_toolkit >::iterator loaded_toolkits_iterator
T & xelem(octave_idx_type n)
string_property(const string_property &p)
virtual void set_defaults(const std::string &)
static graphics_toolkit find_toolkit(const std::string &name)
string_property(const std::string &s, const graphics_handle &h, const std::string &val="")
virtual bool is_xliminclude(void) const
octave::unwind_protect frame
array_property & operator=(const octave_value &val)
graphics_handle get_parent(void) const
base_property * clone(void) const
OCTINTERP_API bool validate(const octave_value &v)
bool is(const std::string &v) const
std::map< listener_mode, octave_value_list >::const_iterator listener_map_const_iterator
bool is_bool_scalar(void) const
bool is_empty(void) const
void run_listeners(listener_mode mode=POSTSET)
Matrix scale(const Matrix &m) const
NDArray array_value(bool frc_str_conv=false) const
Matrix stack(const Matrix &a) const
string_vector string_vector_value(void) const
double scale(double d) const
bool do_set(const octave_value &val)
void add_listener(const octave_value &v, listener_mode mode=POSTSET)
virtual property_list get_defaults_list(void) const
static void cleanup_instance(void)
std::set< std::string >::iterator available_toolkits_iterator
std::string values_as_string(void) const
base_property * clone(void) const
double_radio_property(const std::string &nm, const graphics_handle &h, const double_radio_property &v)
octave_handle graphics_handle
void add_constraint(const dim_vector &dims)
string_property & operator=(const octave_value &val)
radio_values(const radio_values &a)
bool bool_value(bool warn=false) const
=val(i)}if ode{val(i)}occurs in table i
std::map< std::string, pval_map_type > plist_map_type
bool remove_child(double val)
double_property & operator=(const octave_value &val)
NDArray scale(const NDArray &m) const
static OCTINTERP_API property create(const std::string &name, const graphics_handle &parent, const caseless_str &type, const octave_value_list &args)
virtual Matrix scale(const Matrix &) const
OCTINTERP_API bool set(const octave_value &v, bool do_run=true, bool do_notify_toolkit=true)
static bool instance_ok(void)
static OCTINTERP_API void create_instance(void)
plist_map_iterator begin(void)
double scale(double d) const
handle_property & operator=(const octave_value &val)
virtual octave_value get_ylim(void) const
virtual bool is_linear(void) const
NDArray scale(const NDArray &m) const
double_radio_property(double d, const radio_values &v)
virtual void mark_modified(void)
Matrix get_all_children(void) const
double double_value(void) const
defaults to zero A value of zero computes the digamma a value of
bool compare(const std::string &s, size_t limit=std::string::npos) const
bool is_modified(void) const
Matrix get_hidden_children(void) const
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the IEEE symbol NaN(Not a Number).NaN is the result of operations which do not produce a well defined 0 result.Common operations which produce a NaN are arithmetic with infinity ex($\infty-\infty $)
void set_name(const std::string &s)
bool is_defined(void) const
bool is_linear(void) const
bool is(const std::string &v) const
radio_property(const radio_property &p)
void resize(octave_idx_type n, const octave_value &rfv=octave_value())
radio_property(const std::string &nm, const graphics_handle &h, const radio_values &v, const std::string &def)
array_property(const array_property &p)
void add_constraint(const std::string &type)
virtual bool is_zliminclude(void) const
graphics_toolkit do_find_toolkit(const std::string &name) const
base_property * clone(void) const
color_property(const color_values &c, const radio_values &v)
virtual void override_defaults(base_graphics_object &obj)
Matrix scale(const Matrix &m) const
property clone(void) const
charMatrix char_value(void) const
void add_constraint(octave_idx_type len)
std::map< std::string, graphics_toolkit > loaded_toolkits
static Cell loaded_toolkits_list(void)
void set_modified(const octave_value &val)
static OCTINTERP_API gtk_manager * instance
base_property & operator=(const octave_value &val)
MArray< T > reshape(const dim_vector &new_dims) const
octave_scalar_map as_struct(const std::string &prefix_arg) const
bool do_set(const octave_value &val)
ColumnVector real(const ComplexColumnVector &a)
double double_value(bool frc_str_conv=false) const
octave_idx_type cols(void) const
write the output to stdout if nargout is
graphics_handle get_handle(void) const
base_scaler * clone(void) const
Vector representing the dimensions (size) of an Array.
std::string get_name(void) const
OCTINTERP_API bool validate(const octave_value &v) const
virtual bool has_property(const caseless_str &) const
row_vector_property & operator=(const octave_value &val)
bool do_remove_child(double child)
octave_value as_octave_value(void) const
plist_map_const_iterator find(const std::string &go_name) const
static void clear(octave::dynamic_library &oct_file)
set(hf,"paperorientation") esult
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
text_label_property(const std::string &s, const graphics_handle &h, const std::string &val="")
void set_tag(const octave_value &val)
scaler(const std::string &s)
bool do_set(const octave_value &v)
bool do_set(const octave_value &val)
BEGIN_BASE_PROPERTIES bool_property off radio_property busyaction
children_property(const children_property &p)
double unscale(double d) const
static bool is_handle_visible(const graphics_handle &h)
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state vector
Matrix get_all(void) const
plist_map_type::const_iterator plist_map_const_iterator
bool is_linear(void) const
void do_unload_all_toolkits(void)
where the brackets indicate optional arguments and and character or cell array For character arrays the conversion is repeated for every row
double scale(double d) const
graphics_handle handle_value(void) const
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
double_property(const std::string &nm, const graphics_handle &h, double d=0)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
color_property(const color_property &p)
void do_init_children(const std::list< double > &val)
OCTINTERP_API bool do_set(const octave_value &v)
OCTINTERP_API void get_data_limits(void)
base_property * clone(void) const
std::pair< std::string, octave_value > pval_pair
plist_map_type::iterator plist_map_iterator