Mercurial > hg > octave-nkf
changeset 19279:3e0720bd6bfc
Fix setting axes default x/y/zlabel with string values (bug #34755)
* /libinterp/corefcn/graphics.cc (base_properties::set_from_list): when setting a string value, don't delete/recreate the text object, simply set its string property.
* /libinterp/corefcn/graphics.in.h (axes::axes): update_transform before setting default properties.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Sun, 07 Sep 2014 22:26:12 +0200 |
parents | dc88c5784f74 |
children | 99aec089e8c3 |
files | libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h |
diffstat | 2 files changed, 18 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -2806,7 +2806,7 @@ q++) { std::string pname = q->first; - + obj.set (pname, q->second); if (error_state) @@ -4766,28 +4766,23 @@ const std::string& who, const octave_value& v) { + if (v.is_string ()) + { + xset (hp.handle_value (), "string", v); + return; + } + graphics_handle val; - - if (v.is_string ()) - { - val = gh_manager::make_graphics_handle ("text", __myhandle__, - false, false); - - xset (val, "string", v); - } - else - { - graphics_object go = gh_manager::get_object (gh_manager::lookup (v)); - - if (go.isa ("text")) - val = ::reparent (v, "set", who, __myhandle__, false); - else - { - std::string cname = v.class_name (); - - error ("set: expecting text graphics object or character string for %s property, found %s", - who.c_str (), cname.c_str ()); - } + graphics_object go = gh_manager::get_object (gh_manager::lookup (v)); + + if (go.isa ("text")) + val = ::reparent (v, "set", who, __myhandle__, false); + else + { + std::string cname = v.class_name (); + + error ("set: expecting text graphics object or character string for %s property, found %s", + who.c_str (), cname.c_str ()); } if (! error_state)
--- a/libinterp/corefcn/graphics.in.h +++ b/libinterp/corefcn/graphics.in.h @@ -4220,8 +4220,8 @@ axes (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () { + xproperties.update_transform (); xproperties.override_defaults (*this); - xproperties.update_transform (); } ~axes (void) { }