annotate libinterp/dldfcn/__init_fltk__.cc @ 17787:175b392e91fe

Use GNU style coding conventions for code in libinterp/ * libinterp/corefcn/Cell.h, libinterp/corefcn/__contourc__.cc, libinterp/corefcn/__dispatch__.cc, libinterp/corefcn/__lin_interpn__.cc, libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc, libinterp/corefcn/balance.cc, libinterp/corefcn/besselj.cc, libinterp/corefcn/betainc.cc, libinterp/corefcn/bitfcns.cc, libinterp/corefcn/bsxfun.cc, libinterp/corefcn/c-file-ptr-stream.cc, libinterp/corefcn/c-file-ptr-stream.h, libinterp/corefcn/cellfun.cc, libinterp/corefcn/colloc.cc, libinterp/corefcn/comment-list.h, libinterp/corefcn/conv2.cc, libinterp/corefcn/daspk.cc, libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc, libinterp/corefcn/data.cc, libinterp/corefcn/debug.cc, libinterp/corefcn/defaults.cc, libinterp/corefcn/defaults.in.h, libinterp/corefcn/defun-int.h, libinterp/corefcn/defun.cc, libinterp/corefcn/det.cc, libinterp/corefcn/dirfns.cc, libinterp/corefcn/display.cc, libinterp/corefcn/dlmread.cc, libinterp/corefcn/dot.cc, libinterp/corefcn/dynamic-ld.cc, libinterp/corefcn/dynamic-ld.h, libinterp/corefcn/eig.cc, libinterp/corefcn/ellipj.cc, libinterp/corefcn/error.cc, libinterp/corefcn/error.h, libinterp/corefcn/event-queue.h, libinterp/corefcn/fft.cc, libinterp/corefcn/fft2.cc, libinterp/corefcn/fftn.cc, libinterp/corefcn/file-io.cc, libinterp/corefcn/filter.cc, libinterp/corefcn/find.cc, libinterp/corefcn/gammainc.cc, libinterp/corefcn/gcd.cc, libinterp/corefcn/getgrent.cc, libinterp/corefcn/getpwent.cc, libinterp/corefcn/getrusage.cc, libinterp/corefcn/givens.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/gl2ps-renderer.cc, libinterp/corefcn/gl2ps-renderer.h, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/gripes.cc, libinterp/corefcn/gripes.h, libinterp/corefcn/help.cc, libinterp/corefcn/hess.cc, libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc, libinterp/corefcn/input.h, libinterp/corefcn/inv.cc, libinterp/corefcn/jit-ir.h, libinterp/corefcn/jit-typeinfo.cc, libinterp/corefcn/jit-typeinfo.h, libinterp/corefcn/jit-util.h, libinterp/corefcn/kron.cc, libinterp/corefcn/load-path.cc, libinterp/corefcn/load-path.h, libinterp/corefcn/load-save.cc, libinterp/corefcn/load-save.h, libinterp/corefcn/lookup.cc, libinterp/corefcn/ls-ascii-helper.cc, libinterp/corefcn/ls-hdf5.cc, libinterp/corefcn/ls-hdf5.h, libinterp/corefcn/ls-mat-ascii.cc, libinterp/corefcn/ls-mat-ascii.h, libinterp/corefcn/ls-mat4.cc, libinterp/corefcn/ls-mat5.cc, libinterp/corefcn/ls-mat5.h, libinterp/corefcn/ls-oct-ascii.cc, libinterp/corefcn/lsode.cc, libinterp/corefcn/lu.cc, libinterp/corefcn/luinc.cc, libinterp/corefcn/mappers.cc, libinterp/corefcn/matrix_type.cc, libinterp/corefcn/max.cc, libinterp/corefcn/md5sum.cc, libinterp/corefcn/mex.cc, libinterp/corefcn/mexproto.h, libinterp/corefcn/mgorth.cc, libinterp/corefcn/mxarray.in.h, libinterp/corefcn/nproc.cc, libinterp/corefcn/oct-hist.cc, libinterp/corefcn/oct-lvalue.h, libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-prcstrm.h, libinterp/corefcn/oct-stdstrm.h, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h, libinterp/corefcn/octave-link.cc, libinterp/corefcn/octave-link.h, libinterp/corefcn/pager.cc, libinterp/corefcn/pinv.cc, libinterp/corefcn/pr-output.cc, libinterp/corefcn/procstream.h, libinterp/corefcn/profiler.cc, libinterp/corefcn/pt-jit.cc, libinterp/corefcn/pt-jit.h, libinterp/corefcn/quad.cc, libinterp/corefcn/quadcc.cc, libinterp/corefcn/qz.cc, libinterp/corefcn/rand.cc, libinterp/corefcn/rcond.cc, libinterp/corefcn/regexp.cc, libinterp/corefcn/schur.cc, libinterp/corefcn/sighandlers.cc, libinterp/corefcn/sighandlers.h, libinterp/corefcn/sparse-xdiv.cc, libinterp/corefcn/sparse-xdiv.h, libinterp/corefcn/sparse-xpow.cc, libinterp/corefcn/sparse.cc, libinterp/corefcn/spparms.cc, libinterp/corefcn/sqrtm.cc, libinterp/corefcn/str2double.cc, libinterp/corefcn/strfind.cc, libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc, libinterp/corefcn/svd.cc, libinterp/corefcn/syl.cc, libinterp/corefcn/symtab.cc, libinterp/corefcn/symtab.h, libinterp/corefcn/syscalls.cc, libinterp/corefcn/sysdep.cc, libinterp/corefcn/sysdep.h, libinterp/corefcn/time.cc, libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h, libinterp/corefcn/tril.cc, libinterp/corefcn/txt-eng-ft.cc, libinterp/corefcn/txt-eng-ft.h, libinterp/corefcn/txt-eng.h, libinterp/corefcn/typecast.cc, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc, libinterp/corefcn/variables.h, libinterp/corefcn/xdiv.cc, libinterp/corefcn/xdiv.h, libinterp/corefcn/xnorm.h, libinterp/corefcn/xpow.cc, libinterp/corefcn/xpow.h, libinterp/corefcn/zfstream.cc, libinterp/corefcn/zfstream.h, libinterp/dldfcn/__delaunayn__.cc, libinterp/dldfcn/__dsearchn__.cc, libinterp/dldfcn/__eigs__.cc, libinterp/dldfcn/__fltk_uigetfile__.cc, libinterp/dldfcn/__glpk__.cc, libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__init_gnuplot__.cc, libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/__voronoi__.cc, libinterp/dldfcn/amd.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/chol.cc, libinterp/dldfcn/colamd.cc, libinterp/dldfcn/convhulln.cc, libinterp/dldfcn/dmperm.cc, libinterp/dldfcn/fftw.cc, libinterp/dldfcn/qr.cc, libinterp/dldfcn/symbfact.cc, libinterp/dldfcn/symrcm.cc, libinterp/dldfcn/tsearch.cc, libinterp/octave-value/ov-base-diag.cc, libinterp/octave-value/ov-base-diag.h, libinterp/octave-value/ov-base-int.cc, libinterp/octave-value/ov-base-int.h, libinterp/octave-value/ov-base-mat.h, libinterp/octave-value/ov-base-scalar.cc, libinterp/octave-value/ov-base-scalar.h, libinterp/octave-value/ov-base-sparse.cc, libinterp/octave-value/ov-base-sparse.h, libinterp/octave-value/ov-base.cc, libinterp/octave-value/ov-base.h, libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-bool-mat.h, libinterp/octave-value/ov-bool-sparse.cc, libinterp/octave-value/ov-bool-sparse.h, libinterp/octave-value/ov-bool.cc, libinterp/octave-value/ov-bool.h, libinterp/octave-value/ov-builtin.cc, libinterp/octave-value/ov-builtin.h, libinterp/octave-value/ov-cell.cc, libinterp/octave-value/ov-cell.h, libinterp/octave-value/ov-ch-mat.cc, libinterp/octave-value/ov-ch-mat.h, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-colon.h, libinterp/octave-value/ov-complex.cc, libinterp/octave-value/ov-complex.h, libinterp/octave-value/ov-cx-diag.cc, libinterp/octave-value/ov-cx-diag.h, libinterp/octave-value/ov-cx-mat.cc, libinterp/octave-value/ov-cx-mat.h, libinterp/octave-value/ov-cx-sparse.cc, libinterp/octave-value/ov-cx-sparse.h, libinterp/octave-value/ov-dld-fcn.h, libinterp/octave-value/ov-fcn-handle.cc, libinterp/octave-value/ov-fcn-handle.h, libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-fcn-inline.h, libinterp/octave-value/ov-fcn.h, libinterp/octave-value/ov-float.cc, libinterp/octave-value/ov-float.h, libinterp/octave-value/ov-flt-complex.cc, libinterp/octave-value/ov-flt-complex.h, libinterp/octave-value/ov-flt-cx-diag.cc, libinterp/octave-value/ov-flt-cx-diag.h, libinterp/octave-value/ov-flt-cx-mat.cc, libinterp/octave-value/ov-flt-cx-mat.h, libinterp/octave-value/ov-flt-re-diag.cc, libinterp/octave-value/ov-flt-re-diag.h, libinterp/octave-value/ov-flt-re-mat.cc, libinterp/octave-value/ov-flt-re-mat.h, libinterp/octave-value/ov-int16.cc, libinterp/octave-value/ov-int32.cc, libinterp/octave-value/ov-int64.cc, libinterp/octave-value/ov-int8.cc, libinterp/octave-value/ov-intx.h, libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-lazy-idx.h, libinterp/octave-value/ov-mex-fcn.cc, libinterp/octave-value/ov-mex-fcn.h, libinterp/octave-value/ov-null-mat.cc, libinterp/octave-value/ov-null-mat.h, libinterp/octave-value/ov-oncleanup.cc, libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-perm.h, libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-range.h, libinterp/octave-value/ov-re-diag.cc, libinterp/octave-value/ov-re-diag.h, libinterp/octave-value/ov-re-mat.cc, libinterp/octave-value/ov-re-mat.h, libinterp/octave-value/ov-re-sparse.cc, libinterp/octave-value/ov-re-sparse.h, libinterp/octave-value/ov-scalar.cc, libinterp/octave-value/ov-scalar.h, libinterp/octave-value/ov-str-mat.cc, libinterp/octave-value/ov-str-mat.h, libinterp/octave-value/ov-struct.cc, libinterp/octave-value/ov-struct.h, libinterp/octave-value/ov-type-conv.h, libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-typeinfo.h, libinterp/octave-value/ov-uint16.cc, libinterp/octave-value/ov-uint32.cc, libinterp/octave-value/ov-uint64.cc, libinterp/octave-value/ov-uint8.cc, libinterp/octave-value/ov-usr-fcn.cc, libinterp/octave-value/ov-usr-fcn.h, libinterp/octave-value/ov.cc, libinterp/octave-value/ov.h, libinterp/octave.cc, libinterp/operators/op-b-bm.cc, libinterp/operators/op-b-sbm.cc, libinterp/operators/op-bm-b.cc, libinterp/operators/op-bm-bm.cc, libinterp/operators/op-cdm-cdm.cc, libinterp/operators/op-chm.cc, libinterp/operators/op-class.cc, libinterp/operators/op-cm-cm.cc, libinterp/operators/op-cm-cs.cc, libinterp/operators/op-cm-s.cc, libinterp/operators/op-cm-scm.cc, libinterp/operators/op-cm-sm.cc, libinterp/operators/op-cs-cm.cc, libinterp/operators/op-cs-cs.cc, libinterp/operators/op-cs-scm.cc, libinterp/operators/op-cs-sm.cc, libinterp/operators/op-dm-dm.cc, libinterp/operators/op-dm-scm.cc, libinterp/operators/op-double-conv.cc, libinterp/operators/op-fcdm-fcdm.cc, libinterp/operators/op-fcm-fcm.cc, libinterp/operators/op-fcm-fcs.cc, libinterp/operators/op-fcm-fm.cc, libinterp/operators/op-fcm-fs.cc, libinterp/operators/op-fcs-fcm.cc, libinterp/operators/op-fcs-fcs.cc, libinterp/operators/op-fcs-fm.cc, libinterp/operators/op-fcs-fs.cc, libinterp/operators/op-fdm-fdm.cc, libinterp/operators/op-float-conv.cc, libinterp/operators/op-fm-fcm.cc, libinterp/operators/op-fm-fcs.cc, libinterp/operators/op-fm-fm.cc, libinterp/operators/op-fm-fs.cc, libinterp/operators/op-fs-fcm.cc, libinterp/operators/op-fs-fcs.cc, libinterp/operators/op-fs-fm.cc, libinterp/operators/op-fs-fs.cc, libinterp/operators/op-m-cm.cc, libinterp/operators/op-m-cs.cc, libinterp/operators/op-m-m.cc, libinterp/operators/op-m-s.cc, libinterp/operators/op-m-scm.cc, libinterp/operators/op-m-sm.cc, libinterp/operators/op-pm-scm.cc, libinterp/operators/op-range.cc, libinterp/operators/op-s-cm.cc, libinterp/operators/op-s-cs.cc, libinterp/operators/op-s-scm.cc, libinterp/operators/op-sbm-b.cc, libinterp/operators/op-sbm-bm.cc, libinterp/operators/op-sbm-sbm.cc, libinterp/operators/op-scm-cm.cc, libinterp/operators/op-scm-cs.cc, libinterp/operators/op-scm-m.cc, libinterp/operators/op-scm-s.cc, libinterp/operators/op-scm-scm.cc, libinterp/operators/op-scm-sm.cc, libinterp/operators/op-sm-cm.cc, libinterp/operators/op-sm-m.cc, libinterp/operators/op-sm-s.cc, libinterp/operators/op-sm-scm.cc, libinterp/operators/op-sm-sm.cc, libinterp/operators/op-str-m.cc, libinterp/operators/op-str-s.cc, libinterp/operators/op-str-str.cc, libinterp/operators/ops.h, libinterp/parse-tree/lex.h, libinterp/parse-tree/parse.h, libinterp/parse-tree/pt-arg-list.cc, libinterp/parse-tree/pt-arg-list.h, libinterp/parse-tree/pt-assign.cc, libinterp/parse-tree/pt-assign.h, libinterp/parse-tree/pt-binop.cc, libinterp/parse-tree/pt-binop.h, libinterp/parse-tree/pt-bp.h, libinterp/parse-tree/pt-cbinop.cc, libinterp/parse-tree/pt-check.cc, libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-colon.h, libinterp/parse-tree/pt-const.cc, libinterp/parse-tree/pt-decl.cc, libinterp/parse-tree/pt-decl.h, libinterp/parse-tree/pt-eval.cc, libinterp/parse-tree/pt-except.h, libinterp/parse-tree/pt-exp.h, libinterp/parse-tree/pt-fcn-handle.cc, libinterp/parse-tree/pt-id.cc, libinterp/parse-tree/pt-id.h, libinterp/parse-tree/pt-idx.cc, libinterp/parse-tree/pt-idx.h, libinterp/parse-tree/pt-loop.h, libinterp/parse-tree/pt-mat.cc, libinterp/parse-tree/pt-misc.cc, libinterp/parse-tree/pt-misc.h, libinterp/parse-tree/pt-pr-code.cc, libinterp/parse-tree/pt-select.h, libinterp/parse-tree/pt-stmt.h, libinterp/parse-tree/token.h, libinterp/version.cc: Use GNU style coding conventions for code in libinterp/
author Rik <rik@octave.org>
date Mon, 28 Oct 2013 19:51:46 -0700
parents d63878346099
children 06a850f83dd4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1 /*
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17366
diff changeset
3 Copyright (C) 2007-2013 Shai Ayal
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
4
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
5 This file is part of Octave.
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
6
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
10 option) any later version.
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
11
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
15 for more details.
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
16
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
18 along with Octave; see the file COPYING. If not, see
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>.
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
20
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
21 */
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
22
7874
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
23 /*
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
24
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
25 To initialize:
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
26
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
27 graphics_toolkit ("fltk");
7874
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
28 plot (randn (1e3, 1));
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
29
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
30 */
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
31
15503
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
32 // PKG_ADD: if (__have_fltk__ ()) register_graphics_toolkit ("fltk"); endif
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
33
7874
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
34 #ifdef HAVE_CONFIG_H
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
35 #include <config.h>
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
36 #endif
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
37
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
38 #include "builtin-defun-decls.h"
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
39 #include "defun-dld.h"
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
40 #include "error.h"
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
41 #include "ov-fcn-handle.h"
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
42
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
43 #ifdef HAVE_FLTK
7954
3ffc34caec65 configure fixes
John W. Eaton <jwe@octave.org>
parents: 7874
diff changeset
44
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
45 #include <map>
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
46 #include <set>
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
47 #include <sstream>
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
48 #include <iostream>
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
49
13721
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
50 #ifdef WIN32
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
51 #define WIN32_LEAN_AND_MEAN
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
52 #endif
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
53
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
54 #include <FL/Fl.H>
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
55 #include <FL/Fl_Box.H>
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
56 #include <FL/Fl_Button.H>
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
57 #include <FL/Fl_Choice.H>
12565
0f71b9639207 Correct typo in #include path for FLTK header files (bug #32972).
Rik <octave@nomad.inbox5.com>
parents: 12539
diff changeset
58 #include <FL/Fl_File_Chooser.H>
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
59 #include <FL/Fl_Gl_Window.H>
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
60 #include <FL/Fl_Menu_Bar.H>
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
61 #include <FL/Fl_Menu_Button.H>
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
62 #include <FL/Fl_Output.H>
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
63 #include <FL/Fl_Window.H>
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
64 #include <FL/fl_ask.H>
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
65 #include <FL/fl_draw.H>
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
66 #include <FL/gl.h>
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
67
12205
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
68 // FLTK headers may include X11/X.h which defines Complex, and that
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
69 // conflicts with Octave's Complex typedef. We don't need the X11
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
70 // Complex definition in this file, so remove it before including Octave
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
71 // headers which may require Octave's Complex typedef.
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
72 #undef Complex
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
73
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
74 #include "cmd-edit.h"
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
75 #include "lo-ieee.h"
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
76
11590
4ced6b90fffb style fixes for warning and error messages in source files
John W. Eaton <jwe@octave.org>
parents: 11586
diff changeset
77 #include "file-ops.h"
7954
3ffc34caec65 configure fixes
John W. Eaton <jwe@octave.org>
parents: 7874
diff changeset
78 #include "gl-render.h"
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
79 #include "gl2ps-renderer.h"
7954
3ffc34caec65 configure fixes
John W. Eaton <jwe@octave.org>
parents: 7874
diff changeset
80 #include "graphics.h"
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
81 #include "parse.h"
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
82 #include "sysdep.h"
9991
1300d9ced492 F__init_fltk__: add __remove_fltk__ to atexit function list
John W. Eaton <jwe@octave.org>
parents: 9974
diff changeset
83 #include "toplev.h"
9216
9d4b84b14bf0 call mlock in __fltk_init__
John W. Eaton <jwe@octave.org>
parents: 9060
diff changeset
84 #include "variables.h"
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
85
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
86 #define FLTK_GRAPHICS_TOOLKIT_NAME "fltk"
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
87
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
88 // Give FLTK no more than 0.01 sec to do its stuff.
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
89 static double fltk_maxtime = 1e-2;
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
90
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
91 const char* help_text = "\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
92 Keyboard Shortcuts\n\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
93 a - autoscale\n\
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
94 p - pan/zoom\n\
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
95 r - rotate\n\
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
96 g - toggle grid\n\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
97 \n\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
98 Mouse\n\
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
99 left drag - pan\n\
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
100 mouse wheel - zoom\n\
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
101 right drag - rectangle zoom\n\
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
102 left double click - autoscale\n\
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
103 ";
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
104
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
105 class OpenGL_fltk : public Fl_Gl_Window
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
106 {
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
107 public:
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
108 OpenGL_fltk (int xx, int yy, int ww, int hh, double num)
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
109 : Fl_Gl_Window (xx, yy, ww, hh, 0), number (num), renderer (),
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
110 in_zoom (false), zoom_box (), print_mode (false)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
111 {
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
112 // Ask for double buffering and a depth buffer.
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
113 mode (FL_DEPTH | FL_DOUBLE);
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
114 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
115
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
116 ~OpenGL_fltk (void) { }
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
117
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
118 void zoom (bool z)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
119 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
120 in_zoom = z;
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
121 if (! in_zoom)
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
122 hide_overlay ();
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
123 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
124
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
125 bool zoom (void) { return in_zoom; }
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
126 void set_zoom_box (const Matrix& zb) { zoom_box = zb; }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
127
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
128 void print (const std::string& cmd, const std::string& term)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
129 {
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
130 print_mode = true;
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
131 print_cmd = cmd;
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10809
diff changeset
132 print_term = term;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
133 }
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
134
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
135 void resize (int xx, int yy, int ww, int hh)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
136 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
137 Fl_Gl_Window::resize (xx, yy, ww, hh);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
138 setup_viewport (ww, hh);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
139 redraw ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
140 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
141
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
142 bool renumber (double new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
143 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
144 bool retval = false;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
145
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
146 if (number != new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
147 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
148 number = new_number;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
149 retval = true;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
150 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
151
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
152 return retval;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
153 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
154
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
155 private:
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
156 double number;
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
157 opengl_renderer renderer;
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
158 bool in_zoom;
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
159 // (x1,y1,x2,y2)
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
160 Matrix zoom_box;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
161
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
162 bool print_mode;
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
163 std::string print_cmd;
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10809
diff changeset
164 std::string print_term;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
165
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
166 void setup_viewport (int ww, int hh)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
167 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
168 glMatrixMode (GL_PROJECTION);
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
169 glLoadIdentity ();
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
170 glViewport (0, 0, ww, hh);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
171 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
172
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
173 void draw (void)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
174 {
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
175 if (! valid ())
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
176 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
177 valid (1);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
178 setup_viewport (w (), h ());
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
179 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
180
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
181 if (print_mode)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
182 {
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
183 FILE *fp = octave_popen (print_cmd.c_str (), "w");
14418
933101fd5cbb Use file descriptor instead of a FILE pointer for OpenGL printing.
John W. Eaton <jwe@octave.org>
parents: 14366
diff changeset
184 glps_renderer rend (fp, print_term);
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 12226
diff changeset
185
16732
3806afcf974a Include graphics image file name in latex file for {eps,pdf,ps}latex output.
Ben Abbott <bpabbott@mac.com>
parents: 16348
diff changeset
186 rend.draw (gh_manager::get_object (number), print_cmd);
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 12226
diff changeset
187
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
188 octave_pclose (fp);
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
189 print_mode = false;
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
190 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
191 else
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
192 {
12324
85934e0fcce9 gl-renderer.cc and gl2ps-renderer.cc: access objects directly from gh_manager instead of working with handles
John W. Eaton <jwe@octave.org>
parents: 12323
diff changeset
193 renderer.draw (gh_manager::get_object (number));
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
194
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
195 if (zoom ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
196 overlay ();
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
197 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
198 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
199
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
200 void zoom_box_vertex (void)
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
201 {
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
202 glVertex2d (zoom_box(0), h () - zoom_box(1));
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
203 glVertex2d (zoom_box(0), h () - zoom_box(3));
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
204 glVertex2d (zoom_box(2), h () - zoom_box(3));
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
205 glVertex2d (zoom_box(2), h () - zoom_box(1));
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
206 glVertex2d (zoom_box(0), h () - zoom_box(1));
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
207 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
208
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
209 void overlay (void)
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
210 {
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
211 glPushMatrix ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
212
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
213 glMatrixMode (GL_MODELVIEW);
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
214 glLoadIdentity ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
215
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
216 glMatrixMode (GL_PROJECTION);
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
217 glLoadIdentity ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
218 gluOrtho2D (0.0, w (), 0.0, h ());
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
219
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
220 glPushAttrib (GL_DEPTH_BUFFER_BIT | GL_CURRENT_BIT);
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
221 glDisable (GL_DEPTH_TEST);
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
222
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
223 glBegin (GL_POLYGON);
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
224 glColor4f (0.45, 0.62, 0.81, 0.1);
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
225 zoom_box_vertex ();
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
226 glEnd ();
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
227
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
228 glBegin (GL_LINE_STRIP);
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
229 glLineWidth (1.5);
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
230 glColor4f (0.45, 0.62, 0.81, 0.9);
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
231 zoom_box_vertex ();
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
232 glEnd ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
233
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
234 glPopAttrib ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
235 glPopMatrix ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
236 }
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
237
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
238 int handle (int event)
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
239 {
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
240 int retval = Fl_Gl_Window::handle (event);
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
241
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
242 switch (event)
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
243 {
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
244 case FL_ENTER:
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
245 window ()->cursor (FL_CURSOR_CROSS);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
246 return 1;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
247
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
248 case FL_LEAVE:
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
249 window ()->cursor (FL_CURSOR_DEFAULT);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
250 return 1;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
251 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
252
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
253 return retval;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
254 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
255 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
256
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
257 // Parameter controlling how fast we zoom when using the scrool wheel.
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
258 static double Vwheel_zoom_speed = 0.05;
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
259 // Parameter controlling the GUI mode.
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
260 static enum { pan_zoom, rotate_zoom, none } gui_mode;
9668
6291b69cf2d2 imported patch fltk_overlay
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9652
diff changeset
261
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
262 void script_cb (Fl_Widget*, void* data)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
263 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
264 static_cast<uimenu::properties*> (data)->execute_callback ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
265 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
266
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
267
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
268 class fltk_uimenu
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
269 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
270 public:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
271 fltk_uimenu (int xx, int yy, int ww, int hh)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
272 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
273 menubar = new
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
274 Fl_Menu_Bar (xx, yy, ww, hh);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
275 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
276
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
277 int items_to_show (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
278 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
279 //returns the number of visible menu items
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
280 int len = menubar->size ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
281 int n = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
282 for (int t = 0; t < len; t++ )
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
283 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
284 const Fl_Menu_Item *m = static_cast<const Fl_Menu_Item*> (&
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
285 (menubar->menu ()[t]));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
286 if ((m->label () != NULL) && m->visible ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
287 n++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
288 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
289
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
290 return n;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
291 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
292
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
293 void show (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
294 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
295 menubar->show ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
296 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
297
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
298 void hide (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
299 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
300 menubar->hide ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
301 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
302
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
303 bool is_visible (void)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
304 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
305 return menubar->visible ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
306 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
307
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
308 int find_index_by_name (const std::string& findname)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
309 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
310 // This function is derived from Greg Ercolano's function
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
311 // int GetIndexByName(...), see:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
312 // http://seriss.com/people/erco/fltk/#Menu_ChangeLabel
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
313 // He agreed via PM that it can be included in octave using GPLv3
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
314 // Kai Habel (14.10.2010)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
315
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
316 std::string menupath;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
317 for (int t = 0; t < menubar->size (); t++ )
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
318 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
319 Fl_Menu_Item *m = const_cast<Fl_Menu_Item*> (&(menubar->menu ()[t]));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
320 if (m->submenu ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
321 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
322 // item has submenu
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
323 if (!menupath.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
324 menupath += "/";
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
325 menupath += m->label ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
326
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
327 if (menupath.compare (findname) == 0 )
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
328 return (t);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
329 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
330 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
331 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
332 // End of submenu? Pop back one level.
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
333 if (m->label () == NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
334 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
335 std::size_t idx = menupath.find_last_of ("/");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
336 if (idx != std::string::npos)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
337 menupath.erase (idx);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
338 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
339 menupath.clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
340 continue;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
341 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
342 // Menu item?
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
343 std::string itempath = menupath;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
344 if (!itempath.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
345 itempath += "/";
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
346 itempath += m->label ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
347
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
348 if (itempath.compare (findname) == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
349 return (t);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
350 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
351 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
352 return (-1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
353 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
354
11170
a2437f70fe6c Remove template to allow compilation for MacOS
Kai Habel <kai.habel@gmx.de>
parents: 11155
diff changeset
355 Matrix find_uimenu_children (uimenu::properties& uimenup) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
356 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
357 Matrix uimenu_childs = uimenup.get_all_children ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
358 Matrix retval = do_find_uimenu_children (uimenu_childs);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
359 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
360 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
361
11170
a2437f70fe6c Remove template to allow compilation for MacOS
Kai Habel <kai.habel@gmx.de>
parents: 11155
diff changeset
362 Matrix find_uimenu_children (figure::properties& figp) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
363 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
364 Matrix uimenu_childs = figp.get_all_children ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
365 Matrix retval = do_find_uimenu_children (uimenu_childs);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
366 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
367 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
368
11170
a2437f70fe6c Remove template to allow compilation for MacOS
Kai Habel <kai.habel@gmx.de>
parents: 11155
diff changeset
369 Matrix do_find_uimenu_children (Matrix uimenu_childs) const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
370 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
371 octave_idx_type k = 0;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
372
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
373
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 Matrix pos = Matrix (uimenu_childs.numel (), 1);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
375
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 for (octave_idx_type ii = 0; ii < uimenu_childs.numel (); ii++)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
377 {
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
378 graphics_object kidgo = gh_manager::get_object (uimenu_childs (ii));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
379
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
380 if (kidgo.valid_object () && kidgo.isa ("uimenu"))
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
381 {
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
382 uimenu_childs(k) = uimenu_childs(ii);
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
383 pos(k++) =
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
384 dynamic_cast<uimenu::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
385 (kidgo.get_properties ()).get_position ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
386 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
387 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
388
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
389 uimenu_childs.resize (k, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
390 pos.resize (k, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
391 Matrix retval = Matrix (k, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
392 // Don't know if this is the best method to sort.
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
393 // Can we avoid the for loop?
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
394 Array<octave_idx_type> sidx = pos.sort_rows_idx (DESCENDING);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
395 for (octave_idx_type ii = 0; ii < k; ii++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
396 retval(ii) = uimenu_childs (sidx(ii));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
397
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
398 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
399 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
400
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
401 void delete_entry (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
402 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
403 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
404 int idx = find_index_by_name (fltk_label.c_str ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
405
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
406 if (idx >= 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
407 menubar->remove (idx);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
408 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
409
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
410 void update_accelerator (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
411 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
412 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
413 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
414 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
415 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
416 fltk_label.c_str ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
417 if (item != NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
418 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
419 std::string acc = uimenup.get_accelerator ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
420 if (acc.length () > 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
421 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
422 int key = FL_CTRL + acc[0];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
423 item->shortcut (key);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
424 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
425 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
426 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
427 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
428
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
429 void update_callback (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
430 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
431 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
432 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
433 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
434 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
435 fltk_label.c_str ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
436 if (item != NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
437 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
438 if (!uimenup.get_callback ().is_empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
439 item->callback (static_cast<Fl_Callback*> (script_cb),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
440 static_cast<void*> (&uimenup));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
441 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
442 item->callback (NULL, static_cast<void*> (0));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
443 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
444 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
445 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
446
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
447 void update_enable (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
448 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
449 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
450 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
451 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
452 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
453 fltk_label.c_str ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
454 if (item != NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
455 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
456 if (uimenup.is_enable ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
457 item->activate ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
458 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
459 item->deactivate ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
460 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
461 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
462 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
463
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
464 void update_foregroundcolor (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
465 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
466 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
467 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
468 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
469 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
470 fltk_label.c_str ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
471 if (item != NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
472 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
473 Matrix rgb = uimenup.get_foregroundcolor_rgb ();
12539
ccd0572e5e93 use gnulib:: functions as needed
John W. Eaton <jwe@octave.org>
parents: 12507
diff changeset
474
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
475 uchar r = static_cast<uchar> (gnulib::floor (rgb (0) * 255));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
476 uchar g = static_cast<uchar> (gnulib::floor (rgb (1) * 255));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
477 uchar b = static_cast<uchar> (gnulib::floor (rgb (2) * 255));
12539
ccd0572e5e93 use gnulib:: functions as needed
John W. Eaton <jwe@octave.org>
parents: 12507
diff changeset
478
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
479 item->labelcolor (fl_rgb_color (r, g, b));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
480 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
481 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
482 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
483
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
484 void update_seperator (const uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
485 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
486 // Matlab places the separator before the current
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
487 // menu entry, while fltk places it after. So we need to find
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
488 // the previous item in this menu/submenu. (Kai)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
489 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
490 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
491 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
492 int itemflags = 0, idx;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
493 int curr_idx = find_index_by_name (fltk_label.c_str ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
494
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
495 for (idx = curr_idx - 1; idx >= 0; idx--)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
496 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
497 Fl_Menu_Item* item
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
498 = const_cast<Fl_Menu_Item*> (&menubar->menu () [idx]);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
499 itemflags = item->flags;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
500 if (item->label () != NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
501 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
502 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
503
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
504 if (idx >= 0 && idx < menubar->size ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
505 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
506 if (uimenup.is_separator ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
507 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
508 if (idx >= 0 && !(itemflags & FL_SUBMENU))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
509 menubar->mode (idx, itemflags | FL_MENU_DIVIDER);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
510 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
511 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
512 menubar->mode (idx, itemflags & (~FL_MENU_DIVIDER));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
513 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
514 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
515 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
516
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
517 void update_visible (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
518 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
519 std::string fltk_label = uimenup.get_fltk_label ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
520 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
521 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
522 Fl_Menu_Item* item
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
523 = const_cast<Fl_Menu_Item*> (menubar->find_item (fltk_label.c_str ()));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
524 if (item != NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
525 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
526 if (uimenup.is_visible ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
527 item->show ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
528 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
529 item->hide ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
530 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
531 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
532 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
533
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
534 void add_entry (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
535 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
536
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
537 std::string fltk_label = uimenup.get_fltk_label ();
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
538
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
539 if (!fltk_label.empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
540 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
541 bool item_added = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
542 do
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
543 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
544 const Fl_Menu_Item* item
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
545 = menubar->find_item (fltk_label.c_str ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
546
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
547 if (item == NULL)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
548 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
549 Matrix uimenu_ch = find_uimenu_children (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
550 int len = uimenu_ch.numel ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
551 int flags = 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
552 if (len > 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
553 flags = FL_SUBMENU;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
554 if (len == 0 && uimenup.is_checked ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
555 flags += FL_MENU_TOGGLE + FL_MENU_VALUE;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
556 menubar->add (fltk_label.c_str (), 0, 0, 0, flags);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
557 item_added = true;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
558 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
559 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
560 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
561 //avoid duplicate menulabels
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
562 std::size_t idx1 = fltk_label.find_last_of ("(");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
563 std::size_t idx2 = fltk_label.find_last_of (")");
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
564 int len = idx2 - idx1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
565 int val = 1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
566 if (len > 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
567 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
568 std::string valstr = fltk_label.substr (idx1 + 1, len - 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
569 fltk_label.erase (idx1, len + 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
570 val = atoi (valstr.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
571 if (val > 0 && val < 99)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
572 val++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
573 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
574 std::ostringstream valstream;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
575 valstream << val;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
576 fltk_label += "(" + valstream.str () + ")";
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
577 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
578 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
579 while (!item_added);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
580 uimenup.set_fltk_label (fltk_label);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
581 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
582 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
583
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
584 void add_to_menu (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
585 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
586 Matrix kids = find_uimenu_children (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
587 int len = kids.length ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
588 std::string fltk_label = uimenup.get_fltk_label ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
589
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
590 add_entry (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
591 update_foregroundcolor (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
592 update_callback (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
593 update_accelerator (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
594 update_enable (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
595 update_visible (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
596 update_seperator (uimenup);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
597
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
598 for (octave_idx_type ii = 0; ii < len; ii++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
599 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
600 graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
601 if (kgo.valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
602 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
603 uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
604 (kgo.get_properties ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
605 add_to_menu (kprop);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
606 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
607 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
608 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
609
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
610 void add_to_menu (figure::properties& figp)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
611 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
612 Matrix kids = find_uimenu_children (figp);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
613 int len = kids.length ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
614 menubar->clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
615 for (octave_idx_type ii = 0; ii < len; ii++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
616 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
617 graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
618
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
619 if (kgo.valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
620 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
621 uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
622 (kgo.get_properties ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
623 add_to_menu (kprop);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
624 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
625 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
626 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
627
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
628 template <class T_prop>
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
629 void remove_from_menu (T_prop& prop)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
630 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
631 Matrix kids;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
632 std::string type = prop.get_type ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
633 kids = find_uimenu_children (prop);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
634 int len = kids.length ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
635
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
636 for (octave_idx_type ii = 0; ii < len; ii++)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
637 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
638 graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
639
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
640 if (kgo.valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
641 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
642 uimenu::properties kprop = dynamic_cast<uimenu::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
643 (kgo.get_properties ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
644 remove_from_menu (kprop);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
645 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
646 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
647
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
648 if (type.compare ("uimenu") == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
649 delete_entry (dynamic_cast<uimenu::properties&> (prop));
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
650 else if (type.compare ("figure") == 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
651 menubar->clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
652 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
653
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
654 ~fltk_uimenu (void)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
655 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
656 delete menubar;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
657 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
658
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
659 private:
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
660
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
661 // No copying!
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
662
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
663 fltk_uimenu (const fltk_uimenu&);
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
664
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
665 fltk_uimenu operator = (const fltk_uimenu&);
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
666
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
667 Fl_Menu_Bar* menubar;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
668 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
669
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
670 class plot_window : public Fl_Window
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
671 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
672 friend class fltk_uimenu;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
673 public:
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
674 plot_window (int xx, int yy, int ww, int hh, figure::properties& xfp)
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
675 : Fl_Window (xx, yy - menu_h, ww, hh + menu_h + status_h, "octave"),
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
676 window_label (), shift (0), ndim (2), fp (xfp), canvas (0),
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
677 autoscale (0), togglegrid (0), panzoom (0), rotate (0), help (0),
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
678 status (0), ax_obj (), pos_x (0), pos_y (0)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
679 {
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
680 callback (window_close, static_cast<void*> (this));
12465
6b2abcd20fef Call size_range early to allow window resizing for MinGW and MacOS
Kai Habel <kai.habel@gmx.de>
parents: 12449
diff changeset
681 size_range (4*status_h, 2*status_h);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
682
14447
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
683 // FIXME: The function below is only available in FLTK >= 1.3
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
684 // At some point support for FLTK 1.1 will be dropped in Octave.
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
685 // At that point this function should be uncommented.
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
686 // The current solution is to call xclass() before show() for each window.
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
687 // Set WM_CLASS which allows window managers to properly group related
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
688 // windows. Otherwise, the class is just "FLTK"
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
689 //default_xclass ("Octave");
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
690
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
691 begin ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
692 {
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
693 // bbox of plot canvas = [xx, yy, ww, hh];
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
694 // (xx, yy) = UL coordinate relative to UL window.
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
695
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
696 canvas = new OpenGL_fltk (0, menu_h, ww, hh, number ());
12621
c99d6785a27e instantiate canvas before menubar
Kai Habel <kai.habel@gmx.de>
parents: 12565
diff changeset
697
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
698 uimenu = new fltk_uimenu (0, 0, ww, menu_h);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
699 uimenu->hide ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
700
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
701 // Toolbar is a composite of "bottom", "autoscale", "togglegrid",
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
702 // "panzoom", "rotate", "help", and "status".
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
703
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
704 yy = hh + menu_h;
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
705 bottom = new Fl_Box (0, yy, ww, status_h);
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
706 bottom->box (FL_FLAT_BOX);
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
707
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
708 ndim = calc_dimensions (gh_manager::get_object (fp.get___myhandle__ ()));
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
709
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
710 autoscale = new Fl_Button (0, yy, status_h, status_h, "A");
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
711 autoscale->callback (button_callback, static_cast<void*> (this));
10809
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
712 autoscale->tooltip ("Autoscale");
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
713
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
714 togglegrid = new Fl_Button (status_h, yy, status_h,
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
715 status_h, "G");
7856
cf672485be43 Add toggle grid button & handle the 'a' & 'g' keys for auto axis and toggle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7852
diff changeset
716 togglegrid->callback (button_callback, static_cast<void*> (this));
10809
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
717 togglegrid->tooltip ("Toggle Grid");
7856
cf672485be43 Add toggle grid button & handle the 'a' & 'g' keys for auto axis and toggle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7852
diff changeset
718
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
719 panzoom = new Fl_Button (2 * status_h, yy, status_h,
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
720 status_h, "P");
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
721 panzoom->callback (button_callback, static_cast<void*> (this));
10809
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
722 panzoom->tooltip ("Mouse Pan/Zoom");
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
723
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
724 rotate = new Fl_Button (3 * status_h, yy, status_h,
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
725 status_h, "R");
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
726 rotate->callback (button_callback, static_cast<void*> (this));
10809
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
727 rotate->tooltip ("Mouse Rotate");
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
728
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
729 if (ndim == 2)
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
730 rotate->deactivate ();
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
731
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
732 help = new Fl_Button (4 * status_h, yy, status_h,
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
733 status_h, "?");
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
734 help->callback (button_callback, static_cast<void*> (this));
10809
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
735 help->tooltip ("Help");
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
736
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
737 status = new Fl_Output (5 * status_h, yy,
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
738 ww > 2*status_h ? ww - status_h : 0,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
739 status_h, "");
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
740
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
741 status->textcolor (FL_BLACK);
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
742 status->color (FL_GRAY);
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
743 status->textfont (FL_COURIER);
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
744 status->textsize (10);
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
745 status->box (FL_ENGRAVED_BOX);
12507
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
746
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
747 // This allows us to have a valid OpenGL context right away.
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
748 canvas->mode (FL_DEPTH | FL_DOUBLE );
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
749 if (fp.is_visible ())
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
750 {
14447
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
751 // FIXME: This code should be removed when Octave drops support
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
752 // for FLTK 1.1. Search for default_xclass in this file to find
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
753 // code that should be uncommented to take its place.
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
754 //
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
755 // Set WM_CLASS which allows window managers to properly group
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
756 // related windows. Otherwise, the class is just "FLTK"
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
757 xclass ("Octave");
12507
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
758 show ();
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14447
diff changeset
759 if (fp.get_currentaxes ().ok ())
12507
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
760 show_canvas ();
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
761 else
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
762 hide_canvas ();
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
763 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
764 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
765 end ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
766
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
767 status->show ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
768 autoscale->show ();
7856
cf672485be43 Add toggle grid button & handle the 'a' & 'g' keys for auto axis and toggle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7852
diff changeset
769 togglegrid->show ();
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
770 panzoom->show ();
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
771 rotate->show ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
772
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
773 set_name ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
774 resizable (canvas);
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
775 gui_mode = (ndim == 3 ? rotate_zoom : pan_zoom);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
776 uimenu->add_to_menu (fp);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
777 if (uimenu->items_to_show ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
778 show_menubar ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
779 else
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
780 hide_menubar ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
781 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
782
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
783 ~plot_window (void)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
784 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
785 canvas->hide ();
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
786 status->hide ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
787 uimenu->hide ();
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
788 this->hide ();
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
789 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
790
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
791 double number (void) { return fp.get___myhandle__ ().value (); }
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
792
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
793 void renumber (double new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
794 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
795 if (canvas)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
796 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
797 if (canvas->renumber (new_number))
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
798 mark_modified ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
799 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
800 else
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
801 error ("unable to renumber figure");
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
802 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
803
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
804 void print (const std::string& cmd, const std::string& term)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
805 {
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
806 canvas->print (cmd, term);
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
807
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
808 // Print immediately so the output file will exist when the drawnow
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
809 // command is done.
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
810 mark_modified ();
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
811 Fl::wait (fltk_maxtime);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
812 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
813
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
814 void show_menubar (void)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
815 {
12484
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
816 if (!uimenu->is_visible ())
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
817 {
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
818 // FIXME - Toolbar and menubar do not update
12484
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
819 uimenu->show ();
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
820 mark_modified ();
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
821 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
822 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
823
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
824 void hide_menubar (void)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
825 {
12484
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
826 if (uimenu->is_visible ())
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
827 {
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
828 // FIXME - Toolbar and menubar do not update
12484
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
829 uimenu->hide ();
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
830 mark_modified ();
9c831d357e6f fix initial canvas size issue
Konstantinos Poulios <logari81@googlemail.com>
parents: 12465
diff changeset
831 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
832 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
833
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
834 void uimenu_update (const graphics_handle& gh, int id)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
835 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
836 graphics_object uimenu_obj = gh_manager::get_object (gh);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
837
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
838 if (uimenu_obj.valid_object () && uimenu_obj.isa ("uimenu"))
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
839 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
840 uimenu::properties& uimenup =
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
841 dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ());
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
842 std::string fltk_label = uimenup.get_fltk_label ();
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
843 graphics_object fig = uimenu_obj.get_ancestor ("figure");
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
844 figure::properties& figp =
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
845 dynamic_cast<figure::properties&> (fig.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
846
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
847 switch (id)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
848 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
849 case base_properties::ID_BEINGDELETED:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
850 uimenu->remove_from_menu (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
851 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
852
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
853 case base_properties::ID_VISIBLE:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
854 uimenu->update_visible (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
855 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
856
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
857 case uimenu::properties::ID_ACCELERATOR:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
858 uimenu->update_accelerator (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
859 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
860
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
861 case uimenu::properties::ID_CALLBACK:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
862 uimenu->update_callback (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
863 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
864
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
865 case uimenu::properties::ID_CHECKED:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
866 uimenu->add_to_menu (figp);//rebuilding entire menu
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
867 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
868
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
869 case uimenu::properties::ID_ENABLE:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
870 uimenu->update_enable (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
871 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
872
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
873 case uimenu::properties::ID_FOREGROUNDCOLOR:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
874 uimenu->update_foregroundcolor (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
875 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
876
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
877 case uimenu::properties::ID_LABEL:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
878 uimenu->add_to_menu (figp);//rebuilding entire menu
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
879 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
880
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
881 case uimenu::properties::ID_POSITION:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
882 uimenu->add_to_menu (figp);//rebuilding entire menu
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
883 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
884
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
885 case uimenu::properties::ID_SEPARATOR:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
886 uimenu->update_seperator (uimenup);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
887 break;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
888 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
889
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
890 if (uimenu->items_to_show ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
891 show_menubar ();
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
892 else
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
893 hide_menubar ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
894
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14447
diff changeset
895 mark_modified ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
896 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
897 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
898
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
899 void show_canvas (void)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
900 {
12903
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
901 if (fp.is_visible ())
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
902 {
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
903 canvas->show ();
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
904 canvas->make_current ();
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
905 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
906 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
907
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
908 void hide_canvas (void)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
909 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
910 canvas->hide ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
911 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
912
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
913 void mark_modified (void)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
914 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
915 damage (FL_DAMAGE_ALL);
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
916 canvas->damage (FL_DAMAGE_ALL);
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
917 ndim = calc_dimensions (gh_manager::get_object (fp.get___myhandle__ ()));
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
918
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
919 if (ndim == 3)
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
920 rotate->activate ();
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
921 else if (ndim == 2 && gui_mode == rotate_zoom)
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
922 {
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
923 rotate->deactivate ();
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
924 gui_mode = pan_zoom;
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
925 }
7840
2c8f693c32fd convert_position not static anymore
Shai Ayal <shaiay@sourceforge.net>
parents: 7839
diff changeset
926 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
927
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
928 void set_name (void)
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
929 {
10009
360de61b2722 corrected redundency in title setting introduced in previous changeset
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10008
diff changeset
930 window_label = fp.get_title ();
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
931 label (window_label.c_str ());
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
932 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
933
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
934 private:
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
935
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
936 // No copying!
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
937
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
938 plot_window (const plot_window&);
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
939
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
940 plot_window& operator = (const plot_window&);
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
941
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
942 // window name -- this must exists for the duration of the window's
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
943 // life
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
944 std::string window_label;
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
945
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
946 // Mod keys status
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
947 int shift;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
948
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
949 // Number of dimensions, 2 or 3.
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
950 int ndim;
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
951
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
952 // Figure properties.
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
953 figure::properties& fp;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
954
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
955 // Status area height.
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
956 static const int status_h = 20;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
957
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
958 // Menu height
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
959 static const int menu_h = 20;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
960
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
961 // Window callback.
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
962 static void window_close (Fl_Widget*, void* data)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
963 {
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
964 octave_value_list args;
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
965 args(0) = static_cast<plot_window*> (data)->number ();
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
966 feval ("close", args);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
967 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
968
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
969 // Button callbacks.
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
970 static void button_callback (Fl_Widget* ww, void* data)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
971 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
972 static_cast<plot_window*> (data)->button_press (ww, data);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
973 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
974
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
975 void button_press (Fl_Widget* widg, void*)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
976 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
977 if (widg == autoscale)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
978 axis_auto ();
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
979
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
980 if (widg == togglegrid)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
981 toggle_grid ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
982
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
983 if (widg == panzoom)
10797
d479134f59de fltk_backend.cc: use enum for plot_window::gui_mode instead of int
John W. Eaton <jwe@octave.org>
parents: 10792
diff changeset
984 gui_mode = pan_zoom;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
985
10917
888c75785221 Improvements to FLTK backend rotation
Jordi Guti?rrez Hermoso <jordigh@gmail.com>
parents: 10865
diff changeset
986 if (widg == rotate && ndim == 3)
10797
d479134f59de fltk_backend.cc: use enum for plot_window::gui_mode instead of int
John W. Eaton <jwe@octave.org>
parents: 10792
diff changeset
987 gui_mode = rotate_zoom;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
988
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
989 if (widg == help)
9060
de7cef39f505 fltk_backend.cc: don't pass arbitrary string as format
John W. Eaton <jwe@octave.org>
parents: 8333
diff changeset
990 fl_message ("%s", help_text);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
991 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
992
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
993 fltk_uimenu* uimenu;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
994 OpenGL_fltk* canvas;
10809
85cbd239fce2 try a better status bar for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10797
diff changeset
995 Fl_Box* bottom;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
996 Fl_Button* autoscale;
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
997 Fl_Button* togglegrid;
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
998 Fl_Button* panzoom;
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
999 Fl_Button* rotate;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1000 Fl_Button* help;
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1001 Fl_Output* status;
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1002 graphics_object ax_obj;
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1003 int pos_x;
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1004 int pos_y;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1005
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1006 void axis_auto (void)
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
1007 {
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1008 octave_value_list args;
9974
118158f10628 fix fltk backend window buttons
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9973
diff changeset
1009 args(0) = fp.get_currentaxes ().as_octave_value ();
118158f10628 fix fltk backend window buttons
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9973
diff changeset
1010 args(1) = "auto";
118158f10628 fix fltk backend window buttons
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9973
diff changeset
1011 feval ("axis", args);
7852
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
1012 mark_modified ();
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
1013 }
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
1014
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1015 void toggle_grid (void)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1016 {
9974
118158f10628 fix fltk backend window buttons
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9973
diff changeset
1017 octave_value_list args;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1018 if (fp.get_currentaxes ().ok ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1019 args(0) = fp.get_currentaxes ().as_octave_value ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1020
9974
118158f10628 fix fltk backend window buttons
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9973
diff changeset
1021 feval ("grid", args);
7856
cf672485be43 Add toggle grid button & handle the 'a' & 'g' keys for auto axis and toggle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7852
diff changeset
1022 mark_modified ();
cf672485be43 Add toggle grid button & handle the 'a' & 'g' keys for auto axis and toggle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7852
diff changeset
1023 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1024
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1025 void pixel2pos (const graphics_handle& ax, int px, int py, double& xx,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1026 double& yy) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1027 {
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1028 pixel2pos ( gh_manager::get_object (ax), px, py, xx, yy);
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1029 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1030
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1031 void pixel2pos (graphics_object ax, int px, int py, double& xx,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1032 double& yy) const
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1033 {
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1034 if (ax && ax.isa ("axes"))
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1035 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1036 axes::properties& ap =
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1037 dynamic_cast<axes::properties&> (ax.get_properties ());
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1038 ColumnVector pp = ap.pixel2coord (px, py);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1039 xx = pp(0);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1040 yy = pp(1);
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1041 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1042 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1043
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1044 graphics_handle pixel2axes_or_ca (int px, int py )
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1045 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1046 Matrix kids = fp.get_children ();
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1047 int len = kids.length ();
9442
2d73b19c5507 improve behavior of builtin
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
1048
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1049 for (int k = 0; k < len; k++)
9443
8f9d8776d11c undo previous commit
John W. Eaton <jwe@octave.org>
parents: 9442
diff changeset
1050 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1051 graphics_handle hnd = gh_manager::lookup (kids(k));
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1052
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1053 if (hnd.ok ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1054 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1055 graphics_object kid = gh_manager::get_object (hnd);
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1056
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1057 if (kid.valid_object () && kid.isa ("axes"))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1058 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1059 Matrix bb = kid.get_properties ().get_boundingbox (true);
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1060
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1061 if (bb(0) <= px && px < (bb(0)+bb(2))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1062 && bb(1) <= py && py < (bb(1)+bb(3)))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1063 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1064 return hnd;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1065 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1066 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1067 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1068 }
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1069 return fp.get_currentaxes ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1070 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1071
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1072 void pixel2status (const graphics_handle& ax, int px0, int py0,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1073 int px1 = -1, int py1 = -1)
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1074 {
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1075 pixel2status (gh_manager::get_object (ax), px0, py0, px1, py1);
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1076 }
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
1077
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
1078 void pixel2status (graphics_object ax, int px0, int py0,
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1079 int px1 = -1, int py1 = -1)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1080 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1081 double x0, y0, x1, y1;
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1082 std::stringstream cbuf;
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1083 cbuf.precision (4);
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1084 cbuf.width (6);
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1085 pixel2pos (ax, px0, py0, x0, y0);
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1086 cbuf << "[" << x0 << ", " << y0 << "]";
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1087 if (px1 >= 0)
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1088 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1089 pixel2pos (ax, px1, py1, x1, y1);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1090 cbuf << " -> ["<< x1 << ", " << y1 << "]";
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1091 }
7840
2c8f693c32fd convert_position not static anymore
Shai Ayal <shaiay@sourceforge.net>
parents: 7839
diff changeset
1092
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1093 status->value (cbuf.str ().c_str ());
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
1094 status->redraw ();
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1095 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1096
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1097 void view2status (graphics_object ax)
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1098 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1099 if (ax && ax.isa ("axes"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1100 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1101 axes::properties& ap =
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1102 dynamic_cast<axes::properties&> (ax.get_properties ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1103 std::stringstream cbuf;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1104 cbuf.precision (4);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1105 cbuf.width (6);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1106 Matrix v (1,2,0);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1107 v = ap.get ("view").matrix_value ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1108 cbuf << "[azimuth: " << v(0) << ", elevation: " << v(1) << "]";
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1109
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1110 status->value (cbuf.str ().c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1111 status->redraw ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1112 }
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1113 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1114
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1115 void set_currentpoint (int px, int py)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1116 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1117 if (!fp.is_beingdeleted ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1118 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1119 Matrix pos (1,2,0);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1120 pos(0) = px;
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1121 pos(1) = h () - (py + status_h + menu_dy ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1122 fp.set_currentpoint (pos);
17144
88616c872933 Set the root property "currentfigure", and figure property "currentaxes".
Ben Abbott <bpabbott@mac.com>
parents: 17143
diff changeset
1123 graphics_object robj = gh_manager::get_object (fp.get_parent ());
88616c872933 Set the root property "currentfigure", and figure property "currentaxes".
Ben Abbott <bpabbott@mac.com>
parents: 17143
diff changeset
1124 root_figure::properties& rp =
88616c872933 Set the root property "currentfigure", and figure property "currentaxes".
Ben Abbott <bpabbott@mac.com>
parents: 17143
diff changeset
1125 dynamic_cast<root_figure::properties&> (robj.get_properties ());
88616c872933 Set the root property "currentfigure", and figure property "currentaxes".
Ben Abbott <bpabbott@mac.com>
parents: 17143
diff changeset
1126 rp.set_currentfigure (fp.get___myhandle__ ().value ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1127 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1128 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1129
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1130 void set_axes_currentpoint (graphics_object ax, int px, int py)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1131 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1132 if (ax.valid_object ())
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1133 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1134 axes::properties& ap =
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1135 dynamic_cast<axes::properties&> (ax.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1136
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1137 double xx, yy;
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1138 pixel2pos (ax, px, py, xx, yy);
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1139
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1140 Matrix pos (2,3,0);
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1141 pos(0,0) = xx;
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1142 pos(1,0) = yy;
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1143 pos(0,1) = xx;
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1144 pos(1,1) = yy;
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1145
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1146 ap.set_currentpoint (pos);
17144
88616c872933 Set the root property "currentfigure", and figure property "currentaxes".
Ben Abbott <bpabbott@mac.com>
parents: 17143
diff changeset
1147 fp.set_currentaxes (ap.get___myhandle__ ().value ());
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1148 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1149 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1150
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1151 int menu_dy ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1152 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1153 if (uimenu->is_visible ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1154 return menu_h;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1155 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1156 return 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1157 }
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1158
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1159 int key2shift (int key)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1160 {
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1161 if (key == FL_Shift_L || key == FL_Shift_R)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1162 return FL_SHIFT;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1163
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1164 if (key == FL_Control_L || key == FL_Control_R)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1165 return FL_CTRL;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1166
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1167 if (key == FL_Alt_L || key == FL_Alt_R)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1168 return FL_ALT;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1169
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1170 if (key == FL_Meta_L || key == FL_Meta_R)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1171 return FL_META;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1172
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1173 return 0;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1174 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1175
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1176 int key2ascii (int key)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1177 {
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1178 if (key < 256) return key;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1179 if (key == FL_Tab) return '\t';
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1180 if (key == FL_Enter) return 0x0a;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1181 if (key == FL_BackSpace) return 0x08;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1182 if (key == FL_Escape) return 0x1b;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1183
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1184 return 0;
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1185 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1186
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1187 Cell modifier2cell ()
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1188 {
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1189 string_vector mod;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1190
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1191 if (shift & FL_SHIFT)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1192 mod.append (std::string ("shift"));
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1193 if (shift & FL_CTRL)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1194 mod.append (std::string ("control"));
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1195 if (shift & FL_ALT || shift & FL_META)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1196 mod.append (std::string ("alt"));
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1197
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1198 return Cell (mod);
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1199 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1200
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
1201 void resize (int xx,int yy,int ww,int hh)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1202 {
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
1203 Fl_Window::resize (xx, yy, ww, hh);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1204
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1205 Matrix pos (1,4,0);
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
1206 pos(0) = xx;
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1207 pos(1) = yy + menu_dy ();
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
1208 pos(2) = ww;
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1209 pos(3) = hh - menu_dy () - status_h;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1210
14357
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14314
diff changeset
1211 fp.set_boundingbox (pos, true);
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14314
diff changeset
1212 }
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14314
diff changeset
1213
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
1214 void draw (void)
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
1215 {
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1216 // FIXME - Toolbar and menubar do not update properly
14358
adb352685ded fltk toolkit: figure position should have its origin at LL not UL.
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
1217 Matrix pos = fp.get_boundingbox (true);
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1218 int canvas_h = pos(3);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1219 int canvas_w = pos(2);
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1220 int canvas_y = menu_dy ();
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1221 int toolbar_y = menu_dy () + canvas_h;
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1222 pos(1) = pos(1) - menu_dy ();
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1223 pos(3) = pos(3) + menu_dy () + status_h;
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1224
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1225 Fl_Window::resize (pos(0), pos(1), pos(2), pos(3));
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1226
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1227 bottom->resize (0, toolbar_y, status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1228 autoscale->resize (0, toolbar_y, status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1229 togglegrid->resize (status_h, toolbar_y, status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1230 panzoom->resize (2 * status_h, toolbar_y, status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1231 rotate->resize (3 * status_h, toolbar_y, status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1232 help->resize (4 * status_h, toolbar_y, status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1233 status->resize (5 * status_h, toolbar_y, pos(2) - 4 * status_h, status_h);
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1234 if (canvas->valid ())
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1235 canvas->resize (0, canvas_y, canvas_w, canvas_h);
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
1236
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
1237 return Fl_Window::draw ();
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
1238 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1239
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1240 int handle (int event)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1241 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1242 graphics_handle gh;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1243
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1244 graphics_object fig = gh_manager::get_object (fp.get___myhandle__ ());
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1245 int retval = Fl_Window::handle (event);
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1246
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1247 // We only handle events which are in the canvas area.
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1248 if (!Fl::event_inside (canvas))
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1249 return retval;
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1250
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1251 if (!fp.is_beingdeleted ())
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1252 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1253 switch (event)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1254 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1255 case FL_KEYDOWN:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1256 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1257 int key = Fl::event_key ();
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1258
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1259 shift |= key2shift (key);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1260 int key_a = key2ascii (key);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1261 if (key_a && fp.get_keypressfcn ().is_defined ())
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1262 {
16871
5e30b1c950b8 Replace uses of Octave_map with octave_map or octave_scalar_map.
Rik <rik@octave.org>
parents: 16816
diff changeset
1263 octave_scalar_map evt;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1264 evt.assign ("Character", octave_value (key_a));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1265 evt.assign ("Key", octave_value (std::tolower (key_a)));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1266 evt.assign ("Modifier", octave_value (modifier2cell ()));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1267 fp.execute_keypressfcn (evt);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1268 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1269 switch (key)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1270 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1271 case 'a':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1272 case 'A':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1273 axis_auto ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1274 break;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1275
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1276 case 'g':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1277 case 'G':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1278 toggle_grid ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1279 break;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1280
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1281 case 'p':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1282 case 'P':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1283 gui_mode = pan_zoom;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1284 break;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1285
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1286 case 'r':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1287 case 'R':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1288 gui_mode = rotate_zoom;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1289 break;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1290 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1291 }
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1292 break;
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1293
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1294 case FL_KEYUP:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1295 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1296 int key = Fl::event_key ();
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1297
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1298 shift &= (~key2shift (key));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1299 int key_a = key2ascii (key);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1300 if (key_a && fp.get_keyreleasefcn ().is_defined ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1301 {
16871
5e30b1c950b8 Replace uses of Octave_map with octave_map or octave_scalar_map.
Rik <rik@octave.org>
parents: 16816
diff changeset
1302 octave_scalar_map evt;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1303 evt.assign ("Character", octave_value (key_a));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1304 evt.assign ("Key", octave_value (std::tolower (key_a)));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1305 evt.assign ("Modifier", octave_value (modifier2cell ()));
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1306 fp.execute_keyreleasefcn (evt);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1307 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1308 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1309 break;
7856
cf672485be43 Add toggle grid button & handle the 'a' & 'g' keys for auto axis and toggle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7852
diff changeset
1310
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1311 case FL_MOVE:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1312 pixel2status (pixel2axes_or_ca (Fl::event_x (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1313 Fl::event_y () - menu_dy ()),
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1314 Fl::event_x (), Fl::event_y () - menu_dy ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1315 break;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1316
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1317 case FL_PUSH:
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1318 pos_x = Fl::event_x ();
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1319 pos_y = Fl::event_y () - menu_dy ();
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1320
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1321 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1322
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1323 gh = pixel2axes_or_ca (pos_x, pos_y);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1324
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1325 if (gh.ok ())
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1326 {
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1327 ax_obj = gh_manager::get_object (gh);
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1328 set_axes_currentpoint (ax_obj, pos_x, pos_y);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1329 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1330
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1331 fp.execute_windowbuttondownfcn (Fl::event_button());
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1332
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1333 if (Fl::event_button () == 1 || Fl::event_button () == 3)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1334 return 1;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1335
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1336 break;
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1337
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1338 case FL_DRAG:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1339 if (fp.get_windowbuttonmotionfcn ().is_defined ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1340 {
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1341 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1342 fp.execute_windowbuttonmotionfcn ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1343 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1344
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1345 if (Fl::event_button () == 1)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1346 {
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1347 if (ax_obj && ax_obj.isa ("axes"))
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1348 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1349 if (gui_mode == pan_zoom)
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1350 pixel2status (ax_obj, pos_x, pos_y,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1351 Fl::event_x (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1352 Fl::event_y () - menu_dy ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1353 else
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1354 view2status (ax_obj);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1355 axes::properties& ap =
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1356 dynamic_cast<axes::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1357 (ax_obj.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1358
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1359 double x0, y0, x1, y1;
14358
adb352685ded fltk toolkit: figure position should have its origin at LL not UL.
Ben Abbott <bpabbott@mac.com>
parents: 14357
diff changeset
1360 Matrix pos = fp.get_boundingbox (true);
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1361 pixel2pos (ax_obj, pos_x, pos_y, x0, y0);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1362 pixel2pos (ax_obj, Fl::event_x (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1363 Fl::event_y () - menu_dy (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1364 x1, y1);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1365
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1366 if (gui_mode == pan_zoom)
14314
17de694961f5 make panning work for logscale axes
John W. Eaton <jwe@octave.org>
parents: 14233
diff changeset
1367 ap.translate_view (x0, x1, y0, y1);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1368 else if (gui_mode == rotate_zoom)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1369 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1370 double daz, del;
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1371 daz = (Fl::event_x () - pos_x) / pos(2) * 360;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1372 del = (Fl::event_y () - menu_dy () - pos_y)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1373 / pos(3) * 360;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1374 ap.rotate_view (del, daz);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1375 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1376
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1377 pos_x = Fl::event_x ();
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1378 pos_y = Fl::event_y () - menu_dy ();
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1379 mark_modified ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1380 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1381 return 1;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1382 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1383 else if (Fl::event_button () == 3)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1384 {
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1385 pixel2status (ax_obj, pos_x, pos_y,
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1386 Fl::event_x (), Fl::event_y () - menu_dy ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1387 Matrix zoom_box (1,4,0);
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1388 zoom_box (0) = pos_x;
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1389 zoom_box (1) = pos_y;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1390 zoom_box (2) = Fl::event_x ();
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1391 zoom_box (3) = Fl::event_y () - menu_dy ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1392 canvas->set_zoom_box (zoom_box);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1393 canvas->zoom (true);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1394 canvas->redraw ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1395 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1396
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1397 break;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1398
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1399 case FL_MOUSEWHEEL:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1400 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1401 graphics_object ax =
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1402 gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (),
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1403 Fl::event_y ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1404 - menu_dy ()));
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1405 if (ax && ax.isa ("axes"))
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1406 {
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1407 axes::properties& ap =
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1408 dynamic_cast<axes::properties&> (ax.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1409
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1410 // Determine if we're zooming in or out.
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1411 const double factor =
17366
1102c81e9d60 Eliminate hysteresis when using mouse wheel for zooming in FLTK.
Rik <rik@octave.org>
parents: 17344
diff changeset
1412 (Fl::event_dy () > 0) ? 1 / (1.0 - Vwheel_zoom_speed)
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
1413 : 1.0 - Vwheel_zoom_speed;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1414
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1415 // Get the point we're zooming about.
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1416 double x1, y1;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1417 pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1418 x1, y1);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1419
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1420 ap.zoom_about_point (x1, y1, factor, false);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1421 mark_modified ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1422 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1423 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1424 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1425
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1426 case FL_RELEASE:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1427 if (fp.get_windowbuttonupfcn ().is_defined ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1428 {
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1429 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1430 fp.execute_windowbuttonupfcn ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1431 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1432
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1433 if (Fl::event_button () == 1)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1434 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1435 if ( Fl::event_clicks () == 1)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1436 {
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1437 if (ax_obj && ax_obj.isa ("axes"))
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1438 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1439 axes::properties& ap = dynamic_cast<axes::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1440 (ax_obj.get_properties ());
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1441 ap.set_xlimmode ("auto");
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1442 ap.set_ylimmode ("auto");
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1443 ap.set_zlimmode ("auto");
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1444 mark_modified ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1445 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1446 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1447 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1448 if (Fl::event_button () == 3)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1449 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1450 // End of drag -- zoom.
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1451 if (canvas->zoom ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1452 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1453 canvas->zoom (false);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1454 double x0,y0,x1,y1;
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1455 if (ax_obj && ax_obj.isa ("axes"))
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1456 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1457 axes::properties& ap = dynamic_cast<axes::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1458 (ax_obj.get_properties ());
14020
caf69ec5b94c eliminate static data from fltk plot_window member function
John W. Eaton <jwe@octave.org>
parents: 14014
diff changeset
1459 pixel2pos (ax_obj, pos_x, pos_y, x0, y0);
14233
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1460 int pos_x1 = Fl::event_x ();
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1461 int pos_y1 = Fl::event_y () - menu_dy ();
14233
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1462 pixel2pos (ax_obj, pos_x1, pos_y1, x1, y1);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1463 Matrix xl (1,2,0);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1464 Matrix yl (1,2,0);
14233
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1465 int dx = abs (pos_x - pos_x1);
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1466 int dy = abs (pos_y - pos_y1);
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1467 // Smallest zoom box must be 4 pixels square
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1468 if ((dx > 4) && (dy > 4))
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1469 {
14233
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1470 if (x0 < x1)
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1471 {
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1472 xl(0) = x0;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1473 xl(1) = x1;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1474 }
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1475 else
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1476 {
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1477 xl(0) = x1;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1478 xl(1) = x0;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1479 }
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1480 if (y0 < y1)
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1481 {
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1482 yl(0) = y0;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1483 yl(1) = y1;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1484 }
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1485 else
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1486 {
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1487 yl(0) = y1;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1488 yl(1) = y0;
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1489 }
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
1490 ap.zoom (xl, yl);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1491 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1492 mark_modified ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1493 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1494 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1495 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1496 break;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1497 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1498 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1499
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1500 return retval;
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1501 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1502 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1503
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1504 class figure_manager
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1505 {
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1506 public:
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1507
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1508 static bool instance_ok (void)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1509 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1510 bool retval = true;
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1511
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1512 if (! instance)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1513 instance = new figure_manager ();
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1514
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1515 if (! instance)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1516 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1517 ::error ("unable to create figure_manager object!");
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1518
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1519 retval = false;
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1520 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1521
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1522 return retval;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1523 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1524
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1525 ~figure_manager (void)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1526 {
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1527 close_all ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1528 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1529
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1530 static void close_all (void)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1531 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1532 if (instance_ok ())
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1533 instance->do_close_all ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1534 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1535
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1536 static void new_window (figure::properties& fp)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1537 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1538 if (instance_ok ())
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1539 instance->do_new_window (fp);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1540 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1541
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1542 static void delete_window (int idx)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1543 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1544 if (instance_ok ())
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1545 instance->do_delete_window (idx);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1546 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1547
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1548 static void delete_window (const std::string& idx_str)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1549 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1550 delete_window (str2idx (idx_str));
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1551 }
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1552
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1553 static void renumber_figure (const std::string& idx_str, double new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1554 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1555 if (instance_ok ())
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1556 instance->do_renumber_figure (str2idx (idx_str), new_number);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1557 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1558
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1559 static void toggle_window_visibility (int idx, bool is_visible)
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1560 {
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1561 if (instance_ok ())
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1562 instance->do_toggle_window_visibility (idx, is_visible);
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1563 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1564
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1565 static void toggle_window_visibility (const std::string& idx_str,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1566 bool is_visible)
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1567 {
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1568 toggle_window_visibility (str2idx (idx_str), is_visible);
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1569 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1570
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1571 static void mark_modified (int idx)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1572 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1573 if (instance_ok ())
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1574 instance->do_mark_modified (idx);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1575 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1576
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1577 static void mark_modified (const graphics_handle& gh)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1578 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1579 mark_modified (hnd2idx (gh));
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1580 }
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1581
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1582 static void set_name (int idx)
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1583 {
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1584 if (instance_ok ())
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1585 instance->do_set_name (idx);
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1586 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1587
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1588 static void set_name (const std::string& idx_str)
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1589 {
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1590 set_name (str2idx (idx_str));
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1591 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1592
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1593 static Matrix get_size (int idx)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1594 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1595 return instance_ok () ? instance->do_get_size (idx) : Matrix ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1596 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1597
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1598 static Matrix get_size (const graphics_handle& gh)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1599 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1600 return get_size (hnd2idx (gh));
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1601 }
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1602
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1603 static void print (const graphics_handle& gh, const std::string& cmd,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1604 const std::string& term)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1605 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1606 if (instance_ok ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1607 instance->do_print (hnd2idx (gh), cmd, term);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1608 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1609
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1610 static void uimenu_update (const graphics_handle& figh,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1611 const graphics_handle& uimenuh, int id)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1612 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1613 if (instance_ok ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1614 instance->do_uimenu_update (hnd2idx (figh), uimenuh, id);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1615 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1616
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1617 static void update_canvas (const graphics_handle& gh,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1618 const graphics_handle& ca)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1619 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1620 if (instance_ok ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1621 instance->do_update_canvas (hnd2idx (gh), ca);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1622 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1623
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1624 static void toggle_menubar_visibility (int fig_idx, bool menubar_is_figure)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1625 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1626 if (instance_ok ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1627 instance->do_toggle_menubar_visibility (fig_idx, menubar_is_figure);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1628 }
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1629
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1630 static void toggle_menubar_visibility (const std::string& fig_idx_str,
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1631 bool menubar_is_figure)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1632 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1633 toggle_menubar_visibility (str2idx (fig_idx_str), menubar_is_figure);
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1634 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1635
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1636 private:
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1637
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1638 static figure_manager *instance;
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1639
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1640 figure_manager (void) { }
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1641
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1642 // No copying!
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1643 figure_manager (const figure_manager&);
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1644 figure_manager& operator = (const figure_manager&);
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1645
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1646 // Singelton -- hide all of the above.
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1647
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1648 static int curr_index;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1649 typedef std::map<int, plot_window*> window_map;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1650 typedef window_map::iterator wm_iterator;;
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1651 window_map windows;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1652
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1653 static std::string fltk_idx_header;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1654
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1655 void do_close_all (void)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1656 {
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1657 wm_iterator win;
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1658 for (win = windows.begin (); win != windows.end (); win++)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1659 delete win->second;
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1660 windows.clear ();
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1661 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1662
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1663 void do_new_window (figure::properties& fp)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1664 {
13798
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1665 int idx = figprops2idx (fp);
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1666
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1667 if (idx >= 0 && windows.find (idx) == windows.end ())
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1668 {
13804
4f112bebd474 use correct method to get window position for fltk
John W. Eaton <jwe@octave.org>
parents: 13799
diff changeset
1669 Matrix pos = fp.get_boundingbox (true);
13799
760e4e88dba3 convert units for figure positions
John W. Eaton <jwe@octave.org>
parents: 13798
diff changeset
1670
13798
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1671 int x = pos(0);
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1672 int y = pos(1);
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1673 int w = pos(2);
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1674 int h = pos(3);
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1675
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1676 idx2figprops (curr_index, fp);
13798
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
1677
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1678 windows[curr_index++] = new plot_window (x, y, w, h, fp);
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1679 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1680 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1681
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1682 void do_delete_window (int idx)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1683 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1684 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1685
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1686 if (win != windows.end ())
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1687 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1688 delete win->second;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1689 windows.erase (win);
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1690 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1691 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1692
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1693 void do_renumber_figure (int idx, double new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1694 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1695 wm_iterator win = windows.find (idx);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1696
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1697 if (win != windows.end ())
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1698 win->second->renumber (new_number);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1699 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1700
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1701 void do_toggle_window_visibility (int idx, bool is_visible)
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1702 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1703 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1704
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1705 if (win != windows.end ())
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1706 {
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1707 if (is_visible)
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1708 win->second->show ();
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1709 else
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1710 win->second->hide ();
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1711
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1712 win->second->redraw ();
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1713 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1714 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1715
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1716 void do_toggle_menubar_visibility (int fig_idx, bool menubar_is_figure)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1717 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1718 wm_iterator win = windows.find (fig_idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1719
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1720 if (win != windows.end ())
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1721 {
11585
1473d0cf86d2 untabify source files
John W. Eaton <jwe@octave.org>
parents: 11583
diff changeset
1722 if (menubar_is_figure)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1723 win->second->show_menubar ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1724 else
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1725 win->second->hide_menubar ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1726
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1727 win->second->redraw ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1728 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1729 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1730
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1731 void do_mark_modified (int idx)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1732 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1733 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1734
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1735 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1736 win->second->mark_modified ();
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1737 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1738
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1739 void do_set_name (int idx)
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1740 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1741 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1742
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1743 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1744 win->second->set_name ();
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1745 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1746
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1747 Matrix do_get_size (int idx)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1748 {
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1749 Matrix sz (1, 2, 0.0);
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1750
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1751 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1752
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1753 if (win != windows.end ())
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1754 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1755 sz(0) = win->second->w ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1756 sz(1) = win->second->h ();
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1757 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1758
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1759 return sz;
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1760 }
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1761
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
1762 void do_print (int idx, const std::string& cmd, const std::string& term)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1763 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1764 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1765
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1766 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1767 win->second->print (cmd, term);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1768 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1769
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1770 void do_uimenu_update (int idx, const graphics_handle& gh, int id)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1771 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1772 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1773
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1774 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1775 win->second->uimenu_update (gh, id);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1776 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1777
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1778 void do_update_canvas (int idx, const graphics_handle& ca)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1779 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1780 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1781
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1782 if (win != windows.end ())
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1783 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1784 if (ca.ok ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1785 win->second->show_canvas ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1786 else
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1787 win->second->hide_canvas ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1788 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1789 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1790
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1791 static int str2idx (const caseless_str& clstr)
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1792 {
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1793 int ind;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1794 if (clstr.find (fltk_idx_header,0) == 0)
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1795 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1796 std::istringstream istr (clstr.substr (fltk_idx_header.size ()));
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1797 if (istr >> ind)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1798 return ind;
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1799 }
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1800 error ("figure_manager: could not recognize fltk index");
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1801 return -1;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1802 }
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1803
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1804 void idx2figprops (int idx, figure::properties& fp)
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1805 {
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1806 std::ostringstream ind_str;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1807 ind_str << fltk_idx_header << idx;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1808 fp.set___plot_stream__ (ind_str.str ());
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1809 }
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1810
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1811 static int figprops2idx (const figure::properties& fp)
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1812 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1813 if (fp.get___graphics_toolkit__ () == FLTK_GRAPHICS_TOOLKIT_NAME)
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1814 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1815 octave_value ps = fp.get___plot_stream__ ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1816 if (ps.is_string ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1817 return str2idx (ps.string_value ());
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1818 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1819 return 0;
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1820 }
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1821 error ("figure_manager: figure is not fltk");
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1822 return -1;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1823 }
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1824
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1825 static int hnd2idx (double h)
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1826 {
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1827 graphics_object fobj = gh_manager::get_object (h);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1828 if (fobj && fobj.isa ("figure"))
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1829 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1830 figure::properties& fp =
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1831 dynamic_cast<figure::properties&> (fobj.get_properties ());
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1832 return figprops2idx (fp);
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1833 }
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1834 error ("figure_manager: H (= %g) is not a figure", h);
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1835 return -1;
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1836 }
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1837
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1838 static int hnd2idx (const graphics_handle& fh)
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1839 {
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1840 return hnd2idx (fh.value ());
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1841 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1842 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1843
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1844 figure_manager *figure_manager::instance = 0;
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
1845
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1846 std::string figure_manager::fltk_idx_header="fltk index=";
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1847 int figure_manager::curr_index = 1;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1848
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
1849 static bool toolkit_loaded = false;
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1850
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1851 static int
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1852 __fltk_redraw__ (void)
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1853 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
1854 if (toolkit_loaded)
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1855 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1856 // We scan all figures and add those which use FLTK.
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1857 graphics_object obj = gh_manager::get_object (0);
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1858 if (obj && obj.isa ("root"))
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1859 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1860 base_properties& props = obj.get_properties ();
11301
cc9b8cd5aa87 consider hidden handles in uimenu code
Kai Habel <kai.habel@gmx.de>
parents: 11297
diff changeset
1861 Matrix children = props.get_all_children ();
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1862
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1863 for (octave_idx_type n = 0; n < children.numel (); n++)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1864 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1865 graphics_object fobj = gh_manager::get_object (children (n));
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1866 if (fobj && fobj.isa ("figure"))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1867 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1868 figure::properties& fp =
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1869 dynamic_cast<figure::properties&> (fobj.get_properties ());
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1870 if (fp.get___graphics_toolkit__ ()
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1871 == FLTK_GRAPHICS_TOOLKIT_NAME)
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1872 figure_manager::new_window (fp);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1873 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1874 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1875 }
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1876
10229
02ae72071221 improve __fltk_redraw__
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10155
diff changeset
1877 // it seems that we have to call Fl::check twice to get everything drawn
02ae72071221 improve __fltk_redraw__
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10155
diff changeset
1878 Fl::check ();
02ae72071221 improve __fltk_redraw__
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10155
diff changeset
1879 Fl::check ();
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1880 }
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1881
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1882 return 0;
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1883 }
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
1884
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1885 class fltk_graphics_toolkit : public base_graphics_toolkit
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1886 {
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1887 public:
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1888 fltk_graphics_toolkit (void)
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
1889 : base_graphics_toolkit (FLTK_GRAPHICS_TOOLKIT_NAME),
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
1890 input_event_hook_fcn_id ()
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
1891 { }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1892
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
1893 ~fltk_graphics_toolkit (void) { }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1894
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1895 bool is_valid (void) const { return true; }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1896
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12968
diff changeset
1897 bool initialize (const graphics_object& go)
17079
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1898 {
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1899 if (go.isa ("figure")
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1900 || go.isa ("uimenu"))
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1901 {
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1902 if (go.isa ("uimenu"))
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1903 update (go, uimenu::properties::ID_LABEL);
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1904
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1905 return true;
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1906 }
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1907
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1908 return false;
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
1909 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12968
diff changeset
1910
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10972
diff changeset
1911 void finalize (const graphics_object& go)
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1912 {
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1913 if (go.isa ("figure"))
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1914 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1915 octave_value ov = go.get (caseless_str ("__plot_stream__"));
10972
14d16530ad59 fltk_backend::object_destroyed: don't call delete_window if __plot_stream__ is empty
John W. Eaton <jwe@octave.org>
parents: 10955
diff changeset
1916
14d16530ad59 fltk_backend::object_destroyed: don't call delete_window if __plot_stream__ is empty
John W. Eaton <jwe@octave.org>
parents: 10955
diff changeset
1917 if (! ov.is_empty ())
14d16530ad59 fltk_backend::object_destroyed: don't call delete_window if __plot_stream__ is empty
John W. Eaton <jwe@octave.org>
parents: 10955
diff changeset
1918 figure_manager::delete_window (ov.string_value ());
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1919 }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1920 }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1921
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1922 void uimenu_set_fltk_label (graphics_object uimenu_obj)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1923 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1924 if (uimenu_obj.valid_object ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1925 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1926 uimenu::properties& uimenup =
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1927 dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1928 std::string fltk_label = uimenup.get_label ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1929 graphics_object go = gh_manager::get_object (uimenu_obj.get_parent ());
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1930 if (go.isa ("uimenu"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1931 fltk_label = dynamic_cast<const uimenu::properties&>
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1932 (go.get_properties ()).get_fltk_label ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1933 + "/"
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1934 + fltk_label;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1935 else if (go.isa ("figure"))
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1936 ;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1937 else
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1938 error ("unexpected parent object\n");
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1939
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1940 uimenup.set_fltk_label (fltk_label);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1941 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1942 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1943
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10972
diff changeset
1944 void update (const graphics_object& go, int id)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1945 {
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1946 if (go.isa ("figure"))
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1947 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1948 octave_value ov = go.get (caseless_str ("__plot_stream__"));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1949
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1950 if (! ov.is_empty ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1951 {
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1952 const figure::properties& fp =
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1953 dynamic_cast<const figure::properties&> (go.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1954
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1955 switch (id)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1956 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1957 case base_properties::ID_VISIBLE:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1958 figure_manager::toggle_window_visibility (ov.string_value (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1959 fp.is_visible ());
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1960 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1961
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1962 case figure::properties::ID_MENUBAR:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1963 figure_manager::toggle_menubar_visibility
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1964 (ov.string_value (), fp.menubar_is ("figure"));
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1965 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1966
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1967 case figure::properties::ID_CURRENTAXES:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1968 figure_manager::update_canvas (go.get_handle (),
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1969 fp.get_currentaxes ());
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1970 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1971
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1972 case figure::properties::ID_NAME:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1973 case figure::properties::ID_NUMBERTITLE:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1974 figure_manager::set_name (ov.string_value ());
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1975 break;
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1976
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1977 case figure::properties::ID_INTEGERHANDLE:
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1978 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1979 std::string tmp = ov.string_value ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1980 graphics_handle gh = fp.get___myhandle__ ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1981 figure_manager::renumber_figure (tmp, gh.value ());
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1982 figure_manager::set_name (tmp);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1983 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1984 break;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1985 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1986 }
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
1987 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1988 else if (go.isa ("uimenu"))
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1989 {
11239
5fa7667f90e5 Add prefix ID_ to property ids to avoid name clash on windows
Kai Habel <kai.habel@gmx.de>
parents: 11224
diff changeset
1990 if (id == uimenu::properties::ID_LABEL)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1991 uimenu_set_fltk_label (go);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1992
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
1993 graphics_object fig = go.get_ancestor ("figure");
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
1994 figure_manager::uimenu_update (fig.get_handle (), go.get_handle (), id);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1995 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1996 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1997
8077
a4e03f9b4b8a Fix FLTK backend update
Michael Goffioul
parents: 8060
diff changeset
1998 void redraw_figure (const graphics_object& go) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1999 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
2000 figure_manager::mark_modified (go.get_handle ());
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
2001
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
2002 __fltk_redraw__ ();
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2003 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2004
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2005 void print_figure (const graphics_object& go,
10857
2224236440c0 add more terminal types to gl2ps-renderer
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10809
diff changeset
2006 const std::string& term,
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
2007 const std::string& file_cmd, bool /*mono*/,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2008 const std::string& /*debug_file*/) const
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2009 {
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
2010 figure_manager::print (go.get_handle (), file_cmd, term);
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
2011 redraw_figure (go);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2012 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2013
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2014 Matrix get_canvas_size (const graphics_handle& fh) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2015 {
8267
f2f1d07a7f0f fltk_backend.cc (class figure_manager): implement in way consistent with other singleton classes in Octave
John W. Eaton <jwe@octave.org>
parents: 8263
diff changeset
2016 return figure_manager::get_size (fh);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2017 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2018
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2019 double get_screen_resolution (void) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2020 {
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
2021 // FLTK doesn't give this info.
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2022 return 72.0;
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2023 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2024
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2025 Matrix get_screen_size (void) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2026 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2027 Matrix sz (1, 2, 0.0);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2028 sz(0) = Fl::w ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2029 sz(1) = Fl::h ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2030 return sz;
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2031 }
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2032
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2033 void close (void)
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2034 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2035 if (toolkit_loaded)
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2036 {
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2037 munlock ("__init_fltk__");
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2038
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2039 figure_manager::close_all ();
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2040
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2041 octave_value_list args = input_event_hook_fcn_id;
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2042 args.append (false);
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2043 Fremove_input_event_hook (args, 0);
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2044
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2045 input_event_hook_fcn_id = octave_value_list ();
14014
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2046
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2047 // FIXME ???
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2048 Fl::wait (fltk_maxtime);
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2049 }
907d03def9d5 explicitly close figures in clean_up_and_exit instead of using an atexit function
John W. Eaton <jwe@octave.org>
parents: 14002
diff changeset
2050 }
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2051
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2052 void set_input_event_hook_id (const octave_value_list& id)
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2053 {
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2054 input_event_hook_fcn_id = id;
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2055 }
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2056
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2057 private:
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2058 octave_value_list input_event_hook_fcn_id;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2059 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2060
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2061 #endif
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2062
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2063 DEFUN_DLD (__fltk_redraw__, , ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2064 "-*- texinfo -*-\n\
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2065 @deftypefn {Loadable Function} {} __fltk_redraw__ ()\n\
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2066 Undocumented internal function.\n\
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2067 @end deftypefn")
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2068 {
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2069 #ifdef HAVE_FLTK
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2070 __fltk_redraw__ ();
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2071 #else
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2072 error ("__fltk_redraw__: not available without OpenGL and FLTK libraries");
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2073 #endif
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2074
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2075 return octave_value ();
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2076 }
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2077
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2078 // Initialize the fltk graphics toolkit.
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
2079
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2080 DEFUN_DLD (__init_fltk__, , ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2081 "-*- texinfo -*-\n\
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2082 @deftypefn {Loadable Function} {} __init_fltk__ ()\n\
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2083 Undocumented internal function.\n\
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2084 @end deftypefn")
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2085 {
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2086 #ifdef HAVE_FLTK
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2087 if (! toolkit_loaded)
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2088 {
9216
9d4b84b14bf0 call mlock in __fltk_init__
John W. Eaton <jwe@octave.org>
parents: 9060
diff changeset
2089 mlock ();
9d4b84b14bf0 call mlock in __fltk_init__
John W. Eaton <jwe@octave.org>
parents: 9060
diff changeset
2090
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2091 fltk_graphics_toolkit *fltk = new fltk_graphics_toolkit ();
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2092 graphics_toolkit tk (fltk);
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2093 gtk_manager::load_toolkit (tk);
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2094 toolkit_loaded = true;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2095
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2096 octave_value fcn (new octave_builtin (F__fltk_redraw__));
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2097 octave_value fcn_handle (new octave_fcn_handle (fcn, "@__fltk_redraw__"));
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2098 octave_value_list id = Fadd_input_event_hook (fcn_handle, 1);
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2099
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2100 fltk->set_input_event_hook_id (id);
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2101 }
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2102 #else
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2103 error ("__init_fltk__: not available without OpenGL and FLTK libraries");
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2104 #endif
7842
1357bcae6e29 added pixel<->coord transform in axes and use it for display of cursor
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7841
diff changeset
2105
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2106 return octave_value ();
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2107 }
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2108
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2109 DEFUN_DLD (__fltk_maxtime__, args, ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2110 "-*- texinfo -*-\n\
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2111 @deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n\
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2112 @deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\n\
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2113 Undocumented internal function.\n\
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2114 @end deftypefn")
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2115 {
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2116 #ifdef HAVE_FLTK
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2117 octave_value retval = fltk_maxtime;
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2118
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2119 if (args.length () == 1)
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2120 {
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2121 if (args(0).is_real_scalar ())
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
2122 fltk_maxtime = args(0).double_value ();
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
2123 else
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
2124 error ("argument must be a real scalar");
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2125 }
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2126
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2127 return retval;
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2128 #else
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2129 error ("__fltk_maxtime__: not available without OpenGL and FLTK libraries");
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2130 return octave_value ();
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2131 #endif
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2132 }
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
2133
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2134 DEFUN_DLD (__have_fltk__, , ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2135 "-*- texinfo -*-\n\
16816
12005245b645 doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 16785
diff changeset
2136 @deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\n\
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2137 Undocumented internal function.\n\
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2138 @end deftypefn")
15503
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2139 {
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2140 octave_value retval;
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2141
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2142 #ifdef HAVE_FLTK
15503
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2143 retval = true;
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2144 #else
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2145 retval = false;
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2146 #endif
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2147
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2148 return retval;
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2149 }
dca1f2bcccf3 don't register fltk toolkit if compiling without FLTK (bug #37541)
John W. Eaton <jwe@octave.org>
parents: 15195
diff changeset
2150
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2151 // FIXME: This function should be abstracted and made potentially
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2152 // available to all graphics toolkits. This suggests putting it in
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2153 // graphics.cc as is done for drawnow() and having the master
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2154 // mouse_wheel_zoom function call fltk_mouse_wheel_zoom. The same
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2155 // should be done for gui_mode and fltk_gui_mode. For now (2011.01.30),
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2156 // just changing function names and docstrings.
12226
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2157
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2158 DEFUN_DLD (mouse_wheel_zoom, args, nargout,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2159 "-*- texinfo -*-\n\
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2160 @deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2161 @deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2162 @deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\n\
12226
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2163 Query or set the mouse wheel zoom factor.\n\
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2164 \n\
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2165 The zoom factor is a number in the range (0,1) which is the percentage of the\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2166 current axis limits that will be used when zooming. For example, if the\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2167 current x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2168 then a zoom operation will change the limits by 20.\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2169 \n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2170 When called from inside a function with the @qcode{\"local\"} option, the\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2171 variable is changed locally for the function and any subroutines it calls. \n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2172 The original variable value is restored when exiting the function.\n\
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2173 \n\
12226
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2174 This function is currently implemented only for the FLTK graphics toolkit.\n\
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2175 @seealso{gui_mode}\n\
9668
6291b69cf2d2 imported patch fltk_overlay
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9652
diff changeset
2176 @end deftypefn")
6291b69cf2d2 imported patch fltk_overlay
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9652
diff changeset
2177 {
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2178 #ifdef HAVE_FLTK
17344
4ddc277e5bdb Use SET_INTERNAL_VARIABLE macro for mouse_wheel_zoom() variable.
Rik <rik@octave.org>
parents: 17281
diff changeset
2179 return SET_INTERNAL_VARIABLE_WITH_LIMITS(wheel_zoom_speed, 0.0001, 0.9999);
14233
358b59706656 Stop FLTK plot figure crash with right-mouse zoom (Bug #32592).
Doug Stewart <doug.dastew@gmail.com>
parents: 14138
diff changeset
2180 #else
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
2181 error ("mouse_wheel_zoom: not available without OpenGL and FLTK libraries");
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
2182 return octave_value ();
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
2183 #endif
9668
6291b69cf2d2 imported patch fltk_overlay
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9652
diff changeset
2184 }
6291b69cf2d2 imported patch fltk_overlay
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9652
diff changeset
2185
12226
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2186 DEFUN_DLD (gui_mode, args, ,
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2187 "-*- texinfo -*-\n\
12226
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2188 @deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n\
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2189 @deftypefnx {Built-in Function} {} gui_mode (@var{mode})\n\
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2190 Query or set the GUI mode for the current graphics toolkit.\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
2191 The @var{mode} argument can be one of the following strings:\n\
14366
b76f0740940e doc: Periodic grammar check of documentation.
Rik <octave@nomad.inbox5.com>
parents: 14358
diff changeset
2192 \n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
2193 @table @asis\n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17213
diff changeset
2194 @item @qcode{\"2d\"}\n\
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2195 Allows panning and zooming of current axes.\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
2196 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17213
diff changeset
2197 @item @qcode{\"3d\"}\n\
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2198 Allows rotating and zooming of current axes.\n\
11553
01f703952eff Improve docstrings for functions in DLD-FUNCTIONS directory.
Rik <octave@nomad.inbox5.com>
parents: 11523
diff changeset
2199 \n\
17281
bc924baa2c4e doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents: 17213
diff changeset
2200 @item @qcode{\"none\"}\n\
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2201 Mouse inputs have no effect.\n\
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2202 @end table\n\
12226
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2203 \n\
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2204 This function is currently implemented only for the FLTK graphics toolkit.\n\
8cc154f45e37 Rename fltk_mouse_wheel_zoom, fltk_gui_mode functions to remove fltk_ prefix.
Rik <octave@nomad.inbox5.com>
parents: 12215
diff changeset
2205 @seealso{mouse_wheel_zoom}\n\
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2206 @end deftypefn")
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2207 {
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2208 #ifdef HAVE_FLTK
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2209 caseless_str mode_str;
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2210
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2211 if (gui_mode == pan_zoom)
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2212 mode_str = "2d";
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2213 else if (gui_mode == rotate_zoom)
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2214 mode_str = "3d";
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2215 else
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2216 mode_str = "none";
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2217
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2218 bool failed = false;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2219
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2220 if (args.length () == 1)
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2221 {
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2222 if (args(0).is_string ())
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2223 {
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2224 mode_str = args(0).string_value ();
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2225
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2226 if (mode_str.compare ("2d"))
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2227 gui_mode = pan_zoom;
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2228 else if (mode_str.compare ("3d"))
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2229 gui_mode = rotate_zoom;
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2230 else if (mode_str.compare ("none"))
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2231 gui_mode = none;
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2232 else
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2233 failed = true;
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2234 }
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2235 else
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2236 failed = true;
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2237 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2238
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2239 if (failed)
12215
4ae2a74ed04c Add fltk_gui_mode, fltk_mouse_wheel_zoom to documentation.
Rik <octave@nomad.inbox5.com>
parents: 12205
diff changeset
2240 error ("MODE must be one of the strings: \"2D\", \"3D\", or \"none\"");
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2241
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2242 return octave_value (mode_str);
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
2243 #else
15506
b3762b89c3c0 __init_fltk__.cc: Correct function name in gui_mode error message.
Rik <rik@octave.org>
parents: 15503
diff changeset
2244 error ("gui_mode: not available without OpenGL and FLTK libraries");
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
2245 return octave_value ();
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
2246 #endif
11297
76cf48adfdf7 New function to set GUI mode (fltk)
Kai Habel <kai.habel@gmx.de>
parents: 11283
diff changeset
2247 }