# HG changeset patch # User jwe # Date 1202111587 0 # Node ID af92b34f3a3a8ea6efb90dc4892dfed9ab534f18 # Parent 1e1e2608da7b828b6d7fb03cc4ddff60a01dc858 [project @ 2008-02-04 07:53:07 by jwe] diff -r 1e1e2608da7b -r af92b34f3a3a src/ChangeLog --- a/src/ChangeLog Mon Feb 04 07:40:55 2008 +0000 +++ b/src/ChangeLog Mon Feb 04 07:53:07 2008 +0000 @@ -1,3 +1,18 @@ +2008-02-04 Michael Goffioul + + * graphics.h.in (base_graphics_backend::get_screen_size, + graphics_backend::get_screen_size): New methods. + (graphics_backend::available_backends): Export symbol. + (class figure::properties, class axes::properties): Export classes. + (figure::properties::get_boundingbox): New utility method. + (figure::properties::position): Use valid default position. + (axes::properties::gridlinestyle, + axes::properties::minorgridlinestyle): + Use dotted line style as default. + * graphics.cc (default_figure_position): New static function. + (gnuplot_backend::get_screen_size): New method. + (figure::properties::get_boundingbox): New utility method. + 2008-02-02 Shai Ayal * graphics.h.in (base_scaler::~base_scalar): New virtual destructor. diff -r 1e1e2608da7b -r af92b34f3a3a src/graphics.cc --- a/src/graphics.cc Mon Feb 04 07:40:55 2008 +0000 +++ b/src/graphics.cc Mon Feb 04 07:53:07 2008 +0000 @@ -161,6 +161,17 @@ return m; } +static Matrix +default_figure_position (void) +{ + Matrix m (1, 4, 0.0); + m(0) = 300; + m(1) = 200; + m(2) = 560; + m(3) = 420; + return m; +} + // NOTE: "cb" is passed by value, because "function_value" method // is non-const; passing "cb" by const-reference is not // possible @@ -1318,6 +1329,9 @@ double get_screen_resolution (void) const { return 72.0; } + + Matrix get_screen_size (void) const + { return Matrix (1, 2, 0.0); } }; graphics_backend @@ -1404,6 +1418,23 @@ } } +Matrix +figure::properties::get_boundingbox (void) const +{ + graphics_backend b = get_backend (); + // FIXME: screen size should be obtained from root object + Matrix screen_size = b.get_screen_size (); + Matrix pos; + + pos = convert_position (get_position ().matrix_value (), get_units (), + "pixels", screen_size, b); + + pos(0)--; + pos(1)--; + + return pos; +} + octave_value figure::get_default (const caseless_str& name) const { diff -r 1e1e2608da7b -r af92b34f3a3a src/graphics.h.in --- a/src/graphics.h.in Mon Feb 04 07:40:55 2008 +0000 +++ b/src/graphics.h.in Mon Feb 04 07:53:07 2008 +0000 @@ -1119,6 +1119,12 @@ error ("get_screen_resolution: invalid graphics backend"); return -1; } + + virtual Matrix get_screen_size (void) const + { + error ("get_screen_size: invalid graphics backend"); + return Matrix (1, 2, 0.0); + } private: std::string name; @@ -1187,6 +1193,9 @@ double get_screen_resolution (void) const { return rep->get_screen_resolution (); } + Matrix get_screen_size (void) const + { return rep->get_screen_size (); } + OCTINTERP_API static graphics_backend default_backend (void); static void register_backend (const graphics_backend& b) @@ -1208,7 +1217,7 @@ private: base_graphics_backend *rep; - static std::map available_backends; + static OCTINTERP_API std::map available_backends; typedef std::map::iterator available_backends_iterator; typedef std::map::const_iterator const_available_backends_iterator; @@ -2021,7 +2030,7 @@ class OCTINTERP_API figure : public base_graphics_object { public: - class properties : public base_properties + class OCTINTERP_API properties : public base_properties { public: void close (bool pop = true); @@ -2067,6 +2076,8 @@ } } + Matrix get_boundingbox (void) const; + // See the genprops.awk script for an explanation of the // properties declarations. @@ -2102,7 +2113,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 , Matrix (1, 4, 0) + array_property position , default_figure_position () radio_property renderer , "{painters}|zbuffer|opengl|none" radio_property renderermode , "{auto}|manual" bool_property resize , "on" @@ -2264,7 +2275,7 @@ class OCTINTERP_API axes : public base_graphics_object { public: - class properties : public base_properties + class OCTINTERP_API properties : public base_properties { public: void set_defaults (base_graphics_object& obj, const std::string& mode); @@ -2384,11 +2395,11 @@ double_property fontsize , 12 radio_property fontunits , "{points}|normalized|inches|centimeters|pixels" radio_property fontweight , "{normal}|light|demi|bold" - radio_property gridlinestyle , "{-}|--|:|-.|none" + radio_property gridlinestyle , "-|--|{:}|-.|none" // FIXME: should be kind of string array string_property linestyleorder , "-" double_property linewidth , 0.5 - radio_property minorgridlinestyle , "{-}|--|:|-.|none" + radio_property minorgridlinestyle , "-|--|{:}|-.|none" array_property plotboxaspectratio m , Matrix (1, 3, 1.0) radio_property plotboxaspectratiomode , "{auto}|manual" radio_property projection , "{orthographic}|perpective"