Mercurial > hg > octave-terminal
changeset 7445:af92b34f3a3a
[project @ 2008-02-04 07:53:07 by jwe]
author | jwe |
---|---|
date | Mon, 04 Feb 2008 07:53:07 +0000 |
parents | 1e1e2608da7b |
children | 4bfbec4b0e24 |
files | src/ChangeLog src/graphics.cc src/graphics.h.in |
diffstat | 3 files changed, 63 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2008-02-04 Michael Goffioul <michael.goffioul@gmail.com> + + * 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 <shaiay@users.sourceforge.org> * graphics.h.in (base_scaler::~base_scalar): New virtual destructor.
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -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 {
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -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<std::string, graphics_backend> available_backends; + static OCTINTERP_API std::map<std::string, graphics_backend> available_backends; typedef std::map<std::string, graphics_backend>::iterator available_backends_iterator; typedef std::map<std::string, graphics_backend>::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"