Mercurial > octave
comparison libinterp/corefcn/graphics.cc @ 31607:aac27ad79be6 stable
maint: Re-indent code after switch to using namespace macros.
* build-env.h, build-env.in.cc, Cell.h, __betainc__.cc, __eigs__.cc,
__ftp__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __magick_read__.cc,
__pchip_deriv__.cc, amd.cc, base-text-renderer.cc, base-text-renderer.h,
besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.h, call-stack.cc,
call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, dasrt.cc, data.cc,
debug.cc, defaults.cc, defaults.h, det.cc, display.cc, display.h, dlmread.cc,
dynamic-ld.cc, dynamic-ld.h, ellipj.cc, environment.cc, environment.h,
error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h,
event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc,
file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h,
gcd.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h,
graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, gsvd.cc, gtk-manager.cc,
gtk-manager.h, help.cc, help.h, hook-fcn.cc, hook-fcn.h, input.cc, input.h,
interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h,
inv.cc, jsondecode.cc, jsonencode.cc, latex-text-renderer.cc,
latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h,
lookup.cc, ls-hdf5.cc, ls-mat4.cc, ls-mat5.cc, lsode.cc, lu.cc, mappers.cc,
matrix_type.cc, max.cc, mex.cc, mexproto.h, mxarray.h, mxtypes.in.h,
oct-errno.in.cc, oct-hdf5-types.cc, oct-hist.cc, oct-hist.h, oct-map.cc,
oct-map.h, oct-opengl.h, oct-prcstrm.h, oct-process.cc, oct-process.h,
oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.h,
octave-default-image.h, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc,
pow2.cc, pr-output.cc, psi.cc, qr.cc, quadcc.cc, rand.cc, regexp.cc,
settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xpow.cc,
sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfns.cc, svd.cc,
syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h,
symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h,
text-renderer.cc, text-renderer.h, time.cc, toplev.cc, typecast.cc,
url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h,
variables.cc, variables.h, xdiv.cc, __delaunayn__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audioread.cc, convhulln.cc,
gzip.cc, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc,
cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h,
cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h,
cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc,
ov-base-mat.h, ov-base-scalar.cc, ov-base.cc, ov-base.h, ov-bool-mat.cc,
ov-bool-mat.h, ov-bool-sparse.cc, ov-bool.cc, ov-builtin.h, ov-cell.cc,
ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h,
ov-complex.cc, ov-cx-diag.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.cc,
ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-float.cc,
ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc, ov-flt-re-diag.cc,
ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-java.cc, ov-lazy-idx.cc,
ov-legacy-range.cc, ov-magic-int.cc, ov-mex-fcn.cc, ov-mex-fcn.h,
ov-null-mat.cc, ov-perm.cc, ov-range.cc, ov-re-diag.cc, ov-re-mat.cc,
ov-re-mat.h, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc,
ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.h,
octave.cc, octave.h, op-b-sbm.cc, op-bm-sbm.cc, op-cs-scm.cc, op-fm-fcm.cc,
op-fs-fcm.cc, op-s-scm.cc, op-scm-cs.cc, op-scm-s.cc, op-sm-cs.cc, ops.h,
anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h,
comment-list.cc, comment-list.h, filepos.h, lex.h, oct-lvalue.cc, oct-lvalue.h,
parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h,
pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h,
pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc,
pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc,
pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h,
pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h,
pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h,
pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h,
pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h,
pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h,
pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h,
pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h,
idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h,
aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h,
gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc,
lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h,
oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc,
oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h,
randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h,
sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc,
sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h,
file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h,
lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h,
oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc,
oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h,
action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h,
cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h,
lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h,
lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc,
oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc,
oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc,
oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc,
pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc,
url-transfer.h:
Re-indent code after switch to using namespace macros.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 01 Dec 2022 18:02:15 -0800 |
parents | e88a07dec498 |
children | a36035adefeb 597f3ee61a48 |
comparison
equal
deleted
inserted
replaced
31605:e88a07dec498 | 31607:aac27ad79be6 |
---|---|
1070 else if (cdata.is_uint32_type ()) | 1070 else if (cdata.is_uint32_type ()) |
1071 CONVERT_CDATA_1 (uint32NDArray, uint32_, false); | 1071 CONVERT_CDATA_1 (uint32NDArray, uint32_, false); |
1072 else if (cdata.is_uint64_type ()) | 1072 else if (cdata.is_uint64_type ()) |
1073 CONVERT_CDATA_1 (uint64NDArray, uint64_, false); | 1073 CONVERT_CDATA_1 (uint64NDArray, uint64_, false); |
1074 else if (cdata.is_double_type ()) | 1074 else if (cdata.is_double_type ()) |
1075 CONVERT_CDATA_1 (NDArray, , true); | 1075 CONVERT_CDATA_1 (NDArray,, true); |
1076 else if (cdata.is_single_type ()) | 1076 else if (cdata.is_single_type ()) |
1077 CONVERT_CDATA_1 (FloatNDArray, float_, true); | 1077 CONVERT_CDATA_1 (FloatNDArray, float_, true); |
1078 else if (cdata.islogical ()) | 1078 else if (cdata.islogical ()) |
1079 CONVERT_CDATA_1 (boolNDArray, bool_, false); | 1079 CONVERT_CDATA_1 (boolNDArray, bool_, false); |
1080 else | 1080 else |
1697 return flag; \ | 1697 return flag; \ |
1698 } \ | 1698 } \ |
1699 } | 1699 } |
1700 | 1700 |
1701 if (m_data.is_double_type () || m_data.islogical ()) | 1701 if (m_data.is_double_type () || m_data.islogical ()) |
1702 CHECK_ARRAY_EQUAL (double, , NDArray) | 1702 CHECK_ARRAY_EQUAL (double,, NDArray) |
1703 else if (m_data.is_single_type ()) | 1703 else if (m_data.is_single_type ()) |
1704 CHECK_ARRAY_EQUAL (float, float_, FloatNDArray) | 1704 CHECK_ARRAY_EQUAL (float, float_, FloatNDArray) |
1705 else if (m_data.is_int8_type ()) | 1705 else if (m_data.is_int8_type ()) |
1706 CHECK_ARRAY_EQUAL (octave_int8, int8_, int8NDArray) | 1706 CHECK_ARRAY_EQUAL (octave_int8, int8_, int8NDArray) |
1707 else if (m_data.is_int16_type ()) | 1707 else if (m_data.is_int16_type ()) |
1708 CHECK_ARRAY_EQUAL (octave_int16, int16_, int16NDArray) | 1708 CHECK_ARRAY_EQUAL (octave_int16, int16_, int16NDArray) |
1709 else if (m_data.is_int32_type ()) | 1709 else if (m_data.is_int32_type ()) |
1710 CHECK_ARRAY_EQUAL (octave_int32, int32_, int32NDArray) | 1710 CHECK_ARRAY_EQUAL (octave_int32, int32_, int32NDArray) |
1711 else if (m_data.is_int64_type ()) | 1711 else if (m_data.is_int64_type ()) |
1712 CHECK_ARRAY_EQUAL (octave_int64, int64_, int64NDArray) | 1712 CHECK_ARRAY_EQUAL (octave_int64, int64_, int64NDArray) |
1713 else if (m_data.is_uint8_type ()) | 1713 else if (m_data.is_uint8_type ()) |
1714 CHECK_ARRAY_EQUAL (octave_uint8, uint8_, uint8NDArray) | 1714 CHECK_ARRAY_EQUAL (octave_uint8, uint8_, uint8NDArray) |
1715 else if (m_data.is_uint16_type ()) | 1715 else if (m_data.is_uint16_type ()) |
1716 CHECK_ARRAY_EQUAL (octave_uint16, uint16_, uint16NDArray) | 1716 CHECK_ARRAY_EQUAL (octave_uint16, uint16_, uint16NDArray) |
1717 else if (m_data.is_uint32_type ()) | 1717 else if (m_data.is_uint32_type ()) |
1718 CHECK_ARRAY_EQUAL (octave_uint32, uint32_, uint32NDArray) | 1718 CHECK_ARRAY_EQUAL (octave_uint32, uint32_, uint32NDArray) |
1719 else if (m_data.is_uint64_type ()) | 1719 else if (m_data.is_uint64_type ()) |
1720 CHECK_ARRAY_EQUAL (octave_uint64, uint64_, uint64NDArray) | 1720 CHECK_ARRAY_EQUAL (octave_uint64, uint64_, uint64NDArray) |
1721 } | 1721 } |
1722 } | 1722 } |
1723 | 1723 |
1724 return false; | 1724 return false; |
1725 } | 1725 } |
1726 | 1726 |
1978 { | 1978 { |
1979 // We are executing a callback function, so allow handles that have | 1979 // We are executing a callback function, so allow handles that have |
1980 // their handlevisibility property set to "callback" to be visible. | 1980 // their handlevisibility property set to "callback" to be visible. |
1981 | 1981 |
1982 octave::unwind_action executing_callbacks_cleanup | 1982 octave::unwind_action executing_callbacks_cleanup |
1983 ([=] () { executing_callbacks.erase (this); }); | 1983 ([=] () { executing_callbacks.erase (this); }); |
1984 | 1984 |
1985 if (! executing_callbacks.contains (this)) | 1985 if (! executing_callbacks.contains (this)) |
1986 { | 1986 { |
1987 executing_callbacks.insert (this); | 1987 executing_callbacks.insert (this); |
1988 | 1988 |
2012 retval = property (new string_property (name, h, sv)); | 2012 retval = property (new string_property (name, h, sv)); |
2013 } | 2013 } |
2014 else if (type.compare ("any")) | 2014 else if (type.compare ("any")) |
2015 { | 2015 { |
2016 octave_value ov = (args.length () > 0 ? args(0) | 2016 octave_value ov = (args.length () > 0 ? args(0) |
2017 : octave_value (Matrix ())); | 2017 : octave_value (Matrix ())); |
2018 | 2018 |
2019 retval = property (new any_property (name, h, ov)); | 2019 retval = property (new any_property (name, h, ov)); |
2020 } | 2020 } |
2021 else if (type.compare ("radio")) | 2021 else if (type.compare ("radio")) |
2022 { | 2022 { |
2023 if (args.length () < 1) | 2023 if (args.length () < 1) |
2024 error ("addproperty: missing possible values for radio property"); | 2024 error ("addproperty: missing possible values for radio property"); |
2025 | 2025 |
2026 std::string sv = args(0).xstring_value ("addproperty: argument for radio property must be a string"); | 2026 std::string sv = args( |
2027 0).xstring_value ("addproperty: argument for radio property must be a string"); | |
2027 | 2028 |
2028 retval = property (new radio_property (name, h, sv)); | 2029 retval = property (new radio_property (name, h, sv)); |
2029 | 2030 |
2030 if (args.length () > 1) | 2031 if (args.length () > 1) |
2031 retval.set (args(1)); | 2032 retval.set (args(1)); |
2037 retval = property (new double_property (name, h, dv)); | 2038 retval = property (new double_property (name, h, dv)); |
2038 } | 2039 } |
2039 else if (type.compare ("handle")) | 2040 else if (type.compare ("handle")) |
2040 { | 2041 { |
2041 double hv = (args.length () > 0 ? args(0).double_value () | 2042 double hv = (args.length () > 0 ? args(0).double_value () |
2042 : octave::numeric_limits<double>::NaN ()); | 2043 : octave::numeric_limits<double>::NaN ()); |
2043 | 2044 |
2044 graphics_handle gh (hv); | 2045 graphics_handle gh (hv); |
2045 | 2046 |
2046 retval = property (new handle_property (name, h, gh)); | 2047 retval = property (new handle_property (name, h, gh)); |
2047 } | 2048 } |
2933 | 2934 |
2934 m_handle_map.erase (p); | 2935 m_handle_map.erase (p); |
2935 | 2936 |
2936 if (h.value () < 0) | 2937 if (h.value () < 0) |
2937 m_handle_free_list.insert | 2938 m_handle_free_list.insert |
2938 (std::ceil (h.value ()) - make_handle_fraction ()); | 2939 (std::ceil (h.value ()) - make_handle_fraction ()); |
2939 } | 2940 } |
2940 } | 2941 } |
2941 | 2942 |
2942 void | 2943 void |
2943 gh_manager::renumber_figure (const graphics_handle& old_gh, | 2944 gh_manager::renumber_figure (const graphics_handle& old_gh, |
3039 gcf (void) | 3040 gcf (void) |
3040 { | 3041 { |
3041 octave_value val = xget (0, "currentfigure"); | 3042 octave_value val = xget (0, "currentfigure"); |
3042 | 3043 |
3043 return val.isempty () ? octave::numeric_limits<double>::NaN () | 3044 return val.isempty () ? octave::numeric_limits<double>::NaN () |
3044 : val.double_value (); | 3045 : val.double_value (); |
3045 } | 3046 } |
3046 | 3047 |
3047 // This function is NOT equivalent to the scripting language function gca. | 3048 // This function is NOT equivalent to the scripting language function gca. |
3048 graphics_handle | 3049 graphics_handle |
3049 gca (void) | 3050 gca (void) |
3050 { | 3051 { |
3051 octave_value val = xget (gcf (), "currentaxes"); | 3052 octave_value val = xget (gcf (), "currentaxes"); |
3052 | 3053 |
3053 return val.isempty () ? octave::numeric_limits<double>::NaN () | 3054 return val.isempty () ? octave::numeric_limits<double>::NaN () |
3054 : val.double_value (); | 3055 : val.double_value (); |
3055 } | 3056 } |
3056 | 3057 |
3057 static void | 3058 static void |
3058 delete_graphics_object (const graphics_handle& h, bool from_root = false) | 3059 delete_graphics_object (const graphics_handle& h, bool from_root = false) |
3059 { | 3060 { |
3683 { | 3684 { |
3684 if (go.isa (chtype)) | 3685 if (go.isa (chtype)) |
3685 children_list.push_back (go); | 3686 children_list.push_back (go); |
3686 else if (traverse && go.isa ("hggroup")) | 3687 else if (traverse && go.isa ("hggroup")) |
3687 go.get_properties ().get_children_of_type (chtype, | 3688 go.get_properties ().get_children_of_type (chtype, |
3688 get_invisible, | 3689 get_invisible, |
3689 traverse, | 3690 traverse, |
3690 children_list); | 3691 children_list); |
3691 } | 3692 } |
3692 } | 3693 } |
3693 } | 3694 } |
3694 } | 3695 } |
3695 | 3696 |
3709 parent_go.update_axis_limits (axis_type); | 3710 parent_go.update_axis_limits (axis_type); |
3710 } | 3711 } |
3711 | 3712 |
3712 void | 3713 void |
3713 base_graphics_object::update_axis_limits (const std::string& axis_type, | 3714 base_graphics_object::update_axis_limits (const std::string& axis_type, |
3714 const graphics_handle& h) | 3715 const graphics_handle& h) |
3715 { | 3716 { |
3716 if (! valid_object ()) | 3717 if (! valid_object ()) |
3717 error ("base_graphics_object::update_axis_limits: invalid graphics object"); | 3718 error ("base_graphics_object::update_axis_limits: invalid graphics object"); |
3718 | 3719 |
3719 gh_manager& gh_mgr = octave::__get_gh_manager__ (); | 3720 gh_manager& gh_mgr = octave::__get_gh_manager__ (); |
5143 m_sz = "linear"; | 5144 m_sz = "linear"; |
5144 | 5145 |
5145 calc_ticklabels (m_xtick, m_xticklabel, m_xscale.is ("log"), | 5146 calc_ticklabels (m_xtick, m_xticklabel, m_xscale.is ("log"), |
5146 xaxislocation_is ("origin"), | 5147 xaxislocation_is ("origin"), |
5147 m_yscale.is ("log") ? 2 : (yaxislocation_is ("origin") ? 0 : | 5148 m_yscale.is ("log") ? 2 : (yaxislocation_is ("origin") ? 0 : |
5148 (yaxislocation_is ("left") ? -1 : 1)), m_xlim); | 5149 (yaxislocation_is ("left") ? -1 : 1)), m_xlim); |
5149 calc_ticklabels (m_ytick, m_yticklabel, m_yscale.is ("log"), | 5150 calc_ticklabels (m_ytick, m_yticklabel, m_yscale.is ("log"), |
5150 yaxislocation_is ("origin"), | 5151 yaxislocation_is ("origin"), |
5151 m_xscale.is ("log") ? 2 : (xaxislocation_is ("origin") ? 0 : | 5152 m_xscale.is ("log") ? 2 : (xaxislocation_is ("origin") ? 0 : |
5152 (xaxislocation_is ("bottom") ? -1 : 1)), m_ylim); | 5153 (xaxislocation_is ("bottom") ? -1 : 1)), m_ylim); |
5153 calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), | 5154 calc_ticklabels (m_ztick, m_zticklabel, m_zscale.is ("log"), |
5154 false, 2, m_zlim); | 5155 false, 2, m_zlim); |
5155 | 5156 |
5156 xset (m_xlabel.handle_value (), "handlevisibility", "off"); | 5157 xset (m_xlabel.handle_value (), "handlevisibility", "off"); |
5157 xset (m_ylabel.handle_value (), "handlevisibility", "off"); | 5158 xset (m_ylabel.handle_value (), "handlevisibility", "off"); |
6351 m_zticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1)); | 6352 m_zticklen = ticksign * (mode2D ? ticklen(0) : ticklen(1)); |
6352 | 6353 |
6353 double offset = get___fontsize_points__ () / 2; | 6354 double offset = get___fontsize_points__ () / 2; |
6354 | 6355 |
6355 m_xtickoffset = (mode2D ? std::max (0., m_xticklen) : std::abs (m_xticklen)) + | 6356 m_xtickoffset = (mode2D ? std::max (0., m_xticklen) : std::abs (m_xticklen)) + |
6356 (m_xstate == AXE_HORZ_DIR ? offset*1.5 : offset); | 6357 (m_xstate == AXE_HORZ_DIR ? offset*1.5 : offset); |
6357 m_ytickoffset = (mode2D ? std::max (0., m_yticklen) : std::abs (m_yticklen)) + | 6358 m_ytickoffset = (mode2D ? std::max (0., m_yticklen) : std::abs (m_yticklen)) + |
6358 (m_ystate == AXE_HORZ_DIR ? offset*1.5 : offset); | 6359 (m_ystate == AXE_HORZ_DIR ? offset*1.5 : offset); |
6359 m_ztickoffset = (mode2D ? std::max (0., m_zticklen) : std::abs (m_zticklen)) + | 6360 m_ztickoffset = (mode2D ? std::max (0., m_zticklen) : std::abs (m_zticklen)) + |
6360 (m_zstate == AXE_HORZ_DIR ? offset*1.5 : offset); | 6361 (m_zstate == AXE_HORZ_DIR ? offset*1.5 : offset); |
6361 | 6362 |
6362 update_xlabel_position (); | 6363 update_xlabel_position (); |
6363 update_ylabel_position (); | 6364 update_ylabel_position (); |
6364 update_zlabel_position (); | 6365 update_zlabel_position (); |
6365 update_title_position (); | 6366 update_title_position (); |
6431 = reinterpret_cast<text::properties&> (go.get_properties ()); | 6432 = reinterpret_cast<text::properties&> (go.get_properties ()); |
6432 | 6433 |
6433 bool isempty = xlabel_props.get_string ().isempty (); | 6434 bool isempty = xlabel_props.get_string ().isempty (); |
6434 | 6435 |
6435 octave::unwind_protect_var<bool> | 6436 octave::unwind_protect_var<bool> |
6436 restore_var (updating_xlabel_position, true); | 6437 restore_var (updating_xlabel_position, true); |
6437 | 6438 |
6438 if (! isempty) | 6439 if (! isempty) |
6439 { | 6440 { |
6440 if (xlabel_props.horizontalalignmentmode_is ("auto")) | 6441 if (xlabel_props.horizontalalignmentmode_is ("auto")) |
6441 { | 6442 { |
6442 xlabel_props.set_horizontalalignment | 6443 xlabel_props.set_horizontalalignment |
6443 (m_xstate > AXE_DEPTH_DIR ? "center" | 6444 (m_xstate > AXE_DEPTH_DIR ? "center" |
6444 : (m_xyzSym ? "left" : "right")); | 6445 : (m_xyzSym ? "left" : "right")); |
6445 | 6446 |
6446 xlabel_props.set_horizontalalignmentmode ("auto"); | 6447 xlabel_props.set_horizontalalignmentmode ("auto"); |
6447 } | 6448 } |
6448 | 6449 |
6449 if (xlabel_props.verticalalignmentmode_is ("auto")) | 6450 if (xlabel_props.verticalalignmentmode_is ("auto")) |
6450 { | 6451 { |
6451 xlabel_props.set_verticalalignment | 6452 xlabel_props.set_verticalalignment |
6452 (m_xstate == AXE_VERT_DIR || m_x2Dtop ? "bottom" : "top"); | 6453 (m_xstate == AXE_VERT_DIR || m_x2Dtop ? "bottom" : "top"); |
6453 | 6454 |
6454 xlabel_props.set_verticalalignmentmode ("auto"); | 6455 xlabel_props.set_verticalalignmentmode ("auto"); |
6455 } | 6456 } |
6456 } | 6457 } |
6457 | 6458 |
6535 = reinterpret_cast<text::properties&> (go.get_properties ()); | 6536 = reinterpret_cast<text::properties&> (go.get_properties ()); |
6536 | 6537 |
6537 bool isempty = ylabel_props.get_string ().isempty (); | 6538 bool isempty = ylabel_props.get_string ().isempty (); |
6538 | 6539 |
6539 octave::unwind_protect_var<bool> | 6540 octave::unwind_protect_var<bool> |
6540 restore_var (updating_ylabel_position, true); | 6541 restore_var (updating_ylabel_position, true); |
6541 | 6542 |
6542 if (! isempty) | 6543 if (! isempty) |
6543 { | 6544 { |
6544 if (ylabel_props.horizontalalignmentmode_is ("auto")) | 6545 if (ylabel_props.horizontalalignmentmode_is ("auto")) |
6545 { | 6546 { |
6546 ylabel_props.set_horizontalalignment | 6547 ylabel_props.set_horizontalalignment |
6547 (m_ystate > AXE_DEPTH_DIR ? "center" | 6548 (m_ystate > AXE_DEPTH_DIR ? "center" |
6548 : (! m_xyzSym ? "left" : "right")); | 6549 : (! m_xyzSym ? "left" : "right")); |
6549 | 6550 |
6550 ylabel_props.set_horizontalalignmentmode ("auto"); | 6551 ylabel_props.set_horizontalalignmentmode ("auto"); |
6551 } | 6552 } |
6552 | 6553 |
6553 if (ylabel_props.verticalalignmentmode_is ("auto")) | 6554 if (ylabel_props.verticalalignmentmode_is ("auto")) |
6554 { | 6555 { |
6555 ylabel_props.set_verticalalignment | 6556 ylabel_props.set_verticalalignment |
6556 (m_ystate == AXE_VERT_DIR && ! m_y2Dright ? "bottom" : "top"); | 6557 (m_ystate == AXE_VERT_DIR && ! m_y2Dright ? "bottom" : "top"); |
6557 | 6558 |
6558 ylabel_props.set_verticalalignmentmode ("auto"); | 6559 ylabel_props.set_verticalalignmentmode ("auto"); |
6559 } | 6560 } |
6560 } | 6561 } |
6561 | 6562 |
6640 | 6641 |
6641 bool camAuto = cameraupvectormode_is ("auto"); | 6642 bool camAuto = cameraupvectormode_is ("auto"); |
6642 bool isempty = zlabel_props.get_string ().isempty (); | 6643 bool isempty = zlabel_props.get_string ().isempty (); |
6643 | 6644 |
6644 octave::unwind_protect_var<bool> | 6645 octave::unwind_protect_var<bool> |
6645 restore_updating_zlabel_position (updating_zlabel_position, true); | 6646 restore_updating_zlabel_position (updating_zlabel_position, true); |
6646 | 6647 |
6647 if (! isempty) | 6648 if (! isempty) |
6648 { | 6649 { |
6649 if (zlabel_props.horizontalalignmentmode_is ("auto")) | 6650 if (zlabel_props.horizontalalignmentmode_is ("auto")) |
6650 { | 6651 { |
6651 zlabel_props.set_horizontalalignment | 6652 zlabel_props.set_horizontalalignment |
6652 ((m_zstate > AXE_DEPTH_DIR || camAuto) ? "center" : "right"); | 6653 ((m_zstate > AXE_DEPTH_DIR || camAuto) ? "center" : "right"); |
6653 | 6654 |
6654 zlabel_props.set_horizontalalignmentmode ("auto"); | 6655 zlabel_props.set_horizontalalignmentmode ("auto"); |
6655 } | 6656 } |
6656 | 6657 |
6657 if (zlabel_props.verticalalignmentmode_is ("auto")) | 6658 if (zlabel_props.verticalalignmentmode_is ("auto")) |
6658 { | 6659 { |
6659 zlabel_props.set_verticalalignment | 6660 zlabel_props.set_verticalalignment |
6660 (m_zstate == AXE_VERT_DIR | 6661 (m_zstate == AXE_VERT_DIR |
6661 ? "bottom" : ((m_zSign || camAuto) ? "bottom" : "top")); | 6662 ? "bottom" : ((m_zSign || camAuto) ? "bottom" : "top")); |
6662 | 6663 |
6663 zlabel_props.set_verticalalignmentmode ("auto"); | 6664 zlabel_props.set_verticalalignmentmode ("auto"); |
6664 } | 6665 } |
6665 } | 6666 } |
6666 | 6667 |
6914 } | 6915 } |
6915 | 6916 |
6916 if (modified_limits) | 6917 if (modified_limits) |
6917 { | 6918 { |
6918 octave::unwind_protect_var<std::set<double>> | 6919 octave::unwind_protect_var<std::set<double>> |
6919 restore_var (updating_aspectratios); | 6920 restore_var (updating_aspectratios); |
6920 | 6921 |
6921 updating_aspectratios.insert (get___myhandle__ ().value ()); | 6922 updating_aspectratios.insert (get___myhandle__ ().value ()); |
6922 | 6923 |
6923 dx = pba(0) * da(0); | 6924 dx = pba(0) * da(0); |
6924 dy = pba(1) * da(1); | 6925 dy = pba(1) * da(1); |
7010 Matrix | 7011 Matrix |
7011 axes::properties::get_boundingbox (bool internal, | 7012 axes::properties::get_boundingbox (bool internal, |
7012 const Matrix& parent_pix_size) const | 7013 const Matrix& parent_pix_size) const |
7013 { | 7014 { |
7014 Matrix pos = (internal ? get_position ().matrix_value () | 7015 Matrix pos = (internal ? get_position ().matrix_value () |
7015 : get_outerposition ().matrix_value ()); | 7016 : get_outerposition ().matrix_value ()); |
7016 Matrix parent_size (parent_pix_size); | 7017 Matrix parent_size (parent_pix_size); |
7017 | 7018 |
7018 if (parent_size.isempty ()) | 7019 if (parent_size.isempty ()) |
7019 { | 7020 { |
7020 gh_manager& gh_mgr = octave::__get_gh_manager__ (); | 7021 gh_manager& gh_mgr = octave::__get_gh_manager__ (); |
7074 | 7075 |
7075 gh_manager& gh_mgr = octave::__get_gh_manager__ (); | 7076 gh_manager& gh_mgr = octave::__get_gh_manager__ (); |
7076 | 7077 |
7077 text::properties& text_props | 7078 text::properties& text_props |
7078 = reinterpret_cast<text::properties&> | 7079 = reinterpret_cast<text::properties&> |
7079 (gh_mgr.get_object (htext).get_properties ()); | 7080 (gh_mgr.get_object (htext).get_properties ()); |
7080 | 7081 |
7081 Matrix text_pos = text_props.get_data_position (); | 7082 Matrix text_pos = text_props.get_data_position (); |
7082 text_pos = xform.transform (text_pos(0), text_pos(1), text_pos(2)); | 7083 text_pos = xform.transform (text_pos(0), text_pos(1), text_pos(2)); |
7083 if (text_props.get_string ().isempty ()) | 7084 if (text_props.get_string ().isempty ()) |
7084 { | 7085 { |
8195 | 8196 |
8196 // minor ticks between, above, and below min and max ticks | 8197 // minor ticks between, above, and below min and max ticks |
8197 int n = (is_logscale ? 8 : 4); | 8198 int n = (is_logscale ? 8 : 4); |
8198 double mult_below = (is_logscale ? tmp_ticks(1) / tmp_ticks(0) : 1); | 8199 double mult_below = (is_logscale ? tmp_ticks(1) / tmp_ticks(0) : 1); |
8199 double mult_above = (is_logscale ? tmp_ticks(n_ticks-1) / tmp_ticks(n_ticks-2) | 8200 double mult_above = (is_logscale ? tmp_ticks(n_ticks-1) / tmp_ticks(n_ticks-2) |
8200 : 1); | 8201 : 1); |
8201 | 8202 |
8202 double d_below = (tmp_ticks(1) - tmp_ticks(0)) / mult_below / (n+1); | 8203 double d_below = (tmp_ticks(1) - tmp_ticks(0)) / mult_below / (n+1); |
8203 int n_below = static_cast<int> (std::floor ((tmp_ticks(0)-lo_lim) / d_below)); | 8204 int n_below = static_cast<int> (std::floor ((tmp_ticks(0)-lo_lim) / d_below)); |
8204 if (n_below < 0) | 8205 if (n_below < 0) |
8205 n_below = 0; | 8206 n_below = 0; |
8206 int n_between = n * (n_ticks - 1); | 8207 int n_between = n * (n_ticks - 1); |
8207 double d_above = (tmp_ticks(n_ticks-1) - tmp_ticks(n_ticks-2)) * mult_above | 8208 double d_above = (tmp_ticks(n_ticks-1) - tmp_ticks(n_ticks-2)) * mult_above |
8208 / (n+1); | 8209 / (n+1); |
8209 int n_above = static_cast<int> (std::floor ((hi_lim-tmp_ticks(n_ticks-1)) | 8210 int n_above = static_cast<int> (std::floor ((hi_lim-tmp_ticks(n_ticks-1)) |
8210 / d_above)); | 8211 / d_above)); |
8211 if (n_above < 0) | 8212 if (n_above < 0) |
8212 n_above = 0; | 8213 n_above = 0; |
8213 | 8214 |
8214 Matrix tmp_mticks (1, n_below + n_between + n_above); | 8215 Matrix tmp_mticks (1, n_below + n_between + n_above); |
8215 for (int i = 0; i < n_below; i++) | 8216 for (int i = 0; i < n_below; i++) |
8349 labels = c; | 8350 labels = c; |
8350 } | 8351 } |
8351 | 8352 |
8352 Matrix | 8353 Matrix |
8353 axes::properties::get_ticklabel_extents (const Matrix& ticks, | 8354 axes::properties::get_ticklabel_extents (const Matrix& ticks, |
8354 const string_vector& ticklabels, | 8355 const string_vector& ticklabels, |
8355 const Matrix& limits) | 8356 const Matrix& limits) |
8356 { | 8357 { |
8357 Matrix ext (1, 2, 0.0); | 8358 Matrix ext (1, 2, 0.0); |
8358 double wmax, hmax; | 8359 double wmax, hmax; |
8359 double dpr = device_pixel_ratio (get___myhandle__ ()); | 8360 double dpr = device_pixel_ratio (get___myhandle__ ()); |
8360 wmax = hmax = 0.0; | 8361 wmax = hmax = 0.0; |
8649 } | 8650 } |
8650 | 8651 |
8651 #undef FIX_LIMITS | 8652 #undef FIX_LIMITS |
8652 | 8653 |
8653 octave::unwind_protect_var<std::set<double>> | 8654 octave::unwind_protect_var<std::set<double>> |
8654 restore_var (updating_axis_limits); | 8655 restore_var (updating_axis_limits); |
8655 | 8656 |
8656 updating_axis_limits.insert (get_handle ().value ()); | 8657 updating_axis_limits.insert (get_handle ().value ()); |
8657 bool is_auto; | 8658 bool is_auto; |
8658 | 8659 |
8659 switch (update_type) | 8660 switch (update_type) |
8866 } | 8867 } |
8867 | 8868 |
8868 } | 8869 } |
8869 | 8870 |
8870 octave::unwind_protect_var<std::set<double>> | 8871 octave::unwind_protect_var<std::set<double>> |
8871 restore_var (updating_axis_limits); | 8872 restore_var (updating_axis_limits); |
8872 | 8873 |
8873 updating_axis_limits.insert (get_handle ().value ()); | 8874 updating_axis_limits.insert (get_handle ().value ()); |
8874 bool is_auto; | 8875 bool is_auto; |
8875 | 8876 |
8876 switch (update_type) | 8877 switch (update_type) |
9690 gh_manager& gh_mgr = octave::__get_gh_manager__ (); | 9691 gh_manager& gh_mgr = octave::__get_gh_manager__ (); |
9691 | 9692 |
9692 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); | 9693 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); |
9693 | 9694 |
9694 axes::properties& ax_props = dynamic_cast<axes::properties&> | 9695 axes::properties& ax_props = dynamic_cast<axes::properties&> |
9695 (go.get_ancestor ("axes").get_properties ()); | 9696 (go.get_ancestor ("axes").get_properties ()); |
9696 if (is_visible ()) | 9697 if (is_visible ()) |
9697 ax_props.increase_num_lights (); | 9698 ax_props.increase_num_lights (); |
9698 else | 9699 else |
9699 ax_props.decrease_num_lights (); | 9700 ax_props.decrease_num_lights (); |
9700 } | 9701 } |
9707 gh_manager& gh_mgr = octave::__get_gh_manager__ (); | 9708 gh_manager& gh_mgr = octave::__get_gh_manager__ (); |
9708 | 9709 |
9709 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); | 9710 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); |
9710 | 9711 |
9711 axes::properties& ax_props = dynamic_cast<axes::properties&> | 9712 axes::properties& ax_props = dynamic_cast<axes::properties&> |
9712 (go.get_ancestor ("axes").get_properties ()); | 9713 (go.get_ancestor ("axes").get_properties ()); |
9713 | 9714 |
9714 return (ax_props.get_num_lights () > 0); | 9715 return (ax_props.get_num_lights () > 0); |
9715 } | 9716 } |
9716 | 9717 |
9717 octave_value | 9718 octave_value |
10365 | 10366 |
10366 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); | 10367 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); |
10367 | 10368 |
10368 axes::properties& parent_axes_prop | 10369 axes::properties& parent_axes_prop |
10369 = dynamic_cast<axes::properties&> | 10370 = dynamic_cast<axes::properties&> |
10370 (go.get_ancestor ("axes").get_properties ()); | 10371 (go.get_ancestor ("axes").get_properties ()); |
10371 | 10372 |
10372 Matrix color_order = parent_axes_prop.get_colororder ().matrix_value (); | 10373 Matrix color_order = parent_axes_prop.get_colororder ().matrix_value (); |
10373 octave_idx_type s = (static_cast<octave_idx_type> (series_idx(0)) - 1) | 10374 octave_idx_type s = (static_cast<octave_idx_type> (series_idx(0)) - 1) |
10374 % color_order.rows (); | 10375 % color_order.rows (); |
10375 | 10376 |
10393 if (series_idx.isempty ()) | 10394 if (series_idx.isempty ()) |
10394 { | 10395 { |
10395 // Increment series index counter in parent axes | 10396 // Increment series index counter in parent axes |
10396 axes::properties& parent_axes_prop | 10397 axes::properties& parent_axes_prop |
10397 = dynamic_cast<axes::properties&> | 10398 = dynamic_cast<axes::properties&> |
10398 (go.get_ancestor ("axes").get_properties ()); | 10399 (go.get_ancestor ("axes").get_properties ()); |
10399 | 10400 |
10400 if (! parent_axes_prop.nextplot_is ("add")) | 10401 if (! parent_axes_prop.nextplot_is ("add")) |
10401 parent_axes_prop.set_nextseriesindex (1); | 10402 parent_axes_prop.set_nextseriesindex (1); |
10402 | 10403 |
10403 series_idx.resize (1, 1); | 10404 series_idx.resize (1, 1); |
10404 series_idx(0) = parent_axes_prop.get_nextseriesindex (); | 10405 series_idx(0) = parent_axes_prop.get_nextseriesindex (); |
10405 m_properties.set_seriesindex (series_idx); | 10406 m_properties.set_seriesindex (series_idx); |
10406 | 10407 |
10407 parent_axes_prop.set_nextseriesindex | 10408 parent_axes_prop.set_nextseriesindex |
10408 (parent_axes_prop.get_nextseriesindex () + 1); | 10409 (parent_axes_prop.get_nextseriesindex () + 1); |
10409 } | 10410 } |
10410 | 10411 |
10411 if (m_properties.cdatamode_is ("auto")) | 10412 if (m_properties.cdatamode_is ("auto")) |
10412 m_properties.update_color (); | 10413 m_properties.update_color (); |
10413 } | 10414 } |
10426 gh_manager& gh_mgr = octave::__get_gh_manager__ (); | 10427 gh_manager& gh_mgr = octave::__get_gh_manager__ (); |
10427 | 10428 |
10428 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); | 10429 graphics_object go = gh_mgr.get_object (get___myhandle__ ()); |
10429 | 10430 |
10430 axes::properties& ax_prop = dynamic_cast<axes::properties&> | 10431 axes::properties& ax_prop = dynamic_cast<axes::properties&> |
10431 (go.get_ancestor ("axes").get_properties ()); | 10432 (go.get_ancestor ("axes").get_properties ()); |
10432 | 10433 |
10433 return (ax_prop.get_num_lights () > 0); | 10434 return (ax_prop.get_num_lights () > 0); |
10434 } | 10435 } |
10435 | 10436 |
10436 void | 10437 void |
10603 double& nz = n(j, i, 2); | 10604 double& nz = n(j, i, 2); |
10604 | 10605 |
10605 if ((j > 0) && (i > 0)) | 10606 if ((j > 0) && (i > 0)) |
10606 // upper left quadrangle | 10607 // upper left quadrangle |
10607 cross_product | 10608 cross_product |
10608 (x(j1,i-1)-x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i), | 10609 (x(j1, i-1)-x(j2, i), y(j-1, i1)-y(j, i2), z(j-1, i-1)-z(j, i), |
10609 x(j2,i-1)-x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i), | 10610 x(j2, i-1)-x(j1, i), y(j, i1)-y(j-1, i2), z(j, i-1)-z(j-1, i), |
10610 nx, ny, nz); | 10611 nx, ny, nz); |
10611 | 10612 |
10612 if ((j > 0) && (i < (p -1))) | 10613 if ((j > 0) && (i < (p -1))) |
10613 // upper right quadrangle | 10614 // upper right quadrangle |
10614 cross_product | 10615 cross_product |
10615 (x(j1,i+1)-x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i), | 10616 (x(j1, i+1)-x(j2, i), y(j-1, i3)-y(j, i2), z(j-1, i+1)-z(j, i), |
10616 x(j1,i)-x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1), | 10617 x(j1, i)-x(j2, i+1), y(j-1, i2)-y(j, i3), z(j-1, i)-z(j, i+1), |
10617 nx, ny, nz); | 10618 nx, ny, nz); |
10618 | 10619 |
10619 if ((j < (q - 1)) && (i > 0)) | 10620 if ((j < (q - 1)) && (i > 0)) |
10620 // lower left quadrangle | 10621 // lower left quadrangle |
10621 cross_product | 10622 cross_product |
10622 (x(j2,i-1)-x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i), | 10623 (x(j2, i-1)-x(j3, i), y(j, i1)-y(j+1, i2), z(j, i-1)-z(j+1, i), |
10623 x(j3,i-1)-x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i), | 10624 x(j3, i-1)-x(j2, i), y(j+1, i1)-y(j, i2), z(j+1, i-1)-z(j, i), |
10624 nx, ny, nz); | 10625 nx, ny, nz); |
10625 | 10626 |
10626 if ((j < (q - 1)) && (i < (p -1))) | 10627 if ((j < (q - 1)) && (i < (p -1))) |
10627 // lower right quadrangle | 10628 // lower right quadrangle |
10628 cross_product | 10629 cross_product |
10629 (x(j3,i)-x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1), | 10630 (x(j3, i)-x(j2, i+1), y(j+1, i2)-y(j, i3), z(j+1, i)-z(j, i+1), |
10630 x(j3,i+1)-x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i), | 10631 x(j3, i+1)-x(j2, i), y(j+1, i3)-y(j, i2), z(j+1, i+1)-z(j, i), |
10631 nx, ny, nz); | 10632 nx, ny, nz); |
10632 | 10633 |
10633 double d = -std::max (std::max (fabs (nx), fabs (ny)), fabs (nz)); | 10634 double d = -std::max (std::max (fabs (nx), fabs (ny)), fabs (nz)); |
10634 | 10635 |
10635 nx /= d; | 10636 nx /= d; |
10636 ny /= d; | 10637 ny /= d; |
11188 | 11189 |
11189 // --------------------------------------------------------------------- | 11190 // --------------------------------------------------------------------- |
11190 | 11191 |
11191 Matrix | 11192 Matrix |
11192 uibuttongroup::properties::get_boundingbox (bool internal, | 11193 uibuttongroup::properties::get_boundingbox (bool internal, |
11193 const Matrix& parent_pix_size) const | 11194 const Matrix& parent_pix_size) const |
11194 { | 11195 { |
11195 Matrix pos = get_position ().matrix_value (); | 11196 Matrix pos = get_position ().matrix_value (); |
11196 Matrix parent_size (parent_pix_size); | 11197 Matrix parent_size (parent_pix_size); |
11197 | 11198 |
11198 if (parent_size.isempty ()) | 11199 if (parent_size.isempty ()) |
11397 err_set_invalid ("selectedobject"); | 11398 err_set_invalid ("selectedobject"); |
11398 } | 11399 } |
11399 | 11400 |
11400 void | 11401 void |
11401 uibuttongroup::properties::remove_child (const graphics_handle& h, | 11402 uibuttongroup::properties::remove_child (const graphics_handle& h, |
11402 bool from_root) | 11403 bool from_root) |
11403 { | 11404 { |
11404 graphics_handle current_selected = get_selectedobject (); | 11405 graphics_handle current_selected = get_selectedobject (); |
11405 if (h.value () == current_selected.value ()) | 11406 if (h.value () == current_selected.value ()) |
11406 set_selectedobject (Matrix ()); | 11407 set_selectedobject (Matrix ()); |
11407 | 11408 |
12284 args(1) = data; | 12285 args(1) = data; |
12285 else | 12286 else |
12286 args(1) = Matrix (); | 12287 args(1) = Matrix (); |
12287 | 12288 |
12288 octave::unwind_action_safe restore_gcbo_action | 12289 octave::unwind_action_safe restore_gcbo_action |
12289 (&gh_manager::restore_gcbo, this); | 12290 (&gh_manager::restore_gcbo, this); |
12290 | 12291 |
12291 graphics_object go (get_object (h)); | 12292 graphics_object go (get_object (h)); |
12292 if (go) | 12293 if (go) |
12293 { | 12294 { |
12294 // FIXME: Is the lock necessary when we're only calling a | 12295 // FIXME: Is the lock necessary when we're only calling a |
12415 std::string cmd ("close (gcbf ());"); | 12416 std::string cmd ("close (gcbf ());"); |
12416 post_event (graphics_event::create_mcode_event (h, cmd, busyaction)); | 12417 post_event (graphics_event::create_mcode_event (h, cmd, busyaction)); |
12417 } | 12418 } |
12418 else | 12419 else |
12419 post_event (graphics_event::create_callback_event (h, name, data, | 12420 post_event (graphics_event::create_callback_event (h, name, data, |
12420 busyaction)); | 12421 busyaction)); |
12421 } | 12422 } |
12422 } | 12423 } |
12423 | 12424 |
12424 void | 12425 void |
12425 gh_manager::post_function (graphics_event::event_fcn fcn, void *fcn_data) | 12426 gh_manager::post_function (graphics_event::event_fcn fcn, void *fcn_data) |
12435 bool redraw_figure) | 12436 bool redraw_figure) |
12436 { | 12437 { |
12437 octave::autolock guard (m_graphics_lock); | 12438 octave::autolock guard (m_graphics_lock); |
12438 | 12439 |
12439 post_event (graphics_event::create_set_event (h, name, value, notify_toolkit, | 12440 post_event (graphics_event::create_set_event (h, name, value, notify_toolkit, |
12440 redraw_figure)); | 12441 redraw_figure)); |
12441 } | 12442 } |
12442 | 12443 |
12443 int | 12444 int |
12444 gh_manager::process_events (bool force) | 12445 gh_manager::process_events (bool force) |
12445 { | 12446 { |
13116 else | 13117 else |
13117 { | 13118 { |
13118 caseless_str property; | 13119 caseless_str property; |
13119 | 13120 |
13120 if (nargin > 1) | 13121 if (nargin > 1) |
13121 property = args(1).xstring_value ("get: second argument must be property name or cell array of property names"); | 13122 property = args( |
13123 1).xstring_value ("get: second argument must be property name or cell array of property names"); | |
13122 | 13124 |
13123 vals.resize (dim_vector (hcv_len, 1)); | 13125 vals.resize (dim_vector (hcv_len, 1)); |
13124 | 13126 |
13125 for (octave_idx_type n = 0; n < hcv_len; n++) | 13127 for (octave_idx_type n = 0; n < hcv_len; n++) |
13126 { | 13128 { |
13981 dirname.c_str ()); | 13983 dirname.c_str ()); |
13982 | 13984 |
13983 } | 13985 } |
13984 } | 13986 } |
13985 | 13987 |
13986 debug_file = (args.length () > 2 ? args(2).xstring_value ("drawnow: DEBUG_FILE must be a string") : ""); | 13988 debug_file = (args.length () > 2 ? args(2).xstring_value ("drawnow: DEBUG_FILE must be a string") : |
13989 ""); | |
13987 | 13990 |
13988 graphics_handle h = gcf (); | 13991 graphics_handle h = gcf (); |
13989 | 13992 |
13990 if (! h.ok ()) | 13993 if (! h.ok ()) |
13991 error ("drawnow: nothing to draw"); | 13994 error ("drawnow: nothing to draw"); |
14519 && compare_property_values (go.get (pname), args(2))) | 14522 && compare_property_values (go.get (pname), args(2))) |
14520 waitfor_results[id] = true; | 14523 waitfor_results[id] = true; |
14521 else | 14524 else |
14522 { | 14525 { |
14523 cleanup_waitfor_postset_listener_action.set | 14526 cleanup_waitfor_postset_listener_action.set |
14524 (cleanup_waitfor_postset_listener, ov_listener); | 14527 (cleanup_waitfor_postset_listener, ov_listener); |
14525 | 14528 |
14526 go.add_property_listener (pname, ov_listener, GCB_POSTSET); | 14529 go.add_property_listener (pname, ov_listener, GCB_POSTSET); |
14527 go.add_property_listener (pname, ov_listener, GCB_PERSISTENT); | 14530 go.add_property_listener (pname, ov_listener, GCB_PERSISTENT); |
14528 | 14531 |
14529 if (go.get_properties ().has_dynamic_property (pname)) | 14532 if (go.get_properties ().has_dynamic_property (pname)) |
14544 del_listener(3) = pname; | 14547 del_listener(3) = pname; |
14545 | 14548 |
14546 octave_value ov_del_listener (del_listener); | 14549 octave_value ov_del_listener (del_listener); |
14547 | 14550 |
14548 cleanup_waitfor_predelete_listener_action.set | 14551 cleanup_waitfor_predelete_listener_action.set |
14549 (cleanup_waitfor_predelete_listener, ov_del_listener); | 14552 (cleanup_waitfor_predelete_listener, ov_del_listener); |
14550 | 14553 |
14551 go.add_property_listener (pname, ov_del_listener, | 14554 go.add_property_listener (pname, ov_del_listener, |
14552 GCB_PREDELETE); | 14555 GCB_PREDELETE); |
14553 } | 14556 } |
14554 } | 14557 } |
14556 } | 14559 } |
14557 } | 14560 } |
14558 | 14561 |
14559 if (timeout_index < 0 && args.length () > (max_arg_index + 1)) | 14562 if (timeout_index < 0 && args.length () > (max_arg_index + 1)) |
14560 { | 14563 { |
14561 caseless_str s = args(max_arg_index + 1).xstring_value ("waitfor: invalid parameter, expected 'timeout'"); | 14564 caseless_str s = args(max_arg_index + |
14565 1).xstring_value ("waitfor: invalid parameter, expected 'timeout'"); | |
14562 | 14566 |
14563 if (! s.compare ("timeout")) | 14567 if (! s.compare ("timeout")) |
14564 error ("waitfor: invalid parameter '%s'", s.c_str ()); | 14568 error ("waitfor: invalid parameter '%s'", s.c_str ()); |
14565 | 14569 |
14566 timeout_index = max_arg_index + 1; | 14570 timeout_index = max_arg_index + 1; |