Mercurial > hg > octave-lojdl
changeset 17353:4ee5b344a4e3
Resolved merge conflicts. Added a new member to ft_render.
* txt-eng-ft.h: Added a new 'interpret' member to ft_render class and changed constructor to accept one argument.
* txt-ebg-ft.cc: Class is using new argument in constructor to accept interpreter info and store it in 'interpret' member.
* txt-eng.h/.cc: Modified the code to preserve logical structure after merge.
* graphics.h/.cc: Supresed un-needed argument for ft_render::text_to_pixels/get_extent methods.
* gl-render.h/.cc: Modified code to resolve some issues after merging with main repo.
author | Andrej Lojdl <andrej.lojdl@gmail.com> |
---|---|
date | Fri, 30 Aug 2013 12:19:11 +0200 |
parents | 75c18fc1d060 |
children | 0e14b25c5f0f |
files | libinterp/corefcn/gl-render.cc libinterp/corefcn/gl-render.h libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h libinterp/corefcn/txt-eng-ft.cc libinterp/corefcn/txt-eng-ft.h libinterp/corefcn/txt-eng.cc libinterp/corefcn/txt-eng.h libinterp/corefcn/txt-latex.cc libinterp/corefcn/txt-latex.h libinterp/corefcn/txt-render.cc libinterp/corefcn/txt-render.h |
diffstat | 12 files changed, 3301 insertions(+), 3304 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc +++ b/libinterp/corefcn/gl-render.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2008-2012 Michael Goffioul - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ + Copyright (C) 2008-2012 Michael Goffioul + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -56,17 +56,17 @@ { protected: class texture_rep - { + { public: texture_rep (void) : id (), w (), h (), tw (), th (), tx (), ty (), - valid (false), count (1) - { } + valid (false), count (1) + { } texture_rep (GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg) - : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg), - tx (double(w)/tw), ty (double(h)/th), valid (true), - count (1) { } + : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg), + tx (double(w)/tw), ty (double(h)/th), valid (true), + count (1) { } ~texture_rep (void) { @@ -86,7 +86,7 @@ double tx, ty; bool valid; octave_refcount<int> count; - }; + }; texture_rep *rep; @@ -97,7 +97,7 @@ opengl_texture (void) : rep (new texture_rep ()) { } opengl_texture (const opengl_texture& tx) - : rep (tx.rep) + : rep (tx.rep) { rep->count++; } @@ -334,7 +334,7 @@ { public: class vertex_data_rep - { + { public: Matrix coords; Matrix color; @@ -350,14 +350,14 @@ vertex_data_rep (void) : coords (), color (), normal (), alpha (), - ambient (), diffuse (), specular (), specular_exp (),count (1) { } + ambient (), diffuse (), specular (), specular_exp (),count (1) { } vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& n, double a, float as, float ds, float ss, float se) - : coords (c), color (col), normal (n), alpha (a), - ambient (as), diffuse (ds), specular (ss), specular_exp (se), - count (1) { } - }; + : coords (c), color (col), normal (n), alpha (a), + ambient (as), diffuse (ds), specular (ss), specular_exp (se), + count (1) { } + }; private: vertex_data_rep *rep; @@ -371,18 +371,18 @@ public: vertex_data (void) : rep (nil_rep ()) - { rep->count++; } + { rep->count++; } vertex_data (const vertex_data& v) : rep (v.rep) - { rep->count++; } + { rep->count++; } vertex_data (const Matrix& c, const Matrix& col, const Matrix& n, double a, float as, float ds, float ss, float se) - : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se)) + : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se)) { } vertex_data (vertex_data_rep *new_rep) - : rep (new_rep) { } + : rep (new_rep) { } ~vertex_data (void) { @@ -409,9 +409,9 @@ { public: patch_tesselator (opengl_renderer *r, int cmode, int lmode, int idx = 0) - : opengl_tesselator (), renderer (r), - color_mode (cmode), light_mode (lmode), index (idx), - first (true), tmp_vdata () + : opengl_tesselator (), renderer (r), + color_mode (cmode), light_mode (lmode), index (idx), + first (true), tmp_vdata () { } protected: @@ -441,7 +441,7 @@ void vertex (void *data) { vertex_data::vertex_data_rep *v - = reinterpret_cast<vertex_data::vertex_data_rep *> (data); + = reinterpret_cast<vertex_data::vertex_data_rep *> (data); //printf ("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2)); // FIXME: why did I need to keep the first vertex of the face @@ -1119,7 +1119,7 @@ int wmax = 0, hmax = 0; bool tick_along_z = nearhoriz || xisinf (fx); bool mirror = props.is_box () && ystate != AXE_ANY_DIR - && (! props.has_property ("__plotyy_axes__")); + && (! props.has_property ("__plotyy_axes__")); set_color (props.get_ycolor_rgb ()); @@ -2229,7 +2229,7 @@ } vdata[i+j*fr] = - vertex_data (vv, cc, nn, aa, as, ds, ss, se); + vertex_data (vv, cc, nn, aa, as, ds, ss, se); } if (fl_mode > 0 || el_mode > 0) @@ -2408,11 +2408,11 @@ // Single color specifications, we can simplify a little bit if (mfcolor.numel () == 0 - && ! props.markerfacecolor_is ("none")) + && ! props.markerfacecolor_is ("none")) mfcolor = mc; if (mecolor.numel () == 0 - && ! props.markeredgecolor_is ("none")) + && ! props.markeredgecolor_is ("none")) mecolor = mc; } else @@ -2420,7 +2420,7 @@ if (c.numel () == 0) c = props.get_color_data ().matrix_value (); has_markerfacecolor = ((c.numel () > 0) - && (c.rows () == f.rows ())); + && (c.rows () == f.rows ())); } } @@ -2896,14 +2896,14 @@ glEnd (); break; case '.': - { - double ang_step = M_PI / 5; - - glBegin (GL_POLYGON); - for (double ang = 0; ang < (2*M_PI); ang += ang_step) - glVertex2d (sz*cos (ang)/3, sz*sin (ang)/3); - glEnd (); - } + { + double ang_step = M_PI / 5; + + glBegin (GL_POLYGON); + for (double ang = 0; ang < (2*M_PI); ang += ang_step) + glVertex2d (sz*cos (ang)/3, sz*sin (ang)/3); + glEnd (); + } break; case 's': glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); @@ -2914,14 +2914,14 @@ glEnd (); break; case 'o': - { - double ang_step = M_PI / 5; - - glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); - for (double ang = 0; ang < (2*M_PI); ang += ang_step) - glVertex2d (sz*cos (ang)/2, sz*sin (ang)/2); - glEnd (); - } + { + double ang_step = M_PI / 5; + + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); + for (double ang = 0; ang < (2*M_PI); ang += ang_step) + glVertex2d (sz*cos (ang)/2, sz*sin (ang)/2); + glEnd (); + } break; case 'd': glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); @@ -2960,36 +2960,36 @@ glEnd (); break; case 'p': - { - double ang; - double r; - double dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02; - - glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); - for (int i = 0; i < 2*5; i++) - { - ang = (-0.5 + double(i+1)/5) * M_PI; - r = 1.0 - (dr * fmod (double(i+1), 2.0)); - glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); - } - glEnd (); - } + { + double ang; + double r; + double dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02; + + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); + for (int i = 0; i < 2*5; i++) + { + ang = (-0.5 + double(i+1)/5) * M_PI; + r = 1.0 - (dr * fmod (double(i+1), 2.0)); + glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); + } + glEnd (); + } break; case 'h': - { - double ang; - double r; - double dr = 1.0 - 0.5/sin (M_PI/3)*1.02; - - glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); - for (int i = 0; i < 2*6; i++) - { - ang = (0.5 + double(i+1)/6.0) * M_PI; - r = 1.0 - (dr * fmod (double(i+1), 2.0)); - glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); - } - glEnd (); - } + { + double ang; + double r; + double dr = 1.0 - 0.5/sin (M_PI/3)*1.02; + + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); + for (int i = 0; i < 2*6; i++) + { + ang = (0.5 + double(i+1)/6.0) * M_PI; + r = 1.0 - (dr * fmod (double(i+1), 2.0)); + glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); + } + glEnd (); + } break; default: warning ("opengl_renderer: unsupported marker '%s'", @@ -3009,13 +3009,13 @@ int halign, int valign, double rotation) { text_renderer.text_to_pixels (txt, pixels, bbox, - halign, valign, rotation, "none"); + halign, valign, rotation); } Matrix opengl_renderer::render_text (const std::string& txt, - double x, double y, double z, - int halign, int valign, double rotation) + double x, double y, double z, + int halign, int valign, double rotation) { if (txt.empty ()) return Matrix (1, 4, 0.0); @@ -3037,7 +3037,7 @@ glDisable (GL_BLEND); return bbox; - + ::warning ("render_text: cannot render text, Freetype library not available"); return Matrix (1, 4, 0.0);
--- a/libinterp/corefcn/gl-render.h +++ b/libinterp/corefcn/gl-render.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2008-2012 Michael Goffioul + Copyright (C) 2008-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if !defined (gl_render_h) #define gl_render_h 1 @@ -139,7 +139,7 @@ : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (), zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (), camera_pos (), camera_dir (), text_renderer () - { } + { } opengl_renderer& operator = (const opengl_renderer&) { return *this; }
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2007-2012 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ + Copyright (C) 2007-2012 John W. Eaton + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -580,7 +580,7 @@ if (ax.valid_object ()) { const axes::properties& ax_props = - dynamic_cast<const axes::properties&> (ax.get_properties ()); + dynamic_cast<const axes::properties&> (ax.get_properties ()); graphics_xform ax_xform = ax_props.get_transform (); bool is_rectangle = (pos.numel () == 4); Matrix ax_bbox = ax_props.get_boundingbox (true), @@ -757,7 +757,7 @@ do \ { \ ARRAY_T tmp = cdata. VAL_FN ## array_value (); \ - \ + \ convert_cdata_1 (is_scaled, clim_0, clim_1, cmapv, \ tmp.data (), lda, nc, av); \ } \ @@ -967,7 +967,7 @@ } radio_values::radio_values (const std::string& opt_string) - : default_val (), possible_vals () +: default_val (), possible_vals () { size_t beg = 0; size_t len = opt_string.length (); @@ -1121,7 +1121,7 @@ } else error ("invalid value for color property \"%s\"", - get_name ().c_str ()); + get_name ().c_str ()); } else if (val.is_numeric_type ()) { @@ -1142,7 +1142,7 @@ } else error ("invalid value for color property \"%s\"", - get_name ().c_str ()); + get_name ().c_str ()); } else error ("invalid value for color property \"%s\"", @@ -1260,8 +1260,8 @@ #define CHECK_ARRAY_EQUAL(T,F,A) \ { \ if (data.numel () == 1) \ - return data.F ## scalar_value () == \ - v.F ## scalar_value (); \ + return data.F ## scalar_value () == \ + v.F ## scalar_value (); \ else \ { \ /* Keep copy of array_value to allow sparse/bool arrays */ \ @@ -1274,8 +1274,8 @@ bool flag = true; \ \ for (int i = 0; flag && i < data.numel (); i++) \ - if (d1[i] != d2[i]) \ - flag = false; \ + if (d1[i] != d2[i]) \ + flag = false; \ \ return flag; \ } \ @@ -1496,7 +1496,7 @@ else if (type.compare ("any")) { octave_value val = - (args.length () > 0 ? args(0) : octave_value (Matrix ())); + (args.length () > 0 ? args(0) : octave_value (Matrix ())); retval = property (new any_property (name, h, val)); } @@ -1586,12 +1586,12 @@ graphics_object go; std::map<caseless_str, graphics_object>::const_iterator it = - dprop_obj_map.find (go_name); + dprop_obj_map.find (go_name); if (it == dprop_obj_map.end ()) { base_graphics_object *bgo = - make_graphics_object_from_type (go_name); + make_graphics_object_from_type (go_name); if (bgo) { @@ -1929,7 +1929,7 @@ } graphics_handle::graphics_handle (const octave_value& a) - : val (octave_NaN) +: val (octave_NaN) { if (a.is_empty ()) /* do nothing */; @@ -1987,7 +1987,7 @@ %! close (hf); %! assert (lw, 10); %! assert (mk, "x"); -*/ + */ // Set properties given in two cell arrays containing names and values. void @@ -1997,7 +1997,7 @@ if (names.numel () != values.columns ()) { error ("set: number of names must match number of value columns (%d != %d)", - names.numel (), values.columns ()); + names.numel (), values.columns ()); } octave_idx_type k = names.columns (); @@ -2058,7 +2058,7 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -*/ + */ // Set properties given in a struct array void @@ -2069,7 +2069,7 @@ caseless_str name = m.keys ()[p]; octave_value val = octave_value (m.contents (name).elem (m.numel () - 1)); - + set_value_or_default (name, val); if (error_state) @@ -2110,7 +2110,7 @@ %! close (hf); %! assert (class (xticklabel), "cell"); %! assert (size (xticklabel), [6, 1]); -*/ + */ /* ## test set with struct arguments @@ -2156,7 +2156,7 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -*/ + */ // Set a property to a value or to its (factory) default value. @@ -2219,7 +2219,7 @@ %! close (hf); %! set (0, "defaultlinelinewidth", old_lw); %! end_unwind_protect -*/ + */ static double make_handle_fraction (void) @@ -3163,26 +3163,26 @@ } /* -%!test -%! old_units = get (0, "units"); -%! unwind_protect -%! set (0, "units", "pixels"); -%! sz = get (0, "screensize") - [1, 1, 0, 0]; -%! dpi = get (0, "screenpixelsperinch"); -%! set (0, "units", "inches"); -%! assert (get (0, "screensize"), sz / dpi, 0.5 / dpi); -%! set (0, "units", "centimeters"); -%! assert (get (0, "screensize"), sz / dpi * 2.54, 0.5 / dpi * 2.54); -%! set (0, "units", "points"); -%! assert (get (0, "screensize"), sz / dpi * 72, 0.5 / dpi * 72); -%! set (0, "units", "normalized"); -%! assert (get (0, "screensize"), [0.0, 0.0, 1.0, 1.0]); -%! set (0, "units", "pixels"); -%! assert (get (0, "screensize"), sz + [1, 1, 0, 0]); -%! unwind_protect_cleanup -%! set (0, "units", old_units); -%! end_unwind_protect -*/ + %!test + %! old_units = get (0, "units"); + %! unwind_protect + %! set (0, "units", "pixels"); + %! sz = get (0, "screensize") - [1, 1, 0, 0]; + %! dpi = get (0, "screenpixelsperinch"); + %! set (0, "units", "inches"); + %! assert (get (0, "screensize"), sz / dpi, 0.5 / dpi); + %! set (0, "units", "centimeters"); + %! assert (get (0, "screensize"), sz / dpi * 2.54, 0.5 / dpi * 2.54); + %! set (0, "units", "points"); + %! assert (get (0, "screensize"), sz / dpi * 72, 0.5 / dpi * 72); + %! set (0, "units", "normalized"); + %! assert (get (0, "screensize"), [0.0, 0.0, 1.0, 1.0]); + %! set (0, "units", "pixels"); + %! assert (get (0, "screensize"), sz + [1, 1, 0, 0]); + %! unwind_protect_cleanup + %! set (0, "units", old_units); + %! end_unwind_protect + */ void root_figure::properties::remove_child (const graphics_handle& gh) @@ -3788,36 +3788,36 @@ } /* -%!test -%! hf = figure ("visible", "off"); -%! unwind_protect -%! set (hf, "paperunits", "inches"); -%! set (hf, "papersize", [5, 4]); -%! set (hf, "paperunits", "points"); -%! assert (get (hf, "papersize"), [5, 4] * 72, 1); -%! papersize = get (hf, "papersize"); -%! set (hf, "papersize", papersize + 1); -%! set (hf, "papersize", papersize); -%! assert (get (hf, "papersize"), [5, 4] * 72, 1); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect - -%!test -%! hf = figure ("visible", "off"); -%! unwind_protect -%! set (hf, "paperunits", "inches"); -%! set (hf, "papersize", [5, 4]); -%! set (hf, "paperunits", "centimeters"); -%! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); -%! papersize = get (hf, "papersize"); -%! set (hf, "papersize", papersize + 1); -%! set (hf, "papersize", papersize); -%! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -*/ + %!test + %! hf = figure ("visible", "off"); + %! unwind_protect + %! set (hf, "paperunits", "inches"); + %! set (hf, "papersize", [5, 4]); + %! set (hf, "paperunits", "points"); + %! assert (get (hf, "papersize"), [5, 4] * 72, 1); + %! papersize = get (hf, "papersize"); + %! set (hf, "papersize", papersize + 1); + %! set (hf, "papersize", papersize); + %! assert (get (hf, "papersize"), [5, 4] * 72, 1); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + + %!test + %! hf = figure ("visible", "off"); + %! unwind_protect + %! set (hf, "paperunits", "inches"); + %! set (hf, "papersize", [5, 4]); + %! set (hf, "paperunits", "centimeters"); + %! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); + %! papersize = get (hf, "papersize"); + %! set (hf, "papersize", papersize + 1); + %! set (hf, "papersize", papersize); + %! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + */ void figure::properties::update_paperorientation (void) @@ -3839,31 +3839,31 @@ } /* -%!test -%! hf = figure ("visible", "off"); -%! unwind_protect -%! tol = 100 * eps (); -%! ## UPPER case and MiXed case is part of test and should not be changed. -%! set (hf, "paperorientation", "PORTRAIT"); -%! set (hf, "paperunits", "inches"); -%! set (hf, "papertype", "USletter"); -%! assert (get (hf, "papersize"), [8.5, 11.0], tol); -%! set (hf, "paperorientation", "Landscape"); -%! assert (get (hf, "papersize"), [11.0, 8.5], tol); -%! set (hf, "paperunits", "centimeters"); -%! assert (get (hf, "papersize"), [11.0, 8.5] * 2.54, tol); -%! set (hf, "papertype", "a4"); -%! assert (get (hf, "papersize"), [29.7, 21.0], tol); -%! set (hf, "paperunits", "inches", "papersize", [8.5, 11.0]); -%! assert (get (hf, "papertype"), "usletter"); -%! assert (get (hf, "paperorientation"), "portrait"); -%! set (hf, "papersize", [11.0, 8.5]); -%! assert (get (hf, "papertype"), "usletter"); -%! assert (get (hf, "paperorientation"), "landscape"); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -*/ + %!test + %! hf = figure ("visible", "off"); + %! unwind_protect + %! tol = 100 * eps (); + %! ## UPPER case and MiXed case is part of test and should not be changed. + %! set (hf, "paperorientation", "PORTRAIT"); + %! set (hf, "paperunits", "inches"); + %! set (hf, "papertype", "USletter"); + %! assert (get (hf, "papersize"), [8.5, 11.0], tol); + %! set (hf, "paperorientation", "Landscape"); + %! assert (get (hf, "papersize"), [11.0, 8.5], tol); + %! set (hf, "paperunits", "centimeters"); + %! assert (get (hf, "papersize"), [11.0, 8.5] * 2.54, tol); + %! set (hf, "papertype", "a4"); + %! assert (get (hf, "papersize"), [29.7, 21.0], tol); + %! set (hf, "paperunits", "inches", "papersize", [8.5, 11.0]); + %! assert (get (hf, "papertype"), "usletter"); + %! assert (get (hf, "paperorientation"), "portrait"); + %! set (hf, "papersize", [11.0, 8.5]); + %! assert (get (hf, "papertype"), "usletter"); + %! assert (get (hf, "paperorientation"), "landscape"); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + */ void figure::properties::set_units (const octave_value& v) @@ -3887,22 +3887,22 @@ } /* -%!test -%! hf = figure ("visible", "off"); -%! old_units = get (0, "units"); -%! unwind_protect -%! set (0, "units", "pixels"); -%! rsz = get (0, "screensize"); -%! set (gcf (), "units", "pixels"); -%! fsz = get (gcf (), "position"); -%! set (gcf (), "units", "normalized"); -%! pos = get (gcf (), "position"); -%! assert (pos, (fsz - [1, 1, 0, 0]) ./ rsz([3, 4, 3, 4])); -%! unwind_protect_cleanup -%! close (hf); -%! set (0, "units", old_units); -%! end_unwind_protect -*/ + %!test + %! hf = figure ("visible", "off"); + %! old_units = get (0, "units"); + %! unwind_protect + %! set (0, "units", "pixels"); + %! rsz = get (0, "screensize"); + %! set (gcf (), "units", "pixels"); + %! fsz = get (gcf (), "position"); + %! set (gcf (), "units", "normalized"); + %! pos = get (gcf (), "position"); + %! assert (pos, (fsz - [1, 1, 0, 0]) ./ rsz([3, 4, 3, 4])); + %! unwind_protect_cleanup + %! close (hf); + %! set (0, "units", old_units); + %! end_unwind_protect + */ std::string figure::properties::get_title (void) const @@ -4093,65 +4093,65 @@ } /* -%!testif HAVE_FLTK -%! hf = figure ("visible", "off"); -%! graphics_toolkit (hf, "fltk"); -%! unwind_protect -%! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); -%! hax = findall (gcf (), "type", "axes"); -%! positions = cell2mat (get (hax, "position")); -%! outerpositions = cell2mat (get (hax, "outerposition")); -%! looseinsets = cell2mat (get (hax, "looseinset")); -%! tightinsets = cell2mat (get (hax, "tightinset")); -%! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); -%! hax = findall (gcf (), "type", "axes"); -%! assert (cell2mat (get (hax, "position")), positions, 1e-4); -%! assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4); -%! assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4); -%! assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -%!testif HAVE_FLTK -%! hf = figure ("visible", "off"); -%! graphics_toolkit (hf, "fltk"); -%! fpos = get (hf, "position"); -%! unwind_protect -%! plot (rand (3)) -%! position = get (gca, "position"); -%! outerposition = get (gca, "outerposition"); -%! looseinset = get (gca, "looseinset"); -%! tightinset = get (gca, "tightinset"); -%! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) -%! set (hf, "position", fpos); -%! assert (get (gca, "outerposition"), outerposition, 0.001) -%! assert (get (gca, "position"), position, 0.001) -%! assert (get (gca, "looseinset"), looseinset, 0.001) -%! assert (get (gca, "tightinset"), tightinset, 0.001) -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -%!testif HAVE_FLTK -%! hf = figure ("visible", "off"); -%! graphics_toolkit (hf, "fltk"); -%! fpos = get (hf, "position"); -%! set (gca, "activepositionproperty", "position") -%! unwind_protect -%! plot (rand (3)) -%! position = get (gca, "position"); -%! outerposition = get (gca, "outerposition"); -%! looseinset = get (gca, "looseinset"); -%! tightinset = get (gca, "tightinset"); -%! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) -%! set (hf, "position", fpos); -%! assert (get (gca, "position"), position, 0.001) -%! assert (get (gca, "outerposition"), outerposition, 0.001) -%! assert (get (gca, "looseinset"), looseinset, 0.001) -%! assert (get (gca, "tightinset"), tightinset, 0.001) -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -*/ + %!testif HAVE_FLTK + %! hf = figure ("visible", "off"); + %! graphics_toolkit (hf, "fltk"); + %! unwind_protect + %! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); + %! hax = findall (gcf (), "type", "axes"); + %! positions = cell2mat (get (hax, "position")); + %! outerpositions = cell2mat (get (hax, "outerposition")); + %! looseinsets = cell2mat (get (hax, "looseinset")); + %! tightinsets = cell2mat (get (hax, "tightinset")); + %! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); + %! hax = findall (gcf (), "type", "axes"); + %! assert (cell2mat (get (hax, "position")), positions, 1e-4); + %! assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4); + %! assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4); + %! assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + %!testif HAVE_FLTK + %! hf = figure ("visible", "off"); + %! graphics_toolkit (hf, "fltk"); + %! fpos = get (hf, "position"); + %! unwind_protect + %! plot (rand (3)) + %! position = get (gca, "position"); + %! outerposition = get (gca, "outerposition"); + %! looseinset = get (gca, "looseinset"); + %! tightinset = get (gca, "tightinset"); + %! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) + %! set (hf, "position", fpos); + %! assert (get (gca, "outerposition"), outerposition, 0.001) + %! assert (get (gca, "position"), position, 0.001) + %! assert (get (gca, "looseinset"), looseinset, 0.001) + %! assert (get (gca, "tightinset"), tightinset, 0.001) + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + %!testif HAVE_FLTK + %! hf = figure ("visible", "off"); + %! graphics_toolkit (hf, "fltk"); + %! fpos = get (hf, "position"); + %! set (gca, "activepositionproperty", "position") + %! unwind_protect + %! plot (rand (3)) + %! position = get (gca, "position"); + %! outerposition = get (gca, "outerposition"); + %! looseinset = get (gca, "looseinset"); + %! tightinset = get (gca, "tightinset"); + %! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) + %! set (hf, "position", fpos); + %! assert (get (gca, "position"), position, 0.001) + %! assert (get (gca, "outerposition"), outerposition, 0.001) + %! assert (get (gca, "looseinset"), looseinset, 0.001) + %! assert (get (gca, "tightinset"), tightinset, 0.001) + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + */ void axes::properties::set_text_child (handle_property& hp, @@ -4962,33 +4962,33 @@ y2Dright = false; layer2Dtop = false; if (xstate == AXE_HORZ_DIR && ystate == AXE_VERT_DIR) - { - if (xaxislocation_is ("top")) - { - double tmp = yPlane; - yPlane = yPlaneN; - yPlaneN = tmp; - x2Dtop = true; - } - ypTick = yPlaneN; - ypTickN = yPlane; - if (yaxislocation_is ("right")) - { - double tmp = xPlane; - xPlane = xPlaneN; - xPlaneN = tmp; - y2Dright = true; - } - xpTick = xPlaneN; - xpTickN = xPlane; - if (layer_is ("top")) - { - zpTick = zPlaneN; - layer2Dtop = true; - } - else - zpTick = zPlane; - } + { + if (xaxislocation_is ("top")) + { + double tmp = yPlane; + yPlane = yPlaneN; + yPlaneN = tmp; + x2Dtop = true; + } + ypTick = yPlaneN; + ypTickN = yPlane; + if (yaxislocation_is ("right")) + { + double tmp = xPlane; + xPlane = xPlaneN; + xPlaneN = tmp; + y2Dright = true; + } + xpTick = xPlaneN; + xpTickN = xPlane; + if (layer_is ("top")) + { + zpTick = zPlaneN; + layer2Dtop = true; + } + else + zpTick = zPlane; + } Matrix viewmat = get_view ().matrix_value (); nearhoriz = std::abs (viewmat(1)) <= 5; @@ -5043,7 +5043,7 @@ %! xlabel xlabel; %! ylabel ylabel; %! title title; -*/ + */ static bool updating_xlabel_position = false; @@ -5106,19 +5106,19 @@ switch (xstate) { - case AXE_ANY_DIR: - p(0) += (xyzSym ? wmax : -wmax); - p(1) += hmax; - break; - - case AXE_VERT_DIR: - p(0) -= wmax; - angle = 90; - break; - - case AXE_HORZ_DIR: - p(1) += (x2Dtop ? -hmax : hmax); - break; + case AXE_ANY_DIR: + p(0) += (xyzSym ? wmax : -wmax); + p(1) += hmax; + break; + + case AXE_VERT_DIR: + p(0) -= wmax; + angle = 90; + break; + + case AXE_HORZ_DIR: + p(1) += (x2Dtop ? -hmax : hmax); + break; } if (xlabel_props.positionmode_is ("auto")) @@ -5206,19 +5206,19 @@ switch (ystate) { - case AXE_ANY_DIR: - p(0) += (!xyzSym ? wmax : -wmax); - p(1) += hmax; - break; - - case AXE_VERT_DIR: - p(0) += (y2Dright ? wmax : -wmax); - angle = 90; - break; - - case AXE_HORZ_DIR: - p(1) += hmax; - break; + case AXE_ANY_DIR: + p(0) += (!xyzSym ? wmax : -wmax); + p(1) += hmax; + break; + + case AXE_VERT_DIR: + p(0) += (y2Dright ? wmax : -wmax); + angle = 90; + break; + + case AXE_HORZ_DIR: + p(1) += hmax; + break; } if (ylabel_props.positionmode_is ("auto")) @@ -5310,28 +5310,28 @@ switch (zstate) { - case AXE_ANY_DIR: - if (camAuto) - { - p(0) -= wmax; - angle = 90; - } - - // FIXME -- what's the correct offset? - // - // p[0] += (!xySym ? wmax : -wmax); - // p[1] += (zSign ? hmax : -hmax); - - break; - - case AXE_VERT_DIR: - p(0) -= wmax; - angle = 90; - break; - - case AXE_HORZ_DIR: - p(1) += hmax; - break; + case AXE_ANY_DIR: + if (camAuto) + { + p(0) -= wmax; + angle = 90; + } + + // FIXME -- what's the correct offset? + // + // p[0] += (!xySym ? wmax : -wmax); + // p[1] += (zSign ? hmax : -hmax); + + break; + + case AXE_VERT_DIR: + p(0) -= wmax; + angle = 90; + break; + + case AXE_HORZ_DIR: + p(1) += hmax; + break; } if (zlabel_props.positionmode_is ("auto")) @@ -5411,15 +5411,15 @@ normalized_aspectratios (Matrix& aspectratios, const Matrix& scalefactors, double xlength, double ylength, double zlength) { - double xval = xlength/scalefactors(0); - double yval = ylength/scalefactors(1); - double zval = zlength/scalefactors(2); - - double minval = xmin (xmin (xval, yval), zval); - - aspectratios(0) = xval/minval; - aspectratios(1) = yval/minval; - aspectratios(2) = zval/minval; + double xval = xlength/scalefactors(0); + double yval = ylength/scalefactors(1); + double zval = zlength/scalefactors(2); + + double minval = xmin (xmin (xval, yval), zval); + + aspectratios(0) = xval/minval; + aspectratios(1) = yval/minval; + aspectratios(2) = zval/minval; } static void @@ -5578,8 +5578,8 @@ const Matrix& parent_pix_size) const { Matrix pos = (internal ? - get_position ().matrix_value () - : get_outerposition ().matrix_value ()); + get_position ().matrix_value () + : get_outerposition ().matrix_value ()); Matrix parent_size (parent_pix_size); if (parent_size.numel () == 0) @@ -5587,7 +5587,7 @@ graphics_object obj = gh_manager::get_object (get_parent ()); parent_size = - obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); + obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); } pos = convert_position (pos, get_units (), "pixels", parent_size); @@ -5658,9 +5658,9 @@ { double text_rotation = text_props.get_rotation (); if (text_rotation == 0. || text_rotation == 180.) - ignore_horizontal = true; + ignore_horizontal = true; else if (text_rotation == 90. || text_rotation == 270.) - ignore_vertical = true; + ignore_vertical = true; } if (! ignore_horizontal) @@ -5719,7 +5719,7 @@ // Split string with delimiter '|' while (std::getline (iss, tmpstr, '|')) sv.append (tmpstr); - + // If string ends with '|' Matlab appends a null string if (*valstr.rbegin () == '|') sv.append (std::string ("")); @@ -5908,25 +5908,25 @@ // FIXME -- remove. // FIXME -- maybe this should go into array_property class? /* -static void -check_limit_vals (double& min_val, double& max_val, - double& min_pos, double& max_neg, - const array_property& data) -{ - double val = data.min_val (); - if (xfinite (val) && val < min_val) - min_val = val; - val = data.max_val (); - if (xfinite (val) && val > max_val) - max_val = val; - val = data.min_pos (); - if (xfinite (val) && val > 0 && val < min_pos) - min_pos = val; - val = data.max_neg (); - if (xfinite (val) && val < 0 && val > max_neg) - max_neg = val; -} -*/ + static void + check_limit_vals (double& min_val, double& max_val, + double& min_pos, double& max_neg, + const array_property& data) + { + double val = data.min_val (); + if (xfinite (val) && val < min_val) + min_val = val; + val = data.max_val (); + if (xfinite (val) && val > max_val) + max_val = val; + val = data.min_pos (); + if (xfinite (val) && val > 0 && val < min_pos) + min_pos = val; + val = data.max_neg (); + if (xfinite (val) && val < 0 && val > max_neg) + max_neg = val; + } + */ static void check_limit_vals (double& min_val, double& max_val, @@ -6293,7 +6293,7 @@ label.erase (0, label.find_first_not_of (" ")); label = label.substr (0, label.find_last_not_of (" ")+1); #ifdef HAVE_FREETYPE - ext = text_renderer.get_extent (label, 0.0, "none"); + ext = text_renderer.get_extent (label, 0.0); wmax = std::max (wmax, ext(0)); hmax = std::max (hmax, ext(1)); #else @@ -6420,16 +6420,16 @@ { \ val = limits(0); \ if (xfinite (val)) \ - min_val = val; \ + min_val = val; \ val = limits(1); \ if (xfinite (val)) \ - max_val = val; \ + max_val = val; \ val = limits(2); \ if (xfinite (val)) \ - min_pos = val; \ + min_pos = val; \ val = limits(3); \ if (xfinite (val)) \ - max_neg = val; \ + max_neg = val; \ } \ else \ { \ @@ -7088,24 +7088,24 @@ void text::properties::update_font (void) { -/* + /* #ifdef HAVE_FREETYPE #ifdef HAVE_FONTCONFIG - renderer.set_font (get ("fontname").string_value (), - get ("fontweight").string_value (), - get ("fontangle").string_value (), - get ("fontsize").double_value ()); +renderer.set_font (get ("fontname").string_value (), +get ("fontweight").string_value (), +get ("fontangle").string_value (), +get ("fontsize").double_value ()); #endif - renderer.set_color (get_color_rgb ()); +renderer.set_color (get_color_rgb ()); #endif -*/ + */ } void text::properties::update_text_extent (void) { - text_render r (get_interpreter ()); + text_render r (get_interpreter ()); int halign = 0, valign = 0; @@ -7130,18 +7130,18 @@ octave_value string_prop = get_string (); string_vector sv = string_prop.all_strings (); - + r.set_font (get ("fontname").string_value (), get ("fontweight").string_value (), get ("fontangle").string_value (), get ("fontsize").double_value ()); - + r.set_color (get_color_rgb ()); - + r.text_to_pixels (sv.join ("\n"), pixels, bbox, - halign, valign, get_rotation ()); - - + halign, valign, get_rotation ()); + + /* The bbox is relative to the text's position. We'll leave it that way, because get_position () does not return valid results when the text is first constructed. @@ -7290,28 +7290,28 @@ double& nz = n(j, i, 2); if ((j > 0) && (i > 0)) - // upper left quadrangle - cross_product (x(j1,i-1)-x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i), - x(j2,i-1)-x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i), - nx, ny, nz); + // upper left quadrangle + cross_product (x(j1,i-1)-x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i), + x(j2,i-1)-x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i), + nx, ny, nz); if ((j > 0) && (i < (p -1))) - // upper right quadrangle - cross_product (x(j1,i+1)-x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i), - x(j1,i)-x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1), - nx, ny, nz); + // upper right quadrangle + cross_product (x(j1,i+1)-x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i), + x(j1,i)-x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1), + nx, ny, nz); if ((j < (q - 1)) && (i > 0)) - // lower left quadrangle - cross_product (x(j2,i-1)-x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i), - x(j3,i-1)-x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i), - nx, ny, nz); + // lower left quadrangle + cross_product (x(j2,i-1)-x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i), + x(j3,i-1)-x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i), + nx, ny, nz); if ((j < (q - 1)) && (i < (p -1))) - // lower right quadrangle - cross_product (x(j3,i)-x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1), - x(j3,i+1)-x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i), - nx, ny, nz); + // lower right quadrangle + cross_product (x(j3,i)-x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1), + x(j3,i+1)-x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i), + nx, ny, nz); double d = -std::max (std::max (fabs (nx), fabs (ny)), fabs (nz)); @@ -7645,7 +7645,7 @@ graphics_object obj = gh_manager::get_object (get_parent ()); parent_size = - obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); + obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); } pos = convert_position (pos, get_units (), "pixels", parent_size); @@ -7709,7 +7709,7 @@ graphics_object obj = gh_manager::get_object (get_parent ()); parent_size = - obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); + obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); } pos = convert_position (pos, get_units (), "pixels", parent_size); @@ -7877,10 +7877,10 @@ // We use a random value for the handle to avoid issues with plots and // scalar values for the first argument. gh_manager::gh_manager (void) - : handle_map (), handle_free_list (), - next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)), - figure_list (), graphics_lock (), event_queue (), - callback_objects (), event_processing (0) +: handle_map (), handle_free_list (), + next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)), + figure_list (), graphics_lock (), event_queue (), + callback_objects (), event_processing (0) { handle_map[0] = graphics_object (new root_figure ()); @@ -7975,13 +7975,13 @@ public: callback_event (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - : base_graphics_event (), handle (h), callback_name (name), - callback (), callback_data (data) { } + : base_graphics_event (), handle (h), callback_name (name), + callback (), callback_data (data) { } callback_event (const graphics_handle& h, const octave_value& cb, const octave_value& data = Matrix ()) - : base_graphics_event (), handle (h), callback_name (), - callback (cb), callback_data (data) { } + : base_graphics_event (), handle (h), callback_name (), + callback (cb), callback_data (data) { } void execute (void) { @@ -7994,7 +7994,7 @@ private: callback_event (void) : base_graphics_event (), handle (), - callback_name (), callback_data () + callback_name (), callback_data () { } private: @@ -8009,8 +8009,8 @@ { public: function_event (graphics_event::event_fcn fcn, void* data = 0) - : base_graphics_event (), function (fcn), - function_data (data) { } + : base_graphics_event (), function (fcn), + function_data (data) { } void execute (void) { @@ -8039,8 +8039,8 @@ public: set_event (const graphics_handle& h, const std::string& name, const octave_value& value, bool do_notify_toolkit = true) - : base_graphics_event (), handle (h), property_name (name), - property_value (value), notify_toolkit (do_notify_toolkit) { } + : base_graphics_event (), handle (h), property_name (name), + property_value (value), notify_toolkit (do_notify_toolkit) { } void execute (void) { @@ -8060,7 +8060,7 @@ private: set_event (void) : base_graphics_event (), handle (), property_name (), property_value () - { } + { } private: graphics_handle handle; @@ -8122,7 +8122,7 @@ { graphics_object go = gh_manager::get_object (0); root_figure::properties& props = - dynamic_cast<root_figure::properties&> (go.get_properties ()); + dynamic_cast<root_figure::properties&> (go.get_properties ()); props.set_callbackobject (h.as_octave_value ()); } @@ -8400,15 +8400,15 @@ // --------------------------------------------------------------------- DEFUN (ishandle, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} ishandle (@var{h})\n\ -Return true if @var{h} is a graphics handle and false otherwise.\n\ -\n\ -@var{h} may also be a matrix of handles in which case a logical\n\ -array is returned that is true where the elements of @var{h} are\n\ -graphics handles and false where they are not.\n\ -@seealso{isaxes, isfigure}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} ishandle (@var{h})\n\ + Return true if @var{h} is a graphics handle and false otherwise.\n\ + \n\ + @var{h} may also be a matrix of handles in which case a logical\n\ + array is returned that is true where the elements of @var{h} are\n\ + graphics handles and false where they are not.\n\ + @seealso{isaxes, isfigure}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8460,10 +8460,10 @@ } DEFUN (__is_handle_visible__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} __is_handle_visible__ (@var{h})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} __is_handle_visible__ (@var{h})\n\ + Undocumented internal function.\n\ + @end deftypefn") { octave_value retval; @@ -8476,13 +8476,13 @@ } DEFUN (reset, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\ -Remove any defaults set for the handle @var{h}. The default figure\n\ -properties of @qcode{\"position\"}, @qcode{\"units\"},\n\ -@qcode{\"windowstyle\"} and @qcode{\"paperunits\"} and the default axes\n\ -properties of @qcode{\"position\"} and @qcode{\"units\"} are not reset.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\ + Remove any defaults set for the handle @var{h}. The default figure\n\ + properties of @qcode{\"position\"}, @qcode{\"units\"},\n\ + @qcode{\"windowstyle\"} and @qcode{\"paperunits\"} and the default axes\n\ + properties of @qcode{\"position\"} and @qcode{\"units\"} are not reset.\n\ + @end deftypefn") { int nargin = args.length (); @@ -8505,40 +8505,40 @@ } DEFUN (set, args, nargout, - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})\n\ -@deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})\n\ -@deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})\n\ -Set named property values for the graphics handle (or vector of graphics\n\ -handles) @var{h}.\n\ -There are three ways how to give the property names and values:\n\ -\n\ -@itemize\n\ -@item as a comma separated list of @var{property}, @var{value} pairs\n\ -\n\ -Here, each @var{property} is a string containing the property name, each\n\ -@var{value} is a value of the appropriate type for the property.\n\ -\n\ -@item as a cell array of strings @var{properties} containing property names\n\ -and a cell array @var{values} containing property values.\n\ -\n\ -In this case, the number of columns of @var{values} must match the number of\n\ -elements in @var{properties}. The first column of @var{values} contains\n\ -values for the first entry in @var{properties}, etc. The number of rows of\n\ -@var{values} must be 1 or match the number of elements of @var{h}. In the\n\ -first case, each handle in @var{h} will be assigned the same values. In the\n\ -latter case, the first handle in @var{h} will be assigned the values from\n\ -the first row of @var{values} and so on.\n\ -\n\ -@item as a structure array @var{pv}\n\ -\n\ -Here, the field names of @var{pv} represent the property names, and the field\n\ -values give the property values. In contrast to the previous case, all\n\ -elements of @var{pv} will be set in all handles in @var{h} independent of\n\ -the dimensions of @var{pv}.\n\ -@end itemize\n\ -@seealso{get}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})\n\ + @deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})\n\ + @deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})\n\ + Set named property values for the graphics handle (or vector of graphics\n\ + handles) @var{h}.\n\ + There are three ways how to give the property names and values:\n\ + \n\ + @itemize\n\ + @item as a comma separated list of @var{property}, @var{value} pairs\n\ + \n\ + Here, each @var{property} is a string containing the property name, each\n\ + @var{value} is a value of the appropriate type for the property.\n\ + \n\ + @item as a cell array of strings @var{properties} containing property names\n\ + and a cell array @var{values} containing property values.\n\ + \n\ + In this case, the number of columns of @var{values} must match the number of\n\ + elements in @var{properties}. The first column of @var{values} contains\n\ + values for the first entry in @var{properties}, etc. The number of rows of\n\ + @var{values} must be 1 or match the number of elements of @var{h}. In the\n\ + first case, each handle in @var{h} will be assigned the same values. In the\n\ + latter case, the first handle in @var{h} will be assigned the values from\n\ + the first row of @var{values} and so on.\n\ + \n\ + @item as a structure array @var{pv}\n\ + \n\ + Here, the field names of @var{pv} represent the property names, and the field\n\ + values give the property values. In contrast to the previous case, all\n\ + elements of @var{pv} will be set in all handles in @var{h} independent of\n\ + the dimensions of @var{pv}.\n\ + @end itemize\n\ + @seealso{get}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8578,7 +8578,7 @@ else { error ("set: number of graphics handles must match number of value rows (%d != %d)", - hcv.length (), args(2).cell_value ().rows ()); + hcv.length (), args(2).cell_value ().rows ()); break; } @@ -8614,7 +8614,7 @@ break; request_drawnow = true; - } + } if (! error_state && request_drawnow) Vdrawnow_requested = true; @@ -8644,15 +8644,15 @@ } DEFUN (get, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} get (@var{h})\n\ -@deftypefnx {Built-in Function} {@var{val} =} get (@var{h}, @var{p})\n\ -Return the value of the named property @var{p} from the graphics handle\n\ -@var{h}. If @var{p} is omitted, return the complete property list for\n\ -@var{h}. If @var{h} is a vector, return a cell array including the property\n\ -values or lists respectively.\n\ -@seealso{set}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {@var{val} =} get (@var{h})\n\ + @deftypefnx {Built-in Function} {@var{val} =} get (@var{h}, @var{p})\n\ + Return the value of the named property @var{p} from the graphics handle\n\ + @var{h}. If @var{p} is omitted, return the complete property list for\n\ + @var{h}. If @var{h} is a vector, return a cell array including the property\n\ + values or lists respectively.\n\ + @seealso{set}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8811,18 +8811,18 @@ } /* -%!assert (get (findobj (0, "Tag", "nonexistenttag"), "nonexistentproperty"), []) -*/ + %!assert (get (findobj (0, "Tag", "nonexistenttag"), "nonexistentproperty"), []) + */ // Return all properties from the graphics handle @var{h}. // If @var{h} is a vector, return a cell array including the // property values or lists respectively. DEFUN (__get__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __get__ (@var{h})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __get__ (@var{h})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8947,10 +8947,10 @@ } DEFUN (__go_figure__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9047,15 +9047,15 @@ #define GO_BODY(TYPE) \ gh_manager::auto_lock guard; \ - \ - octave_value retval; \ - \ - if (args.length () > 0) \ - retval = make_graphics_object (#TYPE, false, args); \ - else \ - print_usage (); \ - \ - return retval +\ +octave_value retval; \ +\ +if (args.length () > 0) \ +retval = make_graphics_object (#TYPE, false, args); \ +else \ +print_usage (); \ +\ +return retval int calc_dimensions (const graphics_object& go) @@ -9091,11 +9091,11 @@ } DEFUN (__calc_dimensions__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\ -Internal function. Determine the number of dimensions in a graphics\n\ -object, whether 2 or 3.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\ + Internal function. Determine the number of dimensions in a graphics\n\ + object, whether 2 or 3.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9119,136 +9119,136 @@ } DEFUN (__go_axes__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (axes); } DEFUN (__go_line__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (line); } DEFUN (__go_text__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (text); } DEFUN (__go_image__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (image); } DEFUN (__go_surface__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (surface); } DEFUN (__go_patch__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (patch); } DEFUN (__go_hggroup__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (hggroup); } DEFUN (__go_uimenu__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uimenu); } DEFUN (__go_uicontrol__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uicontrol__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uicontrol__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uicontrol); } DEFUN (__go_uipanel__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uipanel__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uipanel__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uipanel); } DEFUN (__go_uicontextmenu__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uicontextmenu__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uicontextmenu__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uicontextmenu); } DEFUN (__go_uitoolbar__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uitoolbar__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uitoolbar__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uitoolbar); } DEFUN (__go_uipushtool__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uipushtool__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uipushtool__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uipushtool); } DEFUN (__go_uitoggletool__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uitoggletool__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uitoggletool__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uitoggletool); } DEFUN (__go_delete__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9290,10 +9290,10 @@ } DEFUN (__go_axes_init__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9344,10 +9344,10 @@ } DEFUN (__go_handles__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_handles__ (@var{show_hidden})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_handles__ (@var{show_hidden})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9360,10 +9360,10 @@ } DEFUN (__go_figure_handles__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_figure_handles__ (@var{show_hidden})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_figure_handles__ (@var{show_hidden})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9376,11 +9376,11 @@ } DEFUN (__go_execute_callback__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name})\n\ -@deftypefnx {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name}, @var{param})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name})\n\ + @deftypefnx {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name}, @var{param})\n\ + Undocumented internal function.\n\ + @end deftypefn") { octave_value retval; @@ -9422,10 +9422,10 @@ } DEFUN (__image_pixel_size__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{px}, @var{py}} __image_pixel_size__ (@var{h})\n\ -Internal function: returns the pixel size of the image in normalized units.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {@var{px}, @var{py}} __image_pixel_size__ (@var{h})\n\ + Internal function: returns the pixel size of the image in normalized units.\n\ + @end deftypefn") { octave_value retval; @@ -9507,11 +9507,11 @@ } DEFUN (available_graphics_toolkits, , , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\ -Return a cell array of registered graphics toolkits.\n\ -@seealso{graphics_toolkit, register_graphics_toolkit}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\ + Return a cell array of registered graphics toolkits.\n\ + @seealso{graphics_toolkit, register_graphics_toolkit}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9519,11 +9519,11 @@ } DEFUN (register_graphics_toolkit, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} register_graphics_toolkit (@var{toolkit})\n\ -List @var{toolkit} as an available graphics toolkit.\n\ -@seealso{available_graphics_toolkits}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} register_graphics_toolkit (@var{toolkit})\n\ + List @var{toolkit} as an available graphics toolkit.\n\ + @seealso{available_graphics_toolkits}\n\ + @end deftypefn") { octave_value retval; @@ -9545,11 +9545,11 @@ } DEFUN (loaded_graphics_toolkits, , , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} loaded_graphics_toolkits ()\n\ -Return a cell array of the currently loaded graphics toolkits.\n\ -@seealso{available_graphics_toolkits}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} loaded_graphics_toolkits ()\n\ + Return a cell array of the currently loaded graphics toolkits.\n\ + @seealso{available_graphics_toolkits}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9557,17 +9557,17 @@ } DEFUN (drawnow, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} drawnow ()\n\ -@deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\ -@deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\ -Update figure windows and their children. The event queue is flushed and\n\ -any callbacks generated are executed. With the optional argument\n\ -@qcode{\"expose\"}, only graphic objects are updated and no other events or\n\ -callbacks are processed.\n\ -The third calling form of @code{drawnow} is for debugging and is\n\ -undocumented.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} drawnow ()\n\ + @deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\ + @deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\ + Update figure windows and their children. The event queue is flushed and\n\ + any callbacks generated are executed. With the optional argument\n\ + @qcode{\"expose\"}, only graphic objects are updated and no other events or\n\ + callbacks are processed.\n\ + The third calling form of @code{drawnow} is for debugging and is\n\ + undocumented.\n\ + @end deftypefn") { static int drawnow_executing = 0; @@ -9718,37 +9718,37 @@ } DEFUN (addlistener, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})\n\ -Register @var{fcn} as listener for the property @var{prop} of the graphics\n\ -object @var{h}. Property listeners are executed (in order of registration)\n\ -when the property is set. The new value is already available when the\n\ -listeners are executed.\n\ -\n\ -@var{prop} must be a string naming a valid property in @var{h}.\n\ -\n\ -@var{fcn} can be a function handle, a string or a cell array whose first\n\ -element is a function handle. If @var{fcn} is a function handle, the\n\ -corresponding function should accept at least 2 arguments, that will be\n\ -set to the object handle and the empty matrix respectively. If @var{fcn}\n\ -is a string, it must be any valid octave expression. If @var{fcn} is a cell\n\ -array, the first element must be a function handle with the same signature\n\ -as described above. The next elements of the cell array are passed\n\ -as additional arguments to the function.\n\ -\n\ -Example:\n\ -\n\ -@example\n\ -@group\n\ -function my_listener (h, dummy, p1)\n\ - fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ -endfunction\n\ -\n\ -addlistener (gcf, \"position\", @{@@my_listener, \"my string\"@})\n\ -@end group\n\ -@end example\n\ -\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})\n\ + Register @var{fcn} as listener for the property @var{prop} of the graphics\n\ + object @var{h}. Property listeners are executed (in order of registration)\n\ + when the property is set. The new value is already available when the\n\ + listeners are executed.\n\ + \n\ + @var{prop} must be a string naming a valid property in @var{h}.\n\ + \n\ + @var{fcn} can be a function handle, a string or a cell array whose first\n\ + element is a function handle. If @var{fcn} is a function handle, the\n\ + corresponding function should accept at least 2 arguments, that will be\n\ + set to the object handle and the empty matrix respectively. If @var{fcn}\n\ + is a string, it must be any valid octave expression. If @var{fcn} is a cell\n\ + array, the first element must be a function handle with the same signature\n\ + as described above. The next elements of the cell array are passed\n\ + as additional arguments to the function.\n\ + \n\ + Example:\n\ + \n\ + @example\n\ + @group\n\ + function my_listener (h, dummy, p1)\n\ + fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ + endfunction\n\ + \n\ + addlistener (gcf, \"position\", @{@@my_listener, \"my string\"@})\n\ + @end group\n\ + @end example\n\ + \n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9796,31 +9796,31 @@ } DEFUN (dellistener, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})\n\ -Remove the registration of @var{fcn} as a listener for the property\n\ -@var{prop} of the graphics object @var{h}. The function @var{fcn} must\n\ -be the same variable (not just the same value), as was passed to the\n\ -original call to @code{addlistener}.\n\ -\n\ -If @var{fcn} is not defined then all listener functions of @var{prop}\n\ -are removed.\n\ -\n\ -Example:\n\ -\n\ -@example\n\ -@group\n\ -function my_listener (h, dummy, p1)\n\ - fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ -endfunction\n\ -\n\ -c = @{@@my_listener, \"my string\"@};\n\ -addlistener (gcf, \"position\", c);\n\ -dellistener (gcf, \"position\", c);\n\ -@end group\n\ -@end example\n\ -\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})\n\ + Remove the registration of @var{fcn} as a listener for the property\n\ + @var{prop} of the graphics object @var{h}. The function @var{fcn} must\n\ + be the same variable (not just the same value), as was passed to the\n\ + original call to @code{addlistener}.\n\ + \n\ + If @var{fcn} is not defined then all listener functions of @var{prop}\n\ + are removed.\n\ + \n\ + Example:\n\ + \n\ + @example\n\ + @group\n\ + function my_listener (h, dummy, p1)\n\ + fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ + endfunction\n\ + \n\ + c = @{@@my_listener, \"my string\"@};\n\ + addlistener (gcf, \"position\", c);\n\ + dellistener (gcf, \"position\", c);\n\ + @end group\n\ + @end example\n\ + \n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9873,74 +9873,74 @@ } DEFUN (addproperty, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})\n\ -@deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})\n\ -Create a new property named @var{name} in graphics object @var{h}.\n\ -@var{type} determines the type of the property to create. @var{args}\n\ -usually contains the default value of the property, but additional\n\ -arguments might be given, depending on the type of the property.\n\ -\n\ -The supported property types are:\n\ -\n\ -@table @code\n\ -@item string\n\ -A string property. @var{arg} contains the default string value.\n\ -\n\ -@item any\n\ -An @nospell{un-typed} property. This kind of property can hold any octave\n\ -value. @var{args} contains the default value.\n\ -\n\ -@item radio\n\ -A string property with a limited set of accepted values. The first\n\ -argument must be a string with all accepted values separated by\n\ -a vertical bar ('|'). The default value can be marked by enclosing\n\ -it with a '@{' '@}' pair. The default value may also be given as\n\ -an optional second string argument.\n\ -\n\ -@item boolean\n\ -A boolean property. This property type is equivalent to a radio\n\ -property with \"on|off\" as accepted values. @var{arg} contains\n\ -the default property value.\n\ -\n\ -@item double\n\ -A scalar double property. @var{arg} contains the default value.\n\ -\n\ -@item handle\n\ -A handle property. This kind of property holds the handle of a\n\ -graphics object. @var{arg} contains the default handle value.\n\ -When no default value is given, the property is initialized to\n\ -the empty matrix.\n\ -\n\ -@item data\n\ -A data (matrix) property. @var{arg} contains the default data\n\ -value. When no default value is given, the data is initialized to\n\ -the empty matrix.\n\ -\n\ -@item color\n\ -A color property. @var{arg} contains the default color value.\n\ -When no default color is given, the property is set to black.\n\ -An optional second string argument may be given to specify an\n\ -additional set of accepted string values (like a radio property).\n\ -@end table\n\ -\n\ -@var{type} may also be the concatenation of a core object type and\n\ -a valid property name for that object type. The property created\n\ -then has the same characteristics as the referenced property (type,\n\ -possible values, hidden state@dots{}). This allows to clone an existing\n\ -property into the graphics object @var{h}.\n\ -\n\ -Examples:\n\ -\n\ -@example\n\ -@group\n\ -addproperty (\"my_property\", gcf, \"string\", \"a string value\");\n\ -addproperty (\"my_radio\", gcf, \"radio\", \"val_1|val_2|@{val_3@}\");\n\ -addproperty (\"my_style\", gcf, \"linelinestyle\", \"--\");\n\ -@end group\n\ -@end example\n\ -\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})\n\ + @deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})\n\ + Create a new property named @var{name} in graphics object @var{h}.\n\ + @var{type} determines the type of the property to create. @var{args}\n\ + usually contains the default value of the property, but additional\n\ + arguments might be given, depending on the type of the property.\n\ + \n\ + The supported property types are:\n\ + \n\ + @table @code\n\ + @item string\n\ + A string property. @var{arg} contains the default string value.\n\ + \n\ + @item any\n\ + An @nospell{un-typed} property. This kind of property can hold any octave\n\ + value. @var{args} contains the default value.\n\ + \n\ + @item radio\n\ + A string property with a limited set of accepted values. The first\n\ + argument must be a string with all accepted values separated by\n\ + a vertical bar ('|'). The default value can be marked by enclosing\n\ + it with a '@{' '@}' pair. The default value may also be given as\n\ + an optional second string argument.\n\ + \n\ + @item boolean\n\ + A boolean property. This property type is equivalent to a radio\n\ + property with \"on|off\" as accepted values. @var{arg} contains\n\ + the default property value.\n\ + \n\ + @item double\n\ + A scalar double property. @var{arg} contains the default value.\n\ + \n\ + @item handle\n\ + A handle property. This kind of property holds the handle of a\n\ + graphics object. @var{arg} contains the default handle value.\n\ + When no default value is given, the property is initialized to\n\ + the empty matrix.\n\ + \n\ + @item data\n\ + A data (matrix) property. @var{arg} contains the default data\n\ + value. When no default value is given, the data is initialized to\n\ + the empty matrix.\n\ + \n\ + @item color\n\ + A color property. @var{arg} contains the default color value.\n\ + When no default color is given, the property is set to black.\n\ + An optional second string argument may be given to specify an\n\ + additional set of accepted string values (like a radio property).\n\ + @end table\n\ + \n\ + @var{type} may also be the concatenation of a core object type and\n\ + a valid property name for that object type. The property created\n\ + then has the same characteristics as the referenced property (type,\n\ + possible values, hidden state@dots{}). This allows to clone an existing\n\ + property into the graphics object @var{h}.\n\ + \n\ + Examples:\n\ + \n\ + @example\n\ + @group\n\ + addproperty (\"my_property\", gcf, \"string\", \"a string value\");\n\ + addproperty (\"my_radio\", gcf, \"radio\", \"val_1|val_2|@{val_3@}\");\n\ + addproperty (\"my_style\", gcf, \"linelinestyle\", \"--\");\n\ + @end group\n\ + @end example\n\ + \n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -10162,45 +10162,45 @@ } DEFUN (waitfor, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} waitfor (@var{h})\n\ -@deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop})\n\ -@deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\ -@deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\ -Suspend the execution of the current program until a condition is\n\ -satisfied on the graphics handle @var{h}. While the program is suspended\n\ -graphics events are still being processed normally, allowing callbacks to\n\ -modify the state of graphics objects. This function is reentrant and can be\n\ -called from a callback, while another @code{waitfor} call is pending at\n\ -top-level.\n\ -\n\ -In the first form, program execution is suspended until the graphics object\n\ -@var{h} is destroyed. If the graphics handle is invalid, the function\n\ -returns immediately.\n\ -\n\ -In the second form, execution is suspended until the graphics object is\n\ -destroyed or the property named @var{prop} is modified. If the graphics\n\ -handle is invalid or the property does not exist, the function returns\n\ -immediately.\n\ -\n\ -In the third form, execution is suspended until the graphics object is\n\ -destroyed or the property named @var{prop} is set to @var{value}. The\n\ -function @code{isequal} is used to compare property values. If the graphics\n\ -handle is invalid, the property does not exist or the property is already\n\ -set to @var{value}, the function returns immediately.\n\ -\n\ -An optional timeout can be specified using the property @code{timeout}.\n\ -This timeout value is the number of seconds to wait for the condition to be\n\ -true. @var{timeout} must be at least 1. If a smaller value is specified, a\n\ -warning is issued and a value of 1 is used instead. If the timeout value is\n\ -not an integer, it is truncated towards 0.\n\ -\n\ -To define a condition on a property named @code{timeout}, use the string\n\ -@code{\\timeout} instead.\n\ -\n\ -In all cases, typing CTRL-C stops program execution immediately.\n\ -@seealso{isequal}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} waitfor (@var{h})\n\ + @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop})\n\ + @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\ + @deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\ + Suspend the execution of the current program until a condition is\n\ + satisfied on the graphics handle @var{h}. While the program is suspended\n\ + graphics events are still being processed normally, allowing callbacks to\n\ + modify the state of graphics objects. This function is reentrant and can be\n\ + called from a callback, while another @code{waitfor} call is pending at\n\ + top-level.\n\ + \n\ + In the first form, program execution is suspended until the graphics object\n\ + @var{h} is destroyed. If the graphics handle is invalid, the function\n\ + returns immediately.\n\ + \n\ + In the second form, execution is suspended until the graphics object is\n\ + destroyed or the property named @var{prop} is modified. If the graphics\n\ + handle is invalid or the property does not exist, the function returns\n\ + immediately.\n\ + \n\ + In the third form, execution is suspended until the graphics object is\n\ + destroyed or the property named @var{prop} is set to @var{value}. The\n\ + function @code{isequal} is used to compare property values. If the graphics\n\ + handle is invalid, the property does not exist or the property is already\n\ + set to @var{value}, the function returns immediately.\n\ + \n\ + An optional timeout can be specified using the property @code{timeout}.\n\ + This timeout value is the number of seconds to wait for the condition to be\n\ + true. @var{timeout} must be at least 1. If a smaller value is specified, a\n\ + warning is issued and a value of 1 is used instead. If the timeout value is\n\ + not an integer, it is truncated towards 0.\n\ + \n\ + To define a condition on a property named @code{timeout}, use the string\n\ + @code{\\timeout} instead.\n\ + \n\ + In all cases, typing CTRL-C stops program execution immediately.\n\ + @seealso{isequal}\n\ + @end deftypefn") { if (args.length () > 0) {
--- a/libinterp/corefcn/graphics.in.h +++ b/libinterp/corefcn/graphics.in.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2007-2012 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ + Copyright (C) 2007-2012 John W. Eaton + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ #if !defined (graphics_h) #define graphics_h 1 @@ -70,49 +70,49 @@ graphics_handle (const graphics_handle& a) : val (a.val) { } graphics_handle& operator = (const graphics_handle& a) - { - if (&a != this) - val = a.val; - - return *this; - } + { + if (&a != this) + val = a.val; + + return *this; + } ~graphics_handle (void) { } double value (void) const { return val; } octave_value as_octave_value (void) const - { - return ok () ? octave_value (val) : octave_value (Matrix ()); - } + { + return ok () ? octave_value (val) : octave_value (Matrix ()); + } // Prefix increment/decrement operators. graphics_handle& operator ++ (void) - { - ++val; - return *this; - } + { + ++val; + return *this; + } graphics_handle& operator -- (void) - { - --val; - return *this; - } + { + --val; + return *this; + } // Postfix increment/decrement operators. const graphics_handle operator ++ (int) - { - graphics_handle old_value = *this; - ++(*this); - return old_value; - } + { + graphics_handle old_value = *this; + ++(*this); + return old_value; + } const graphics_handle operator -- (int) - { - graphics_handle old_value = *this; - --(*this); - return old_value; - } + { + graphics_handle old_value = *this; + --(*this); + return old_value; + } bool ok (void) const { return ! xisnan (val); } @@ -306,7 +306,7 @@ ? new log_scaler () : (s == "neglog" ? new neg_log_scaler () : (s == "linear" ? new lin_scaler () : new base_scaler ()))) - { } + { } ~scaler (void) { delete rep; } @@ -384,8 +384,8 @@ base_property (const base_property& p) : id (-1), count (1), name (p.name), parent (p.parent), - hidden (p.hidden), listeners () - { } + hidden (p.hidden), listeners () + { } virtual ~base_property (void) { } @@ -621,7 +621,7 @@ string_array_property (const string_array_property& p) : base_property (p), desired_type (p.desired_type), - separator (p.separator), str (p.str) { } + separator (p.separator), str (p.str) { } octave_value get (void) const { @@ -780,76 +780,76 @@ text_label_property (const std::string& s, const graphics_handle& h, const std::string& val = "") : base_property (s, h), value (val), stored_type (char_t) - { } + { } text_label_property (const std::string& s, const graphics_handle& h, const NDArray& nda) : base_property (s, h), stored_type (char_t) - { - octave_idx_type nel = nda.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - std::ostringstream buf; - buf << nda(i); - value[i] = buf.str (); - } - } + { + octave_idx_type nel = nda.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + std::ostringstream buf; + buf << nda(i); + value[i] = buf.str (); + } + } text_label_property (const std::string& s, const graphics_handle& h, const Cell& c) : base_property (s, h), stored_type (cellstr_t) - { - octave_idx_type nel = c.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - octave_value tmp = c(i); - - if (tmp.is_string ()) - value[i] = c(i).string_value (); - else - { - double d = c(i).double_value (); - - if (! error_state) - { - std::ostringstream buf; - buf << d; - value[i] = buf.str (); - } - else - break; - } - } - } + { + octave_idx_type nel = c.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + octave_value tmp = c(i); + + if (tmp.is_string ()) + value[i] = c(i).string_value (); + else + { + double d = c(i).double_value (); + + if (! error_state) + { + std::ostringstream buf; + buf << d; + value[i] = buf.str (); + } + else + break; + } + } + } text_label_property (const text_label_property& p) : base_property (p), value (p.value), stored_type (p.stored_type) - { } + { } bool empty (void) const - { - octave_value tmp = get (); - return tmp.is_empty (); - } + { + octave_value tmp = get (); + return tmp.is_empty (); + } octave_value get (void) const - { - if (stored_type == char_t) - return octave_value (char_value ()); - else - return octave_value (cell_value ()); - } + { + if (stored_type == char_t) + return octave_value (char_value ()); + else + return octave_value (cell_value ()); + } std::string string_value (void) const - { - return value.empty () ? std::string () : value[0]; - } + { + return value.empty () ? std::string () : value[0]; + } string_vector string_vector_value (void) const { return value; } @@ -858,84 +858,84 @@ Cell cell_value (void) const {return Cell (value); } text_label_property& operator = (const octave_value& val) - { - set (val); - return *this; - } + { + set (val); + return *this; + } base_property* clone (void) const { return new text_label_property (*this); } protected: bool do_set (const octave_value& val) - { - if (val.is_string ()) - { - value = val.all_strings (); - - stored_type = char_t; - } - else if (val.is_cell ()) - { - Cell c = val.cell_value (); - - octave_idx_type nel = c.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - octave_value tmp = c(i); - - if (tmp.is_string ()) - value[i] = c(i).string_value (); - else - { - double d = c(i).double_value (); - - if (! error_state) - { - std::ostringstream buf; - buf << d; - value[i] = buf.str (); - } - else - return false; - } - } - - stored_type = cellstr_t; - } - else - { - NDArray nda = val.array_value (); - - if (! error_state) - { - octave_idx_type nel = nda.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - std::ostringstream buf; - buf << nda(i); - value[i] = buf.str (); - } - - stored_type = char_t; - } - else - { - error ("set: invalid string property value for \"%s\"", - get_name ().c_str ()); - - return false; - } - } - - return true; - } + { + if (val.is_string ()) + { + value = val.all_strings (); + + stored_type = char_t; + } + else if (val.is_cell ()) + { + Cell c = val.cell_value (); + + octave_idx_type nel = c.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + octave_value tmp = c(i); + + if (tmp.is_string ()) + value[i] = c(i).string_value (); + else + { + double d = c(i).double_value (); + + if (! error_state) + { + std::ostringstream buf; + buf << d; + value[i] = buf.str (); + } + else + return false; + } + } + + stored_type = cellstr_t; + } + else + { + NDArray nda = val.array_value (); + + if (! error_state) + { + octave_idx_type nel = nda.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + std::ostringstream buf; + buf << nda(i); + value[i] = buf.str (); + } + + stored_type = char_t; + } + else + { + error ("set: invalid string property value for \"%s\"", + get_name ().c_str ()); + + return false; + } + } + + return true; + } private: string_vector value; @@ -953,72 +953,72 @@ : default_val (a.default_val), possible_vals (a.possible_vals) { } radio_values& operator = (const radio_values& a) - { - if (&a != this) - { - default_val = a.default_val; - possible_vals = a.possible_vals; - } - - return *this; - } + { + if (&a != this) + { + default_val = a.default_val; + possible_vals = a.possible_vals; + } + + return *this; + } std::string default_value (void) const { return default_val; } bool validate (const std::string& val, std::string& match) - { - bool retval = true; - - if (! contains (val, match)) - { - error ("invalid value = %s", val.c_str ()); - retval = false; - } - - return retval; - } + { + bool retval = true; + + if (! contains (val, match)) + { + error ("invalid value = %s", val.c_str ()); + retval = false; + } + + return retval; + } bool contains (const std::string& val, std::string& match) - { - size_t k = 0; - - size_t len = val.length (); - - std::string first_match; - - for (std::set<caseless_str>::const_iterator p = possible_vals.begin (); - p != possible_vals.end (); p++) - { - if (p->compare (val, len)) - { - if (len == p->length ()) - { - // We found a full match (consider the case of val == - // "replace" with possible values "replace" and - // "replacechildren"). Any other matches are - // irrelevant, so set match and return now. - - match = *p; - return true; - } - else - { - if (k == 0) - first_match = *p; - - k++; - } - } - } - - if (k == 1) - { - match = first_match; - return true; - } - else - return false; - } + { + size_t k = 0; + + size_t len = val.length (); + + std::string first_match; + + for (std::set<caseless_str>::const_iterator p = possible_vals.begin (); + p != possible_vals.end (); p++) + { + if (p->compare (val, len)) + { + if (len == p->length ()) + { + // We found a full match (consider the case of val == + // "replace" with possible values "replace" and + // "replacechildren"). Any other matches are + // irrelevant, so set match and return now. + + match = *p; + return true; + } + else + { + if (k == 0) + first_match = *p; + + k++; + } + } + } + + if (k == 1) + { + match = first_match; + return true; + } + else + return false; + } std::string values_as_string (void) const; @@ -1038,17 +1038,17 @@ radio_property (const std::string& nm, const graphics_handle& h, const radio_values& v = radio_values ()) : base_property (nm, h), - vals (v), current_val (v.default_value ()) { } + vals (v), current_val (v.default_value ()) { } radio_property (const std::string& nm, const graphics_handle& h, const std::string& v) : base_property (nm, h), - vals (v), current_val (vals.default_value ()) { } + vals (v), current_val (vals.default_value ()) { } radio_property (const std::string& nm, const graphics_handle& h, const radio_values& v, const std::string& def) : base_property (nm, h), - vals (v), current_val (def) { } + vals (v), current_val (def) { } radio_property (const radio_property& p) : base_property (p), vals (p.vals), current_val (p.current_val) { } @@ -1076,35 +1076,35 @@ protected: bool do_set (const octave_value& newval) - { - if (newval.is_string ()) - { - std::string s = newval.string_value (); - - std::string match; - - if (vals.validate (s, match)) - { - if (match != current_val) - { - if (s.length () != match.length ()) - warning_with_id ("Octave:abbreviated-property-match", - "%s: allowing %s to match %s value %s", - "set", s.c_str (), get_name ().c_str (), - match.c_str ()); - current_val = match; - return true; - } - } - else - error ("set: invalid value for radio property \"%s\" (value = %s)", - get_name ().c_str (), s.c_str ()); - } - else - error ("set: invalid value for radio property \"%s\"", - get_name ().c_str ()); - return false; - } + { + if (newval.is_string ()) + { + std::string s = newval.string_value (); + + std::string match; + + if (vals.validate (s, match)) + { + if (match != current_val) + { + if (s.length () != match.length ()) + warning_with_id ("Octave:abbreviated-property-match", + "%s: allowing %s to match %s value %s", + "set", s.c_str (), get_name ().c_str (), + match.c_str ()); + current_val = match; + return true; + } + } + else + error ("set: invalid value for radio property \"%s\" (value = %s)", + get_name ().c_str (), s.c_str ()); + } + else + error ("set: invalid value for radio property \"%s\"", + get_name ().c_str ()); + return false; + } private: radio_values vals; @@ -1118,32 +1118,32 @@ public: color_values (double r = 0, double g = 0, double b = 1) : xrgb (1, 3) - { - xrgb(0) = r; - xrgb(1) = g; - xrgb(2) = b; - - validate (); - } + { + xrgb(0) = r; + xrgb(1) = g; + xrgb(2) = b; + + validate (); + } color_values (std::string str) : xrgb (1, 3) - { - if (! str2rgb (str)) - error ("invalid color specification: %s", str.c_str ()); - } + { + if (! str2rgb (str)) + error ("invalid color specification: %s", str.c_str ()); + } color_values (const color_values& c) : xrgb (c.xrgb) - { } + { } color_values& operator = (const color_values& c) - { - if (&c != this) - xrgb = c.xrgb; - - return *this; - } + { + if (&c != this) + xrgb = c.xrgb; + + return *this; + } bool operator == (const color_values& c) const { @@ -1160,16 +1160,16 @@ operator octave_value (void) const { return xrgb; } void validate (void) const - { - for (int i = 0; i < 3; i++) - { - if (xrgb(i) < 0 || xrgb(i) > 1) - { - error ("invalid RGB color specification"); - break; - } - } - } + { + for (int i = 0; i < 3; i++) + { + if (xrgb(i) < 0 || xrgb(i) > 1) + { + error ("invalid RGB color specification"); + break; + } + } + } private: Matrix xrgb; @@ -1182,51 +1182,51 @@ public: color_property (const color_values& c, const radio_values& v) : base_property ("", graphics_handle ()), - current_type (color_t), color_val (c), radio_val (v), - current_val (v.default_value ()) + current_type (color_t), color_val (c), radio_val (v), + current_val (v.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const color_values& c = color_values (), const radio_values& v = radio_values ()) : base_property (nm, h), - current_type (color_t), color_val (c), radio_val (v), - current_val (v.default_value ()) + current_type (color_t), color_val (c), radio_val (v), + current_val (v.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const radio_values& v) : base_property (nm, h), - current_type (radio_t), color_val (color_values ()), radio_val (v), - current_val (v.default_value ()) + current_type (radio_t), color_val (color_values ()), radio_val (v), + current_val (v.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const std::string& v) : base_property (nm, h), - current_type (radio_t), color_val (color_values ()), radio_val (v), - current_val (radio_val.default_value ()) + current_type (radio_t), color_val (color_values ()), radio_val (v), + current_val (radio_val.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const color_property& v) : base_property (nm, h), - current_type (v.current_type), color_val (v.color_val), - radio_val (v.radio_val), current_val (v.current_val) + current_type (v.current_type), color_val (v.color_val), + radio_val (v.radio_val), current_val (v.current_val) { } color_property (const color_property& p) : base_property (p), current_type (p.current_type), - color_val (p.color_val), radio_val (p.radio_val), - current_val (p.current_val) { } + color_val (p.color_val), radio_val (p.radio_val), + current_val (p.current_val) { } octave_value get (void) const - { - if (current_type == color_t) - return color_val.rgb (); - - return current_val; - } + { + if (current_type == color_t) + return color_val.rgb (); + + return current_val; + } bool is_rgb (void) const { return (current_type == color_t); } @@ -1236,20 +1236,20 @@ { return (is_radio () && current_val == v); } Matrix rgb (void) const - { - if (current_type != color_t) - error ("color has no rgb value"); - - return color_val.rgb (); - } + { + if (current_type != color_t) + error ("color has no rgb value"); + + return color_val.rgb (); + } const std::string& current_value (void) const - { - if (current_type != radio_t) - error ("color has no radio value"); - - return current_val; - } + { + if (current_type != radio_t) + error ("color has no radio value"); + + return current_val; + } color_property& operator = (const octave_value& val) { @@ -1283,7 +1283,7 @@ double_property (const std::string& nm, const graphics_handle& h, double d = 0) : base_property (nm, h), - current_val (d) { } + current_val (d) { } double_property (const double_property& p) : base_property (p), current_val (p.current_val) { } @@ -1329,37 +1329,37 @@ { public: double_radio_property (double d, const radio_values& v) - : base_property ("", graphics_handle ()), - current_type (double_t), dval (d), radio_val (v), - current_val (v.default_value ()) + : base_property ("", graphics_handle ()), + current_type (double_t), dval (d), radio_val (v), + current_val (v.default_value ()) { } double_radio_property (const std::string& nm, const graphics_handle& h, const std::string& v) - : base_property (nm, h), - current_type (radio_t), dval (0), radio_val (v), - current_val (radio_val.default_value ()) + : base_property (nm, h), + current_type (radio_t), dval (0), radio_val (v), + current_val (radio_val.default_value ()) { } double_radio_property (const std::string& nm, const graphics_handle& h, const double_radio_property& v) - : base_property (nm, h), - current_type (v.current_type), dval (v.dval), - radio_val (v.radio_val), current_val (v.current_val) + : base_property (nm, h), + current_type (v.current_type), dval (v.dval), + radio_val (v.radio_val), current_val (v.current_val) { } double_radio_property (const double_radio_property& p) : base_property (p), current_type (p.current_type), - dval (p.dval), radio_val (p.radio_val), - current_val (p.current_val) { } + dval (p.dval), radio_val (p.radio_val), + current_val (p.current_val) { } octave_value get (void) const - { - if (current_type == double_t) - return dval; - - return current_val; - } + { + if (current_type == double_t) + return dval; + + return current_val; + } bool is_double (void) const { return (current_type == double_t); } @@ -1369,20 +1369,20 @@ { return (is_radio () && current_val == v); } double double_value (void) const - { - if (current_type != double_t) - error ("%s: property has no double", get_name ().c_str ()); - - return dval; - } + { + if (current_type != double_t) + error ("%s: property has no double", get_name ().c_str ()); + + return dval; + } const std::string& current_value (void) const - { - if (current_type != radio_t) - error ("%s: property has no radio value"); - - return current_val; - } + { + if (current_type != radio_t) + error ("%s: property has no radio value"); + + return current_val; + } double_radio_property& operator = (const octave_value& val) { @@ -1412,29 +1412,29 @@ public: array_property (void) : base_property ("", graphics_handle ()), data (Matrix ()), - xmin (), xmax (), xminp (), xmaxp (), - type_constraints (), size_constraints () - { - get_data_limits (); - } + xmin (), xmax (), xminp (), xmaxp (), + type_constraints (), size_constraints () + { + get_data_limits (); + } array_property (const std::string& nm, const graphics_handle& h, const octave_value& m) : base_property (nm, h), data (m.is_sparse_type () ? m.full_value () : m), - xmin (), xmax (), xminp (), xmaxp (), - type_constraints (), size_constraints () - { - get_data_limits (); - } + xmin (), xmax (), xminp (), xmaxp (), + type_constraints (), size_constraints () + { + get_data_limits (); + } // This copy constructor is only intended to be used // internally to access min/max values; no need to // copy constraints. array_property (const array_property& p) : base_property (p), data (p.data), - xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), - type_constraints (), size_constraints () - { } + xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), + type_constraints (), size_constraints () + { } octave_value get (void) const { return data; } @@ -1524,42 +1524,42 @@ row_vector_property (const std::string& nm, const graphics_handle& h, const octave_value& m) : array_property (nm, h, m) - { - add_constraint (dim_vector (-1, 1)); - add_constraint (dim_vector (1, -1)); - } + { + add_constraint (dim_vector (-1, 1)); + add_constraint (dim_vector (1, -1)); + } row_vector_property (const row_vector_property& p) : array_property (p) - { - add_constraint (dim_vector (-1, 1)); - add_constraint (dim_vector (1, -1)); - } + { + add_constraint (dim_vector (-1, 1)); + add_constraint (dim_vector (1, -1)); + } void add_constraint (const std::string& type) - { - array_property::add_constraint (type); - } + { + array_property::add_constraint (type); + } void add_constraint (const dim_vector& dims) - { - array_property::add_constraint (dims); - } + { + array_property::add_constraint (dims); + } void add_constraint (octave_idx_type len) - { - size_constraints.remove (dim_vector (1, -1)); - size_constraints.remove (dim_vector (-1, 1)); - - add_constraint (dim_vector (1, len)); - add_constraint (dim_vector (len, 1)); - } + { + size_constraints.remove (dim_vector (1, -1)); + size_constraints.remove (dim_vector (-1, 1)); + + add_constraint (dim_vector (1, len)); + add_constraint (dim_vector (len, 1)); + } row_vector_property& operator = (const octave_value& val) - { - set (val); - return *this; - } + { + set (val); + return *this; + } base_property* clone (void) const { @@ -1573,27 +1573,27 @@ protected: bool do_set (const octave_value& v) - { - bool retval = array_property::do_set (v); - - if (! error_state) - { - dim_vector dv = data.dims (); - - if (dv(0) > 1 && dv(1) == 1) - { - int tmp = dv(0); - dv(0) = dv(1); - dv(1) = tmp; - - data = data.reshape (dv); - } - - return retval; - } - - return false; - } + { + bool retval = array_property::do_set (v); + + if (! error_state) + { + dim_vector dv = data.dims (); + + if (dv(0) > 1 && dv(1) == 1) + { + int tmp = dv(0); + dv(0) = dv(1); + dv(1) = tmp; + + data = data.reshape (dv); + } + + return retval; + } + + return false; + } private: OCTINTERP_API bool validate (const octave_value& v); @@ -1607,7 +1607,7 @@ bool_property (const std::string& nm, const graphics_handle& h, bool val) : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}")) - { } + { } bool_property (const std::string& nm, const graphics_handle& h, const char* val) @@ -1645,7 +1645,7 @@ handle_property (const std::string& nm, const graphics_handle& h, const graphics_handle& val = graphics_handle ()) : base_property (nm, h), - current_val (val) { } + current_val (val) { } handle_property (const handle_property& p) : base_property (p), current_val (p.current_val) { } @@ -1681,7 +1681,7 @@ { public: any_property (const std::string& nm, const graphics_handle& h, - const octave_value& m = Matrix ()) + const octave_value& m = Matrix ()) : base_property (nm, h), data (m) { } any_property (const any_property& p) @@ -1761,9 +1761,9 @@ } Matrix get_all (void) const - { - return do_get_all_children (); - } + { + return do_get_all_children (); + } octave_value get (void) const { @@ -1958,15 +1958,15 @@ { public: property (void) : rep (new base_property ("", graphics_handle ())) - { } + { } property (base_property *bp, bool persist = false) : rep (bp) - { if (persist) rep->count++; } + { if (persist) rep->count++; } property (const property& p) : rep (p.rep) - { - rep->count++; - } + { + rep->count++; + } ~property (void) { @@ -2039,38 +2039,38 @@ void delete_listener (const octave_value& v = octave_value (), listener_mode mode = POSTSET) - { rep->delete_listener (v, mode); } + { rep->delete_listener (v, mode); } void run_listeners (listener_mode mode = POSTSET) { rep->run_listeners (mode); } OCTINTERP_API static - property create (const std::string& name, const graphics_handle& parent, - const caseless_str& type, - const octave_value_list& args); + property create (const std::string& name, const graphics_handle& parent, + const caseless_str& type, + const octave_value_list& args); property clone (void) const { return property (rep->clone ()); } /* - const string_property& as_string_property (void) const - { return *(dynamic_cast<string_property*> (rep)); } - - const radio_property& as_radio_property (void) const - { return *(dynamic_cast<radio_property*> (rep)); } - - const color_property& as_color_property (void) const - { return *(dynamic_cast<color_property*> (rep)); } - - const double_property& as_double_property (void) const - { return *(dynamic_cast<double_property*> (rep)); } - - const bool_property& as_bool_property (void) const - { return *(dynamic_cast<bool_property*> (rep)); } - - const handle_property& as_handle_property (void) const - { return *(dynamic_cast<handle_property*> (rep)); } - */ + const string_property& as_string_property (void) const + { return *(dynamic_cast<string_property*> (rep)); } + + const radio_property& as_radio_property (void) const + { return *(dynamic_cast<radio_property*> (rep)); } + + const color_property& as_color_property (void) const + { return *(dynamic_cast<color_property*> (rep)); } + + const double_property& as_double_property (void) const + { return *(dynamic_cast<double_property*> (rep)); } + + const bool_property& as_bool_property (void) const + { return *(dynamic_cast<bool_property*> (rep)); } + + const handle_property& as_handle_property (void) const + { return *(dynamic_cast<handle_property*> (rep)); } + */ private: base_property *rep; @@ -2106,14 +2106,14 @@ plist_map_const_iterator end (void) const { return plist_map.end (); } plist_map_iterator find (const std::string& go_name) - { - return plist_map.find (go_name); - } + { + return plist_map.find (go_name); + } plist_map_const_iterator find (const std::string& go_name) const - { - return plist_map.find (go_name); - } + { + return plist_map.find (go_name); + } octave_scalar_map as_struct (const std::string& prefix_arg) const; @@ -2133,7 +2133,7 @@ public: base_graphics_toolkit (const std::string& nm) - : name (nm), count (0) { } + : name (nm), count (0) { } virtual ~base_graphics_toolkit (void) { } @@ -2193,7 +2193,7 @@ // Close the graphics toolkit. virtual void close (void) - { gripe_invalid ("base_graphics_toolkit::close"); } + { gripe_invalid ("base_graphics_toolkit::close"); } private: std::string name; @@ -2211,19 +2211,19 @@ { public: graphics_toolkit (void) - : rep (new base_graphics_toolkit ("unknown")) + : rep (new base_graphics_toolkit ("unknown")) { rep->count++; } graphics_toolkit (base_graphics_toolkit* b) - : rep (b) + : rep (b) { rep->count++; } graphics_toolkit (const graphics_toolkit& b) - : rep (b.rep) + : rep (b.rep) { rep->count++; } @@ -2305,60 +2305,60 @@ public: static graphics_toolkit get_toolkit (void) - { - return instance_ok () ? instance->do_get_toolkit () : graphics_toolkit (); - } + { + return instance_ok () ? instance->do_get_toolkit () : graphics_toolkit (); + } static void register_toolkit (const std::string& name) - { - if (instance_ok ()) - instance->do_register_toolkit (name); - } + { + if (instance_ok ()) + instance->do_register_toolkit (name); + } static void unregister_toolkit (const std::string& name) - { - if (instance_ok ()) - instance->do_unregister_toolkit (name); - } + { + if (instance_ok ()) + instance->do_unregister_toolkit (name); + } static void load_toolkit (const graphics_toolkit& tk) - { - if (instance_ok ()) - instance->do_load_toolkit (tk); - } + { + if (instance_ok ()) + instance->do_load_toolkit (tk); + } static void unload_toolkit (const std::string& name) - { - if (instance_ok ()) - instance->do_unload_toolkit (name); - } + { + if (instance_ok ()) + instance->do_unload_toolkit (name); + } static graphics_toolkit find_toolkit (const std::string& name) - { - return instance_ok () - ? instance->do_find_toolkit (name) : graphics_toolkit (); - } + { + return instance_ok () + ? instance->do_find_toolkit (name) : graphics_toolkit (); + } static Cell available_toolkits_list (void) - { - return instance_ok () ? instance->do_available_toolkits_list () : Cell (); - } + { + return instance_ok () ? instance->do_available_toolkits_list () : Cell (); + } static Cell loaded_toolkits_list (void) - { - return instance_ok () ? instance->do_loaded_toolkits_list () : Cell (); - } + { + return instance_ok () ? instance->do_loaded_toolkits_list () : Cell (); + } static void unload_all_toolkits (void) - { - if (instance_ok ()) - instance->do_unload_all_toolkits (); - } + { + if (instance_ok ()) + instance->do_unload_all_toolkits (); + } static std::string default_toolkit (void) - { - return instance_ok () ? instance->do_default_toolkit () : std::string (); - } + { + return instance_ok () ? instance->do_default_toolkit () : std::string (); + } private: @@ -2372,21 +2372,21 @@ OCTINTERP_API static void create_instance (void); static bool instance_ok (void) - { - bool retval = true; - - if (! instance) - create_instance (); - - if (! instance) - { - ::error ("unable to create gh_manager!"); - - retval = false; - } - - return retval; - } + { + bool retval = true; + + if (! instance) + create_instance (); + + if (! instance) + { + ::error ("unable to create gh_manager!"); + + retval = false; + } + + return retval; + } static void cleanup_instance (void) { delete instance; instance = 0; } @@ -2415,75 +2415,75 @@ graphics_toolkit do_get_toolkit (void) const; void do_register_toolkit (const std::string& name) - { - available_toolkits.insert (name); - } + { + available_toolkits.insert (name); + } void do_unregister_toolkit (const std::string& name) - { - available_toolkits.erase (name); - } + { + available_toolkits.erase (name); + } void do_load_toolkit (const graphics_toolkit& tk) - { - loaded_toolkits[tk.get_name ()] = tk; - } + { + loaded_toolkits[tk.get_name ()] = tk; + } void do_unload_toolkit (const std::string& name) - { - loaded_toolkits.erase (name); - } + { + loaded_toolkits.erase (name); + } graphics_toolkit do_find_toolkit (const std::string& name) const - { - const_loaded_toolkits_iterator p = loaded_toolkits.find (name); - - if (p != loaded_toolkits.end ()) - return p->second; - else - return graphics_toolkit (); - } + { + const_loaded_toolkits_iterator p = loaded_toolkits.find (name); + + if (p != loaded_toolkits.end ()) + return p->second; + else + return graphics_toolkit (); + } Cell do_available_toolkits_list (void) const - { - Cell m (1 , available_toolkits.size ()); - - octave_idx_type i = 0; - for (const_available_toolkits_iterator p = available_toolkits.begin (); - p != available_toolkits.end (); p++) - m(i++) = *p; - - return m; - } + { + Cell m (1 , available_toolkits.size ()); + + octave_idx_type i = 0; + for (const_available_toolkits_iterator p = available_toolkits.begin (); + p != available_toolkits.end (); p++) + m(i++) = *p; + + return m; + } Cell do_loaded_toolkits_list (void) const - { - Cell m (1 , loaded_toolkits.size ()); - - octave_idx_type i = 0; - for (const_loaded_toolkits_iterator p = loaded_toolkits.begin (); - p != loaded_toolkits.end (); p++) - m(i++) = p->first; - - return m; - } + { + Cell m (1 , loaded_toolkits.size ()); + + octave_idx_type i = 0; + for (const_loaded_toolkits_iterator p = loaded_toolkits.begin (); + p != loaded_toolkits.end (); p++) + m(i++) = p->first; + + return m; + } void do_unload_all_toolkits (void) - { - while (! loaded_toolkits.empty ()) - { - loaded_toolkits_iterator p = loaded_toolkits.begin (); - - std::string name = p->first; - - p->second.close (); - - // The toolkit may have unloaded itself. If not, we'll do - // it here. - if (loaded_toolkits.find (name) != loaded_toolkits.end ()) - unload_toolkit (name); - } - } + { + while (! loaded_toolkits.empty ()) + { + loaded_toolkits_iterator p = loaded_toolkits.begin (); + + std::string name = p->first; + + p->second.close (); + + // The toolkit may have unloaded itself. If not, we'll do + // it here. + if (loaded_toolkits.find (name) != loaded_toolkits.end ()) + unload_toolkit (name); + } + } std::string do_default_toolkit (void) { return dtk; } }; @@ -2530,24 +2530,24 @@ virtual octave_value get (const caseless_str& pname) const; virtual octave_value get (const std::string& pname) const - { - return get (caseless_str (pname)); - } + { + return get (caseless_str (pname)); + } virtual octave_value get (const char *pname) const - { - return get (caseless_str (pname)); - } + { + return get (caseless_str (pname)); + } virtual octave_value get (bool all = false) const; virtual property get_property (const caseless_str& pname); virtual bool has_property (const caseless_str&) const - { - panic_impossible (); - return false; - } + { + panic_impossible (); + return false; + } bool is_modified (void) const { return is___modified__ (); } @@ -2558,10 +2558,10 @@ } virtual void adopt (const graphics_handle& h) - { - children.adopt (h.value ()); - mark_modified (); - } + { + children.adopt (h.value ()); + mark_modified (); + } virtual graphics_toolkit get_toolkit (void) const; @@ -2686,29 +2686,29 @@ // additional (Octave-specific) properties bool_property __modified__ s , "on" graphics_handle __myhandle__ fhrs , mh - END_PROPERTIES + END_PROPERTIES protected: - struct cmp_caseless_str - { - bool operator () (const caseless_str &a, const caseless_str &b) const - { - std::string a1 = a; - std::transform (a1.begin (), a1.end (), a1.begin (), tolower); - std::string b1 = b; - std::transform (b1.begin (), b1.end (), b1.begin (), tolower); - - return a1 < b1; - } - }; - - std::map<caseless_str, property, cmp_caseless_str> all_props; + struct cmp_caseless_str + { + bool operator () (const caseless_str &a, const caseless_str &b) const + { + std::string a1 = a; + std::transform (a1.begin (), a1.end (), a1.begin (), tolower); + std::string b1 = b; + std::transform (b1.begin (), b1.end (), b1.begin (), tolower); + + return a1 < b1; + } + }; + + std::map<caseless_str, property, cmp_caseless_str> all_props; protected: - void insert_static_property (const std::string& name, base_property& p) - { insert_property (name, property (&p, true)); } - - virtual void init (void) { } + void insert_static_property (const std::string& name, base_property& p) + { insert_property (name, property (&p, true)); } + + virtual void init (void) { } }; class OCTINTERP_API base_graphics_object @@ -2721,154 +2721,154 @@ virtual ~base_graphics_object (void) { } virtual void mark_modified (void) - { - if (valid_object ()) - get_properties ().mark_modified (); - else - error ("base_graphics_object::mark_modified: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().mark_modified (); + else + error ("base_graphics_object::mark_modified: invalid graphics object"); + } virtual void override_defaults (base_graphics_object& obj) - { - if (valid_object ()) - get_properties ().override_defaults (obj); - else - error ("base_graphics_object::override_defaults: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().override_defaults (obj); + else + error ("base_graphics_object::override_defaults: invalid graphics object"); + } virtual void set_from_list (property_list& plist) - { - if (valid_object ()) - get_properties ().set_from_list (*this, plist); - else - error ("base_graphics_object::set_from_list: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().set_from_list (*this, plist); + else + error ("base_graphics_object::set_from_list: invalid graphics object"); + } virtual void set (const caseless_str& pname, const octave_value& pval) - { - if (valid_object ()) - get_properties ().set (pname, pval); - else - error ("base_graphics_object::set: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().set (pname, pval); + else + error ("base_graphics_object::set: invalid graphics object"); + } virtual void set_defaults (const std::string&) - { - error ("base_graphics_object::set_defaults: invalid graphics object"); - } + { + error ("base_graphics_object::set_defaults: invalid graphics object"); + } virtual octave_value get (bool all = false) const - { - if (valid_object ()) - return get_properties ().get (all); - else - { - error ("base_graphics_object::get: invalid graphics object"); - return octave_value (); - } - } + { + if (valid_object ()) + return get_properties ().get (all); + else + { + error ("base_graphics_object::get: invalid graphics object"); + return octave_value (); + } + } virtual octave_value get (const caseless_str& pname) const - { - if (valid_object ()) - return get_properties ().get (pname); - else - { - error ("base_graphics_object::get: invalid graphics object"); - return octave_value (); - } - } + { + if (valid_object ()) + return get_properties ().get (pname); + else + { + error ("base_graphics_object::get: invalid graphics object"); + return octave_value (); + } + } virtual octave_value get_default (const caseless_str&) const; virtual octave_value get_factory_default (const caseless_str&) const; virtual octave_value get_defaults (void) const - { - error ("base_graphics_object::get_defaults: invalid graphics object"); - return octave_value (); - } + { + error ("base_graphics_object::get_defaults: invalid graphics object"); + return octave_value (); + } virtual octave_value get_factory_defaults (void) const - { - error ("base_graphics_object::get_factory_defaults: invalid graphics object"); - return octave_value (); - } + { + error ("base_graphics_object::get_factory_defaults: invalid graphics object"); + return octave_value (); + } virtual std::string values_as_string (void); virtual octave_scalar_map values_as_struct (void); virtual graphics_handle get_parent (void) const - { - if (valid_object ()) - return get_properties ().get_parent (); - else - { - error ("base_graphics_object::get_parent: invalid graphics object"); - return graphics_handle (); - } - } + { + if (valid_object ()) + return get_properties ().get_parent (); + else + { + error ("base_graphics_object::get_parent: invalid graphics object"); + return graphics_handle (); + } + } graphics_handle get_handle (void) const - { - if (valid_object ()) - return get_properties ().get___myhandle__ (); - else - { - error ("base_graphics_object::get_handle: invalid graphics object"); - return graphics_handle (); - } - } + { + if (valid_object ()) + return get_properties ().get___myhandle__ (); + else + { + error ("base_graphics_object::get_handle: invalid graphics object"); + return graphics_handle (); + } + } virtual void remove_child (const graphics_handle& h) - { - if (valid_object ()) - get_properties ().remove_child (h); - else - error ("base_graphics_object::remove_child: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().remove_child (h); + else + error ("base_graphics_object::remove_child: invalid graphics object"); + } virtual void adopt (const graphics_handle& h) - { - if (valid_object ()) - get_properties ().adopt (h); - else - error ("base_graphics_object::adopt: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().adopt (h); + else + error ("base_graphics_object::adopt: invalid graphics object"); + } virtual void reparent (const graphics_handle& np) - { - if (valid_object ()) - get_properties ().reparent (np); - else - error ("base_graphics_object::reparent: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().reparent (np); + else + error ("base_graphics_object::reparent: invalid graphics object"); + } virtual void defaults (void) const - { - if (valid_object ()) - { - std::string msg = (type () + "::defaults"); - gripe_not_implemented (msg.c_str ()); - } - else - error ("base_graphics_object::default: invalid graphics object"); - } + { + if (valid_object ()) + { + std::string msg = (type () + "::defaults"); + gripe_not_implemented (msg.c_str ()); + } + else + error ("base_graphics_object::default: invalid graphics object"); + } virtual base_properties& get_properties (void) - { - static base_properties properties; - error ("base_graphics_object::get_properties: invalid graphics object"); - return properties; - } + { + static base_properties properties; + error ("base_graphics_object::get_properties: invalid graphics object"); + return properties; + } virtual const base_properties& get_properties (void) const - { - static base_properties properties; - error ("base_graphics_object::get_properties: invalid graphics object"); - return properties; - } + { + static base_properties properties; + error ("base_graphics_object::get_properties: invalid graphics object"); + return properties; + } virtual void update_axis_limits (const std::string& axis_type); @@ -2880,26 +2880,26 @@ bool valid_toolkit_object (void) const { return toolkit_flag; } virtual std::string type (void) const - { - return (valid_object () ? get_properties ().graphics_object_name () - : "unknown"); - } + { + return (valid_object () ? get_properties ().graphics_object_name () + : "unknown"); + } bool isa (const std::string& go_name) const - { - return type () == go_name; - } + { + return type () == go_name; + } virtual graphics_toolkit get_toolkit (void) const - { - if (valid_object ()) - return get_properties ().get_toolkit (); - else - { - error ("base_graphics_object::get_toolkit: invalid graphics object"); - return graphics_toolkit (); - } - } + { + if (valid_object ()) + return get_properties ().get_toolkit (); + else + { + error ("base_graphics_object::get_toolkit: invalid graphics object"); + return graphics_toolkit (); + } + } virtual void add_property_listener (const std::string& nm, const octave_value& v, @@ -2965,9 +2965,9 @@ base_graphics_object (const base_graphics_object&) : count (0) { } base_graphics_object& operator = (const base_graphics_object&) - { - return *this; - } + { + return *this; + } }; class OCTINTERP_API graphics_object @@ -2984,38 +2984,38 @@ } graphics_object& operator = (const graphics_object& obj) - { - if (rep != obj.rep) - { - if (--rep->count == 0) - delete rep; - - rep = obj.rep; - rep->count++; - } - - return *this; - } + { + if (rep != obj.rep) + { + if (--rep->count == 0) + delete rep; + + rep = obj.rep; + rep->count++; + } + + return *this; + } ~graphics_object (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } void mark_modified (void) { rep->mark_modified (); } void override_defaults (base_graphics_object& obj) - { - rep->override_defaults (obj); - } + { + rep->override_defaults (obj); + } void set_from_list (property_list& plist) { rep->set_from_list (plist); } void set (const caseless_str& name, const octave_value& val) - { - rep->set (name, val); - } + { + rep->set (name, val); + } void set (const octave_value_list& args); @@ -3032,39 +3032,39 @@ octave_value get (bool all = false) const { return rep->get (all); } octave_value get (const caseless_str& name) const - { - return name.compare ("default") - ? get_defaults () - : (name.compare ("factory") - ? get_factory_defaults () : rep->get (name)); - } + { + return name.compare ("default") + ? get_defaults () + : (name.compare ("factory") + ? get_factory_defaults () : rep->get (name)); + } octave_value get (const std::string& name) const - { - return get (caseless_str (name)); - } + { + return get (caseless_str (name)); + } octave_value get (const char *name) const - { - return get (caseless_str (name)); - } + { + return get (caseless_str (name)); + } octave_value get_default (const caseless_str& name) const - { - return rep->get_default (name); - } + { + return rep->get_default (name); + } octave_value get_factory_default (const caseless_str& name) const - { - return rep->get_factory_default (name); - } + { + return rep->get_factory_default (name); + } octave_value get_defaults (void) const { return rep->get_defaults (); } octave_value get_factory_defaults (void) const - { - return rep->get_factory_defaults (); - } + { + return rep->get_factory_defaults (); + } std::string values_as_string (void) { return rep->values_as_string (); } @@ -3089,20 +3089,20 @@ base_properties& get_properties (void) { return rep->get_properties (); } const base_properties& get_properties (void) const - { - return rep->get_properties (); - } + { + return rep->get_properties (); + } void update_axis_limits (const std::string& axis_type) - { - rep->update_axis_limits (axis_type); - } + { + rep->update_axis_limits (axis_type); + } void update_axis_limits (const std::string& axis_type, const graphics_handle& h) - { - rep->update_axis_limits (axis_type, h); - } + { + rep->update_axis_limits (axis_type, h); + } bool valid_object (void) const { return rep->valid_object (); } @@ -3116,37 +3116,37 @@ // EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS octave_value get_alim (void) const - { return get_properties ().get_alim (); } + { return get_properties ().get_alim (); } octave_value get_clim (void) const - { return get_properties ().get_clim (); } + { return get_properties ().get_clim (); } octave_value get_xlim (void) const - { return get_properties ().get_xlim (); } + { return get_properties ().get_xlim (); } octave_value get_ylim (void) const - { return get_properties ().get_ylim (); } + { return get_properties ().get_ylim (); } octave_value get_zlim (void) const - { return get_properties ().get_zlim (); } + { return get_properties ().get_zlim (); } bool is_aliminclude (void) const - { return get_properties ().is_aliminclude (); } + { return get_properties ().is_aliminclude (); } bool is_climinclude (void) const - { return get_properties ().is_climinclude (); } + { return get_properties ().is_climinclude (); } bool is_xliminclude (void) const - { return get_properties ().is_xliminclude (); } + { return get_properties ().is_xliminclude (); } bool is_yliminclude (void) const - { return get_properties ().is_yliminclude (); } + { return get_properties ().is_yliminclude (); } bool is_zliminclude (void) const - { return get_properties ().is_zliminclude (); } + { return get_properties ().is_zliminclude (); } bool is_handle_visible (void) const - { return get_properties ().is_handle_visible (); } + { return get_properties ().is_handle_visible (); } graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } @@ -3159,13 +3159,13 @@ { rep->delete_property_listener (nm, v, mode); } void initialize (void) { rep->initialize (*this); } - + void finalize (void) { rep->finalize (*this); } void update (int id) { rep->update (*this, id); } void reset_default_properties (void) - { rep->reset_default_properties (); } + { rep->reset_default_properties (); } private: base_graphics_object *rep; @@ -3178,56 +3178,56 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void remove_child (const graphics_handle& h); - - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - - // FIXME: it seems strange to me that the diary, diaryfile, - // echo, errormessage, format, formatspacing, language, and - // recursionlimit properties are here. - // WTF do they have to do with graphics? - // Also note that these properties (and the monitorpositions, - // pointerlocation, and pointerwindow properties) are not yet used - // by Octave, so setting them will have no effect, and changes - // made elswhere (say, the diary or format functions) will not - // cause these properties to be updated. - // ANSWER: Matlab defines these properties and uses them in - // the same way that Octave uses an internal static variable to - // keep track of state. set (0, "echo", "on") is equivalent - // to Octave's echo ("on"). Maybe someday we can connect callbacks - // that actually call Octave's own functions for this. - - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (root_figure, root) - handle_property callbackobject Sr , graphics_handle () - array_property commandwindowsize r , Matrix (1, 2, 0) - handle_property currentfigure S , graphics_handle () - bool_property diary , "off" - string_property diaryfile , "diary" - bool_property echo , "off" - string_property errormessage , "" - string_property fixedwidthfontname , "Courier" - radio_property format , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rational|{short}|shorte|shorteng|shortg" - radio_property formatspacing , "compact|{loose}" - string_property language , "ascii" - array_property monitorpositions , Matrix (1, 4, 0) - array_property pointerlocation , Matrix (1, 2, 0) - double_property pointerwindow r , 0.0 - double_property recursionlimit , 256.0 - double_property screendepth r , default_screendepth () - double_property screenpixelsperinch r , default_screenpixelsperinch () - array_property screensize r , default_screensize () - bool_property showhiddenhandles , "off" - radio_property units U , "inches|centimeters|normalized|points|{pixels}" +public: + void remove_child (const graphics_handle& h); + + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + + // FIXME: it seems strange to me that the diary, diaryfile, + // echo, errormessage, format, formatspacing, language, and + // recursionlimit properties are here. + // WTF do they have to do with graphics? + // Also note that these properties (and the monitorpositions, + // pointerlocation, and pointerwindow properties) are not yet used + // by Octave, so setting them will have no effect, and changes + // made elswhere (say, the diary or format functions) will not + // cause these properties to be updated. + // ANSWER: Matlab defines these properties and uses them in + // the same way that Octave uses an internal static variable to + // keep track of state. set (0, "echo", "on") is equivalent + // to Octave's echo ("on"). Maybe someday we can connect callbacks + // that actually call Octave's own functions for this. + + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (root_figure, root) + handle_property callbackobject Sr , graphics_handle () + array_property commandwindowsize r , Matrix (1, 2, 0) + handle_property currentfigure S , graphics_handle () + bool_property diary , "off" + string_property diaryfile , "diary" + bool_property echo , "off" + string_property errormessage , "" + string_property fixedwidthfontname , "Courier" + radio_property format , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rational|{short}|shorte|shorteng|shortg" + radio_property formatspacing , "compact|{loose}" + string_property language , "ascii" + array_property monitorpositions , Matrix (1, 4, 0) + array_property pointerlocation , Matrix (1, 2, 0) + double_property pointerwindow r , 0.0 + double_property recursionlimit , 256.0 + double_property screendepth r , default_screendepth () + double_property screenpixelsperinch r , default_screenpixelsperinch () + array_property screensize r , default_screensize () + bool_property showhiddenhandles , "off" + radio_property units U , "inches|centimeters|normalized|points|{pixels}" END_PROPERTIES - private: +private: std::list<graphics_handle> cbo_stack; }; @@ -3243,75 +3243,75 @@ void mark_modified (void) { } void override_defaults (base_graphics_object& obj) - { - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - if (name.compare ("default", 7)) - return get_default (name.substr (7)); - else if (name.compare ("factory", 7)) - return get_factory_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + if (name.compare ("default", 7)) + return get_default (name.substr (7)); + else if (name.compare ("factory", 7)) + return get_factory_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const - { - octave_value retval = default_properties.lookup (name); - - if (retval.is_undefined ()) - { - // no default property found, use factory default - retval = factory_properties.lookup (name); - - if (retval.is_undefined ()) - error ("get: invalid default property '%s'", name.c_str ()); - } - - return retval; - } + { + octave_value retval = default_properties.lookup (name); + + if (retval.is_undefined ()) + { + // no default property found, use factory default + retval = factory_properties.lookup (name); + + if (retval.is_undefined ()) + error ("get: invalid default property '%s'", name.c_str ()); + } + + return retval; + } octave_value get_factory_default (const caseless_str& name) const - { - octave_value retval = factory_properties.lookup (name); - - if (retval.is_undefined ()) - error ("get: invalid factory default property '%s'", name.c_str ()); - - return retval; - } + { + octave_value retval = factory_properties.lookup (name); + + if (retval.is_undefined ()) + error ("get: invalid factory default property '%s'", name.c_str ()); + + return retval; + } octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } octave_value get_factory_defaults (void) const - { - return factory_properties.as_struct ("factory"); - } + { + return factory_properties.as_struct ("factory"); + } base_properties& get_properties (void) { return xproperties; } @@ -3336,27 +3336,27 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void init_integerhandle (const octave_value& val) - { - integerhandle = val; - } - - void remove_child (const graphics_handle& h); - - void set_visible (const octave_value& val); - - graphics_toolkit get_toolkit (void) const - { - if (! toolkit) - toolkit = gtk_manager::get_toolkit (); - - return toolkit; - } - - void set_toolkit (const graphics_toolkit& b); - - void set___graphics_toolkit__ (const octave_value& val) +public: + void init_integerhandle (const octave_value& val) + { + integerhandle = val; + } + + void remove_child (const graphics_handle& h); + + void set_visible (const octave_value& val); + + graphics_toolkit get_toolkit (void) const + { + if (! toolkit) + toolkit = gtk_manager::get_toolkit (); + + return toolkit; + } + + void set_toolkit (const graphics_toolkit& b); + + void set___graphics_toolkit__ (const octave_value& val) { if (! error_state) { @@ -3379,92 +3379,92 @@ } } - 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, bool internal = false, + 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 map_from_boundingbox (double x, double y) const; - - Matrix map_to_boundingbox (double x, double y) const; - - void update_units (const caseless_str& old_units); - - void update_paperunits (const caseless_str& old_paperunits); - - std::string get_title (void) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (figure) - array_property alphamap , Matrix (64, 1, 1) - callback_property buttondownfcn , Matrix () - callback_property closerequestfcn , "closereq" - color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) - array_property colormap , jet_colormap () - handle_property currentaxes S , graphics_handle () - string_property currentcharacter r , "" - handle_property currentobject r , graphics_handle () - array_property currentpoint r , Matrix (2, 1, 0) - bool_property dockcontrols , "off" - bool_property doublebuffer , "on" - string_property filename , "" - bool_property integerhandle S , "on" - bool_property inverthardcopy , "off" - callback_property keypressfcn , Matrix () - callback_property keyreleasefcn , Matrix () - radio_property menubar , "none|{figure}" - double_property mincolormap , 64 - string_property name , "" - radio_property nextplot , "new|{add}|replacechildren|replace" - bool_property numbertitle , "on" - array_property outerposition s , Matrix (1, 4, -1.0) - radio_property paperorientation U , "{portrait}|landscape|rotated" - array_property paperposition , default_figure_paperposition () - radio_property paperpositionmode , "auto|{manual}" - array_property papersize U , default_figure_papersize () - radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>" - radio_property paperunits Su , "{inches}|centimeters|normalized|points" - 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 () - radio_property renderer , "{painters}|zbuffer|opengl|none" - radio_property renderermode , "{auto}|manual" - bool_property resize , "on" - callback_property resizefcn , Matrix () - radio_property selectiontype , "{normal}|open|alt|extend" - radio_property toolbar , "none|{auto}|figure" - radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters" - callback_property windowbuttondownfcn , Matrix () - callback_property windowbuttonmotionfcn , Matrix () - callback_property windowbuttonupfcn , Matrix () - callback_property windowkeypressfcn , Matrix () - callback_property windowkeyreleasefcn , Matrix () - callback_property windowscrollwheelfcn , Matrix () - radio_property windowstyle , "{normal}|modal|docked" - string_property wvisual , "" - radio_property wvisualmode , "{auto}|manual" - string_property xdisplay , "" - string_property xvisual , "" - radio_property xvisualmode , "{auto}|manual" - // Octave-specific properties - bool_property __enhanced__ h , "on" - string_property __graphics_toolkit__ s , "gnuplot" - any_property __guidata__ h , Matrix () - any_property __plot_stream__ h , Matrix () + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + void set_boundingbox (const Matrix& bb, bool internal = false, + bool do_notify_toolkit = true); + + Matrix map_from_boundingbox (double x, double y) const; + + Matrix map_to_boundingbox (double x, double y) const; + + void update_units (const caseless_str& old_units); + + void update_paperunits (const caseless_str& old_paperunits); + + std::string get_title (void) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (figure) + array_property alphamap , Matrix (64, 1, 1) + callback_property buttondownfcn , Matrix () + callback_property closerequestfcn , "closereq" + color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) + array_property colormap , jet_colormap () + handle_property currentaxes S , graphics_handle () + string_property currentcharacter r , "" + handle_property currentobject r , graphics_handle () + array_property currentpoint r , Matrix (2, 1, 0) + bool_property dockcontrols , "off" + bool_property doublebuffer , "on" + string_property filename , "" + bool_property integerhandle S , "on" + bool_property inverthardcopy , "off" + callback_property keypressfcn , Matrix () + callback_property keyreleasefcn , Matrix () + radio_property menubar , "none|{figure}" + double_property mincolormap , 64 + string_property name , "" + radio_property nextplot , "new|{add}|replacechildren|replace" + bool_property numbertitle , "on" + array_property outerposition s , Matrix (1, 4, -1.0) + radio_property paperorientation U , "{portrait}|landscape|rotated" + array_property paperposition , default_figure_paperposition () + radio_property paperpositionmode , "auto|{manual}" + array_property papersize U , default_figure_papersize () + radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>" + radio_property paperunits Su , "{inches}|centimeters|normalized|points" + 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 () + radio_property renderer , "{painters}|zbuffer|opengl|none" + radio_property renderermode , "{auto}|manual" + bool_property resize , "on" + callback_property resizefcn , Matrix () + radio_property selectiontype , "{normal}|open|alt|extend" + radio_property toolbar , "none|{auto}|figure" + radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters" + callback_property windowbuttondownfcn , Matrix () + callback_property windowbuttonmotionfcn , Matrix () + callback_property windowbuttonupfcn , Matrix () + callback_property windowkeypressfcn , Matrix () + callback_property windowkeyreleasefcn , Matrix () + callback_property windowscrollwheelfcn , Matrix () + radio_property windowstyle , "{normal}|modal|docked" + string_property wvisual , "" + radio_property wvisualmode , "{auto}|manual" + string_property xdisplay , "" + string_property xvisual , "" + radio_property xvisualmode , "{auto}|manual" + // Octave-specific properties + bool_property __enhanced__ h , "on" + string_property __graphics_toolkit__ s , "gnuplot" + any_property __guidata__ h , Matrix () + any_property __plot_stream__ h , Matrix () END_PROPERTIES - protected: +protected: void init (void) { colormap.add_constraint (dim_vector (-1, 3)); @@ -3476,7 +3476,7 @@ outerposition.add_constraint (dim_vector (1, 4)); } - private: +private: mutable graphics_toolkit toolkit; }; @@ -3486,55 +3486,55 @@ public: figure (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~figure (void) { } void override_defaults (base_graphics_object& obj) - { - // Allow parent (root figure) to override first (properties knows how - // to find the parent object). - xproperties.override_defaults (obj); - - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Allow parent (root figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - if (name.compare ("default", 7)) - retval = get_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const; octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } base_properties& get_properties (void) { return xproperties; } @@ -3555,19 +3555,19 @@ public: graphics_xform (void) : xform (xform_eye ()), xform_inv (xform_eye ()), - sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0) - { - zlim(1) = 1.0; - } + sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0) + { + zlim(1) = 1.0; + } graphics_xform (const Matrix& xm, const Matrix& xim, const scaler& x, const scaler& y, const scaler& z, const Matrix& zl) - : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } + : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } graphics_xform (const graphics_xform& g) - : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), - sy (g.sy), sz (g.sz), zlim (g.zlim) { } + : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), + sy (g.sy), sz (g.sz), zlim (g.zlim) { } ~graphics_xform (void) { } @@ -3631,10 +3631,10 @@ }; enum { - AXE_ANY_DIR = 0, - AXE_DEPTH_DIR = 1, - AXE_HORZ_DIR = 2, - AXE_VERT_DIR = 3 + AXE_ANY_DIR = 0, + AXE_DEPTH_DIR = 1, + AXE_HORZ_DIR = 2, + AXE_VERT_DIR = 3 }; class OCTINTERP_API axes : public base_graphics_object @@ -3642,283 +3642,283 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void set_defaults (base_graphics_object& obj, const std::string& mode); - - void remove_child (const graphics_handle& h); - - const scaler& get_x_scaler (void) const { return sx; } - const scaler& get_y_scaler (void) const { return sy; } - const scaler& get_z_scaler (void) const { return sz; } - - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - Matrix get_extent (bool with_text = false, bool only_text_height=false) const; - - double get_fontsize_points (double box_pix_height = 0) const; - - void update_boundingbox (void) - { - if (units_is ("normalized")) - { - sync_positions (); - base_properties::update_boundingbox (); - } - } - - void update_camera (void); - void update_axes_layout (void); - void update_aspectratios (void); - void update_transform (void) - { - update_aspectratios (); - update_camera (); - update_axes_layout (); - } - - void sync_positions (void); - - void update_autopos (const std::string& elem_type); - void update_xlabel_position (void); - void update_ylabel_position (void); - void update_zlabel_position (void); - void update_title_position (void); - - graphics_xform get_transform (void) const - { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } - - Matrix get_transform_matrix (void) const { return x_render; } - Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } - Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } - Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } - Matrix get_transform_zlim (void) const { return x_zlim; } - - int get_xstate (void) const { return xstate; } - int get_ystate (void) const { return ystate; } - int get_zstate (void) const { return zstate; } - double get_xPlane (void) const { return xPlane; } - double get_xPlaneN (void) const { return xPlaneN; } - double get_yPlane (void) const { return yPlane; } - double get_yPlaneN (void) const { return yPlaneN; } - double get_zPlane (void) const { return zPlane; } - double get_zPlaneN (void) const { return zPlaneN; } - double get_xpTick (void) const { return xpTick; } - double get_xpTickN (void) const { return xpTickN; } - double get_ypTick (void) const { return ypTick; } - double get_ypTickN (void) const { return ypTickN; } - double get_zpTick (void) const { return zpTick; } - double get_zpTickN (void) const { return zpTickN; } - double get_x_min (void) const { return std::min (xPlane, xPlaneN); } - double get_x_max (void) const { return std::max (xPlane, xPlaneN); } - double get_y_min (void) const { return std::min (yPlane, yPlaneN); } - double get_y_max (void) const { return std::max (yPlane, yPlaneN); } - double get_z_min (void) const { return std::min (zPlane, zPlaneN); } - double get_z_max (void) const { return std::max (zPlane, zPlaneN); } - double get_fx (void) const { return fx; } - double get_fy (void) const { return fy; } - double get_fz (void) const { return fz; } - double get_xticklen (void) const { return xticklen; } - double get_yticklen (void) const { return yticklen; } - double get_zticklen (void) const { return zticklen; } - double get_xtickoffset (void) const { return xtickoffset; } - double get_ytickoffset (void) const { return ytickoffset; } - double get_ztickoffset (void) const { return ztickoffset; } - bool get_x2Dtop (void) const { return x2Dtop; } - bool get_y2Dright (void) const { return y2Dright; } - bool get_layer2Dtop (void) const { return layer2Dtop; } - bool get_xySym (void) const { return xySym; } - bool get_xyzSym (void) const { return xyzSym; } - bool get_zSign (void) const { return zSign; } - bool get_nearhoriz (void) const { return nearhoriz; } - - ColumnVector pixel2coord (double px, double py) const +public: + void set_defaults (base_graphics_object& obj, const std::string& mode); + + void remove_child (const graphics_handle& h); + + const scaler& get_x_scaler (void) const { return sx; } + const scaler& get_y_scaler (void) const { return sy; } + const scaler& get_z_scaler (void) const { return sz; } + + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + Matrix get_extent (bool with_text = false, bool only_text_height=false) const; + + double get_fontsize_points (double box_pix_height = 0) const; + + void update_boundingbox (void) + { + if (units_is ("normalized")) + { + sync_positions (); + base_properties::update_boundingbox (); + } + } + + void update_camera (void); + void update_axes_layout (void); + void update_aspectratios (void); + void update_transform (void) + { + update_aspectratios (); + update_camera (); + update_axes_layout (); + } + + void sync_positions (void); + + void update_autopos (const std::string& elem_type); + void update_xlabel_position (void); + void update_ylabel_position (void); + void update_zlabel_position (void); + void update_title_position (void); + + graphics_xform get_transform (void) const + { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } + + Matrix get_transform_matrix (void) const { return x_render; } + Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } + Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } + Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } + Matrix get_transform_zlim (void) const { return x_zlim; } + + int get_xstate (void) const { return xstate; } + int get_ystate (void) const { return ystate; } + int get_zstate (void) const { return zstate; } + double get_xPlane (void) const { return xPlane; } + double get_xPlaneN (void) const { return xPlaneN; } + double get_yPlane (void) const { return yPlane; } + double get_yPlaneN (void) const { return yPlaneN; } + double get_zPlane (void) const { return zPlane; } + double get_zPlaneN (void) const { return zPlaneN; } + double get_xpTick (void) const { return xpTick; } + double get_xpTickN (void) const { return xpTickN; } + double get_ypTick (void) const { return ypTick; } + double get_ypTickN (void) const { return ypTickN; } + double get_zpTick (void) const { return zpTick; } + double get_zpTickN (void) const { return zpTickN; } + double get_x_min (void) const { return std::min (xPlane, xPlaneN); } + double get_x_max (void) const { return std::max (xPlane, xPlaneN); } + double get_y_min (void) const { return std::min (yPlane, yPlaneN); } + double get_y_max (void) const { return std::max (yPlane, yPlaneN); } + double get_z_min (void) const { return std::min (zPlane, zPlaneN); } + double get_z_max (void) const { return std::max (zPlane, zPlaneN); } + double get_fx (void) const { return fx; } + double get_fy (void) const { return fy; } + double get_fz (void) const { return fz; } + double get_xticklen (void) const { return xticklen; } + double get_yticklen (void) const { return yticklen; } + double get_zticklen (void) const { return zticklen; } + double get_xtickoffset (void) const { return xtickoffset; } + double get_ytickoffset (void) const { return ytickoffset; } + double get_ztickoffset (void) const { return ztickoffset; } + bool get_x2Dtop (void) const { return x2Dtop; } + bool get_y2Dright (void) const { return y2Dright; } + bool get_layer2Dtop (void) const { return layer2Dtop; } + bool get_xySym (void) const { return xySym; } + bool get_xyzSym (void) const { return xyzSym; } + bool get_zSign (void) const { return zSign; } + bool get_nearhoriz (void) const { return nearhoriz; } + + ColumnVector pixel2coord (double px, double py) const { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); } - ColumnVector coord2pixel (double x, double y, double z) const + ColumnVector coord2pixel (double x, double y, double z) const { return get_transform ().transform (x, y, z); } - void zoom_about_point (double x, double y, double factor, - bool push_to_zoom_stack = true); - void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack = true); - void translate_view (double x0, double x1, double y0, double y1); - void rotate_view (double delta_az, double delta_el); - void unzoom (void); - void clear_zoom_stack (void); - - void update_units (const caseless_str& old_units); - - void update_fontunits (const caseless_str& old_fontunits); - - private: - scaler sx, sy, sz; - Matrix x_render, x_render_inv; - Matrix x_gl_mat1, x_gl_mat2; - Matrix x_zlim; - std::list<octave_value> zoom_stack; - - // Axes layout data - int xstate, ystate, zstate; - double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN; - double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN; - double fx, fy, fz; - double xticklen, yticklen, zticklen; - double xtickoffset, ytickoffset, ztickoffset; - bool x2Dtop, y2Dright, layer2Dtop; - bool xySym, xyzSym, zSign, nearhoriz; + void zoom_about_point (double x, double y, double factor, + bool push_to_zoom_stack = true); + void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack = true); + void translate_view (double x0, double x1, double y0, double y1); + void rotate_view (double delta_az, double delta_el); + void unzoom (void); + void clear_zoom_stack (void); + + void update_units (const caseless_str& old_units); + + void update_fontunits (const caseless_str& old_fontunits); + +private: + scaler sx, sy, sz; + Matrix x_render, x_render_inv; + Matrix x_gl_mat1, x_gl_mat2; + Matrix x_zlim; + std::list<octave_value> zoom_stack; + + // Axes layout data + int xstate, ystate, zstate; + double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN; + double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN; + double fx, fy, fz; + double xticklen, yticklen, zticklen; + double xtickoffset, ytickoffset, ztickoffset; + bool x2Dtop, y2Dright, layer2Dtop; + bool xySym, xyzSym, zSign, nearhoriz; #if HAVE_FREETYPE - // freetype renderer, used for calculation of text (tick labels) size - text_render text_renderer; + // freetype renderer, used for calculation of text (tick labels) size + text_render text_renderer; #endif - void set_text_child (handle_property& h, const std::string& who, - const octave_value& v); - - void delete_text_child (handle_property& h); - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (axes) - radio_property activepositionproperty , "{outerposition}|position" - row_vector_property alim m , default_lim () - radio_property alimmode , "{auto}|manual" - color_property ambientlightcolor , color_values (1, 1, 1) - bool_property box , "on" - array_property cameraposition m , Matrix (1, 3, 0.0) - radio_property camerapositionmode , "{auto}|manual" - array_property cameratarget m , Matrix (1, 3, 0.0) - radio_property cameratargetmode , "{auto}|manual" - array_property cameraupvector m , Matrix () - radio_property cameraupvectormode , "{auto}|manual" - double_property cameraviewangle m , 10.0 - radio_property cameraviewanglemode , "{auto}|manual" - row_vector_property clim m , default_lim () - radio_property climmode al , "{auto}|manual" - color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) - array_property colororder , default_colororder () - array_property currentpoint , Matrix (2, 3, 0.0) - array_property dataaspectratio mu , Matrix (1, 3, 1.0) - radio_property dataaspectratiomode u , "{auto}|manual" - radio_property drawmode , "{normal}|fast" - radio_property fontangle u , "{normal}|italic|oblique" - string_property fontname u , OCTAVE_DEFAULT_FONTNAME - double_property fontsize u , 10 - radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels" - radio_property fontweight u , "{normal}|light|demi|bold" - radio_property gridlinestyle , "-|--|{:}|-.|none" - // NOTE: interpreter is not a Matlab axis property, but it makes - // more sense to have it so that axis ticklabels can use it. - radio_property interpreter , "tex|{none}|latex" - radio_property layer u , "{bottom}|top" - string_array_property linestyleorder , "-" - double_property linewidth , 0.5 - radio_property minorgridlinestyle , "-|--|{:}|-.|none" - radio_property nextplot , "add|replacechildren|{replace}" - array_property outerposition u , default_axes_outerposition () - array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) - radio_property plotboxaspectratiomode u , "{auto}|manual" - array_property position u , default_axes_position () - radio_property projection , "{orthographic}|perpective" - radio_property tickdir mu , "{in}|out" - radio_property tickdirmode u , "{auto}|manual" - array_property ticklength u , default_axes_ticklength () - array_property tightinset r , Matrix (1, 4, 0.0) - handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - // FIXME: uicontextmenu should be moved here. - radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" - array_property view u , Matrix () - radio_property xaxislocation u , "{bottom}|top|zero" - color_property xcolor , color_values (0, 0, 0) - radio_property xdir u , "{normal}|reverse" - bool_property xgrid , "off" - handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - row_vector_property xlim mu , default_lim () - radio_property xlimmode al , "{auto}|manual" - bool_property xminorgrid , "off" - bool_property xminortick , "off" - radio_property xscale alu , "{linear}|log" - row_vector_property xtick mu , default_axes_tick () - // FIXME: should be kind of string array. - any_property xticklabel S , "" - radio_property xticklabelmode u , "{auto}|manual" - radio_property xtickmode u , "{auto}|manual" - radio_property yaxislocation u , "{left}|right|zero" - color_property ycolor , color_values (0, 0, 0) - radio_property ydir u , "{normal}|reverse" - bool_property ygrid , "off" - handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - row_vector_property ylim mu , default_lim () - radio_property ylimmode al , "{auto}|manual" - bool_property yminorgrid , "off" - bool_property yminortick , "off" - radio_property yscale alu , "{linear}|log" - row_vector_property ytick mu , default_axes_tick () - any_property yticklabel S , "" - radio_property yticklabelmode u , "{auto}|manual" - radio_property ytickmode u , "{auto}|manual" - color_property zcolor , color_values (0, 0, 0) - radio_property zdir u , "{normal}|reverse" - bool_property zgrid , "off" - handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - row_vector_property zlim mu , default_lim () - radio_property zlimmode al , "{auto}|manual" - bool_property zminorgrid , "off" - bool_property zminortick , "off" - radio_property zscale alu , "{linear}|log" - row_vector_property ztick mu , default_axes_tick () - any_property zticklabel S , "" - radio_property zticklabelmode u , "{auto}|manual" - radio_property ztickmode u , "{auto}|manual" - // Octave-specific properties - bool_property __hold_all__ h , "off" - // hidden properties for alignment of subplots - radio_property autopos_tag h , "{none}|subplot" - // hidden properties for inset - array_property looseinset hu , Matrix (1, 4, 0.0) - // hidden properties for transformation computation - array_property x_viewtransform h , Matrix (4, 4, 0.0) - array_property x_projectiontransform h , Matrix (4, 4, 0.0) - array_property x_viewporttransform h , Matrix (4, 4, 0.0) - array_property x_normrendertransform h , Matrix (4, 4, 0.0) - array_property x_rendertransform h , Matrix (4, 4, 0.0) - // hidden properties for minor ticks - row_vector_property xmtick h , Matrix () - row_vector_property ymtick h , Matrix () - row_vector_property zmtick h , Matrix () - END_PROPERTIES - - protected: + void set_text_child (handle_property& h, const std::string& who, + const octave_value& v); + + void delete_text_child (handle_property& h); + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (axes) + radio_property activepositionproperty , "{outerposition}|position" + row_vector_property alim m , default_lim () + radio_property alimmode , "{auto}|manual" + color_property ambientlightcolor , color_values (1, 1, 1) + bool_property box , "on" + array_property cameraposition m , Matrix (1, 3, 0.0) + radio_property camerapositionmode , "{auto}|manual" + array_property cameratarget m , Matrix (1, 3, 0.0) + radio_property cameratargetmode , "{auto}|manual" + array_property cameraupvector m , Matrix () + radio_property cameraupvectormode , "{auto}|manual" + double_property cameraviewangle m , 10.0 + radio_property cameraviewanglemode , "{auto}|manual" + row_vector_property clim m , default_lim () + radio_property climmode al , "{auto}|manual" + color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) + array_property colororder , default_colororder () + array_property currentpoint , Matrix (2, 3, 0.0) + array_property dataaspectratio mu , Matrix (1, 3, 1.0) + radio_property dataaspectratiomode u , "{auto}|manual" + radio_property drawmode , "{normal}|fast" + radio_property fontangle u , "{normal}|italic|oblique" + string_property fontname u , OCTAVE_DEFAULT_FONTNAME + double_property fontsize u , 10 + radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels" + radio_property fontweight u , "{normal}|light|demi|bold" + radio_property gridlinestyle , "-|--|{:}|-.|none" + // NOTE: interpreter is not a Matlab axis property, but it makes + // more sense to have it so that axis ticklabels can use it. + radio_property interpreter , "tex|{none}|latex" + radio_property layer u , "{bottom}|top" + string_array_property linestyleorder , "-" + double_property linewidth , 0.5 + radio_property minorgridlinestyle , "-|--|{:}|-.|none" + radio_property nextplot , "add|replacechildren|{replace}" + array_property outerposition u , default_axes_outerposition () + array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) + radio_property plotboxaspectratiomode u , "{auto}|manual" + array_property position u , default_axes_position () + radio_property projection , "{orthographic}|perpective" + radio_property tickdir mu , "{in}|out" + radio_property tickdirmode u , "{auto}|manual" + array_property ticklength u , default_axes_ticklength () + array_property tightinset r , Matrix (1, 4, 0.0) + handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + // FIXME: uicontextmenu should be moved here. + radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" + array_property view u , Matrix () + radio_property xaxislocation u , "{bottom}|top|zero" + color_property xcolor , color_values (0, 0, 0) + radio_property xdir u , "{normal}|reverse" + bool_property xgrid , "off" + handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + row_vector_property xlim mu , default_lim () + radio_property xlimmode al , "{auto}|manual" + bool_property xminorgrid , "off" + bool_property xminortick , "off" + radio_property xscale alu , "{linear}|log" + row_vector_property xtick mu , default_axes_tick () + // FIXME: should be kind of string array. + any_property xticklabel S , "" + radio_property xticklabelmode u , "{auto}|manual" + radio_property xtickmode u , "{auto}|manual" + radio_property yaxislocation u , "{left}|right|zero" + color_property ycolor , color_values (0, 0, 0) + radio_property ydir u , "{normal}|reverse" + bool_property ygrid , "off" + handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + row_vector_property ylim mu , default_lim () + radio_property ylimmode al , "{auto}|manual" + bool_property yminorgrid , "off" + bool_property yminortick , "off" + radio_property yscale alu , "{linear}|log" + row_vector_property ytick mu , default_axes_tick () + any_property yticklabel S , "" + radio_property yticklabelmode u , "{auto}|manual" + radio_property ytickmode u , "{auto}|manual" + color_property zcolor , color_values (0, 0, 0) + radio_property zdir u , "{normal}|reverse" + bool_property zgrid , "off" + handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + row_vector_property zlim mu , default_lim () + radio_property zlimmode al , "{auto}|manual" + bool_property zminorgrid , "off" + bool_property zminortick , "off" + radio_property zscale alu , "{linear}|log" + row_vector_property ztick mu , default_axes_tick () + any_property zticklabel S , "" + radio_property zticklabelmode u , "{auto}|manual" + radio_property ztickmode u , "{auto}|manual" + // Octave-specific properties + bool_property __hold_all__ h , "off" + // hidden properties for alignment of subplots + radio_property autopos_tag h , "{none}|subplot" + // hidden properties for inset + array_property looseinset hu , Matrix (1, 4, 0.0) + // hidden properties for transformation computation + array_property x_viewtransform h , Matrix (4, 4, 0.0) + array_property x_projectiontransform h , Matrix (4, 4, 0.0) + array_property x_viewporttransform h , Matrix (4, 4, 0.0) + array_property x_normrendertransform h , Matrix (4, 4, 0.0) + array_property x_rendertransform h , Matrix (4, 4, 0.0) + // hidden properties for minor ticks + row_vector_property xmtick h , Matrix () + row_vector_property ymtick h , Matrix () + row_vector_property zmtick h , Matrix () + END_PROPERTIES + +protected: void init (void); - private: +private: std::string - get_scale (const std::string& scale, const Matrix& lims) - { - std::string retval = scale; - - if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0) - retval = "neglog"; - - return retval; - } + get_scale (const std::string& scale, const Matrix& lims) + { + std::string retval = scale; + + if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0) + retval = "neglog"; + + return retval; + } void update_xscale (void) - { - sx = get_scale (get_xscale (), xlim.get ().matrix_value ()); - } + { + sx = get_scale (get_xscale (), xlim.get ().matrix_value ()); + } void update_yscale (void) - { - sy = get_scale (get_yscale (), ylim.get ().matrix_value ()); - } + { + sy = get_scale (get_yscale (), ylim.get ().matrix_value ()); + } void update_zscale (void) - { - sz = get_scale (get_zscale (), zlim.get ().matrix_value ()); - } + { + sz = get_scale (get_zscale (), zlim.get ().matrix_value ()); + } void update_view (void) { sync_positions (); } void update_dataaspectratio (void) { sync_positions (); } @@ -3964,27 +3964,27 @@ void update_xtickmode (void) { - if (xtickmode.is ("auto")) - { - calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); - update_xtick (); - } + if (xtickmode.is ("auto")) + { + calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); + update_xtick (); + } } void update_ytickmode (void) { - if (ytickmode.is ("auto")) - { - calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); - update_ytick (); - } + if (ytickmode.is ("auto")) + { + calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); + update_ytick (); + } } void update_ztickmode (void) { - if (ztickmode.is ("auto")) - { - calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); - update_ztick (); - } + if (ztickmode.is ("auto")) + { + calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); + update_ztick (); + } } void update_xticklabelmode (void) @@ -4010,48 +4010,48 @@ void update_fontweight (void) { update_font (); } void update_outerposition (void) - { - set_activepositionproperty ("outerposition"); - caseless_str old_units = get_units (); - set_units ("normalized"); - Matrix outerbox = outerposition.get ().matrix_value (); - Matrix innerbox = position.get ().matrix_value (); - Matrix linset = looseinset.get ().matrix_value (); - Matrix tinset = tightinset.get ().matrix_value (); - outerbox(2) = outerbox(2) + outerbox(0); - outerbox(3) = outerbox(3) + outerbox(1); - innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0)); - innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1)); - innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2)); - innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3)); - innerbox(2) = innerbox(2) - innerbox(0); - innerbox(3) = innerbox(3) - innerbox(1); - position = innerbox; - set_units (old_units); - update_transform (); - } + { + set_activepositionproperty ("outerposition"); + caseless_str old_units = get_units (); + set_units ("normalized"); + Matrix outerbox = outerposition.get ().matrix_value (); + Matrix innerbox = position.get ().matrix_value (); + Matrix linset = looseinset.get ().matrix_value (); + Matrix tinset = tightinset.get ().matrix_value (); + outerbox(2) = outerbox(2) + outerbox(0); + outerbox(3) = outerbox(3) + outerbox(1); + innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0)); + innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1)); + innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2)); + innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3)); + innerbox(2) = innerbox(2) - innerbox(0); + innerbox(3) = innerbox(3) - innerbox(1); + position = innerbox; + set_units (old_units); + update_transform (); + } void update_position (void) - { - set_activepositionproperty ("position"); - caseless_str old_units = get_units (); - set_units ("normalized"); - Matrix outerbox = outerposition.get ().matrix_value (); - Matrix innerbox = position.get ().matrix_value (); - Matrix linset = looseinset.get ().matrix_value (); - Matrix tinset = tightinset.get ().matrix_value (); - innerbox(2) = innerbox(2) + innerbox(0); - innerbox(3) = innerbox(3) + innerbox(1); - outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0)); - outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1)); - outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2)); - outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3)); - outerbox(2) = outerbox(2) - outerbox(0); - outerbox(3) = outerbox(3) - outerbox(1); - outerposition = outerbox; - set_units (old_units); - update_transform (); - } + { + set_activepositionproperty ("position"); + caseless_str old_units = get_units (); + set_units ("normalized"); + Matrix outerbox = outerposition.get ().matrix_value (); + Matrix innerbox = position.get ().matrix_value (); + Matrix linset = looseinset.get ().matrix_value (); + Matrix tinset = tightinset.get ().matrix_value (); + innerbox(2) = innerbox(2) + innerbox(0); + innerbox(3) = innerbox(3) + innerbox(1); + outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0)); + outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1)); + outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2)); + outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3)); + outerbox(2) = outerbox(2) - outerbox(0); + outerbox(3) = outerbox(3) - outerbox(1); + outerposition = outerbox; + set_units (old_units); + update_transform (); + } void update_looseinset (void) { @@ -4098,81 +4098,81 @@ const Matrix& limits); void fix_limits (array_property& lims) - { - if (lims.get ().is_empty ()) - return; - - Matrix l = lims.get ().matrix_value (); - if (l(0) > l(1)) - { - l(0) = 0; - l(1) = 1; - lims = l; - } - else if (l(0) == l(1)) - { - l(0) -= 0.5; - l(1) += 0.5; - lims = l; - } - } + { + if (lims.get ().is_empty ()) + return; + + Matrix l = lims.get ().matrix_value (); + if (l(0) > l(1)) + { + l(0) = 0; + l(1) = 1; + lims = l; + } + else if (l(0) == l(1)) + { + l(0) -= 0.5; + l(1) += 0.5; + lims = l; + } + } Matrix calc_tightbox (const Matrix& init_pos); - public: +public: Matrix get_axis_limits (double xmin, double xmax, double min_pos, double max_neg, bool logscale); void update_xlim (bool do_clr_zoom = true) - { - if (xtickmode.is ("auto")) - calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); - if (xticklabelmode.is ("auto")) - calc_ticklabels (xtick, xticklabel, xscale.is ("log")); - - fix_limits (xlim); - - update_xscale (); - - if (do_clr_zoom) - zoom_stack.clear (); - - update_axes_layout (); - } + { + if (xtickmode.is ("auto")) + calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); + if (xticklabelmode.is ("auto")) + calc_ticklabels (xtick, xticklabel, xscale.is ("log")); + + fix_limits (xlim); + + update_xscale (); + + if (do_clr_zoom) + zoom_stack.clear (); + + update_axes_layout (); + } void update_ylim (bool do_clr_zoom = true) - { - if (ytickmode.is ("auto")) - calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); - if (yticklabelmode.is ("auto")) - calc_ticklabels (ytick, yticklabel, yscale.is ("log")); - - fix_limits (ylim); - - update_yscale (); - - if (do_clr_zoom) - zoom_stack.clear (); - - update_axes_layout (); - } + { + if (ytickmode.is ("auto")) + calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); + if (yticklabelmode.is ("auto")) + calc_ticklabels (ytick, yticklabel, yscale.is ("log")); + + fix_limits (ylim); + + update_yscale (); + + if (do_clr_zoom) + zoom_stack.clear (); + + update_axes_layout (); + } void update_zlim (void) - { - if (ztickmode.is ("auto")) - calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); - if (zticklabelmode.is ("auto")) - calc_ticklabels (ztick, zticklabel, zscale.is ("log")); - - fix_limits (zlim); - - update_zscale (); - - zoom_stack.clear (); - - update_axes_layout (); - } + { + if (ztickmode.is ("auto")) + calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); + if (zticklabelmode.is ("auto")) + calc_ticklabels (ztick, zticklabel, zscale.is ("log")); + + fix_limits (zlim); + + update_zscale (); + + zoom_stack.clear (); + + update_axes_layout (); + } }; @@ -4182,63 +4182,63 @@ public: axes (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () - { - xproperties.override_defaults (*this); - xproperties.update_transform (); - } + { + xproperties.override_defaults (*this); + xproperties.update_transform (); + } ~axes (void) { } void override_defaults (base_graphics_object& obj) - { - // Allow parent (figure) to override first (properties knows how - // to find the parent object). - xproperties.override_defaults (obj); - - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Allow parent (figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } void set_defaults (const std::string& mode) - { - remove_all_listeners (); - xproperties.set_defaults (*this, mode); - } + { + remove_all_listeners (); + xproperties.set_defaults (*this, mode); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - // FIXME: finish this. - if (name.compare ("default", 7)) - retval = get_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + // FIXME: finish this. + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const; octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } base_properties& get_properties (void) { return xproperties; } @@ -4267,41 +4267,41 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (line) - color_property color , color_values (0, 0, 0) - string_property displayname , "" - radio_property erasemode , "{normal}|none|xor|background" - // FIXME: interpreter is not a property of Matlab line objects. - // Octave uses this for legend() with the string displayname. - radio_property interpreter , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" - color_property markeredgecolor , "{auto}|none" - color_property markerfacecolor , "auto|{none}" - double_property markersize , 6 - row_vector_property xdata u , default_data () - string_property xdatasource , "" - row_vector_property ydata u , default_data () - string_property ydatasource , "" - row_vector_property zdata u , Matrix () - string_property zdatasource , "" - - // hidden properties for limit computation - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" - bool_property zliminclude hl , "off" +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (line) + color_property color , color_values (0, 0, 0) + string_property displayname , "" + radio_property erasemode , "{normal}|none|xor|background" + // FIXME: interpreter is not a property of Matlab line objects. + // Octave uses this for legend() with the string displayname. + radio_property interpreter , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" + color_property markeredgecolor , "{auto}|none" + color_property markerfacecolor , "auto|{none}" + double_property markersize , 6 + row_vector_property xdata u , default_data () + string_property xdatasource , "" + row_vector_property ydata u , default_data () + string_property ydatasource , "" + row_vector_property zdata u , Matrix () + string_property zdatasource , "" + + // hidden properties for limit computation + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" + bool_property zliminclude hl , "off" END_PROPERTIES - private: +private: Matrix compute_xlim (void) const; Matrix compute_ylim (void) const; @@ -4322,9 +4322,9 @@ public: line (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~line (void) { } @@ -4342,19 +4342,19 @@ public: class OCTINTERP_API properties : public base_properties { - public: - double get_fontsize_points (double box_pix_height = 0) const; - - void set_position (const octave_value& val) +public: + double get_fontsize_points (double box_pix_height = 0) const; + + void set_position (const octave_value& val) { if (! error_state) { octave_value new_val (val); - + if (new_val.numel () == 2) { dim_vector dv (1, 3); - + new_val = new_val.resize (dv, true); } @@ -4370,116 +4370,116 @@ } } - // See the genprops.awk script for an explanation of the - // properties declarations. - - BEGIN_PROPERTIES (text) - color_property backgroundcolor , "{none}" - color_property color u , color_values (0, 0, 0) - string_property displayname , "" - color_property edgecolor , "{none}" - bool_property editing , "off" - radio_property erasemode , "{normal}|none|xor|background" - array_property extent rG , Matrix (1, 4, 0.0) - radio_property fontangle u , "{normal}|italic|oblique" - string_property fontname u , OCTAVE_DEFAULT_FONTNAME - double_property fontsize u , 10 - radio_property fontunits , "inches|centimeters|normalized|{points}|pixels" - radio_property fontweight u , "light|{normal}|demi|bold" - radio_property horizontalalignment mu , "{left}|center|right" - radio_property interpreter u , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - double_property margin , 1 - array_property position smu , Matrix (1, 3, 0.0) - double_property rotation mu , 0 - text_label_property string u , "" - radio_property units u , "{data}|pixels|normalized|inches|centimeters|points" - radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom" - - // hidden properties for limit computation - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property xliminclude hl , "off" - bool_property yliminclude hl , "off" - bool_property zliminclude hl , "off" - // hidden properties for auto-positioning - radio_property positionmode hu , "{auto}|manual" - radio_property rotationmode hu , "{auto}|manual" - radio_property horizontalalignmentmode hu , "{auto}|manual" - radio_property verticalalignmentmode hu , "{auto}|manual" - radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title" + // See the genprops.awk script for an explanation of the + // properties declarations. + + BEGIN_PROPERTIES (text) + color_property backgroundcolor , "{none}" + color_property color u , color_values (0, 0, 0) + string_property displayname , "" + color_property edgecolor , "{none}" + bool_property editing , "off" + radio_property erasemode , "{normal}|none|xor|background" + array_property extent rG , Matrix (1, 4, 0.0) + radio_property fontangle u , "{normal}|italic|oblique" + string_property fontname u , OCTAVE_DEFAULT_FONTNAME + double_property fontsize u , 10 + radio_property fontunits , "inches|centimeters|normalized|{points}|pixels" + radio_property fontweight u , "light|{normal}|demi|bold" + radio_property horizontalalignment mu , "{left}|center|right" + radio_property interpreter u , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + double_property margin , 1 + array_property position smu , Matrix (1, 3, 0.0) + double_property rotation mu , 0 + text_label_property string u , "" + radio_property units u , "{data}|pixels|normalized|inches|centimeters|points" + radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom" + + // hidden properties for limit computation + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property xliminclude hl , "off" + bool_property yliminclude hl , "off" + bool_property zliminclude hl , "off" + // hidden properties for auto-positioning + radio_property positionmode hu , "{auto}|manual" + radio_property rotationmode hu , "{auto}|manual" + radio_property horizontalalignmentmode hu , "{auto}|manual" + radio_property verticalalignmentmode hu , "{auto}|manual" + radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title" END_PROPERTIES Matrix get_data_position (void) const; - Matrix get_extent_matrix (void) const; - const uint8NDArray& get_pixels (void) const { return pixels; } -/* + Matrix get_extent_matrix (void) const; + const uint8NDArray& get_pixels (void) const { return pixels; } + /* #if HAVE_FREETYPE - // freetype renderer, used for calculation of text size - text_render renderer; + // freetype renderer, used for calculation of text size + text_render renderer; #endif -*/ - - protected: - void init (void) - { - position.add_constraint (dim_vector (1, 3)); - cached_units = get_units (); - update_font (); - } - - private: - void update_position (void) - { - Matrix pos = get_data_position (); - Matrix lim; - - lim = Matrix (1, 3, pos(0)); - lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); - set_xlim (lim); - - lim = Matrix (1, 3, pos(1)); - lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); - set_ylim (lim); - - if (pos.numel () == 3) - { - lim = Matrix (1, 3, pos(2)); - lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); - set_zliminclude ("on"); - set_zlim (lim); - } - else - set_zliminclude ("off"); - } - - void update_text_extent (void); - - void request_autopos (void); - void update_positionmode (void) { request_autopos (); } - void update_rotationmode (void) { request_autopos (); } - void update_horizontalalignmentmode (void) { request_autopos (); } - void update_verticalalignmentmode (void) { request_autopos (); } - - void update_font (void); - void update_string (void) { request_autopos (); update_text_extent (); } - void update_rotation (void) { update_text_extent (); } - void update_color (void) { update_font (); update_text_extent (); } - void update_fontname (void) { update_font (); update_text_extent (); } - void update_fontsize (void) { update_font (); update_text_extent (); } - void update_fontangle (void) { update_font (); update_text_extent (); } - void update_fontweight (void) { update_font (); update_text_extent (); } - void update_interpreter (void) { update_text_extent (); } - void update_horizontalalignment (void) { update_text_extent (); } - void update_verticalalignment (void) { update_text_extent (); } - - void update_units (void); - - private: - std::string cached_units; - uint8NDArray pixels; + */ + +protected: + void init (void) + { + position.add_constraint (dim_vector (1, 3)); + cached_units = get_units (); + update_font (); + } + +private: + void update_position (void) + { + Matrix pos = get_data_position (); + Matrix lim; + + lim = Matrix (1, 3, pos(0)); + lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); + set_xlim (lim); + + lim = Matrix (1, 3, pos(1)); + lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); + set_ylim (lim); + + if (pos.numel () == 3) + { + lim = Matrix (1, 3, pos(2)); + lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); + set_zliminclude ("on"); + set_zlim (lim); + } + else + set_zliminclude ("off"); + } + + void update_text_extent (void); + + void request_autopos (void); + void update_positionmode (void) { request_autopos (); } + void update_rotationmode (void) { request_autopos (); } + void update_horizontalalignmentmode (void) { request_autopos (); } + void update_verticalalignmentmode (void) { request_autopos (); } + + void update_font (void); + void update_string (void) { request_autopos (); update_text_extent (); } + void update_rotation (void) { update_text_extent (); } + void update_color (void) { update_font (); update_text_extent (); } + void update_fontname (void) { update_font (); update_text_extent (); } + void update_fontsize (void) { update_font (); update_text_extent (); } + void update_fontangle (void) { update_font (); update_text_extent (); } + void update_fontweight (void) { update_font (); update_text_extent (); } + void update_interpreter (void) { update_text_extent (); } + void update_horizontalalignment (void) { update_text_extent (); } + void update_verticalalignment (void) { update_text_extent (); } + + void update_units (void); + +private: + std::string cached_units; + uint8NDArray pixels; }; private: @@ -4488,10 +4488,10 @@ public: text (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.set_clipping ("off"); - xproperties.override_defaults (*this); - } + { + xproperties.set_clipping ("off"); + xproperties.override_defaults (*this); + } ~text (void) { } @@ -4509,43 +4509,43 @@ public: class OCTINTERP_API properties : public base_properties { - public: - bool is_aliminclude (void) const - { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } - std::string get_aliminclude (void) const - { return aliminclude.current_value (); } - - bool is_climinclude (void) const - { return (climinclude.is_on () && cdatamapping.is ("scaled")); } - std::string get_climinclude (void) const - { return climinclude.current_value (); } - - octave_value get_color_data (void) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (image) - array_property alphadata u , Matrix () - radio_property alphadatamapping al , "none|direct|{scaled}" - array_property cdata u , Matrix () - radio_property cdatamapping al , "scaled|{direct}" - radio_property erasemode , "{normal}|none|xor|background" - row_vector_property xdata u , Matrix () - row_vector_property ydata u , Matrix () - // hidden properties for limit computation - row_vector_property alim hlr , Matrix () - row_vector_property clim hlr , Matrix () - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - bool_property aliminclude hlg , "on" - bool_property climinclude hlg , "on" - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" +public: + bool is_aliminclude (void) const + { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } + std::string get_aliminclude (void) const + { return aliminclude.current_value (); } + + bool is_climinclude (void) const + { return (climinclude.is_on () && cdatamapping.is ("scaled")); } + std::string get_climinclude (void) const + { return climinclude.current_value (); } + + octave_value get_color_data (void) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (image) + array_property alphadata u , Matrix () + radio_property alphadatamapping al , "none|direct|{scaled}" + array_property cdata u , Matrix () + radio_property cdatamapping al , "scaled|{direct}" + radio_property erasemode , "{normal}|none|xor|background" + row_vector_property xdata u , Matrix () + row_vector_property ydata u , Matrix () + // hidden properties for limit computation + row_vector_property alim hlr , Matrix () + row_vector_property clim hlr , Matrix () + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + bool_property aliminclude hlg , "on" + bool_property climinclude hlg , "on" + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" END_PROPERTIES - protected: +protected: void init (void) { xdata.add_constraint (2); @@ -4561,7 +4561,7 @@ cdata.add_constraint (dim_vector (-1, -1, 3)); } - private: +private: void update_alphadata (void) { if (alphadatamapping_is ("scaled")) @@ -4579,52 +4579,52 @@ } void update_xdata (void) - { - Matrix limits = xdata.get_limits (); - float dp = pixel_xsize (); - - limits(0) = limits(0) - dp; - limits(1) = limits(1) + dp; - set_xlim (limits); - } + { + Matrix limits = xdata.get_limits (); + float dp = pixel_xsize (); + + limits(0) = limits(0) - dp; + limits(1) = limits(1) + dp; + set_xlim (limits); + } void update_ydata (void) - { - Matrix limits = ydata.get_limits (); - float dp = pixel_ysize (); - - limits(0) = limits(0) - dp; - limits(1) = limits(1) + dp; - set_ylim (limits); - } + { + Matrix limits = ydata.get_limits (); + float dp = pixel_ysize (); + + limits(0) = limits(0) - dp; + limits(1) = limits(1) + dp; + set_ylim (limits); + } float pixel_size (octave_idx_type dim, const Matrix limits) - { - octave_idx_type l = dim - 1; - float dp; - - if (l > 0 && limits(0) != limits(1)) - dp = (limits(1) - limits(0))/(2*l); - else - { - if (limits(1) == limits(2)) - dp = 0.5; - else - dp = (limits(1) - limits(0))/2; - } - return dp; - } - - public: + { + octave_idx_type l = dim - 1; + float dp; + + if (l > 0 && limits(0) != limits(1)) + dp = (limits(1) - limits(0))/(2*l); + else + { + if (limits(1) == limits(2)) + dp = 0.5; + else + dp = (limits(1) - limits(0))/2; + } + return dp; + } + +public: float pixel_xsize (void) - { - return pixel_size ((get_cdata ().dims ())(1), xdata.get_limits ()); - } + { + return pixel_size ((get_cdata ().dims ())(1), xdata.get_limits ()); + } float pixel_ysize (void) - { - return pixel_size ((get_cdata ().dims ())(0), ydata.get_limits ()); - } + { + return pixel_size ((get_cdata ().dims ())(0), ydata.get_limits ()); + } }; private: @@ -4633,9 +4633,9 @@ public: image (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~image (void) { } @@ -4653,74 +4653,74 @@ public: class OCTINTERP_API properties : public base_properties { - public: - octave_value get_color_data (void) const; - - bool is_aliminclude (void) const - { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } - std::string get_aliminclude (void) const - { return aliminclude.current_value (); } - - bool is_climinclude (void) const - { return (climinclude.is_on () && cdatamapping.is ("scaled")); } - std::string get_climinclude (void) const - { return climinclude.current_value (); } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (patch) - radio_property alphadatamapping l , "none|{scaled}|direct" - double_property ambientstrength , 0.3 - radio_property backfacelighting , "unlit|lit|{reverselit}" - array_property cdata u , Matrix () - radio_property cdatamapping l , "{scaled}|direct" - double_property diffusestrength , 0.6 - string_property displayname , "" - double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) - color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) - radio_property edgelighting , "{none}|flat|gouraud|phong" - radio_property erasemode , "{normal}|background|xor|none" - double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp")) - color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) - radio_property facelighting , "{none}|flat|gouraud|phong" - array_property faces , Matrix () - array_property facevertexalphadata , Matrix () - array_property facevertexcdata , Matrix () - // FIXME: interpreter is not a property of a Matlab patch. - // Octave uses this for legend() with the string displayname. - radio_property interpreter , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" - color_property markeredgecolor , "none|{auto}|flat" - color_property markerfacecolor , "{none}|auto|flat" - double_property markersize , 6 - radio_property normalmode , "{auto}|manual" - double_property specularcolorreflectance , 1.0 - double_property specularexponent , 10.0 - double_property specularstrength , 0.6 - array_property vertexnormals , Matrix () - array_property vertices , Matrix () - array_property xdata u , Matrix () - array_property ydata u , Matrix () - array_property zdata u , Matrix () - - // hidden properties for limit computation - row_vector_property alim hlr , Matrix () - row_vector_property clim hlr , Matrix () - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property aliminclude hlg , "on" - bool_property climinclude hlg , "on" - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" - bool_property zliminclude hl , "on" +public: + octave_value get_color_data (void) const; + + bool is_aliminclude (void) const + { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } + std::string get_aliminclude (void) const + { return aliminclude.current_value (); } + + bool is_climinclude (void) const + { return (climinclude.is_on () && cdatamapping.is ("scaled")); } + std::string get_climinclude (void) const + { return climinclude.current_value (); } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (patch) + radio_property alphadatamapping l , "none|{scaled}|direct" + double_property ambientstrength , 0.3 + radio_property backfacelighting , "unlit|lit|{reverselit}" + array_property cdata u , Matrix () + radio_property cdatamapping l , "{scaled}|direct" + double_property diffusestrength , 0.6 + string_property displayname , "" + double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) + color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) + radio_property edgelighting , "{none}|flat|gouraud|phong" + radio_property erasemode , "{normal}|background|xor|none" + double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp")) + color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) + radio_property facelighting , "{none}|flat|gouraud|phong" + array_property faces , Matrix () + array_property facevertexalphadata , Matrix () + array_property facevertexcdata , Matrix () + // FIXME: interpreter is not a property of a Matlab patch. + // Octave uses this for legend() with the string displayname. + radio_property interpreter , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" + color_property markeredgecolor , "none|{auto}|flat" + color_property markerfacecolor , "{none}|auto|flat" + double_property markersize , 6 + radio_property normalmode , "{auto}|manual" + double_property specularcolorreflectance , 1.0 + double_property specularexponent , 10.0 + double_property specularstrength , 0.6 + array_property vertexnormals , Matrix () + array_property vertices , Matrix () + array_property xdata u , Matrix () + array_property ydata u , Matrix () + array_property zdata u , Matrix () + + // hidden properties for limit computation + row_vector_property alim hlr , Matrix () + row_vector_property clim hlr , Matrix () + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property aliminclude hlg , "on" + bool_property climinclude hlg , "on" + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" + bool_property zliminclude hl , "on" END_PROPERTIES - protected: +protected: void init (void) { xdata.add_constraint (dim_vector (-1, -1)); @@ -4735,7 +4735,7 @@ facevertexalphadata.add_constraint (dim_vector (-1, 1)); } - private: +private: void update_xdata (void) { set_xlim (xdata.get_limits ()); } void update_ydata (void) { set_ylim (ydata.get_limits ()); } void update_zdata (void) { set_zlim (zdata.get_limits ()); } @@ -4755,9 +4755,9 @@ public: patch (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~patch (void) { } @@ -4775,76 +4775,76 @@ public: class OCTINTERP_API properties : public base_properties { - public: - octave_value get_color_data (void) const; - - bool is_aliminclude (void) const - { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } - std::string get_aliminclude (void) const - { return aliminclude.current_value (); } - - bool is_climinclude (void) const - { return (climinclude.is_on () && cdatamapping.is ("scaled")); } - std::string get_climinclude (void) const - { return climinclude.current_value (); } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (surface) - array_property alphadata u , Matrix () - radio_property alphadatamapping l , "none|direct|{scaled}" - double_property ambientstrength , 0.3 - radio_property backfacelighting , "unlit|lit|{reverselit}" - array_property cdata u , Matrix () - radio_property cdatamapping al , "{scaled}|direct" - string_property cdatasource , "" - double_property diffusestrength , 0.6 - string_property displayname , "" - double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) - color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) - radio_property edgelighting , "{none}|flat|gouraud|phong" - radio_property erasemode , "{normal}|none|xor|background" - double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap")) - color_property facecolor , "none|{flat}|interp|texturemap" - radio_property facelighting , "{none}|flat|gouraud|phong" - // FIXME: interpreter is not a Matlab surface property - // Octave uses this for legend() with the string displayname. - radio_property interpreter , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" - color_property markeredgecolor , "none|{auto}|flat" - color_property markerfacecolor , "{none}|auto|flat" - double_property markersize , 6 - radio_property meshstyle , "{both}|row|column" - radio_property normalmode u , "{auto}|manual" - double_property specularcolorreflectance , 1 - double_property specularexponent , 10 - double_property specularstrength , 0.9 - array_property vertexnormals u , Matrix () - array_property xdata u , Matrix () - string_property xdatasource , "" - array_property ydata u , Matrix () - string_property ydatasource , "" - array_property zdata u , Matrix () - string_property zdatasource , "" - - // hidden properties for limit computation - row_vector_property alim hlr , Matrix () - row_vector_property clim hlr , Matrix () - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property aliminclude hlg , "on" - bool_property climinclude hlg , "on" - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" - bool_property zliminclude hl , "on" +public: + octave_value get_color_data (void) const; + + bool is_aliminclude (void) const + { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } + std::string get_aliminclude (void) const + { return aliminclude.current_value (); } + + bool is_climinclude (void) const + { return (climinclude.is_on () && cdatamapping.is ("scaled")); } + std::string get_climinclude (void) const + { return climinclude.current_value (); } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (surface) + array_property alphadata u , Matrix () + radio_property alphadatamapping l , "none|direct|{scaled}" + double_property ambientstrength , 0.3 + radio_property backfacelighting , "unlit|lit|{reverselit}" + array_property cdata u , Matrix () + radio_property cdatamapping al , "{scaled}|direct" + string_property cdatasource , "" + double_property diffusestrength , 0.6 + string_property displayname , "" + double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) + color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) + radio_property edgelighting , "{none}|flat|gouraud|phong" + radio_property erasemode , "{normal}|none|xor|background" + double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap")) + color_property facecolor , "none|{flat}|interp|texturemap" + radio_property facelighting , "{none}|flat|gouraud|phong" + // FIXME: interpreter is not a Matlab surface property + // Octave uses this for legend() with the string displayname. + radio_property interpreter , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" + color_property markeredgecolor , "none|{auto}|flat" + color_property markerfacecolor , "{none}|auto|flat" + double_property markersize , 6 + radio_property meshstyle , "{both}|row|column" + radio_property normalmode u , "{auto}|manual" + double_property specularcolorreflectance , 1 + double_property specularexponent , 10 + double_property specularstrength , 0.9 + array_property vertexnormals u , Matrix () + array_property xdata u , Matrix () + string_property xdatasource , "" + array_property ydata u , Matrix () + string_property ydatasource , "" + array_property zdata u , Matrix () + string_property zdatasource , "" + + // hidden properties for limit computation + row_vector_property alim hlr , Matrix () + row_vector_property clim hlr , Matrix () + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property aliminclude hlg , "on" + bool_property climinclude hlg , "on" + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" + bool_property zliminclude hl , "on" END_PROPERTIES - protected: +protected: void init (void) { xdata.add_constraint (dim_vector (-1, -1)); @@ -4862,7 +4862,7 @@ cdata.add_constraint (dim_vector (-1, -1, 3)); } - private: +private: void update_alphadata (void) { if (alphadatamapping_is ("scaled")) @@ -4912,9 +4912,9 @@ public: surface (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~surface (void) { } @@ -4932,47 +4932,47 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void remove_child (const graphics_handle& h) - { - base_properties::remove_child (h); - update_limits (); - } - - void adopt (const graphics_handle& h) - { - - base_properties::adopt (h); - update_limits (h); - } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (hggroup) - string_property displayname , "" - radio_property erasemode , "{normal}|none|xor|background" - - // hidden properties for limit computation - row_vector_property alim hr , Matrix () - row_vector_property clim hr , Matrix () - row_vector_property xlim hr , Matrix () - row_vector_property ylim hr , Matrix () - row_vector_property zlim hr , Matrix () - bool_property aliminclude h , "on" - bool_property climinclude h , "on" - bool_property xliminclude h , "on" - bool_property yliminclude h , "on" - bool_property zliminclude h , "on" +public: + void remove_child (const graphics_handle& h) + { + base_properties::remove_child (h); + update_limits (); + } + + void adopt (const graphics_handle& h) + { + + base_properties::adopt (h); + update_limits (h); + } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (hggroup) + string_property displayname , "" + radio_property erasemode , "{normal}|none|xor|background" + + // hidden properties for limit computation + row_vector_property alim hr , Matrix () + row_vector_property clim hr , Matrix () + row_vector_property xlim hr , Matrix () + row_vector_property ylim hr , Matrix () + row_vector_property zlim hr , Matrix () + bool_property aliminclude h , "on" + bool_property climinclude h , "on" + bool_property xliminclude h , "on" + bool_property yliminclude h , "on" + bool_property zliminclude h , "on" END_PROPERTIES - private: - void update_limits (void) const; - - void update_limits (const graphics_handle& h) const; - - protected: +private: + void update_limits (void) const; + + void update_limits (const graphics_handle& h) const; + +protected: void init (void) { } @@ -4984,9 +4984,9 @@ public: hggroup (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~hggroup (void) { } @@ -5010,36 +5010,36 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void remove_child (const graphics_handle& h) - { - base_properties::remove_child (h); - } - - void adopt (const graphics_handle& h) - { - base_properties::adopt (h); - } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uimenu) - any_property __object__ , Matrix () - string_property accelerator , "" - callback_property callback , Matrix () - bool_property checked , "off" - bool_property enable , "on" - color_property foregroundcolor , color_values (0, 0, 0) - string_property label , "" - double_property position , 9 - bool_property separator , "off" - // Octave-specific properties - string_property fltk_label h , "" +public: + void remove_child (const graphics_handle& h) + { + base_properties::remove_child (h); + } + + void adopt (const graphics_handle& h) + { + base_properties::adopt (h); + } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uimenu) + any_property __object__ , Matrix () + string_property accelerator , "" + callback_property callback , Matrix () + bool_property checked , "off" + bool_property enable , "on" + color_property foregroundcolor , color_values (0, 0, 0) + string_property label , "" + double_property position , 9 + bool_property separator , "off" + // Octave-specific properties + string_property fltk_label h , "" END_PROPERTIES - protected: +protected: void init (void) { } }; @@ -5050,9 +5050,9 @@ public: uimenu (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uimenu (void) { } @@ -5071,18 +5071,18 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uicontextmenu) - any_property __object__ , Matrix () - callback_property callback , Matrix () - array_property position , Matrix (1, 2, 0.0) +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uicontextmenu) + any_property __object__ , Matrix () + callback_property callback , Matrix () + array_property position , Matrix (1, 2, 0.0) END_PROPERTIES - protected: +protected: void init (void) { position.add_constraint (dim_vector (1, 2)); @@ -5097,9 +5097,9 @@ public: uicontextmenu (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uicontextmenu (void) { } @@ -5118,49 +5118,49 @@ public: class OCTINTERP_API properties : public base_properties { - public: - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - double get_fontsize_points (double box_pix_height = 0) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uicontrol) - any_property __object__ , Matrix () - color_property backgroundcolor , color_values (1, 1, 1) - callback_property callback , Matrix () - array_property cdata , Matrix () - bool_property clipping , "on" - radio_property enable , "{on}|inactive|off" - array_property extent rG , Matrix (1, 4, 0.0) - radio_property fontangle u , "{normal}|italic|oblique" - string_property fontname u , OCTAVE_DEFAULT_FONTNAME - double_property fontsize u , 10 - radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" - radio_property fontweight u , "light|{normal}|demi|bold" - color_property foregroundcolor , color_values (0, 0, 0) - radio_property horizontalalignment , "left|{center}|right" - callback_property keypressfcn , Matrix () - double_property listboxtop , 1 - double_property max , 1 - double_property min , 0 - array_property position , default_control_position () - array_property sliderstep , default_control_sliderstep () - string_array_property string u , "" - radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|text|slider|frame|listbox|popupmenu" - string_property tooltipstring , "" - radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters" - row_vector_property value , Matrix (1, 1, 1.0) - radio_property verticalalignment , "top|{middle}|bottom" +public: + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + double get_fontsize_points (double box_pix_height = 0) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uicontrol) + any_property __object__ , Matrix () + color_property backgroundcolor , color_values (1, 1, 1) + callback_property callback , Matrix () + array_property cdata , Matrix () + bool_property clipping , "on" + radio_property enable , "{on}|inactive|off" + array_property extent rG , Matrix (1, 4, 0.0) + radio_property fontangle u , "{normal}|italic|oblique" + string_property fontname u , OCTAVE_DEFAULT_FONTNAME + double_property fontsize u , 10 + radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" + radio_property fontweight u , "light|{normal}|demi|bold" + color_property foregroundcolor , color_values (0, 0, 0) + radio_property horizontalalignment , "left|{center}|right" + callback_property keypressfcn , Matrix () + double_property listboxtop , 1 + double_property max , 1 + double_property min , 0 + array_property position , default_control_position () + array_property sliderstep , default_control_sliderstep () + string_array_property string u , "" + radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|text|slider|frame|listbox|popupmenu" + string_property tooltipstring , "" + radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters" + row_vector_property value , Matrix (1, 1, 1.0) + radio_property verticalalignment , "top|{middle}|bottom" END_PROPERTIES - private: +private: std::string cached_units; - protected: +protected: void init (void) { cdata.add_constraint ("double"); @@ -5171,7 +5171,7 @@ sliderstep.add_constraint (dim_vector (1, 2)); cached_units = get_units (); } - + void update_text_extent (void); void update_string (void) { update_text_extent (); } @@ -5191,9 +5191,9 @@ public: uicontrol (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uicontrol (void) { } @@ -5211,42 +5211,42 @@ public: class OCTINTERP_API properties : public base_properties { - public: - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - double get_fontsize_points (double box_pix_height = 0) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uipanel) - any_property __object__ , Matrix () - color_property backgroundcolor , color_values (1, 1, 1) - radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line" - double_property borderwidth , 1 - radio_property fontangle , "{normal}|italic|oblique" - string_property fontname , OCTAVE_DEFAULT_FONTNAME - double_property fontsize , 10 - radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" - radio_property fontweight , "light|{normal}|demi|bold" - color_property foregroundcolor , color_values (0, 0, 0) - color_property highlightcolor , color_values (1, 1, 1) - array_property position , default_panel_position () - callback_property resizefcn , Matrix () - color_property shadowcolor , color_values (0, 0, 0) - string_property title , "" - radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom" - radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" +public: + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + double get_fontsize_points (double box_pix_height = 0) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uipanel) + any_property __object__ , Matrix () + color_property backgroundcolor , color_values (1, 1, 1) + radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line" + double_property borderwidth , 1 + radio_property fontangle , "{normal}|italic|oblique" + string_property fontname , OCTAVE_DEFAULT_FONTNAME + double_property fontsize , 10 + radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" + radio_property fontweight , "light|{normal}|demi|bold" + color_property foregroundcolor , color_values (0, 0, 0) + color_property highlightcolor , color_values (1, 1, 1) + array_property position , default_panel_position () + callback_property resizefcn , Matrix () + color_property shadowcolor , color_values (0, 0, 0) + string_property title , "" + radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom" + radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" END_PROPERTIES - protected: +protected: void init (void) { position.add_constraint (dim_vector (1, 4)); } - + void update_units (const caseless_str& old_units); void update_fontunits (const caseless_str& old_units); @@ -5258,9 +5258,9 @@ public: uipanel (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uipanel (void) { } @@ -5278,16 +5278,16 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uitoolbar) - any_property __object__ , Matrix () +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uitoolbar) + any_property __object__ , Matrix () END_PROPERTIES - protected: +protected: void init (void) { } }; @@ -5298,55 +5298,55 @@ public: uitoolbar (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uitoolbar (void) { } void override_defaults (base_graphics_object& obj) - { - // Allow parent (figure) to override first (properties knows how - // to find the parent object). - xproperties.override_defaults (obj); - - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Allow parent (figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - if (name.compare ("default", 7)) - retval = get_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const; octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } base_properties& get_properties (void) { return xproperties; } @@ -5367,21 +5367,21 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uipushtool) - any_property __object__ , Matrix () - array_property cdata , Matrix () - callback_property clickedcallback , Matrix () - bool_property enable , "on" - bool_property separator , "off" - string_property tooltipstring , "" +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uipushtool) + any_property __object__ , Matrix () + array_property cdata , Matrix () + callback_property clickedcallback , Matrix () + bool_property enable , "on" + bool_property separator , "off" + string_property tooltipstring , "" END_PROPERTIES - protected: +protected: void init (void) { cdata.add_constraint ("double"); @@ -5397,9 +5397,9 @@ public: uipushtool (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uipushtool (void) { } @@ -5418,24 +5418,24 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uitoggletool) - any_property __object__ , Matrix () - array_property cdata , Matrix () - callback_property clickedcallback , Matrix () - bool_property enable , "on" - callback_property offcallback , Matrix () - callback_property oncallback , Matrix () - bool_property separator , "off" - bool_property state , "off" - string_property tooltipstring , "" +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uitoggletool) + any_property __object__ , Matrix () + array_property cdata , Matrix () + callback_property clickedcallback , Matrix () + bool_property enable , "on" + callback_property offcallback , Matrix () + callback_property oncallback , Matrix () + bool_property separator , "off" + bool_property state , "off" + string_property tooltipstring , "" END_PROPERTIES - protected: +protected: void init (void) { cdata.add_constraint ("double"); @@ -5451,9 +5451,9 @@ public: uitoggletool (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uitoggletool (void) { } @@ -5503,9 +5503,9 @@ graphics_event (void) : rep (0) { } graphics_event (const graphics_event& e) : rep (e.rep) - { - rep->count++; - } + { + rep->count++; + } ~graphics_event (void) { @@ -5535,22 +5535,22 @@ { return (rep != 0); } static graphics_event - create_callback_event (const graphics_handle& h, - const std::string& name, - const octave_value& data = Matrix ()); - - static graphics_event - create_callback_event (const graphics_handle& h, - const octave_value& cb, - const octave_value& data = Matrix ()); + create_callback_event (const graphics_handle& h, + const std::string& name, + const octave_value& data = Matrix ()); static graphics_event - create_function_event (event_fcn fcn, void *data = 0); + create_callback_event (const graphics_handle& h, + const octave_value& cb, + const octave_value& data = Matrix ()); static graphics_event - create_set_event (const graphics_handle& h, const std::string& name, - const octave_value& value, - bool notify_toolkit = true); + create_function_event (event_fcn fcn, void *data = 0); + + static graphics_event + create_set_event (const graphics_handle& h, const std::string& name, + const octave_value& value, + bool notify_toolkit = true); private: base_graphics_event *rep; }; @@ -5566,201 +5566,201 @@ static void create_instance (void); static bool instance_ok (void) - { - bool retval = true; - - if (! instance) - create_instance (); - - if (! instance) - { - ::error ("unable to create gh_manager!"); - - retval = false; - } - - return retval; - } + { + bool retval = true; + + if (! instance) + create_instance (); + + if (! instance) + { + ::error ("unable to create gh_manager!"); + + retval = false; + } + + return retval; + } static void cleanup_instance (void) { delete instance; instance = 0; } static graphics_handle get_handle (bool integer_figure_handle) - { - return instance_ok () - ? instance->do_get_handle (integer_figure_handle) : graphics_handle (); - } + { + return instance_ok () + ? instance->do_get_handle (integer_figure_handle) : graphics_handle (); + } static void free (const graphics_handle& h) - { - if (instance_ok ()) - instance->do_free (h); - } + { + if (instance_ok ()) + instance->do_free (h); + } static void renumber_figure (const graphics_handle& old_gh, const graphics_handle& new_gh) - { - if (instance_ok ()) - instance->do_renumber_figure (old_gh, new_gh); - } + { + if (instance_ok ()) + instance->do_renumber_figure (old_gh, new_gh); + } static graphics_handle lookup (double val) - { - return instance_ok () ? instance->do_lookup (val) : graphics_handle (); - } + { + return instance_ok () ? instance->do_lookup (val) : graphics_handle (); + } static graphics_handle lookup (const octave_value& val) - { - return val.is_real_scalar () - ? lookup (val.double_value ()) : graphics_handle (); - } + { + return val.is_real_scalar () + ? lookup (val.double_value ()) : graphics_handle (); + } static graphics_object get_object (double val) - { - return get_object (lookup (val)); - } + { + return get_object (lookup (val)); + } static graphics_object get_object (const graphics_handle& h) - { - return instance_ok () ? instance->do_get_object (h) : graphics_object (); - } + { + return instance_ok () ? instance->do_get_object (h) : graphics_object (); + } static graphics_handle - make_graphics_handle (const std::string& go_name, - const graphics_handle& parent, - bool integer_figure_handle = false, - bool do_createfcn = true, - bool do_notify_toolkit = true) - { - return instance_ok () - ? instance->do_make_graphics_handle (go_name, parent, - integer_figure_handle, - do_createfcn, do_notify_toolkit) - : graphics_handle (); - } + make_graphics_handle (const std::string& go_name, + const graphics_handle& parent, + bool integer_figure_handle = false, + bool do_createfcn = true, + bool do_notify_toolkit = true) + { + return instance_ok () + ? instance->do_make_graphics_handle (go_name, parent, + integer_figure_handle, + do_createfcn, do_notify_toolkit) + : graphics_handle (); + } static graphics_handle make_figure_handle (double val, bool do_notify_toolkit = true) - { - return instance_ok () - ? instance->do_make_figure_handle (val, do_notify_toolkit) - : graphics_handle (); - } + { + return instance_ok () + ? instance->do_make_figure_handle (val, do_notify_toolkit) + : graphics_handle (); + } static void push_figure (const graphics_handle& h) - { - if (instance_ok ()) - instance->do_push_figure (h); - } + { + if (instance_ok ()) + instance->do_push_figure (h); + } static void pop_figure (const graphics_handle& h) - { - if (instance_ok ()) - instance->do_pop_figure (h); - } + { + if (instance_ok ()) + instance->do_pop_figure (h); + } static graphics_handle current_figure (void) - { - return instance_ok () - ? instance->do_current_figure () : graphics_handle (); - } + { + return instance_ok () + ? instance->do_current_figure () : graphics_handle (); + } static Matrix handle_list (bool show_hidden = false) - { - return instance_ok () - ? instance->do_handle_list (show_hidden) : Matrix (); - } + { + return instance_ok () + ? instance->do_handle_list (show_hidden) : Matrix (); + } static void lock (void) - { - if (instance_ok ()) - instance->do_lock (); - } + { + if (instance_ok ()) + instance->do_lock (); + } static bool try_lock (void) - { - if (instance_ok ()) - return instance->do_try_lock (); - else - return false; - } + { + if (instance_ok ()) + return instance->do_try_lock (); + else + return false; + } static void unlock (void) - { - if (instance_ok ()) - instance->do_unlock (); - } - + { + if (instance_ok ()) + instance->do_unlock (); + } + static Matrix figure_handle_list (bool show_hidden = false) - { - return instance_ok () - ? instance->do_figure_handle_list (show_hidden) : Matrix (); - } + { + return instance_ok () + ? instance->do_figure_handle_list (show_hidden) : Matrix (); + } static void execute_listener (const graphics_handle& h, const octave_value& l) - { - if (instance_ok ()) - instance->do_execute_listener (h, l); - } + { + if (instance_ok ()) + instance->do_execute_listener (h, l); + } static void execute_callback (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - { - octave_value cb; - - if (true) - { - gh_manager::auto_lock lock; - - graphics_object go = get_object (h); - - if (go.valid_object ()) - cb = go.get (name); - } - - if (! error_state) - execute_callback (h, cb, data); - } + { + octave_value cb; + + if (true) + { + gh_manager::auto_lock lock; + + graphics_object go = get_object (h); + + if (go.valid_object ()) + cb = go.get (name); + } + + if (! error_state) + execute_callback (h, cb, data); + } static void execute_callback (const graphics_handle& h, const octave_value& cb, const octave_value& data = Matrix ()) - { - if (instance_ok ()) - instance->do_execute_callback (h, cb, data); - } + { + if (instance_ok ()) + instance->do_execute_callback (h, cb, data); + } static void post_callback (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - { - if (instance_ok ()) - instance->do_post_callback (h, name, data); - } - + { + if (instance_ok ()) + instance->do_post_callback (h, name, data); + } + static void post_function (graphics_event::event_fcn fcn, void* data = 0) - { - if (instance_ok ()) - instance->do_post_function (fcn, data); - } + { + if (instance_ok ()) + instance->do_post_function (fcn, data); + } static void post_set (const graphics_handle& h, const std::string& name, const octave_value& value, bool notify_toolkit = true) - { - if (instance_ok ()) - instance->do_post_set (h, name, value, notify_toolkit); - } + { + if (instance_ok ()) + instance->do_post_set (h, name, value, notify_toolkit); + } static int process_events (void) - { - return (instance_ok () ? instance->do_process_events () : 0); - } + { + return (instance_ok () ? instance->do_process_events () : 0); + } static int flush_events (void) - { - return (instance_ok () ? instance->do_process_events (true) : 0); - } + { + return (instance_ok () ? instance->do_process_events (true) : 0); + } static void enable_event_processing (bool enable = true) { @@ -5769,39 +5769,39 @@ } static bool is_handle_visible (const graphics_handle& h) - { - bool retval = false; - - graphics_object go = get_object (h); - - if (go.valid_object ()) - retval = go.is_handle_visible (); - - return retval; - } + { + bool retval = false; + + graphics_object go = get_object (h); + + if (go.valid_object ()) + retval = go.is_handle_visible (); + + return retval; + } static void close_all_figures (void) - { - if (instance_ok ()) - instance->do_close_all_figures (); - } + { + if (instance_ok ()) + instance->do_close_all_figures (); + } public: class auto_lock : public octave_autolock { - public: - auto_lock (bool wait = true) - : octave_autolock (instance_ok () - ? instance->graphics_lock - : octave_mutex (), - wait) +public: + auto_lock (bool wait = true) + : octave_autolock (instance_ok () + ? instance->graphics_lock + : octave_mutex (), + wait) { } - private: - - // No copying! - auto_lock (const auto_lock&); - auto_lock& operator = (const auto_lock&); +private: + + // No copying! + auto_lock (const auto_lock&); + auto_lock& operator = (const auto_lock&); }; private: @@ -5850,18 +5850,18 @@ const graphics_handle& new_gh); graphics_handle do_lookup (double val) - { - iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val)); - - return (p != handle_map.end ()) ? p->first : graphics_handle (); - } + { + iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val)); + + return (p != handle_map.end ()) ? p->first : graphics_handle (); + } graphics_object do_get_object (const graphics_handle& h) - { - iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ()); - - return (p != handle_map.end ()) ? p->second : graphics_object (); - } + { + iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ()); + + return (p != handle_map.end ()) ? p->second : graphics_object (); + } graphics_handle do_make_graphics_handle (const std::string& go_name, const graphics_handle& p, @@ -5872,63 +5872,63 @@ graphics_handle do_make_figure_handle (double val, bool do_notify_toolkit); Matrix do_handle_list (bool show_hidden) - { - Matrix retval (1, handle_map.size ()); - - octave_idx_type i = 0; - for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++) - { - graphics_handle h = p->first; - - if (show_hidden || is_handle_visible (h)) - retval(i++) = h.value (); - } - - retval.resize (1, i); - - return retval; - } + { + Matrix retval (1, handle_map.size ()); + + octave_idx_type i = 0; + for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++) + { + graphics_handle h = p->first; + + if (show_hidden || is_handle_visible (h)) + retval(i++) = h.value (); + } + + retval.resize (1, i); + + return retval; + } Matrix do_figure_handle_list (bool show_hidden) - { - Matrix retval (1, figure_list.size ()); - - octave_idx_type i = 0; - for (const_figure_list_iterator p = figure_list.begin (); - p != figure_list.end (); - p++) - { - graphics_handle h = *p; - - if (show_hidden || is_handle_visible (h)) - retval(i++) = h.value (); - } - - retval.resize (1, i); - - return retval; - } + { + Matrix retval (1, figure_list.size ()); + + octave_idx_type i = 0; + for (const_figure_list_iterator p = figure_list.begin (); + p != figure_list.end (); + p++) + { + graphics_handle h = *p; + + if (show_hidden || is_handle_visible (h)) + retval(i++) = h.value (); + } + + retval.resize (1, i); + + return retval; + } void do_push_figure (const graphics_handle& h); void do_pop_figure (const graphics_handle& h); graphics_handle do_current_figure (void) const - { - graphics_handle retval; - - for (const_figure_list_iterator p = figure_list.begin (); - p != figure_list.end (); - p++) - { - graphics_handle h = *p; - - if (is_handle_visible (h)) - retval = h; - } - - return retval; - } + { + graphics_handle retval; + + for (const_figure_list_iterator p = figure_list.begin (); + p != figure_list.end (); + p++) + { + graphics_handle h = *p; + + if (is_handle_visible (h)) + retval = h; + } + + return retval; + } void do_lock (void) { graphics_lock.lock (); } @@ -5943,7 +5943,7 @@ void do_post_callback (const graphics_handle& h, const std::string name, const octave_value& data); - + void do_post_function (graphics_event::event_fcn fcn, void* fcn_data); void do_post_set (const graphics_handle& h, const std::string name, @@ -5954,10 +5954,10 @@ void do_close_all_figures (void); static void restore_gcbo (void) - { - if (instance_ok ()) - instance->do_restore_gcbo (); - } + { + if (instance_ok ()) + instance->do_restore_gcbo (); + } void do_restore_gcbo (void);
--- a/libinterp/corefcn/txt-eng-ft.cc +++ b/libinterp/corefcn/txt-eng-ft.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2009-2012 Michael Goffioul + Copyright (C) 2009-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -305,11 +305,12 @@ // --------------------------------------------------------------------------- -ft_render::ft_render (void) - : text_processor (), font (), bbox (1, 4, 0.0), halign (0), xoffset (0), - line_yoffset (0), yoffset (0), mode (MODE_BBOX), - color (dim_vector (1, 3), 0) +ft_render::ft_render (const caseless_str& argument) +: text_processor (), font (), bbox (1, 4, 0.0), halign (0), xoffset (0), + line_yoffset (0), yoffset (0), mode (MODE_BBOX), + color (dim_vector (1, 3), 0), interpret () { + interpret = argument; } ft_render::~ft_render (void) @@ -507,7 +508,7 @@ if (code != '\n' && (! glyph_index - || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT))) + || FT_Load_Glyph (face, glyph_index, FT_LOAD_DEFAULT))) { glyph_index = 0; gripe_missing_glyph (code); @@ -594,9 +595,6 @@ } else { - } - else - { Matrix& bb = line_bbox.back (); // If we have a previous glyph, use kerning information. @@ -673,8 +671,8 @@ if (font.is_valid ()) { - bbox(3) += (bbox(1) - desc); - bbox(1) = desc; + int h = font.get_face ()->size->metrics.height >> 6; + // Shifting the baseline by 2/3 the font height seems to produce // decent result. yoffset -= (h * 2) / 3; @@ -917,10 +915,9 @@ } Matrix -ft_render::get_extent (const std::string& txt, double rotation, - const caseless_str& interpreter) +ft_render::get_extent (const std::string& txt, double rotation) { - text_element *elt = text_parser::parse (txt, interpreter); + text_element *elt = text_parser::parse (txt, interpret); Matrix extent = get_extent (elt, rotation); delete elt; @@ -945,15 +942,14 @@ void ft_render::text_to_pixels (const std::string& txt, uint8NDArray& pixels_, Matrix& box, - int _halign, int valign, double rotation, - const caseless_str& interpreter) + int _halign, int valign, double rotation) { // FIXME: clip "rotation" between 0 and 360 int rot_mode = rotation_to_mode (rotation); halign = _halign; - text_element *elt = text_parser::parse (txt, interpreter); + text_element *elt = text_parser::parse (txt, interpret); pixels_ = render (elt, box, rot_mode); delete elt; @@ -998,8 +994,8 @@ } ft_render::ft_font::ft_font (const ft_font& ft) - : name (ft.name), weight (ft.weight), angle (ft.angle), size (ft.size), - face (0) +: name (ft.name), weight (ft.weight), angle (ft.angle), size (ft.size), + face (0) { #if HAVE_FT_REFERENCE_FACE FT_Face ft_face = ft.get_face ();
--- a/libinterp/corefcn/txt-eng-ft.h +++ b/libinterp/corefcn/txt-eng-ft.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2009-2012 Michael Goffioul + Copyright (C) 2009-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if ! defined (txt_eng_ft_h) #define txt_eng_ft_h 1 @@ -54,7 +54,7 @@ }; public: - ft_render (void); + ft_render (const caseless_str& argument); ~ft_render (void); @@ -88,8 +88,7 @@ int rotation = ROTATION_0); Matrix get_extent (text_element *elt, double rotation = 0.0); - Matrix get_extent (const std::string& txt, double rotation = 0.0, - const caseless_str& interpreter = "tex"); + Matrix get_extent (const std::string& txt, double rotation = 0.0); void set_font (const std::string& name, const std::string& weight, const std::string& angle, double size); @@ -100,8 +99,7 @@ void text_to_pixels (const std::string& txt, uint8NDArray& pixels_, Matrix& bbox, - int halign, int valign, double rotation, - const caseless_str& interpreter = "tex"); + int halign, int valign, double rotation); private: int rotation_to_mode (double rotation) const; @@ -116,42 +114,42 @@ // reference to the font objects loaded by freetype. class ft_font { - public: - ft_font (void) - : name (), weight (), angle (), size (0), face (0) { } + public: + ft_font (void) + : name (), weight (), angle (), size (0), face (0) { } - ft_font (const std::string& nm, const std::string& wt, - const std::string& ang, double sz, FT_Face f = 0) - : name (nm), weight (wt), angle (ang), size (sz), face (f) { } + ft_font (const std::string& nm, const std::string& wt, + const std::string& ang, double sz, FT_Face f = 0) + : name (nm), weight (wt), angle (ang), size (sz), face (f) { } - ft_font (const ft_font& ft); + ft_font (const ft_font& ft); - ~ft_font (void) - { - if (face) - FT_Done_Face (face); - } + ~ft_font (void) + { + if (face) + FT_Done_Face (face); + } - ft_font& operator = (const ft_font& ft); + ft_font& operator = (const ft_font& ft); - bool is_valid (void) const { return get_face (); } + bool is_valid (void) const { return get_face (); } - std::string get_name (void) const { return name; } + std::string get_name (void) const { return name; } - std::string get_weight (void) const { return weight; } + std::string get_weight (void) const { return weight; } - std::string get_angle (void) const { return angle; } + std::string get_angle (void) const { return angle; } - double get_size (void) const { return size; } + double get_size (void) const { return size; } - FT_Face get_face (void) const; + FT_Face get_face (void) const; - private: - std::string name; - std::string weight; - std::string angle; - double size; - mutable FT_Face face; + private: + std::string name; + std::string weight; + std::string angle; + double size; + mutable FT_Face face; }; void push_new_line (void); @@ -202,6 +200,9 @@ // The base color of the rendered text. uint8NDArray color; + + // Current interpreter used + caseless_str interpret; }; #endif // HAVE_FREETYPE
--- a/libinterp/corefcn/txt-eng.cc +++ b/libinterp/corefcn/txt-eng.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2013 Michael Goffioul + Copyright (C) 2013 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #ifdef HAVE_CONFIG_H #include <config.h>
--- a/libinterp/corefcn/txt-eng.h +++ b/libinterp/corefcn/txt-eng.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2009-2012 Michael Goffioul + Copyright (C) 2009-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if ! defined (txt_eng_h) #define txt_eng_h 1
--- a/libinterp/corefcn/txt-latex.cc +++ b/libinterp/corefcn/txt-latex.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2013 Andrej Lojdl + Copyright (C) 2013 Andrej Lojdl -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -193,12 +193,12 @@ { png_byte* ptr = &(row[j*4]); - if(ptr[0] < 30 && ptr[1] < 30 && ptr[2] < 30 ) + if(ptr[0] < 50 && ptr[1] < 50 && ptr[2] < 50 ) { data(0,j,i) = red; data(1,j,i) = green; data(2,j,i) = blue; - data(3,j,i) = 255; + data(3,j,i) = ptr[3]; } else {
--- a/libinterp/corefcn/txt-latex.h +++ b/libinterp/corefcn/txt-latex.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2013 Andrej Lojdl + Copyright (C) 2013 Andrej Lojdl -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if ! defined (txt_latex_h) #define txt_latex_h 1
--- a/libinterp/corefcn/txt-render.cc +++ b/libinterp/corefcn/txt-render.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2013 Andrej Lojdl + Copyright (C) 2013 Andrej Lojdl -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -33,8 +33,8 @@ #include "oct-refcount.h" dummy_render::dummy_render (void) -: bbox (1, 4, 0.0),red (0),green (0),blue (0) {} -dummy_render::~dummy_render (void) {} + : bbox (1, 4, 0.0),red (0),green (0),blue (0) {} + dummy_render::~dummy_render (void) {} void dummy_render::set_font (const std::string& name, const std::string& weight, @@ -71,12 +71,12 @@ #if ENABLE_LATEX rep = new latex_render (); #else - rep = new dummy_render (); + rep = new dummy_render (); #endif else { #if HAVE_FREETYPE - rep = new ft_render (); + rep = new ft_render (s); #else rep = new dummy_render (); #endif
--- a/libinterp/corefcn/txt-render.h +++ b/libinterp/corefcn/txt-render.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2013 Andrej Lojdl + Copyright (C) 2013 Andrej Lojdl -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if ! defined(txt_render_h) #define txt_render_h 1 @@ -81,7 +81,7 @@ Matrix get_extent (text_element *elt, double rotation = 0.0); Matrix get_extent (const std::string& txt, double rotation = 0.0); - + private: Matrix bbox; uint8NDArray pixels;