Mercurial > octave
changeset 25273:ac6ba9f2fa41
Add new Figure graphic property "Number" (bug #53343).
* NEWS: Announce new graphics property.
* genprops.awk: Fix a typo in a comment.
* graphics.cc (figure::properties::get_number): New function.
* graphics.in.h: Add new read-only "number" property to figures with an
external function to implement it..
* struct2hdl.m: Add read-only property "number" to list of excluded read-only
properties for figure objects.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 17 Apr 2018 12:48:33 -0700 |
parents | 49a8d0a2d7ae |
children | 9eb3755b419b |
files | NEWS libinterp/corefcn/genprops.awk libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h scripts/plot/util/struct2hdl.m |
diffstat | 5 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Apr 17 12:05:17 2018 -0700 +++ b/NEWS Tue Apr 17 12:48:33 2018 -0700 @@ -5,6 +5,11 @@ or "skew" to calculate the symmetric or skew-symmetric property of a matrix. Performance has also been increased. + ** Figure graphic objects have a new property "Number" which is + read-only and will return the handle (number) of the figure. + However, if the property "IntegerHandle" has been set to "off" then + the property will return an empty matrix ([]). + ** Deprecated functions. The following functions have been deprecated in Octave 5.0 and will
--- a/libinterp/corefcn/genprops.awk Tue Apr 17 12:05:17 2018 -0700 +++ b/libinterp/corefcn/genprops.awk Tue Apr 17 12:48:33 2018 -0700 @@ -137,7 +137,7 @@ ## ## f: The property does not have any factory default value. ## -## The 'o' and 'O' qualifiers are only useful when the the property type +## The 'o' and 'O' qualifiers are only useful when the property type ## is something other than octave_value. ## simple accessor
--- a/libinterp/corefcn/graphics.cc Tue Apr 17 12:05:17 2018 -0700 +++ b/libinterp/corefcn/graphics.cc Tue Apr 17 12:48:33 2018 -0700 @@ -3853,6 +3853,15 @@ } } +octave_value +figure::properties::get_number (void) const +{ + if (integerhandle.is_on ()) + return __myhandle__.value (); + else + return Matrix (); +} + graphics_toolkit figure::properties::get_toolkit (void) const {
--- a/libinterp/corefcn/graphics.in.h Tue Apr 17 12:05:17 2018 -0700 +++ b/libinterp/corefcn/graphics.in.h Tue Apr 17 12:48:33 2018 -0700 @@ -3124,8 +3124,7 @@ callback_property keyreleasefcn , Matrix () radio_property menubar , "{figure}|none" string_property name , "" - // FIXME: Need RO property which returns current figure number. - // double_property number r , + array_property number rG , Matrix () radio_property nextplot , "{add}|new|replace|replacechildren" bool_property numbertitle , "on" array_property outerposition s , Matrix (1, 4, -1.0)
--- a/scripts/plot/util/struct2hdl.m Tue Apr 17 12:05:17 2018 -0700 +++ b/scripts/plot/util/struct2hdl.m Tue Apr 17 12:48:33 2018 -0700 @@ -130,7 +130,7 @@ h = figure (); s.properties = rmfield (s.properties, ... {"currentaxes", "currentcharacter", ... - "currentobject", "currentpoint"}); + "currentobject", "currentpoint", "number"}); elseif (strcmp (s.type, "axes")) ## legends and colorbars are "transformed" in to normal axes ## if hilev is not requested