# HG changeset patch # User Michael Goffioul # Date 1318884362 -3600 # Node ID d99aa455296e0ece82bddca44859d62344470dd4 # Parent f80473f245532a328f7c925a8c4845581c56d978 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. diff -r f80473f24553 -r d99aa455296e src/graphics.cc --- 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) diff -r f80473f24553 -r d99aa455296e src/graphics.h.in --- a/src/graphics.h.in Mon Oct 17 13:39:51 2011 -0400 +++ b/src/graphics.h.in Mon Oct 17 21:46:02 2011 +0100 @@ -3095,10 +3095,17 @@ } } + void set_position (const octave_value& val, + bool do_notify_toolkit = true); + + void set_outerposition (const octave_value& val, + bool do_notify_toolkit = true); + Matrix get_boundingbox (bool internal = false, const Matrix& parent_pix_size = Matrix ()) const; - void set_boundingbox (const Matrix& bb); + void set_boundingbox (const Matrix& bb, bool internal = false, + bool do_notify_toolkit = true); Matrix map_from_boundingbox (double x, double y) const; @@ -3137,6 +3144,7 @@ double_property mincolormap , 64 string_property name , "" bool_property numbertitle , "on" + array_property outerposition s , Matrix (1, 4, -1.0) radio_property paperunits Su , "{inches}|centimeters|normalized|points" array_property paperposition , default_figure_paperposition () radio_property paperpositionmode , "auto|{manual}" @@ -3145,7 +3153,7 @@ radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand" array_property pointershapecdata , Matrix (16, 16, 0) array_property pointershapehotspot , Matrix (1, 2, 0) - array_property position S , default_figure_position () + array_property position s , default_figure_position () radio_property renderer , "{painters}|zbuffer|opengl|none" radio_property renderermode , "{auto}|manual" bool_property resize , "on" @@ -3177,6 +3185,7 @@ pointershapecdata.add_constraint (dim_vector (16, 16)); pointershapehotspot.add_constraint (dim_vector (1, 2)); position.add_constraint (dim_vector (1, 4)); + outerposition.add_constraint (dim_vector (1, 4)); } private: