Mercurial > octave-nkf
diff src/graphics.cc @ 13713:d99aa455296e
Add outerposition property to figure objects.
* graphics.h.in (figure::properties::outerposition): New property.
(figure::properties::position): Make with 's' flag.
(figure::properties::set_position): Explicit definition with additional input
argument for toolkit notification.
(figure::properties::set_outerposition): New method.
(figure::properties::set_boundingbox): New arguments for inner/outer bounding
box and toolkit notification.
(figure::properties::init): Add constraint for outerposition.
* graphics.cc (figure::properties::get_boundingbox): Returns position or
outerposition, depending on internal flag.
(figure::properties::set_boundingbox): New input arguments for inner/outer
position and toolkit notification.
(figure::properties::set_position): New input argument for toolkit
noticiation.
(figure::properties::set_outerposition): New method.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Mon, 17 Oct 2011 21:46:02 +0100 |
parents | 22ce748da25f |
children | deb69dab4514 |
line wrap: on
line diff
--- a/src/graphics.cc Mon Oct 17 13:39:51 2011 -0400 +++ b/src/graphics.cc Mon Oct 17 21:46:02 2011 +0100 @@ -3066,13 +3066,14 @@ } Matrix -figure::properties::get_boundingbox (bool, const Matrix&) const +figure::properties::get_boundingbox (bool internal, const Matrix&) const { Matrix screen_size = screen_size_pixels (); - Matrix pos; - - pos = convert_position (get_position ().matrix_value (), get_units (), - "pixels", screen_size); + Matrix pos = (internal ? + get_position ().matrix_value () : + get_outerposition ().matrix_value ()); + + pos = convert_position (pos, get_units (), "pixels", screen_size); pos(0)--; pos(1)--; @@ -3082,7 +3083,8 @@ } void -figure::properties::set_boundingbox (const Matrix& bb) +figure::properties::set_boundingbox (const Matrix& bb, bool internal, + bool do_notify_toolkit) { Matrix screen_size = screen_size_pixels (); Matrix pos = bb; @@ -3092,7 +3094,10 @@ pos(0)++; pos = convert_position (pos, "pixels", get_units (), screen_size); - set_position (pos); + if (internal) + set_position (pos, do_notify_toolkit); + else + set_outerposition (pos, do_notify_toolkit); } Matrix @@ -3130,14 +3135,15 @@ } void -figure::properties::set_position (const octave_value& v) +figure::properties::set_position (const octave_value& v, + bool do_notify_toolkit) { if (! error_state) { Matrix old_bb, new_bb; old_bb = get_boundingbox (); - position = v; + position.set (v, true, do_notify_toolkit); new_bb = get_boundingbox (); if (old_bb != new_bb) @@ -3154,6 +3160,19 @@ } void +figure::properties::set_outerposition (const octave_value& v, + bool do_notify_toolkit) +{ + if (! error_state) + { + if (outerposition.set (v, true, do_notify_toolkit)) + { + mark_modified (); + } + } +} + +void figure::properties::set_paperunits (const octave_value& v) { if (! error_state)