comparison src/graphics.cc @ 14367:ba01a38bc5c1

Use internal bounding box in figure::properties::set_position. * graphics.cc (figure::properties::update_units): Don't run listeners when changing units property. * graphics.cc (figure::properties::set_position): Use internal bounding box to trigger update actions. Move listeners execution to the end.
author Ben Abbott <bpabbott@mac.com>
date Wed, 15 Feb 2012 18:41:12 -0500
parents e7c74f56cd03
children c9ec21bef97a
comparison
equal deleted inserted replaced
14366:b76f0740940e 14367:ba01a38bc5c1
3252 bool do_notify_toolkit) 3252 bool do_notify_toolkit)
3253 { 3253 {
3254 if (! error_state) 3254 if (! error_state)
3255 { 3255 {
3256 Matrix old_bb, new_bb; 3256 Matrix old_bb, new_bb;
3257 3257 bool modified = false;
3258 old_bb = get_boundingbox (); 3258
3259 position.set (v, true, do_notify_toolkit); 3259 old_bb = get_boundingbox (true);
3260 new_bb = get_boundingbox (); 3260 modified = position.set (v, false, do_notify_toolkit);
3261 new_bb = get_boundingbox (true);
3261 3262
3262 if (old_bb != new_bb) 3263 if (old_bb != new_bb)
3263 { 3264 {
3264 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3)) 3265 if (old_bb(2) != new_bb(2) || old_bb(3) != new_bb(3))
3265 { 3266 {
3266 execute_resizefcn (); 3267 execute_resizefcn ();
3267 update_boundingbox (); 3268 update_boundingbox ();
3268 } 3269 }
3269 } 3270 }
3270 3271
3271 mark_modified (); 3272 if (modified)
3273 {
3274 position.run_listeners (POSTSET);
3275 mark_modified ();
3276 }
3272 } 3277 }
3273 } 3278 }
3274 3279
3275 void 3280 void
3276 figure::properties::set_outerposition (const octave_value& v, 3281 figure::properties::set_outerposition (const octave_value& v,
3709 } 3714 }
3710 3715
3711 void 3716 void
3712 figure::properties::update_units (const caseless_str& old_units) 3717 figure::properties::update_units (const caseless_str& old_units)
3713 { 3718 {
3714 set_position (convert_position (get_position ().matrix_value (), old_units, 3719 position.set (convert_position (get_position ().matrix_value (), old_units,
3715 get_units (), screen_size_pixels ())); 3720 get_units (), screen_size_pixels ()), false);
3716 } 3721 }
3717 3722
3718 /* 3723 /*
3719 %!test 3724 %!test
3720 %! figure (1, "visible", false) 3725 %! figure (1, "visible", false)