annotate libinterp/dldfcn/__init_fltk__.cc @ 31771:21f9b34eb893

maint: Eliminate "(void)" in C++ function prototypes/declarations. * mk-opts.pl, external.txi, embedded.cc, make_int.cc, standalone.cc, standalonebuiltin.cc, BaseControl.cc, BaseControl.h, ButtonControl.cc, ButtonControl.h, ButtonGroup.cc, ButtonGroup.h, Canvas.cc, Canvas.h, CheckBoxControl.cc, CheckBoxControl.h, Container.cc, Container.h, ContextMenu.cc, ContextMenu.h, EditControl.cc, EditControl.h, Figure.cc, Figure.h, FigureWindow.cc, FigureWindow.h, GLCanvas.cc, GLCanvas.h, GenericEventNotify.h, KeyMap.cc, ListBoxControl.cc, ListBoxControl.h, Logger.cc, Logger.h, Menu.cc, Menu.h, MenuContainer.h, Object.cc, Object.h, ObjectProxy.cc, ObjectProxy.h, Panel.cc, Panel.h, PopupMenuControl.cc, PopupMenuControl.h, PushButtonControl.cc, PushButtonControl.h, PushTool.cc, PushTool.h, RadioButtonControl.cc, RadioButtonControl.h, SliderControl.cc, SliderControl.h, Table.cc, Table.h, TextControl.cc, TextControl.h, TextEdit.h, ToggleButtonControl.cc, ToggleButtonControl.h, ToggleTool.cc, ToggleTool.h, ToolBar.cc, ToolBar.h, ToolBarButton.cc, ToolBarButton.h, gl-select.cc, gl-select.h, qopengl-functions.h, qt-graphics-toolkit.h, qdialog.cpp, qfontdialog.cpp, qprintdialog_win.cpp, liboctgui-build-info.h, liboctgui-build-info.in.cc, color-picker.cc, color-picker.h, command-widget.cc, command-widget.h, community-news.cc, community-news.h, dialog.cc, dialog.h, documentation-bookmarks.cc, documentation-bookmarks.h, documentation-dock-widget.cc, documentation-dock-widget.h, documentation.cc, documentation.h, dw-main-window.cc, dw-main-window.h, external-editor-interface.cc, external-editor-interface.h, files-dock-widget.cc, files-dock-widget.h, find-files-dialog.cc, find-files-dialog.h, find-files-model.cc, find-files-model.h, gui-preferences.cc, gui-preferences.h, gui-settings.cc, gui-settings.h, history-dock-widget.cc, history-dock-widget.h, interpreter-qobject.cc, interpreter-qobject.h, file-editor-interface.h, file-editor-tab.cc, file-editor-tab.h, file-editor.cc, file-editor.h, find-dialog.cc, find-dialog.h, marker.cc, marker.h, octave-qscintilla.cc, octave-qscintilla.h, octave-txt-lexer.cc, octave-txt-lexer.h, main-window.cc, main-window.h, news-reader.cc, news-reader.h, octave-dock-widget.cc, octave-dock-widget.h, octave-qobject.cc, octave-qobject.h, qt-application.cc, qt-application.h, qt-interpreter-events.cc, qt-interpreter-events.h, release-notes.cc, release-notes.h, set-path-dialog.cc, set-path-dialog.h, set-path-model.cc, set-path-model.h, settings-dialog.cc, settings-dialog.h, shortcuts-tree-widget.cc, shortcuts-tree-widget.h, tab-bar.cc, tab-bar.h, terminal-dock-widget.cc, terminal-dock-widget.h, variable-editor-model.cc, variable-editor-model.h, variable-editor.cc, variable-editor.h, welcome-wizard.cc, welcome-wizard.h, workspace-model.cc, workspace-model.h, workspace-view.cc, workspace-view.h, build-env.h, Cell.cc, Cell.h, __contourc__.cc, __magick_read__.cc, auto-shlib.cc, auto-shlib.h, base-text-renderer.h, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, debug.cc, defaults.cc, defaults.h, defun.cc, display.cc, display.h, dynamic-ld.cc, dynamic-ld.h, environment.cc, environment.h, error.cc, error.h, errwarn.cc, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, ft-text-renderer.cc, ft-text-renderer.h, genprops.awk, gh-manager.cc, gh-manager.h, gl-render.cc, gl-render.h, gl2ps-print.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gtk-manager.cc, gtk-manager.h, help.cc, help.h, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, jsondecode.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, ls-hdf5.cc, ls-hdf5.h, mxarray.h, oct-errno.h, oct-errno.in.cc, oct-fstrm.cc, oct-fstrm.h, oct-handle.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-map.cc, oct-map.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, pager.cc, pager.h, pr-flt-fmt.cc, pr-flt-fmt.h, pr-output.cc, pr-output.h, procstream.cc, procstream.h, settings.cc, settings.h, sighandlers.cc, sighandlers.h, stack-frame.cc, stack-frame.h, svd.cc, syminfo.cc, syminfo.h, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, toplev.cc, url-handle-manager.cc, url-handle-manager.h, variables.cc, xpow.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, audiodevinfo.cc, gzip.cc, liboctinterp-build-info.h, liboctinterp-build-info.in.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc, ov-bool.h, ov-builtin.cc, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-ch-mat.h, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-colon.h, ov-complex.cc, ov-complex.h, ov-cs-list.h, ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc, ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.cc, ov-fcn.h, ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h, ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h, ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-flt-re-mat.h, ov-intx.h, ov-java.cc, ov-java.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-legacy-range.cc, ov-legacy-range.h, ov-magic-int.cc, ov-magic-int.h, ov-mex-fcn.cc, ov-mex-fcn.h, ov-null-mat.cc, ov-null-mat.h, ov-oncleanup.cc, ov-oncleanup.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h, ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-re-sparse.h, ov-scalar.cc, ov-scalar.h, ov-str-mat.cc, ov-str-mat.h, ov-struct.cc, ov-struct.h, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, ovl.h, octave.cc, octave.h, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.h, pt-cbinop.h, pt-cell.h, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.h, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-walk.h, pt.cc, pt.h, token.cc, token.h, usage.h, Array-base.cc, Array.h, CColVector.cc, CColVector.h, CDiagMatrix.cc, CDiagMatrix.h, CMatrix.cc, CMatrix.h, CNDArray.cc, CNDArray.h, CRowVector.cc, CRowVector.h, CSparse.cc, CSparse.h, DiagArray2.cc, DiagArray2.h, MArray.cc, MArray.h, MDiagArray2.h, MSparse.h, MatrixType.cc, MatrixType.h, PermMatrix.cc, PermMatrix.h, Range.cc, Range.h, Sparse-b.cc, Sparse.cc, Sparse.h, boolMatrix.cc, boolMatrix.h, boolNDArray.cc, boolNDArray.h, boolSparse.cc, boolSparse.h, chMatrix.h, chNDArray.h, dColVector.cc, dColVector.h, dDiagMatrix.cc, dDiagMatrix.h, dMatrix.cc, dMatrix.h, dNDArray.cc, dNDArray.h, dRowVector.cc, dRowVector.h, dSparse.cc, dSparse.h, dim-vector.cc, dim-vector.h, fCColVector.cc, fCColVector.h, fCDiagMatrix.cc, fCDiagMatrix.h, fCMatrix.cc, fCMatrix.h, fCNDArray.cc, fCNDArray.h, fCRowVector.cc, fCRowVector.h, fColVector.cc, fColVector.h, fDiagMatrix.cc, fDiagMatrix.h, fMatrix.cc, fMatrix.h, fNDArray.cc, fNDArray.h, fRowVector.cc, fRowVector.h, idx-vector.cc, idx-vector.h, intNDArray.cc, intNDArray.h, liboctave-build-info.h, liboctave-build-info.in.cc, CollocWt.cc, CollocWt.h, DAE.h, DAEFunc.h, DAERT.h, DAERTFunc.h, DASPK.cc, DASPK.h, DASRT.cc, DASRT.h, DASSL.cc, DASSL.h, DET.h, EIG.h, LSODE.cc, LSODE.h, ODE.h, ODEFunc.h, ODES.h, ODESFunc.h, Quad.h, aepbalance.cc, aepbalance.h, base-dae.h, base-de.h, chol.cc, chol.h, eigs-base.cc, fEIG.h, gepbalance.h, gsvd.cc, gsvd.h, hess.h, lu.cc, lu.h, oct-fftw.cc, oct-fftw.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randmtzig.cc, randmtzig.h, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, data-conv.cc, file-info.h, glob-match.cc, glob-match.h, kpse.cc, kpse.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.cc, lo-ieee.h, lo-regexp.cc, lo-regexp.h, oct-inttypes.cc, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sort.h, oct-sparse.cc, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, singleton-cleanup.cc, singleton-cleanup.h, str-vec.cc, str-vec.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h, version.cc, version.in.h, cxx-signal-helpers.cc, acinclude.m4, main-cli.cc, main-gui.cc, main.in.cc, mkoctfile.in.cc, octave-build-info.h, octave-build-info.in.cc, octave-config.in.cc, octave-svgconvert.cc, shared-fcns.h: maint: Eliminate "(void)" in C++ function prototypes/declarations.
author Rik <rik@octave.org>
date Tue, 24 Jan 2023 17:19:44 -0800
parents 610a85b0ff62
children e25bf4beb488
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31607
diff changeset
3 // Copyright (C) 2007-2023 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
25
7874
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
26 /*
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
27
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
28 To initialize:
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
29
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
30 graphics_toolkit ("fltk");
7874
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
31 plot (randn (1e3, 1));
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
32
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
33 */
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
34
27263
99aa1bcb8848 rename octave_link and octave_link_events classes, move inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26595
diff changeset
35 // PKG_ADD: if (__have_feature__ ("FLTK") && __have_feature__ ("OPENGL") && have_window_system () && ! (ismac () && __event_manager_enabled__ ())) register_graphics_toolkit ("fltk"); endif
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
36
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
37 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21200
diff changeset
38 # include "config.h"
7874
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
39 #endif
e3a502930e2a eliminate src/graphics subdirectory
John W. Eaton <jwe@octave.org>
parents: 7869
diff changeset
40
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
41 #include "defun-dld.h"
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
42 #include "error.h"
21126
ba0a4b4f021d include errwarn.h in files that use err_disabled_feature conditionally
John W. Eaton <jwe@octave.org>
parents: 21109
diff changeset
43 #include "errwarn.h"
14111
c5222658dc3c doc: Build documentation for functions even when they are unavailable
Rik <octave@nomad.inbox5.com>
parents: 14021
diff changeset
44
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
45 #if defined (HAVE_X_WINDOWS)
21196
bd96c2efd4fe move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
46 # include <X11/Xlib.h>
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
47 #endif
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
48
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
49 #include <cmath>
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
50
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
51 #include <locale>
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
52 #include <map>
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
53 #include <sstream>
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
54 #include <string>
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
55 #include <vector>
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
56
21196
bd96c2efd4fe move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
57 #if defined (WIN32)
bd96c2efd4fe move include statements for OpenGL headers to a single file
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
58 # define WIN32_LEAN_AND_MEAN
13721
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
59 #endif
ca90a6d59ab6 Prevent auto-inclusion of winsock.h in WIN32.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 13281
diff changeset
60
30003
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
61 #if defined (HAVE_FLTK)
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
62 # include <FL/Fl.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
63 # include <FL/Fl_Box.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
64 # include <FL/Fl_Button.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
65 # include <FL/Fl_Choice.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
66 # include <FL/Fl_File_Chooser.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
67 # include <FL/Fl_Gl_Window.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
68 # include <FL/names.h>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
69 # include <FL/Fl_Menu_Bar.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
70 # include <FL/Fl_Menu_Button.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
71 # include <FL/Fl_Output.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
72 # include <FL/Fl_Window.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
73 # include <FL/fl_ask.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
74 # include <FL/fl_draw.H>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
75 # include <FL/gl.h>
66763afc32c9 * __init_fltk__.cc: Make HAVE_FLTK apply only to fltk headers.
John W. Eaton <jwe@octave.org>
parents: 30002
diff changeset
76 #endif
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
77
12205
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
78 // 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
79 // 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
80 // 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
81 // 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
82 #undef Complex
be90f9e4548e #undef Complex after including FLTK headers
John W. Eaton <jwe@octave.org>
parents: 12183
diff changeset
83
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
84 #include "Array.h"
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
85 #include "cmd-edit.h"
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
86 #include "dColVector.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
87 #include "dMatrix.h"
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
88 #include "lo-ieee.h"
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
89 #include "oct-env.h"
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
90
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
91 #include "Cell.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
92 #include "builtin-defun-decls.h"
17881
7aadb87f599a Display warning and don't init FLTK toolkit if no DISPLAY available (bug #40423).
Rik <rik@octave.org>
parents: 17861
diff changeset
93 #include "display.h"
19657
0cdda69dc2b4 Fix compilation error when building with FLTK but without gl2ps
Mike Miller <mtmiller@ieee.org>
parents: 19639
diff changeset
94 #include "gl-render.h"
21199
dd6605e1eaea make gl2ps_renderer implementation private
John W. Eaton <jwe@octave.org>
parents: 21196
diff changeset
95 #include "gl2ps-print.h"
7954
3ffc34caec65 configure fixes
John W. Eaton <jwe@octave.org>
parents: 7874
diff changeset
96 #include "graphics.h"
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23746
diff changeset
97 #include "gtk-manager.h"
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
98 #include "interpreter-private.h"
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
99 #include "interpreter.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
100 #include "oct-map.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
101 #include "oct-opengl.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
102 #include "ov-fcn-handle.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
103 #include "ov.h"
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
104 #include "ovl.h"
9216
9d4b84b14bf0 call mlock in __fltk_init__
John W. Eaton <jwe@octave.org>
parents: 9060
diff changeset
105 #include "variables.h"
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
106
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31105
diff changeset
107 OCTAVE_BEGIN_NAMESPACE(octave)
29993
b5fae48ad807 move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29966
diff changeset
108
30002
1cf04058fea6 Make sure octave namespace begin and end tags appear in matching pairs.
Markus Mützel <markus.muetzel@gmx.de>
parents: 29993
diff changeset
109 #if defined (HAVE_FLTK)
1cf04058fea6 Make sure octave namespace begin and end tags appear in matching pairs.
Markus Mützel <markus.muetzel@gmx.de>
parents: 29993
diff changeset
110
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
111 #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
112
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
113 const char *help_text = "\
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
114 Keyboard Shortcuts\n\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
115 a - autoscale\n\
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
116 p - pan/zoom\n\
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
117 r - rotate\n\
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
118 g - toggle grid\n\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
119 \n\
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
120 Mouse\n\
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
121 left drag - pan\n\
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
122 mouse wheel - zoom\n\
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
123 right drag - rectangle zoom\n\
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
124 left double click - autoscale\n\
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
125 ";
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
126
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
127 class OpenGL_fltk : public Fl_Gl_Window
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
128 {
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
129 public:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
130
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
131 OpenGL_fltk (int xx, int yy, int ww, int hh, double num)
25862
e5a73a8c116c use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents: 25853
diff changeset
132 : Fl_Gl_Window (xx, yy, ww, hh, nullptr), m_number (num),
e5a73a8c116c use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents: 25853
diff changeset
133 m_glfcns (), m_renderer (m_glfcns), m_in_zoom (false), m_zoom_box ()
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
134 {
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
135 #if defined (HAVE_OPENGL)
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
136
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
137 // Ask for double buffering and a depth buffer.
18293
c6e5466d74fe Ensure anti-aliasing in fltk plots (patch #8259)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 17945
diff changeset
138 mode (FL_DEPTH | FL_DOUBLE | FL_MULTISAMPLE);
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
139
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
140 #else
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
141
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
142 err_disabled_feature ("OpenGL_fltk", "OpenGL");
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
143
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
144 #endif
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
145 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
146
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
147 ~OpenGL_fltk () = default;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
148
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
149 void zoom (bool z)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
150 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
151 m_in_zoom = z;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
152 if (! m_in_zoom)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
153 hide_overlay ();
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
154 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
155
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
156 bool zoom () { return m_in_zoom; }
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
157 void set_zoom_box (const Matrix& zb) { m_zoom_box = zb; }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
158
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
159 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
160 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
161 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
162
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
163 octave::gl2ps_print (m_glfcns, gh_mgr.get_object (m_number), cmd, term);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
164 }
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
165
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
166 uint8NDArray get_pixels ()
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
167 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
168 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
169
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
170 m_renderer.draw (gh_mgr.get_object (m_number));
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
171
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
172 return m_renderer.get_pixels (w (), h ());
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
173 }
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
174
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
175 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
176 {
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
177 #if defined (HAVE_OPENGL)
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
178
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
179 Fl_Gl_Window::resize (xx, yy, ww, hh);
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
180
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
181 #else
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
182
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
183 octave_unused_parameter (xx);
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
184 octave_unused_parameter (yy);
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
185 octave_unused_parameter (ww);
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
186 octave_unused_parameter (hh);
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
187
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
188 // This shouldn't happen because construction of Opengl_fltk
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
189 // objects is supposed to be impossible if OpenGL is not available.
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
190
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
191 panic_impossible ();
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
192
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
193 #endif
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
194 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
195
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
196 bool renumber (double new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
197 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
198 bool retval = false;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
199
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
200 if (m_number != new_number)
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
201 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
202 m_number = new_number;
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
203 retval = true;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
204 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
205
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
206 return retval;
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
207 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
208
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
209 private:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
210
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
211 double m_number;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
212
25862
e5a73a8c116c use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents: 25853
diff changeset
213 octave::opengl_functions m_glfcns;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
214 octave::opengl_renderer m_renderer;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
215
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
216 bool m_in_zoom;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
217
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
218 // (x1,y1,x2,y2)
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
219 Matrix m_zoom_box;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
220
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
221 void draw ()
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
222 {
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
223 #if defined (HAVE_OPENGL)
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
224
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
225 if (! valid ())
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
226 {
25862
e5a73a8c116c use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents: 25853
diff changeset
227 m_glfcns.glMatrixMode (GL_PROJECTION);
e5a73a8c116c use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents: 25853
diff changeset
228 m_glfcns.glLoadIdentity ();
e5a73a8c116c use wrapper class to call OpenGL functions
John W. Eaton <jwe@octave.org>
parents: 25853
diff changeset
229 m_glfcns.glViewport (0, 0, w (), h ());
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
230 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
231
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
232 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
233
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
234 m_renderer.draw (gh_mgr.get_object (m_number));
12323
c8da31f12c1d avoid using new to create temporary gl2ps_renderer object
John W. Eaton <jwe@octave.org>
parents: 12226
diff changeset
235
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
236 if (zoom ())
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
237 overlay ();
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
238
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
239 #else
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
240
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
241 // This shouldn't happen because construction of Opengl_fltk
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
242 // objects is supposed to be impossible if OpenGL is not available.
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
243
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
244 panic_impossible ();
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
245
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
246 #endif
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
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
249 void overlay ()
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
250 {
25863
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
251 Matrix overlaycolor (3, 1);
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
252 overlaycolor(0) = 0.45;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
253 overlaycolor(1) = 0.62;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
254 overlaycolor(2) = 0.81;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
255 double overlayalpha = 0.1;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
256 Matrix bordercolor = overlaycolor;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
257 double borderalpha = 0.9;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
258 double borderwidth = 1.5;
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
259
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
260 m_renderer.draw_zoom_box (w (), h (),
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
261 m_zoom_box(0), m_zoom_box(1),
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
262 m_zoom_box(2), m_zoom_box(3),
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
263 overlaycolor, overlayalpha,
8a6bf76abf31 eliminate some duplicate OpenGL drawing code
John W. Eaton <jwe@octave.org>
parents: 25862
diff changeset
264 bordercolor, borderalpha, borderwidth);
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
265 }
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
266
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
267 int handle (int event)
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
268 {
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
269 #if defined (HAVE_OPENGL)
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
270
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
271 switch (event)
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
272 {
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
273 case FL_ENTER:
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
274 cursor (FL_CURSOR_CROSS);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
275 return 1;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
276
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
277 case FL_LEAVE:
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
278 cursor (FL_CURSOR_DEFAULT);
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
279 return 1;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
280 }
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
281
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
282 return Fl_Gl_Window::handle (event);
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
283
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
284 #else
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
285
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
286 octave_unused_parameter (event);
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
287
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
288 // This shouldn't happen because construction of Opengl_fltk
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
289 // objects is supposed to be impossible if OpenGL is not available.
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
290
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
291 panic_impossible ();
25864
baeb93e9febc allow building without OpenGL to work again
John W. Eaton <jwe@octave.org>
parents: 25863
diff changeset
292
21374
1487a68a496a untangle configuration of OpenGL, FLTK, and Qt (bug #47263)
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
293 #endif
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
294 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
295 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
296
29966
7d9be634ac91 declare extra functions in .oct file sources as static
John W. Eaton <jwe@octave.org>
parents: 29751
diff changeset
297 static 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
298 {
30999
fef2957c38ec Deprecate uimenu properties "label" and "callback" (bug #62443)
Rik <rik@octave.org>
parents: 30767
diff changeset
299 static_cast<uimenu::properties *> (data)->execute_menuselectedfcn ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
300 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
301
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
302 class fltk_uimenu
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
303 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
304 public:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
305
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
306 fltk_uimenu (int xx, int yy, int ww, int hh)
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
307 : m_menubar (new Fl_Menu_Bar (xx, yy, ww, hh))
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
308 { }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
309
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
310 int items_to_show ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
311 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
312 //returns the number of visible menu items
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
313 int len = m_menubar->size ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
314 int n = 0;
18678
6113e0c6920b maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents: 18618
diff changeset
315 for (int t = 0; t < len; t++)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
316 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
317 const Fl_Menu_Item *m
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
318 = static_cast<const Fl_Menu_Item *> (&(m_menubar->menu ()[t]));
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
319
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
320 if (m->label () && m->visible ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
321 n++;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
322 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
323
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
324 return n;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
325 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
326
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
327 void show ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
328 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
329 m_menubar->show ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
330 m_menubar->redraw ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
331 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
332
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
333 void hide ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
334 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
335 m_menubar->hide ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
336 m_menubar->redraw ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
337 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
338
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
339 bool is_visible ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
340 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
341 return m_menubar->visible ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
342 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
343
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
344 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
345 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
346 // 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
347 // int GetIndexByName(...), see:
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
348 // 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
349 // 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
350 // Kai Habel (14.10.2010)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
351
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
352 std::string menupath;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
353 for (int t = 0; t < m_menubar->size (); t++)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
354 {
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
355 Fl_Menu_Item *m = const_cast<Fl_Menu_Item *> (&(m_menubar->menu ()[t]));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
356 if (m->submenu ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
357 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
358 // item has submenu
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
359 if (! menupath.empty ())
23802
3f7226b07a38 Change string append += "c" to += 'c' to avoid string constructor.
Rik <rik@octave.org>
parents: 23800
diff changeset
360 menupath += '/';
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
361 menupath += m->label ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
362
21021
a5b99b09f8fd maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents: 21006
diff changeset
363 if (menupath == findname)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
364 return (t);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
365 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
366 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
367 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
368 // End of submenu? Pop back one level.
17900
8e9532632838 * __init_fltk__.cc: Fix typo in previous change.
John W. Eaton <jwe@octave.org>
parents: 17898
diff changeset
369 if (! m->label ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
370 {
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
371 std::size_t idx = menupath.find_last_of ('/');
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
372 if (idx != std::string::npos)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
373 menupath.erase (idx);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
374 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
375 menupath.clear ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
376 continue;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
377 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
378 // Menu item?
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
379 std::string itempath = menupath;
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
380 if (! itempath.empty ())
23802
3f7226b07a38 Change string append += "c" to += 'c' to avoid string constructor.
Rik <rik@octave.org>
parents: 23800
diff changeset
381 itempath += '/';
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
382 itempath += m->label ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
383
21021
a5b99b09f8fd maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents: 21006
diff changeset
384 if (itempath == findname)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
385 return (t);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
386 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
387 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
388 return (-1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
389 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
390
11170
a2437f70fe6c Remove template to allow compilation for MacOS
Kai Habel <kai.habel@gmx.de>
parents: 11155
diff changeset
391 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
392 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
393 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
394 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
395 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
396 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
397
11170
a2437f70fe6c Remove template to allow compilation for MacOS
Kai Habel <kai.habel@gmx.de>
parents: 11155
diff changeset
398 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
399 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
400 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
401 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
402 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
403 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
404
11170
a2437f70fe6c Remove template to allow compilation for MacOS
Kai Habel <kai.habel@gmx.de>
parents: 11155
diff changeset
405 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
406 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
407 octave_idx_type k = 0;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
408
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
409 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
410
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
411 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
412 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
413 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
414
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
415 graphics_object kidgo = gh_mgr.get_object (uimenu_childs (ii));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
416
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
417 if (kidgo.valid_object () && kidgo.isa ("uimenu"))
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
418 {
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
419 uimenu_childs(k) = uimenu_childs(ii);
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
420 pos(k++) = dynamic_cast<uimenu::properties&> (kidgo.get_properties ()).get_position ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
421 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
422 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
423
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
424 uimenu_childs.resize (k, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
425 pos.resize (k, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
426 Matrix retval = Matrix (k, 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
427 // 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
428 // Can we avoid the for loop?
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
429 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
430 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
431 retval(ii) = uimenu_childs (sidx(ii));
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
432
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
433 return retval;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
434 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
435
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
436 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
437 {
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
438 std::string fltk_label = uimenup.get___fltk_label__ ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
439 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
440
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
441 if (idx >= 0)
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
442 m_menubar->remove (idx);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
443 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
444
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
445 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
446 {
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
447 std::string fltk_label = uimenup.get___fltk_label__ ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
448 if (! fltk_label.empty ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
449 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
450 Fl_Menu_Item *item = const_cast<Fl_Menu_Item *> (m_menubar->find_item (fltk_label.c_str ()));
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
451
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
452 if (item)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
453 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
454 std::string acc = uimenup.get_accelerator ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
455 if (acc.length () > 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
456 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
457 int key = FL_CTRL + acc[0];
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
458 item->shortcut (key);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
459 }
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
30999
fef2957c38ec Deprecate uimenu properties "label" and "callback" (bug #62443)
Rik <rik@octave.org>
parents: 30767
diff changeset
464 void update_menuselectedfcn (uimenu::properties& uimenup)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
465 {
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
466 std::string fltk_label = uimenup.get___fltk_label__ ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
467 if (! fltk_label.empty ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
468 {
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
469 Fl_Menu_Item *item
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
470 = const_cast<Fl_Menu_Item *> (m_menubar->find_item (fltk_label.c_str ()));
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
471 if (item)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
472 {
30999
fef2957c38ec Deprecate uimenu properties "label" and "callback" (bug #62443)
Rik <rik@octave.org>
parents: 30767
diff changeset
473 if (! uimenup.get_menuselectedfcn ().isempty ())
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
474 item->callback (static_cast<Fl_Callback *> (script_cb),
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
475 static_cast<void *> (&uimenup));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
476 else
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
477 item->callback (nullptr, static_cast<void *> (nullptr));
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
478 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
479 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
480 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
481
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
482 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
483 {
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
484 std::string fltk_label = uimenup.get___fltk_label__ ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
485 if (! fltk_label.empty ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
486 {
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
487 Fl_Menu_Item *item
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
488 = const_cast<Fl_Menu_Item *> (m_menubar->find_item (fltk_label.c_str ()));
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
489 if (item)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
490 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
491 if (uimenup.is_enable ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
492 item->activate ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
493 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
494 item->deactivate ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
495 }
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 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
498
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
499 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
500 {
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
501 std::string fltk_label = uimenup.get___fltk_label__ ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
502 if (! fltk_label.empty ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
503 {
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
504 Fl_Menu_Item *item
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
505 = const_cast<Fl_Menu_Item *> (m_menubar->find_item (fltk_label.c_str ()));
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
506 if (item)
17787
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 Matrix rgb = uimenup.get_foregroundcolor_rgb ();
12539
ccd0572e5e93 use gnulib:: functions as needed
John W. Eaton <jwe@octave.org>
parents: 12507
diff changeset
509
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
510 uchar r = static_cast<uchar> (std::floor (rgb (0) * 255));
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
511 uchar g = static_cast<uchar> (std::floor (rgb (1) * 255));
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21751
diff changeset
512 uchar b = static_cast<uchar> (std::floor (rgb (2) * 255));
12539
ccd0572e5e93 use gnulib:: functions as needed
John W. Eaton <jwe@octave.org>
parents: 12507
diff changeset
513
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
514 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
515 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
516 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
517 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
518
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
519 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
520 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
521 // Matlab places the separator before the current
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21732
diff changeset
522 // menu entry, while fltk places it after. So we need to find
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
523 // the previous item in this menu/submenu. (Kai)
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
524 std::string fltk_label = uimenup.get___fltk_label__ ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
525 if (! fltk_label.empty ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
526 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
527 int itemflags = 0, idx;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
528 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
529
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
530 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
531 {
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
532 Fl_Menu_Item *item
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
533 = const_cast<Fl_Menu_Item *> (&m_menubar->menu () [idx]);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
534 itemflags = item->flags;
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
535 if (item->label ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
536 break;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
537 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
538
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
539 if (idx >= 0 && idx < m_menubar->size ())
17787
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 if (uimenup.is_separator ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
542 {
26373
5b4b46f7e9ec __init_fltk__.cc: Fix static analyzer detected V560 issue (bug #55347)
Andreas Weber <octave@josoansi.de>
parents: 26002
diff changeset
543 if (! (itemflags & FL_SUBMENU))
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
544 m_menubar->mode (idx, itemflags | FL_MENU_DIVIDER);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
545 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
546 else
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
547 m_menubar->mode (idx, itemflags & (~FL_MENU_DIVIDER));
17787
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 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
550 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
551
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
552 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
553 {
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
554 std::string fltk_label = uimenup.get___fltk_label__ ();
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
555 if (! fltk_label.empty ())
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
556 {
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
557 Fl_Menu_Item *item
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
558 = const_cast<Fl_Menu_Item *> (m_menubar->find_item (fltk_label.c_str ()));
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
559 if (item)
17787
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 if (uimenup.is_visible ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
562 item->show ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
563 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
564 item->hide ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
565 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
566 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
567 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
568
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
569 void update_position (uimenu::properties& uimenup, int pos)
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
570 {
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
571 uimenup.get_property ("position").set (octave_value (static_cast<double> (pos)),
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
572 true, false);
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
573 }
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
574
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
575 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
576 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
577
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
578 std::string fltk_label = uimenup.get___fltk_label__ ();
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
579
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
580 if (! fltk_label.empty ())
17787
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 bool item_added = false;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
583 do
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
584 {
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
585 const Fl_Menu_Item *item
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
586 = m_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
587
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
588 if (item)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
589 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
590 //avoid duplicate menulabels
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
591 std::size_t idx1 = fltk_label.find_last_of ('(');
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
592 std::size_t idx2 = fltk_label.find_last_of (')');
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
593 int len = idx2 - idx1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
594 int val = 1;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
595 if (len > 0)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
596 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
597 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
598 fltk_label.erase (idx1, len + 1);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
599 val = atoi (valstr.c_str ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
600 if (val > 0 && val < 99)
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
601 val++;
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 std::ostringstream valstream;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
604 valstream << val;
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23802
diff changeset
605 fltk_label += '(' + valstream.str () + ')';
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
606 }
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
607 else
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
608 {
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
609 Matrix uimenu_ch = find_uimenu_children (uimenup);
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
610 int len = uimenu_ch.numel ();
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
611 int flags = 0;
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
612 if (len > 0)
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
613 flags = FL_SUBMENU;
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
614 if (len == 0 && uimenup.is_checked ())
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
615 flags += FL_MENU_TOGGLE + FL_MENU_VALUE;
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
616 m_menubar->add (fltk_label.c_str (),
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
617 0, nullptr, nullptr, flags);
17898
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
618 item_added = true;
8c33abdd2f9a maint: Avoid using NULL in C++ code.
John W. Eaton <jwe@octave.org>
parents: 17881
diff changeset
619 }
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
620 }
20955
77f5591878bf maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents: 20845
diff changeset
621 while (! item_added);
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
622 uimenup.set___fltk_label__ (fltk_label);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
623 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
624 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
625
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
626 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
627 {
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
628 std::vector<int> delayed_menus;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
629 Matrix kids = find_uimenu_children (uimenup);
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
630 int len = kids.numel ();
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
631 std::string fltk_label = uimenup.get___fltk_label__ ();
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
632 int count = 0;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
633
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
634 add_entry (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
635 update_foregroundcolor (uimenup);
30999
fef2957c38ec Deprecate uimenu properties "label" and "callback" (bug #62443)
Rik <rik@octave.org>
parents: 30767
diff changeset
636 update_menuselectedfcn (uimenup);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
637 update_accelerator (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
638 update_enable (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
639 update_visible (uimenup);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
640 update_seperator (uimenup);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
641
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
642 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
643
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
644 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
645 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
646 graphics_object kgo = gh_mgr.get_object (kids (len - (ii + 1)));
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
647
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
648 if (kgo.valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
649 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
650 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
651 (kgo.get_properties ());
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
652
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
653 // if no pos yet, delay adding menu until after other menus
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
654 int pos = kprop.get_position ();
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
655 if (pos <= 0)
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20119
diff changeset
656 delayed_menus.push_back ((len - (ii + 1)));
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
657 else
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
658 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
659 add_to_menu (kprop);
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
660 }
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
661 }
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
662 }
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
663
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
664 // create any delayed menus
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
665 for (std::size_t ii = 0; ii < delayed_menus.size (); ii++)
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
666 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
667 graphics_object kgo = gh_mgr.get_object (kids (delayed_menus[ii]));
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
668
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
669 if (kgo.valid_object ())
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
670 {
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
671 uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
672 (kgo.get_properties ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
673 add_to_menu (kprop);
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
674 update_position (kprop, ++count);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
675 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
676 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
677 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
678
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
679 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
680 {
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
681 std::vector<int> delayed_menus;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
682 Matrix kids = find_uimenu_children (figp);
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
683 int len = kids.numel ();
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
684 int count = 0;
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
685
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
686 m_menubar->clear ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
687
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
688 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
689
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
690 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
691 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
692 graphics_object kgo = gh_mgr.get_object (kids (len - (ii + 1)));
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
693
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
694 if (kgo.valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
695 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
696 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
697 (kgo.get_properties ());
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
698
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
699 // if no pos yet, delay adding menu until after other menus
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
700 int pos = kprop.get_position ();
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
701 if (pos <= 0)
20181
aa36fb998a4d maint: Remove unnecessary whitespace at end of lines.
Rik <rik@octave.org>
parents: 20119
diff changeset
702 delayed_menus.push_back ((len - (ii + 1)));
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
703 else
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
704 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
705 add_to_menu (kprop);
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
706 update_position (kprop, ++count);
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
707 }
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
708 }
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
709 }
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
710
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
711 // create any delayed menus
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
712 for (std::size_t ii = 0; ii < delayed_menus.size (); ii++)
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
713 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
714 graphics_object kgo = gh_mgr.get_object (kids (delayed_menus[ii]));
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
715
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
716 if (kgo.valid_object ())
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
717 {
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
718 uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
719 (kgo.get_properties ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
720 add_to_menu (kprop);
20053
ac59136f1f10 update fltk uimenu position when adding to figure
John Donoghue <john.donoghue@ieee.org>
parents: 19998
diff changeset
721 update_position (kprop, ++count);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
722 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
723 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
724 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
725
21139
538b57866b90 consistently use "typename" intead of "class" in template declarations
John W. Eaton <jwe@octave.org>
parents: 21126
diff changeset
726 template <typename T_prop>
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
727 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
728 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
729 Matrix kids;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
730 std::string type = prop.get_type ();
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
731 kids = find_uimenu_children (prop);
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
732 int len = kids.numel ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
733
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
734 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
735
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
736 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
737 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
738 graphics_object kgo = gh_mgr.get_object (kids (len - (ii + 1)));
11207
51e6ac3e5afc Code fixes for uimenu
Kai Habel <kai.habel@gmx.de>
parents: 11170
diff changeset
739
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
740 if (kgo.valid_object ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
741 {
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
742 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
743 (kgo.get_properties ());
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
744 remove_from_menu (kprop);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
745 }
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
746 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
747
21021
a5b99b09f8fd maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents: 21006
diff changeset
748 if (type == "uimenu")
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
749 delete_entry (dynamic_cast<uimenu::properties&> (prop));
21021
a5b99b09f8fd maint: Use comparison operators rather than compare() for strings.
Rik <rik@octave.org>
parents: 21006
diff changeset
750 else if (type == "figure")
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
751 m_menubar->clear ();
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
752 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
753
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
754 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
755
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
756 fltk_uimenu (const fltk_uimenu&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
757
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
758 fltk_uimenu operator = (const fltk_uimenu&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
759
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
760 ~fltk_uimenu ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
761 {
24072
dbbc7e5e2294 avoid direct leak from fltk plot_window class
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
762 // FLTK is supposed to manage memory for widgets.
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
763 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
764
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
765 private:
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
766
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
767 Fl_Menu_Bar *m_menubar;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
768 };
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
769
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
770 #if defined (HAVE_X_WINDOWS)
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
771 static int
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
772 xerror_handler (Display *, XErrorEvent *)
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
773 {
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
774 return 0;
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
775 }
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
776 #endif
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
777
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
778 class plot_window : public Fl_Window
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
779 {
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
780 friend class fltk_uimenu;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
781
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
782 public:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
783
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
784 plot_window (int xx, int yy, int ww, int hh, figure::properties& xfp,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
785 bool internal)
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
786 : Fl_Window (xx, yy, ww, hh + m_menu_h + m_status_h + 2, "octave"),
23795
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
787 m_window_label (), m_fp (xfp), m_uimenu (nullptr), m_canvas (nullptr),
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
788 m_autoscale (nullptr), m_togglegrid (nullptr), m_panzoom (nullptr),
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
789 m_rotate (nullptr), m_help (nullptr), m_status (nullptr),
980f39c3ab90 Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents: 23785
diff changeset
790 m_resize_dummy (nullptr), m_ax_obj (), m_pos_x (0), m_pos_y (0)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
791 {
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
792 callback (window_close, static_cast<void *> (this));
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
793
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
794 // The size of the resize_dummy box also determines the minimum
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
795 // window size.
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
796 m_resize_dummy = new Fl_Box (5 * m_status_h, m_menu_h,
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
797 ww - 5 * m_status_h, hh);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
798
18985
f84361735a40 maint: Use Octave coding conventions for some recent patches.
Rik <rik@octave.org>
parents: 18968
diff changeset
799 // See http://fltk.org/articles.php?L415+I0+T+M1000+P1
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
800 // for how resizable works
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
801 resizable (m_resize_dummy);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
802
14447
c97416a0f657 Allow window managers to group FLTK plot windows (bug #35199)
Colin Macdonald <macdonald@maths.ox.ac.uk>
parents: 14418
diff changeset
803 // 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
804 // 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
805 // 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
806 // 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
807 // 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
808 // 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
809 //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
810
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
811 m_uimenu = new fltk_uimenu (0, 0, ww, m_menu_h);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
812 m_canvas = new OpenGL_fltk (0, m_menu_h, ww, hh, number ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
813
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
814 // The bottom toolbar is a composite of "autoscale", "togglegrid",
18985
f84361735a40 maint: Use Octave coding conventions for some recent patches.
Rik <rik@octave.org>
parents: 18968
diff changeset
815 // "panzoom", "rotate", "help", and "status".
f84361735a40 maint: Use Octave coding conventions for some recent patches.
Rik <rik@octave.org>
parents: 18968
diff changeset
816 // Only "status" should be resized.
12621
c99d6785a27e instantiate canvas before menubar
Kai Habel <kai.habel@gmx.de>
parents: 12565
diff changeset
817
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
818 int toolbar_y = m_menu_h + hh + 1;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
819 m_status = new Fl_Output (5 * m_status_h, toolbar_y,
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
820 ww - 5 * m_status_h, m_status_h, "");
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
821
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
822 m_status->textcolor (FL_BLACK);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
823 m_status->color (FL_GRAY);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
824 m_status->textfont (FL_COURIER);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
825 m_status->textsize (10);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
826 m_status->box (FL_ENGRAVED_BOX);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
827
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
828 m_autoscale = new Fl_Button (0, toolbar_y, m_status_h, m_status_h, "A");
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
829 m_autoscale->callback (button_callback, static_cast<void *> (this));
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
830 m_autoscale->tooltip ("Autoscale");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
831
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
832 m_togglegrid = new Fl_Button (m_status_h, toolbar_y, m_status_h, m_status_h, "G");
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
833 m_togglegrid->callback (button_callback, static_cast<void *> (this));
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
834 m_togglegrid->tooltip ("Toggle Grid");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
835
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
836 m_panzoom = new Fl_Button (2* m_status_h, toolbar_y, m_status_h, m_status_h, "P");
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
837 m_panzoom->callback (button_callback, static_cast<void *> (this));
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
838 m_panzoom->tooltip ("Mouse Pan/Zoom");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
839
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
840 m_rotate = new Fl_Button (3 * m_status_h, toolbar_y, m_status_h, m_status_h, "R");
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
841 m_rotate->callback (button_callback, static_cast<void *> (this));
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
842 m_rotate->tooltip ("Mouse Rotate");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
843
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
844 m_help = new Fl_Button (4 * m_status_h, toolbar_y, m_status_h, m_status_h, "?");
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
845 m_help->callback (button_callback, static_cast<void *> (this));
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
846 m_help->tooltip ("Help");
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
847
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
848 end ();
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
849
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
850 set_name ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
851 m_uimenu->add_to_menu (m_fp);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
852 if (m_fp.menubar_is ("none") || ! m_uimenu->items_to_show ())
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
853 hide_menubar ();
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
854
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
855 update_boundingbox (internal);
12507
41d183070c04 revert changes from 2011-02-26
Konstantinos Poulios <logari81@googlemail.com>
parents: 12484
diff changeset
856
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
857 if (m_fp.is_visible ())
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
858 {
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
859 // FIXME: This code should be removed when Octave drops support
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
860 // for FLTK 1.1. Search for default_xclass in this file to find
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
861 // code that should be uncommented to take its place.
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
862 //
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
863 // Set WM_CLASS which allows window managers to properly group
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
864 // related windows. Otherwise, the class is just "FLTK"
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
865 xclass ("Octave");
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
866
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
867 show ();
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
868
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
869 #if defined (HAVE_X_WINDOWS)
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
870 std::string show_gui_msgs
21732
6a1eded90355 use namespace for system env class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
871 = octave::sys::env::getenv ("OCTAVE_SHOW_GUI_MESSAGES");
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
872
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
873 // Installing our handler suppresses the messages.
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
874 if (show_gui_msgs.empty ())
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
875 XSetErrorHandler (xerror_handler);
18618
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
876 #endif
c644cfa9cb3b suppress all X11 and Qt error messages by default
John W. Eaton <jwe@octave.org>
parents: 18293
diff changeset
877
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
878 if (m_fp.get_currentaxes ().ok ())
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
879 show_canvas ();
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
880 else
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
881 hide_canvas ();
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
882 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
883 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
884
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
885 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
886
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
887 plot_window (const plot_window&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
888
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
889 plot_window& operator = (const plot_window&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
890
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
891 ~plot_window ()
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
892 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
893 this->hide ();
19020
d74cdfc5d5c3 Fix problem that FLTK figure stays visible after "close"
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19013
diff changeset
894 Fl::check ();
24072
dbbc7e5e2294 avoid direct leak from fltk plot_window class
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
895
dbbc7e5e2294 avoid direct leak from fltk plot_window class
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
896 delete m_uimenu;
dbbc7e5e2294 avoid direct leak from fltk plot_window class
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
897
dbbc7e5e2294 avoid direct leak from fltk plot_window class
John W. Eaton <jwe@octave.org>
parents: 23807
diff changeset
898 // FLTK is supposed to manage memory for widgets.
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
899 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
900
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
901 double number () { return m_fp.get___myhandle__ ().value (); }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
902
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
903 void renumber (double new_number)
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
904 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
905 if (! m_canvas)
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
906 error ("unable to renumber figure");
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20957
diff changeset
907
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
908 if (m_canvas->renumber (new_number))
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20957
diff changeset
909 mark_modified ();
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
910 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
911
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
912 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
913 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
914 m_canvas->print (cmd, term);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
915 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
916
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
917 uint8NDArray get_pixels ()
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
918 {
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
919 return m_canvas->get_pixels ();
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
920 }
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
921
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
922 void show_menubar ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
923 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
924 m_uimenu->show ();
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
925 update_toolbar_position ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
926 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
927
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
928 void hide_menubar ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
929 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
930 m_uimenu->hide ();
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
931 update_toolbar_position ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
932 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
933
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
934 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
935 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
936 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
937
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
938 graphics_object uimenu_obj = gh_mgr.get_object (gh);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
939
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
940 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
941 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
942 uimenu::properties& uimenup
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
943 = dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ());
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
944 std::string fltk_label = uimenup.get___fltk_label__ ();
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
945 graphics_object fig = uimenu_obj.get_ancestor ("figure");
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
946 figure::properties& figp
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
947 = 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
948
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
949 switch (id)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
950 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
951 case base_properties::ID_BEINGDELETED:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
952 m_uimenu->remove_from_menu (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
953 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
954
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
955 case base_properties::ID_VISIBLE:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
956 m_uimenu->update_visible (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
957 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
958
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
959 case uimenu::properties::ID_ACCELERATOR:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
960 m_uimenu->update_accelerator (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
961 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
962
30999
fef2957c38ec Deprecate uimenu properties "label" and "callback" (bug #62443)
Rik <rik@octave.org>
parents: 30767
diff changeset
963 case uimenu::properties::ID_MENUSELECTEDFCN:
fef2957c38ec Deprecate uimenu properties "label" and "callback" (bug #62443)
Rik <rik@octave.org>
parents: 30767
diff changeset
964 m_uimenu->update_menuselectedfcn (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
965 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
966
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
967 case uimenu::properties::ID_CHECKED:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
968 m_uimenu->add_to_menu (figp);//rebuilding entire menu
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
969 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
970
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
971 case uimenu::properties::ID_ENABLE:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
972 m_uimenu->update_enable (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
973 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
974
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
975 case uimenu::properties::ID_FOREGROUNDCOLOR:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
976 m_uimenu->update_foregroundcolor (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
977 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
978
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
979 case uimenu::properties::ID_LABEL:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
980 m_uimenu->add_to_menu (figp);//rebuilding entire menu
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
981 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
982
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
983 case uimenu::properties::ID_POSITION:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
984 m_uimenu->add_to_menu (figp);//rebuilding entire menu
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
985 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
986
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
987 case uimenu::properties::ID_SEPARATOR:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
988 m_uimenu->update_seperator (uimenup);
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
989 break;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
990 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
991
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
992 if (m_uimenu->items_to_show ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
993 show_menubar ();
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
994 else
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
995 hide_menubar ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
996 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
997 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
998
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
999 void show_canvas ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1000 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1001 if (! m_canvas->can_do ())
19454
8dbd55742112 Prevent segfault when video card has insufficient OpenGL support (bug #41747).
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18618
diff changeset
1002 error ("unable to plot due to insufficient OpenGL support");
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1003 else if (m_fp.is_visible ())
12903
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
1004 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1005 m_canvas->show ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1006 m_canvas->make_current ();
12903
35ea8b9b2a8e __init_fltk__.cc: show canvas only, when figure is visible (bug #33321)
Kai Habel <kai.habel@gmx.de>
parents: 12621
diff changeset
1007 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1008 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1009
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1010 void hide_canvas ()
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1011 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1012 m_canvas->hide ();
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1013 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1014
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1015 // Move the toolbar at the bottom of the plot_window.
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1016 // The only reason for moving the toolbar is hiding and
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21732
diff changeset
1017 // showing the menubar. All other resizing is done by fltk.
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1018
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1019 void update_toolbar_position ()
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1020 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1021 int old_canvas_h = m_canvas->h ();
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1022
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1023 // keep position fix, change outerposition accordingly
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1024 update_boundingbox (true);
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1025 m_canvas->resize (0, menu_dy (), w (), old_canvas_h);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1026
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1027 int toolbar_y = m_canvas->h () + menu_dy () + 1;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1028 m_autoscale->position (0, toolbar_y);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1029 m_togglegrid->position (m_status_h, toolbar_y);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1030 m_panzoom->position (2 * m_status_h, toolbar_y);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1031 m_rotate->position (3 * m_status_h, toolbar_y);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1032 m_help->position (4 * m_status_h, toolbar_y);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1033 m_status->resize (5 * m_status_h, toolbar_y,
25103
078b795c5219 maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents: 25054
diff changeset
1034 w () - 5 * m_status_h, m_status_h);
18985
f84361735a40 maint: Use Octave coding conventions for some recent patches.
Rik <rik@octave.org>
parents: 18968
diff changeset
1035 init_sizes ();
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1036 redraw ();
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1037 }
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1038
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1039 Matrix outerposition2position (const Matrix& outerpos)
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1040 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1041 Matrix pos = outerpos;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1042 pos(1) += menu_dy ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1043 pos(3) -= menu_dy () + m_status_h + 2;
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1044 return pos;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1045 }
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1046
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1047 Matrix position2outerposition (const Matrix& pos)
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1048 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1049 Matrix outerpos = pos;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1050 outerpos(1) -= menu_dy ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1051 outerpos(3) += menu_dy () + m_status_h + 2;
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1052 return outerpos;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1053 }
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1054
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1055 // Called from figure::properties::ID_POSITION if internal = true
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1056 // or ID_OUTERPOSITION if false.
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1057 // (someone has requested a position change with set (h, "position", [...])
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1058 // or set (h, "outerposition", [...])
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1059
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1060 void update_boundingbox (bool internal)
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1061 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1062 Matrix bb = m_fp.get_boundingbox (internal);
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1063 if (internal)
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1064 bb = position2outerposition (bb);
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1065 resize (bb(0), bb(1), bb(2), bb(3));
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1066 }
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1067
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1068 void mark_modified ()
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1069 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1070 m_canvas->redraw ();
7840
2c8f693c32fd convert_position not static anymore
Shai Ayal <shaiay@sourceforge.net>
parents: 7839
diff changeset
1071 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1072
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1073 void set_name ()
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1074 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1075 m_window_label = m_fp.get_title ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1076 label (m_window_label.c_str ());
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1077 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1078
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1079 private:
12122
f4689107dd8c Explicitly disallow copying in some classes.
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents: 11590
diff changeset
1080
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1081 // 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
1082 // life
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1083 std::string m_window_label;
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1084
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1085 // Figure properties.
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1086 figure::properties& m_fp;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1087
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1088 // Status area height.
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1089 static const int m_status_h = 20;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1090
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1091 // Menu height
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1092 static const int m_menu_h = 25;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1093
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1094 fltk_uimenu *m_uimenu;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1095
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1096 OpenGL_fltk *m_canvas;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1097
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1098 Fl_Button *m_autoscale;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1099 Fl_Button *m_togglegrid;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1100 Fl_Button *m_panzoom;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1101 Fl_Button *m_rotate;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1102 Fl_Button *m_help;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1103 Fl_Output *m_status;
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1104
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1105 Fl_Box *m_resize_dummy;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1106
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1107 graphics_object m_ax_obj;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1108
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1109 int m_pos_x;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1110 int m_pos_y;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1111
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1112 // Window callback.
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1113 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
1114 {
31730
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1115 interpreter& interp = __get_interpreter__ ();
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1116
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1117 octave_value_list args;
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
1118 args(0) = static_cast<plot_window *> (data)->number ();
31730
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1119
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1120 interp.feval ("close", args);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1121 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1122
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
1123 // Button callbacks.
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1124 static void button_callback (Fl_Widget *ww, void *data)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1125 {
23447
db1fdf4384dd maint: Use convention "static_cast<void *>" for casting of pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
1126 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
1127 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1128
23449
c763214a8260 maint: Use convention 'int *x' for naming pointers.
Rik <rik@octave.org>
parents: 23447
diff changeset
1129 void button_press (Fl_Widget *widg, void *)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1130 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1131 if (widg == m_autoscale)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1132 axis_auto ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1133 else if (widg == m_togglegrid)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1134 toggle_grid ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1135 else if (widg == m_panzoom)
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1136 m_fp.set___mouse_mode__ ("pan");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1137 else if (widg == m_rotate)
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1138 m_fp.set___mouse_mode__ ("rotate");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1139 else if (widg == m_help)
9060
de7cef39f505 fltk_backend.cc: don't pass arbitrary string as format
John W. Eaton <jwe@octave.org>
parents: 8333
diff changeset
1140 fl_message ("%s", help_text);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1141 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1142
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1143 void set_on_ax_obj (const std::string& name, const std::string& value)
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1144 {
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1145 // ax_obj is the last clicked axes object
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1146 if (m_ax_obj && m_ax_obj.isa ("axes")
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1147 && m_ax_obj.get_properties ().get_tag () != "legend"
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1148 && m_ax_obj.get_properties ().get_tag () != "colorbar")
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1149 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1150 axes::properties& ap
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1151 = dynamic_cast<axes::properties&>(m_ax_obj.get_properties ());
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1152 ap.set (name, value);
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1153 }
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1154 else // no axes object clicked so far, take currentaxes
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1155 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1156 graphics_handle gh = m_fp.get_currentaxes ();
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1157 if (gh.ok ())
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1158 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
1159 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1160
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1161 graphics_object go = gh_mgr.get_object (gh);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1162
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1163 axes::properties& ap
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1164 = dynamic_cast<axes::properties&>(go.get_properties ());
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1165
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1166 ap.set (name, value);
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1167 }
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1168 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1169 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1170
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1171 void axis_auto ()
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
1172 {
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1173 octave_value_list args;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1174 if (m_fp.get_currentaxes ().ok ())
18968
0257a936dc4a Fix FLTK redraw and event issue
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18966
diff changeset
1175 {
31730
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1176 interpreter& interp = __get_interpreter__ ();
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1177
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1178 args(0) = m_fp.get_currentaxes ().as_octave_value ();
18968
0257a936dc4a Fix FLTK redraw and event issue
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18966
diff changeset
1179 args(1) = "auto";
31730
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1180
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1181 interp.feval ("axis", args);
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1182
18968
0257a936dc4a Fix FLTK redraw and event issue
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18966
diff changeset
1183 mark_modified ();
0257a936dc4a Fix FLTK redraw and event issue
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18966
diff changeset
1184 }
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
1185 }
4dc3e0ff730a Added zoombox (mouse button 1) & autoscale (button marked A and mouse button 3)
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7842
diff changeset
1186
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1187 void toggle_grid ()
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1188 {
31730
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1189 interpreter& interp = __get_interpreter__ ();
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1190
9974
118158f10628 fix fltk backend window buttons
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9973
diff changeset
1191 octave_value_list args;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1192 if (m_fp.get_currentaxes ().ok ())
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1193 args(0) = m_fp.get_currentaxes ().as_octave_value ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1194
31730
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1195 interp.feval ("grid", args);
610a85b0ff62 use interpreter::feval instead of global feval function
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
1196
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
1197 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
1198 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1199
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1200 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
1201 double& yy) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1202 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
1203 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1204
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1205 pixel2pos (gh_mgr.get_object (ax), px, py, xx, yy);
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1206 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1207
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1208 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
1209 double& yy) const
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1210 {
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1211 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
1212 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1213 axes::properties& ap
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1214 = dynamic_cast<axes::properties&> (ax.get_properties ());
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1215 ColumnVector pp = ap.pixel2coord (px, py);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1216 xx = pp(0);
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1217 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
1218 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1219 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1220
18678
6113e0c6920b maint: Clean up extra spaces before/after parentheses.
Rik <rik@octave.org>
parents: 18618
diff changeset
1221 graphics_handle pixel2axes_or_ca (int px, int py)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1222 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1223 Matrix kids = m_fp.get_children ();
20232
a9574e3c6e9e Deprecate Array::length() and Sparse::length() in favour of ::numel().
Carnë Draug <carandraug@octave.org>
parents: 20181
diff changeset
1224 int len = kids.numel ();
9442
2d73b19c5507 improve behavior of builtin
John W. Eaton <jwe@octave.org>
parents: 9245
diff changeset
1225
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
1226 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1227
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1228 for (int k = 0; k < len; k++)
9443
8f9d8776d11c undo previous commit
John W. Eaton <jwe@octave.org>
parents: 9442
diff changeset
1229 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1230 graphics_handle hnd = gh_mgr.lookup (kids(k));
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1231
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1232 if (hnd.ok ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1233 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1234 graphics_object kid = gh_mgr.get_object (hnd);
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1235
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1236 if (kid.valid_object () && kid.isa ("axes"))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1237 {
19296
8ba8f3d22189 __init_fltk__.cc: Allow selection of axes from whole plot area
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19152
diff changeset
1238 Matrix bb = kid.get_properties ().get_boundingbox (false);
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
1239
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1240 if (bb(0) <= px && px < (bb(0)+bb(2))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1241 && bb(1) <= py && py < (bb(1)+bb(3)))
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1242 {
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1243 return hnd;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1244 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1245 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1246 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1247 }
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1248 return m_fp.get_currentaxes ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1249 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1250
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1251 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
1252 int px1 = -1, int py1 = -1)
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1253 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
1254 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1255
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1256 pixel2status (gh_mgr.get_object (ax), px0, py0, px1, py1);
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1257 }
9802
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
1258
9b4a301d88ed fix for fltk zoom box problems
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9798
diff changeset
1259 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
1260 int px1 = -1, int py1 = -1)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1261 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1262 double x0, y0, x1, y1;
21723
bae585228161 use namespace for numeric_limits
John W. Eaton <jwe@octave.org>
parents: 21721
diff changeset
1263 x0 = y0 = x1 = y1 = octave::numeric_limits<double>::NaN ();
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
1264 std::stringstream cbuf;
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1265 cbuf.precision (4);
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1266 cbuf.width (6);
9640
110863cd3371 more bug fixes in fltk zoom
shaiay@users.sourceforge.net
parents: 9455
diff changeset
1267 pixel2pos (ax, px0, py0, x0, y0);
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23802
diff changeset
1268 cbuf << '[' << 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
1269 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
1270 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
1271 pixel2pos (ax, px1, py1, x1, y1);
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23802
diff changeset
1272 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
1273 }
7840
2c8f693c32fd convert_position not static anymore
Shai Ayal <shaiay@sourceforge.net>
parents: 7839
diff changeset
1274
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1275 m_status->value (cbuf.str ().c_str ());
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1276 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1277
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1278 void view2status (graphics_object ax)
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1279 {
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1280 if (ax && ax.isa ("axes"))
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1281 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1282 axes::properties& ap
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1283 = dynamic_cast<axes::properties&> (ax.get_properties ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1284 std::stringstream cbuf;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1285 cbuf.precision (4);
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1286 cbuf.width (6);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1287 Matrix v (1, 2, 0);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1288 v = ap.get ("view").matrix_value ();
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23802
diff changeset
1289 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
1290
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1291 m_status->value (cbuf.str ().c_str ());
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1292 }
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1293 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1294
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1295 void set_currentpoint (int px, int py)
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1296 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1297 if (! m_fp.is_beingdeleted ())
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1298 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1299 Matrix pos = m_fp.map_from_boundingbox (px, py);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1300 m_fp.set_currentpoint (pos);
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1301
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
1302 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1303
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1304 graphics_object robj = gh_mgr.get_object (m_fp.get_parent ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1305
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1306 root_figure::properties& rp
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1307
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1308 = dynamic_cast<root_figure::properties&> (robj.get_properties ());
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1309 rp.set_currentfigure (m_fp.get___myhandle__ ().value ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1310 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1311 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1312
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1313 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
1314 {
19027
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1315 if (ax.valid_object () && ax.isa ("axes"))
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1316 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1317 axes::properties& ap
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1318 = 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
1319
19027
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1320 Matrix x_zlim = ap.get_transform_zlim ();
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1321 Matrix pos (2, 3, 0.0);
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1322
19027
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1323 // front point (nearest to the viewer)
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1324 ColumnVector tmp = ap.get_transform ().untransform (px, py, x_zlim(0));
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1325 pos(0, 0) = tmp(0);
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1326 pos(0, 1) = tmp(1);
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1327 pos(0, 2) = tmp(2);
19027
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1328
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1329 // back point (furthest from the viewer)
0ee9daa71273 Fix axes property "currentpoint" for FLTK, extend documentation
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19021
diff changeset
1330 tmp = ap.get_transform ().untransform (px, py, x_zlim(1));
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1331 pos(1, 0) = tmp(0);
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1332 pos(1, 1) = tmp(1);
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1333 pos(1, 2) = tmp(2);
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1334
10593
26d51c6e1c4c fixed fltk_backend bug when clicking on empty figure
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10555
diff changeset
1335 ap.set_currentpoint (pos);
21643
9191c24fb329 Fix autoscale affecting legend axes objects (bug #47765).
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20181
diff changeset
1336 if (ap.get_tag () != "legend" && ap.get_tag () != "colorbar")
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1337 m_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
1338 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1339 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1340
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1341 int menu_dy ()
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1342 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1343 if (m_uimenu->is_visible ())
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1344 return m_menu_h;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1345 else
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1346 return 0;
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
1347 }
17213
4407606d0939 FLTK toolkit: Simplify conditionals for uimenu presence.
Ben Abbott <bpabbott@mac.com>
parents: 17201
diff changeset
1348
30346
91c6288781ba maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 30003
diff changeset
1349 octave_scalar_map format_key_event (int e_key, const char *e_text,
91c6288781ba maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 30003
diff changeset
1350 int e_state)
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1351 {
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1352 octave_scalar_map evt;
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1353
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1354 evt.assign ("Character", octave_value (e_text));
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1355 evt.assign ("Modifier", octave_value (modifier2cell (e_state)));
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1356
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1357 std::string key_str;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1358 std::ostringstream tmp_str;
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1359
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1360 if (e_key == FL_Escape)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1361 key_str = "escape";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1362 else if (e_key == FL_Tab)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1363 key_str = "tab";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1364 else if (e_key == FL_Caps_Lock)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1365 key_str = "capslock";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1366 else if (e_key == FL_Shift_L || e_key == FL_Shift_R)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1367 key_str = "shift";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1368 else if (e_key == FL_Control_L || e_key == FL_Control_R)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1369 key_str = "control";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1370 else if (e_key == FL_Meta_L || e_key == FL_Meta_R)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1371 key_str = "windows";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1372 else if (e_key == FL_Alt_L || e_key == FL_Alt_R)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1373 key_str = "alt";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1374 else if (e_key == 32)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1375 key_str = "space";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1376 else if (e_key == FL_Enter)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1377 key_str = "return";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1378 else if (e_key == FL_BackSpace)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1379 key_str = "backspace";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1380 else if (e_key == FL_Print)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1381 key_str = "printscreen";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1382 else if (e_key == FL_Pause)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1383 key_str = "pause";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1384 else if (e_key == FL_Home)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1385 key_str = "home";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1386 else if (e_key == FL_End)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1387 key_str = "end";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1388 else if (e_key == FL_Insert)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1389 key_str = "insert";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1390 else if (e_key == FL_Page_Up)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1391 key_str = "pageup";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1392 else if (e_key == FL_Delete)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1393 key_str = "delete";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1394 else if (e_key == FL_Page_Down)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1395 key_str = "pagedown";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1396 else if (e_key == FL_Left)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1397 key_str = "leftarrow";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1398 else if (e_key == FL_Up)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1399 key_str = "uparrow";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1400 else if (e_key == FL_Right)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1401 key_str = "rightarrow";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1402 else if (e_key == FL_Down)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1403 key_str = "downarrow";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1404 else if (e_key == FL_Num_Lock)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1405 key_str = "numlock";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1406 else if (e_key == 0xffaf)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1407 key_str = "divide";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1408 else if (e_key == 0xffaa)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1409 key_str = "multiply";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1410 else if (e_key == 0xffad)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1411 key_str = "subtract";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1412 else if (e_key == 0xffab)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1413 key_str = "add";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1414 else if (e_key == 0xff8d)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1415 key_str = "return";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1416 else if (e_key == 0xffac)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1417 key_str = "separator";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1418 else if (e_key >= 0xffb0 && e_key <= 0xffb9)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1419 {
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1420 tmp_str << "numpad" << (e_key - 0xffb0);
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1421 key_str = tmp_str.str ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1422 }
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1423 else if (e_key >= (FL_F + 1) && e_key <= (FL_F + 12))
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1424 {
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23802
diff changeset
1425 tmp_str << 'f' << (e_key - FL_F);
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1426 key_str = tmp_str.str ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1427 }
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1428 else if (e_key == ',')
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1429 key_str = "comma";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1430 else if (e_key == '.')
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1431 key_str = "period";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1432 else if (e_key == '-')
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1433 key_str = "hyphen";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1434 else if (e_key == '^' || e_key == '+' || e_key == '#'
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1435 || e_key == '<' || e_key == 0xfe03 /*AltGr*/)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1436 key_str = "0";
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1437 else if (isalnum (e_key))
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1438 key_str = std::tolower (e_key);
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1439 else if (isprint (e_text[0]))
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1440 key_str = "0";
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1441
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1442 evt.assign ("Key", octave_value (key_str));
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1443 return evt;
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1444 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1445
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1446 Cell modifier2cell (int e_state)
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1447 {
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1448 string_vector mod;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1449
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1450 if (e_state & FL_SHIFT)
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1451 mod.append (std::string ("shift"));
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1452 if (e_state & FL_CTRL)
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1453 mod.append (std::string ("control"));
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1454 if (e_state & FL_ALT)
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1455 mod.append (std::string ("alt"));
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1456 if (e_state & FL_COMMAND)
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1457 mod.append (std::string ("command"));
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1458 return Cell (mod);
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1459 }
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1460
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
1461 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
1462 {
10555
a80207303549 style fixes
John W. Eaton <jwe@octave.org>
parents: 10553
diff changeset
1463 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
1464
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1465 Matrix bb (1, 4);
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1466 bb(0) = xx;
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1467 bb(1) = yy;
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1468 bb(2) = ww;
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1469 bb(3) = hh;
14357
e7c74f56cd03 fltk toolkit requires figure units to be "pixels". Bug # 35430.
Ben Abbott <bpabbott@mac.com>
parents: 14314
diff changeset
1470
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1471 // update outerposition
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1472 m_fp.set_boundingbox (bb, false, false);
17131
ea19ea629a09 Proper placement of the menubar, the toolbar and plot canvas.
Ben Abbott <bpabbott@mac.com>
parents: 17079
diff changeset
1473
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
1474 // update position
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1475 m_fp.set_boundingbox (outerposition2position (bb), true, false);
7839
71eb1793f0db fltk_backend can now handle figure.position changes
Shai Ayal <shaiay@sourceforge.net>
parents: 7834
diff changeset
1476 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1477
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1478 bool pan_enabled ()
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1479 {
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1480 // Getting pan mode property:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1481 octave_value ov_pm = m_fp.get___pan_mode__ ();
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1482
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1483 octave_scalar_map pm = ov_pm.scalar_map_value ();
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1484
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1485 return pm.contents ("Enable").string_value () == "on";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1486 }
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1487
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1488 std::string pan_mode ()
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1489 {
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1490 // Getting pan mode property:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1491 octave_value ov_pm = m_fp.get___pan_mode__ ();
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1492
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1493 octave_scalar_map pm = ov_pm.scalar_map_value ();
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1494
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1495 return pm.contents ("Motion").string_value ();
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1496 }
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1497
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1498 bool rotate_enabled ()
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1499 {
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1500 // Getting rotate mode property:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1501 octave_value ov_rm = m_fp.get___rotate_mode__ ();
19663
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1502
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1503 octave_scalar_map rm = ov_rm.scalar_map_value ();
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1504
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1505 return rm.contents ("Enable").string_value () == "on";
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1506 }
dfea01b3425f more mouse interaction features for Qt plotting widget
John W. Eaton <jwe@octave.org>
parents: 19657
diff changeset
1507
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1508 int handle (int event)
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1509 {
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1510 if (event == FL_FOCUS)
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1511 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1512
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1513 graphics_handle gh;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1514
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1515 if (! m_fp.is_beingdeleted ())
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1516 {
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1517 // FLTK resends keyboard events with flipped case if all
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1518 // widgets rejects the event.
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1519 // See Event Propagation http://www.fltk.org/doc-1.3/events.html
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1520 static bool key_resent_detected = false;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1521
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
1522 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1523
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1524 switch (event)
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1525 {
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1526 case FL_SHORTCUT:
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1527 {
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1528 // check if it a resent event with switched case
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1529 static int last_event_key = 0;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1530 static char last_event_text = 0;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1531
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1532 int e_key = Fl::event_key ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1533 char e_text = Fl::event_text ()[0];
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1534 key_resent_detected = (e_key == last_event_key
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
1535 && std::tolower (last_event_text) == std::tolower (e_text)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
1536 && ((islower (last_event_text) && isupper (e_text))
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
1537 || (isupper (last_event_text) && islower (e_text))));
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1538
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1539 last_event_key = e_key;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1540 last_event_text = e_text;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1541 }
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1542 break;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1543
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1544 case FL_KEYDOWN:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1545 {
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1546 int e_key = Fl::event_key ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1547 const char *e_text = Fl::event_text ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1548 int e_state = Fl::event_state ();
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1549 octave_scalar_map evt = format_key_event (e_key, e_text, e_state);
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1550
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1551 m_fp.set_currentcharacter (std::string (e_text));
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1552
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1553 if (! m_fp.get_keypressfcn ().isempty ()
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1554 && (evt.contents ("Key").length () > 0))
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1555 {
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1556 // Update CurrentPoint before callback
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1557 if (Fl::event_inside (m_canvas))
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1558 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1559 m_pos_x = Fl::event_x ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1560 m_pos_y = Fl::event_y () - menu_dy ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1561
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1562 set_currentpoint (m_pos_x, m_pos_y);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1563
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1564 gh = pixel2axes_or_ca (m_pos_x, m_pos_y);
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1565
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1566 if (gh.ok ())
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1567 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1568 m_ax_obj = gh_mgr.get_object (gh);
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1569 set_axes_currentpoint (m_ax_obj, m_pos_x, m_pos_y);
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1570 }
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
1571 }
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1572
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1573 m_fp.execute_keypressfcn (evt);
20118
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1574 }
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1575
144498565de9 Return correct x,y coordinates for keystroke with ginput in FLTK (bug #44834).
Rik <rik@octave.org>
parents: 20108
diff changeset
1576 // Handle special keys used in toolbar
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1577 switch (e_key)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1578 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1579 case 'a':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1580 case 'A':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1581 axis_auto ();
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1582 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1583
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1584 case 'g':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1585 case 'G':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1586 toggle_grid ();
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1587 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1588
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1589 case 'p':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1590 case 'P':
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1591 m_fp.set___mouse_mode__ ("pan");
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1592 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1593
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1594 case 'r':
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1595 case 'R':
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1596 m_fp.set___mouse_mode__ ("rotate");
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1597 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1598 }
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1599 }
10792
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1600 break;
91342260063e mouse rotation for fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10593
diff changeset
1601
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1602 case FL_KEYUP:
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1603 {
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1604 int e_key = Fl::event_key ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1605 int e_state = Fl::event_state ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1606 octave_scalar_map evt;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1607 if (key_resent_detected && Fl::event_length () == 1)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1608 {
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1609 // FLTK flipped the case of Fl::event_text because no
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1610 // widget wanted the FL_KEYDOWN event.
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1611 char tmp_e_text[2];
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1612 tmp_e_text[0] = Fl::event_text ()[0];
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1613 tmp_e_text[1] = 0;
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1614 // Undo the case flip
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1615 if (std::islower (tmp_e_text[0]))
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1616 tmp_e_text[0] = std::toupper (tmp_e_text[0]);
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1617 else
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1618 tmp_e_text[0] = std::tolower (tmp_e_text[0]);
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1619 evt = format_key_event (e_key, tmp_e_text, e_state);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1620 }
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1621 else
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1622 {
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1623 const char *e_text = Fl::event_text ();
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1624 evt = format_key_event (e_key, e_text, e_state);
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1625 }
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1626
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1627 if (! m_fp.get_keyreleasefcn ().isempty ()
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1628 && (evt.contents ("Key").length () > 0))
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1629 m_fp.execute_keyreleasefcn (evt);
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
1630 return 1;
10517
9cdd6c8c05a4 [mq]: fltk_cb
Shai Ayal <shaiay@users.sourceforge.net>
parents: 10346
diff changeset
1631 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1632 break;
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1633 }
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
1634
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1635 // Events we only handle if they are in the canvas area.
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1636 if (Fl::event_inside (m_canvas))
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1637 switch (event)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1638 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1639 case FL_MOVE:
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1640 pixel2status (pixel2axes_or_ca (Fl::event_x (),
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1641 Fl::event_y () - menu_dy ()),
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1642 Fl::event_x (), Fl::event_y () - menu_dy ());
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1643 return 1;
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1644
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1645 case FL_PUSH:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1646 m_pos_x = Fl::event_x ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1647 m_pos_y = Fl::event_y () - menu_dy ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1648
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1649 set_currentpoint (m_pos_x, m_pos_y);
19021
9609f345823e Implement figure property SelectionType for FLTK
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19020
diff changeset
1650
19998
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1651 if (Fl::event_clicks ())
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1652 m_fp.set_selectiontype ("open");
19998
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1653 else if (Fl::event_button () == FL_MIDDLE_MOUSE
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1654 || (Fl::event_button () == FL_LEFT_MOUSE
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1655 && Fl::event_shift ()))
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1656 m_fp.set_selectiontype ("extend");
19998
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1657 else if (Fl::event_button () == FL_RIGHT_MOUSE
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1658 || (Fl::event_button () == FL_LEFT_MOUSE
91e2212b060d Fix FLTK SelectionType for Middle Button and double clicks (bug #44669).
Rik <rik@octave.org>
parents: 19976
diff changeset
1659 && Fl::event_ctrl ()))
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1660 m_fp.set_selectiontype ("alt");
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1661 else
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1662 m_fp.set_selectiontype ("normal");
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1663
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1664 gh = pixel2axes_or_ca (m_pos_x, m_pos_y);
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1665
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1666 if (gh.ok ())
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1667 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1668 m_ax_obj = gh_mgr.get_object (gh);
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1669 set_axes_currentpoint (m_ax_obj, m_pos_x, m_pos_y);
19946
4910b70d7328 Ensure correct coordinates are available in windowbuttondownfcn callback
Mike Miller <mtmiller@octave.org>
parents: 19891
diff changeset
1670 }
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
1671
19946
4910b70d7328 Ensure correct coordinates are available in windowbuttondownfcn callback
Mike Miller <mtmiller@octave.org>
parents: 19891
diff changeset
1672 // Ensure windowbuttondownfcn is called after currentpoint
4910b70d7328 Ensure correct coordinates are available in windowbuttondownfcn callback
Mike Miller <mtmiller@octave.org>
parents: 19891
diff changeset
1673 // is updated but before calling buttondownfcn.
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1674 if (! m_fp.get_windowbuttondownfcn ().isempty ())
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1675 m_fp.execute_windowbuttondownfcn (Fl::event_button ());
19946
4910b70d7328 Ensure correct coordinates are available in windowbuttondownfcn callback
Mike Miller <mtmiller@octave.org>
parents: 19891
diff changeset
1676
4910b70d7328 Ensure correct coordinates are available in windowbuttondownfcn callback
Mike Miller <mtmiller@octave.org>
parents: 19891
diff changeset
1677 if (gh.ok ())
4910b70d7328 Ensure correct coordinates are available in windowbuttondownfcn callback
Mike Miller <mtmiller@octave.org>
parents: 19891
diff changeset
1678 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1679 m_fp.set_currentobject (m_ax_obj.get_handle ().value ());
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1680
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1681 base_properties& props = m_ax_obj.get_properties ();
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1682 if (! props.get_buttondownfcn ().isempty ())
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1683 props.execute_buttondownfcn (Fl::event_button ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1684
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1685 return 1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1686 }
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1687 else if (! m_fp.get_buttondownfcn ().isempty ())
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1688 m_fp.execute_buttondownfcn (Fl::event_button ());
9455
ee8a035f3997 imported patch fltk_zoom
shaia@mars.bioc
parents: 9443
diff changeset
1689
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1690 break;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1691
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1692 case FL_DRAG:
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1693 if (! m_fp.get_windowbuttonmotionfcn ().isempty ())
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1694 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1695 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1696 m_fp.execute_windowbuttonmotionfcn ();
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1697 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1698
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1699 if (Fl::event_button () == 1)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1700 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1701 if (m_ax_obj && m_ax_obj.isa ("axes"))
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1702 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1703 axes::properties& ap = dynamic_cast<axes::properties&> (m_ax_obj.get_properties ());
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1704
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1705 // Don't pan or rotate legend
21641
6459479840ba Restore rotate capability for FLTK toolkit (bug #47698).
Rik <rik@octave.org>
parents: 21575
diff changeset
1706 if (ap.get_tag () != "legend")
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1707 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1708 if (rotate_enabled ())
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1709 view2status (m_ax_obj);
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1710 else
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1711 pixel2status (m_ax_obj, m_pos_x, m_pos_y,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1712 Fl::event_x (),
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1713 Fl::event_y () - menu_dy ());
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1714
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1715 double x0, y0, x1, y1;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1716 Matrix pos = m_fp.get_boundingbox (true);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1717 pixel2pos (m_ax_obj, m_pos_x, m_pos_y, x0, y0);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1718 pixel2pos (m_ax_obj, Fl::event_x (),
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1719 Fl::event_y () - menu_dy (),
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1720 x1, y1);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1721
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1722 if (pan_enabled ())
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
1723 {
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
1724 std::string mode = pan_mode ();
19891
fa290c42197e Implement x- and y-only panning for FLTK (bug #44408).
Rik <rik@octave.org>
parents: 19872
diff changeset
1725
22407
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
1726 ap.translate_view (mode, x0, x1, y0, y1);
34ce5be04942 maint: Style check C++ code in libinterp/.
Rik <rik@octave.org>
parents: 22370
diff changeset
1727 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1728 else if (rotate_enabled ())
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1729 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1730 double daz, del;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1731 daz = (Fl::event_x () - m_pos_x) / pos(2) * 360;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1732 del = (Fl::event_y () - menu_dy () - m_pos_y)
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1733 / pos(3) * 360;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1734 ap.rotate_view (del, daz);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1735 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1736 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1737 else
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1738 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1739 // move the position of the legend
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1740 Matrix pos = ap.get_position ().matrix_value ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1741 pos(0) += double (Fl::event_x () - m_pos_x)
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1742 / m_canvas->w ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1743 pos(1) -= double (Fl::event_y () - menu_dy () - m_pos_y)
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1744 / m_canvas->h ();
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1745 ap.set_position (pos);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1746 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1747
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1748 m_pos_x = Fl::event_x ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1749 m_pos_y = Fl::event_y () - menu_dy ();
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1750 mark_modified ();
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1751 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1752 return 1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1753 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1754 else if (Fl::event_button () == 3)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1755 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1756 pixel2status (m_ax_obj, m_pos_x, m_pos_y,
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1757 Fl::event_x (), Fl::event_y () - menu_dy ());
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1758 Matrix zoom_box (1, 4, 0);
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1759 zoom_box(0) = m_pos_x;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1760 zoom_box(1) = m_pos_y;
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1761 zoom_box(2) = Fl::event_x ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1762 zoom_box(3) = Fl::event_y () - menu_dy ();
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1763 m_canvas->set_zoom_box (zoom_box);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1764 m_canvas->zoom (true);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1765 mark_modified ();
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1766 return 1;
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1767 }
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1768
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1769 break;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1770
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1771 case FL_MOUSEWHEEL:
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1772 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1773 graphics_object ax
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
1774 = gh_mgr.get_object (pixel2axes_or_ca (Fl::event_x (),
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
1775 Fl::event_y ()
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
1776 - menu_dy ()));
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1777 if (ax && ax.isa ("axes"))
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1778 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1779 axes::properties& ap
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
1780 = dynamic_cast<axes::properties&> (ax.get_properties ());
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1781
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1782 // Control how fast to zoom when using scroll wheel.
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1783 double wheel_zoom_speed = ap.get_mousewheelzoom ();
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1784
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1785 // Determine if we're zooming in or out.
19867
6ba3d0f7c6e8 improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
1786 const double factor = (Fl::event_dy () < 0
6ba3d0f7c6e8 improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
1787 ? 1 / (1.0 - wheel_zoom_speed)
6ba3d0f7c6e8 improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
1788 : 1.0 - wheel_zoom_speed);
6ba3d0f7c6e8 improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
1789
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1790 // Get the point we're zooming about.
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1791 double x1, y1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1792 pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (),
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1793 x1, y1);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1794
19867
6ba3d0f7c6e8 improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
1795 // FIXME: should we only zoom about point for 2D plots?
6ba3d0f7c6e8 improve mouse zooming for Qt plotting (bug #44302)
John W. Eaton <jwe@octave.org>
parents: 19861
diff changeset
1796
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1797 ap.zoom_about_point ("both", x1, y1, factor, false);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1798 mark_modified ();
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1799 return 1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1800 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
1801 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1802
23800
2fdc65c031b5 Add break or continue statements to prevent implicit fall-through in case statements.
Rik <rik@octave.org>
parents: 23795
diff changeset
1803 break;
2fdc65c031b5 Add break or continue statements to prevent implicit fall-through in case statements.
Rik <rik@octave.org>
parents: 23795
diff changeset
1804
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1805 case FL_RELEASE:
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
1806 if (! m_fp.get_windowbuttonupfcn ().isempty ())
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1807 {
30346
91c6288781ba maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 30003
diff changeset
1808 set_currentpoint (Fl::event_x (),
91c6288781ba maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 30003
diff changeset
1809 Fl::event_y () - menu_dy ());
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1810 m_fp.execute_windowbuttonupfcn ();
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1811 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1812
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1813 if ((Fl::event_button () == 1) && Fl::event_clicks ())
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1814 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1815 // Double click
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1816 set_on_ax_obj ("xlimmode", "auto");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1817 set_on_ax_obj ("ylimmode", "auto");
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1818 set_on_ax_obj ("zlimmode", "auto");
20061
402e6678673b Redraw FLTK figure after double-click "zoom out".
Rik <rik@octave.org>
parents: 20060
diff changeset
1819 mark_modified ();
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1820 return 1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1821 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1822 if (Fl::event_button () == 3)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1823 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1824 // End of drag -- zoom.
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1825 if (m_canvas->zoom ())
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1826 {
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1827 m_canvas->zoom (false);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1828 double x0, y0, x1, y1;
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1829 if (m_ax_obj && m_ax_obj.isa ("axes"))
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1830 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1831 axes::properties& ap = dynamic_cast<axes::properties&>
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1832 (m_ax_obj.get_properties ());
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1833 pixel2pos (m_ax_obj, m_pos_x, m_pos_y, x0, y0);
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1834 int pos_x1 = Fl::event_x ();
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1835 int pos_y1 = Fl::event_y () - menu_dy ();
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1836 pixel2pos (m_ax_obj, pos_x1, pos_y1, x1, y1);
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1837 Matrix xl (1, 2, 0);
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
1838 Matrix yl (1, 2, 0);
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1839 int dx = abs (m_pos_x - pos_x1);
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
1840 int dy = abs (m_pos_y - pos_y1);
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1841 // Smallest zoom box must be 4 pixels square
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1842 if ((dx > 4) && (dy > 4))
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1843 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1844 if (x0 < x1)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1845 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1846 xl(0) = x0;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1847 xl(1) = x1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1848 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1849 else
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1850 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1851 xl(0) = x1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1852 xl(1) = x0;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1853 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1854 if (y0 < y1)
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1855 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1856 yl(0) = y0;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1857 yl(1) = y1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1858 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1859 else
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1860 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1861 yl(0) = y1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1862 yl(1) = y0;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1863 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1864 ap.zoom ("both", xl, yl);
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1865 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1866 mark_modified ();
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1867 return 1;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1868 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1869 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1870 }
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1871 break;
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
1872 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1873 }
26002
8c3e5b727e8f * __init_fltk__.cc: Eliminate some old commented debugging code.
John W. Eaton <jwe@octave.org>
parents: 25864
diff changeset
1874
18966
b2db129c664d Fix FLTK event handling for shortcuts and mouse cursor change
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18961
diff changeset
1875 return Fl_Window::handle (event);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1876 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1877 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1878
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1879 class figure_manager
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1880 {
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1881 private:
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1882
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1883 figure_manager () = default;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1884
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1885 public:
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1886
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1887 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1888
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1889 figure_manager (const figure_manager&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1890
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1891 figure_manager& operator = (const figure_manager&) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1892
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1893 ~figure_manager ()
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1894 {
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1895 close_all ();
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1896 }
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
1897
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1898 static bool instance_ok ()
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1899 {
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
1900 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
1901
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
1902 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
1903 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
1904
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
1905 return retval;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1906 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1907
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
1908 static void close_all ()
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1909 {
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
1910 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
1911 instance->do_close_all ();
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1912 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1913
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
1914 static void new_window (figure::properties& fp)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1915 {
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
1916 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
1917 instance->do_new_window (fp);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1918 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1919
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
1920 static void delete_window (int idx)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1921 {
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
1922 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
1923 instance->do_delete_window (idx);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1924 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1925
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1926 static void delete_window (const std::string& idx_str)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1927 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1928 delete_window (str2idx (idx_str));
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1929 }
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1930
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1931 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
1932 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1933 if (instance_ok ())
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1934 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
1935 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
1936
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1937 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
1938 {
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1939 if (instance_ok ())
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1940 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
1941 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1942
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1943 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
1944 bool is_visible)
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1945 {
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1946 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
1947 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
1948
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
1949 static void mark_modified (int idx)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1950 {
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
1951 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
1952 instance->do_mark_modified (idx);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1953 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1954
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
1955 static void mark_modified (const graphics_handle& gh)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1956 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1957 mark_modified (hnd2idx (gh));
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1958 }
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1959
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1960 static void set_name (int idx)
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1961 {
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1962 if (instance_ok ())
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1963 instance->do_set_name (idx);
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1964 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1965
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1966 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
1967 {
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1968 set_name (str2idx (idx_str));
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1969 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
1970
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
1971 static Matrix get_size (int idx)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1972 {
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
1973 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
1974 }
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
1975
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
1976 static Matrix get_size (const graphics_handle& gh)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1977 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1978 return get_size (hnd2idx (gh));
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
1979 }
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
1980
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1981 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
1982 const std::string& term)
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1983 {
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
1984 if (instance_ok ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1985 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
1986 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
1987
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1988 static uint8NDArray get_pixels (const graphics_handle& gh)
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1989 {
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1990 uint8NDArray retval;
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1991 if (instance_ok ())
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1992 retval = instance->do_get_pixels (hnd2idx (gh));
23563
614d71cdf614 maint: Strip trailing whitespace from files.
John W. Eaton <jwe@octave.org>
parents: 23535
diff changeset
1993
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1994 return retval;
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1995 }
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
1996
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
1997 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
1998 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
1999 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2000 if (instance_ok ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2001 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
2002 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2003
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2004 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
2005 const graphics_handle& ca)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2006 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2007 if (instance_ok ())
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2008 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
2009 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2010
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2011 static void update_boundingbox (const std::string& fig_idx_str,
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2012 bool internal)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2013 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2014 if (instance_ok ())
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2015 instance->do_update_boundingbox (str2idx (fig_idx_str), internal);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2016 }
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2017
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2018 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
2019 bool menubar_is_figure)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2020 {
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2021 if (instance_ok ())
18985
f84361735a40 maint: Use Octave coding conventions for some recent patches.
Rik <rik@octave.org>
parents: 18968
diff changeset
2022 instance->do_toggle_menubar_visibility (str2idx (fig_idx_str),
f84361735a40 maint: Use Octave coding conventions for some recent patches.
Rik <rik@octave.org>
parents: 18968
diff changeset
2023 menubar_is_figure);
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2024 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2025
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2026 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
2027
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
2028 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
2029
27956
2310164737b3 fix many spelling errors (bug #57613)
John W. Eaton <jwe@octave.org>
parents: 26580
diff changeset
2030 // Singleton -- hide all of the above.
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2031
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2032 static int curr_index;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2033
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
2034 typedef std::map<int, plot_window *> window_map;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2035
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2036 typedef window_map::iterator wm_iterator;;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
2037
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2038 window_map windows;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2039
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2040 static std::string fltk_idx_header;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2041
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2042 void do_close_all ()
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
2043 {
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
2044 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
2045 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
2046 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
2047 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
2048 }
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
2049
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
2050 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
2051 {
13798
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
2052 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
2053
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
2054 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
2055 {
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2056 Matrix pos = fp.get_outerposition ().matrix_value ();
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2057 bool internal = false;
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2058 // check if figure::properties::outerposition is default -1.0
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2059 if (pos(2) != -1.0 && pos(3) != -1.0)
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2060 {
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2061 pos = fp.get_boundingbox (internal);
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2062 }
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2063 else
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2064 {
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2065 // use position
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2066 internal = true;
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2067 pos = fp.get_boundingbox (internal);
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2068 }
13798
718f78b01de1 allow initial position to be set for fltk windows
John W. Eaton <jwe@octave.org>
parents: 13721
diff changeset
2069
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2070 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
2071
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19758
diff changeset
2072 windows[curr_index++] = new plot_window (pos(0), pos(1), pos(2), pos(3),
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2073 fp, internal);
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
2074 }
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
2075 }
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
2076
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
2077 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
2078 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2079 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2080
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2081 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
2082 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2083 delete win->second;
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2084 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
2085 }
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
2086 }
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
2087
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2088 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
2089 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2090 wm_iterator win = windows.find (idx);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2091
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2092 if (win != windows.end ())
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2093 win->second->renumber (new_number);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2094 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2095
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2096 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
2097 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2098 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2099
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2100 if (win != windows.end ())
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2101 {
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2102 if (is_visible)
19453
728873ccd637 Show canvas if figure was created with visible off (bug #41895)
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19296
diff changeset
2103 {
728873ccd637 Show canvas if figure was created with visible off (bug #41895)
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19296
diff changeset
2104 win->second->show ();
728873ccd637 Show canvas if figure was created with visible off (bug #41895)
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19296
diff changeset
2105 win->second->show_canvas ();
728873ccd637 Show canvas if figure was created with visible off (bug #41895)
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19296
diff changeset
2106 }
9973
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2107 else
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2108 win->second->hide ();
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2109
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2110 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2111 }
cd8f355157b8 Handle figure visibility in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9951
diff changeset
2112
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2113 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
2114 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2115 wm_iterator win = windows.find (fig_idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2116
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2117 if (win != windows.end ())
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2118 {
11585
1473d0cf86d2 untabify source files
John W. Eaton <jwe@octave.org>
parents: 11583
diff changeset
2119 if (menubar_is_figure)
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2120 win->second->show_menubar ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2121 else
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2122 win->second->hide_menubar ();
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2123
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2124 win->second->redraw ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2125 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2126 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2127
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
2128 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
2129 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2130 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2131
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2132 if (win != windows.end ())
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2133 {
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2134 win->second->mark_modified ();
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2135 }
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
2136 }
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
2137
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
2138 void do_set_name (int idx)
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
2139 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2140 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2141
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2142 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2143 win->second->set_name ();
10008
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
2144 }
b6261d776a82 handle window title correctly in fltk_backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9991
diff changeset
2145
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
2146 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
2147 {
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
2148 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
2149
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2150 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2151
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2152 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
2153 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2154 sz(0) = win->second->w ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2155 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
2156 }
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
2157
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
2158 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
2159 }
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
2160
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
2161 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
2162 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2163 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2164
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2165 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2166 win->second->print (cmd, term);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2167 }
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2168
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2169 uint8NDArray do_get_pixels (int idx)
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2170 {
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2171 uint8NDArray retval;
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2172 wm_iterator win = windows.find (idx);
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2173
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2174 if (win != windows.end ())
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2175 retval = win->second->get_pixels ();
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2176
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2177 return retval;
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2178 }
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2179
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2180 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
2181 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2182 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2183
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2184 if (win != windows.end ())
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2185 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
2186 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2187
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2188 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
2189 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2190 wm_iterator win = windows.find (idx);
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2191
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2192 if (win != windows.end ())
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2193 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2194 if (ca.ok ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2195 win->second->show_canvas ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2196 else
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2197 win->second->hide_canvas ();
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2198 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2199 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2200
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2201 void do_update_boundingbox (int idx, bool internal)
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2202 {
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2203 wm_iterator win = windows.find (idx);
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2204
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2205 if (win != windows.end ())
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2206 win->second->update_boundingbox (internal);
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2207 }
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2208
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2209 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
2210 {
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2211 int ind;
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 30003
diff changeset
2212 if (clstr.find (fltk_idx_header, 0) == 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
2213 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2214 std::istringstream istr (clstr.substr (fltk_idx_header.size ()));
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2215 if (istr >> ind)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2216 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
2217 }
20825
66cd994d1b79 eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
2218
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2219 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
2220 }
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2221
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2222 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
2223 {
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2224 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
2225 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
2226 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
2227 }
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2228
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
2229 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
2230 {
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2231 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
2232 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2233 octave_value ps = fp.get___plot_stream__ ();
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2234 if (ps.is_string ())
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2235 return str2idx (ps.string_value ());
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2236 else
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2237 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
2238 }
20825
66cd994d1b79 eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
2239
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2240 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
2241 }
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2242
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2243 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
2244 {
31105
670a0d878af1 eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents: 30999
diff changeset
2245 gh_manager& gh_mgr = octave::__get_gh_manager__ ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2246
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2247 graphics_object fobj = gh_mgr.get_object (h);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2248
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2249 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
2250 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2251 figure::properties& fp
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2252 = dynamic_cast<figure::properties&> (fobj.get_properties ());
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2253 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
2254 }
20825
66cd994d1b79 eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20711
diff changeset
2255
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2256 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
2257 }
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
2258
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
2259 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
2260 {
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
2261 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
2262 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2263 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2264
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23449
diff changeset
2265 figure_manager *figure_manager::instance = nullptr;
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
2266
7841
c643e5c520f5 fltk_backend now indexes using an internal index instead of figure handle
Shai Ayal <shaiay@users.sourceforge.net>
parents: 7840
diff changeset
2267 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
2268 int figure_manager::curr_index = 1;
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2269
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2270 static bool toolkit_loaded = false;
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
2271
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27350
diff changeset
2272 class fltk_graphics_toolkit : public octave::base_graphics_toolkit
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2273 {
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2274 public:
23097
0c5f04b9dca1 style fixes
John W. Eaton <jwe@octave.org>
parents: 23084
diff changeset
2275
23703
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2276 fltk_graphics_toolkit (octave::interpreter& interp)
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27350
diff changeset
2277 : octave::base_graphics_toolkit (FLTK_GRAPHICS_TOOLKIT_NAME),
30766
db0335e1b6e0 Backed out changeset fc530ec01070 (bug #61994)
John W. Eaton <jwe@octave.org>
parents: 30760
diff changeset
2278 m_interpreter (interp), input_event_hook_fcn_id ()
19012
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
2279 {
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
2280 Fl::visual (FL_RGB);
7f73293d8423 Revise FLTK keypressfcn and keyreleasefcn callbacks
Andreas Weber <andy.weber.aw@gmail.com>
parents: 19010
diff changeset
2281 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2282
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2283 ~fltk_graphics_toolkit () = default;
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2284
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2285 bool is_valid () const { return true; }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2286
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12968
diff changeset
2287 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
2288 {
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2289 if (go.isa ("figure")
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2290 || go.isa ("uimenu"))
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2291 {
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2292 if (go.isa ("uimenu"))
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2293 update (go, uimenu::properties::ID_LABEL);
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2294
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2295 return true;
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2296 }
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2297
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2298 return false;
7a67ab7c4771 Initialize uimenu objects for the fltk toolkit.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 16871
diff changeset
2299 }
13281
834f904a3dcb Add support for full asynchronous graphics toolkit running in a separate
Michael Goffioul <michael.goffioul@gmail.com>
parents: 12968
diff changeset
2300
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10972
diff changeset
2301 void finalize (const graphics_object& go)
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2302 {
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2303 if (go.isa ("figure"))
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2304 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2305 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
2306
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
2307 if (! ov.isempty ())
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
2308 figure_manager::delete_window (ov.string_value ());
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2309 }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2310 }
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2311
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
2312 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
2313 {
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2314 if (uimenu_obj.valid_object ())
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2315 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2316 uimenu::properties& uimenup
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2317 = 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
2318 std::string fltk_label = uimenup.get_label ();
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2319
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2320 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2321
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2322 graphics_object go = gh_mgr.get_object (uimenu_obj.get_parent ());
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2323
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2324 if (go.isa ("uimenu"))
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2325 fltk_label = dynamic_cast<const uimenu::properties&>
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
2326 (go.get_properties ()).get___fltk_label__ ()
23807
336f89b6208b Use character literals 'c' rather than string literals "c" when possible.
Rik <rik@octave.org>
parents: 23802
diff changeset
2327 + '/'
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2328 + fltk_label;
20108
de1377a638d7 Let annotation work with fltk again
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 20061
diff changeset
2329 else if (go.isa ("figure") || go.isa ("uicontextmenu"))
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2330 ;
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2331 else
20711
7b608fadc663 Make error messages more specific about the variable and problem encountered.
Rik <rik@octave.org>
parents: 20428
diff changeset
2332 error ("invalid parent object\n");
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2333
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
2334 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
2335 }
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2336 }
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2337
10973
a8235d26b57a improve names of base_graphics_backend methods
John W. Eaton <jwe@octave.org>
parents: 10972
diff changeset
2338 void update (const graphics_object& go, int id)
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2339 {
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2340 if (go.isa ("figure"))
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2341 {
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2342 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
2343
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23563
diff changeset
2344 if (! ov.isempty ())
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2345 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2346 const figure::properties& fp
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2347 = 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
2348
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2349 switch (id)
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2350 {
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2351 case base_properties::ID_VISIBLE:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2352 figure_manager::toggle_window_visibility (ov.string_value (),
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2353 fp.is_visible ());
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2354 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2355
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2356 case figure::properties::ID_MENUBAR:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2357 figure_manager::toggle_menubar_visibility
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2358 (ov.string_value (), fp.menubar_is ("figure"));
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2359 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2360
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2361 case figure::properties::ID_CURRENTAXES:
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
2362 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
2363 fp.get_currentaxes ());
13815
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2364 break;
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2365
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2366 case figure::properties::ID_NAME:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2367 case figure::properties::ID_NUMBERTITLE:
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2368 figure_manager::set_name (ov.string_value ());
0aba6f90f5f8 maint: __init_fltk__.cc style fixes
John W. Eaton <jwe@octave.org>
parents: 13804
diff changeset
2369 break;
13816
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2370
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2371 case figure::properties::ID_INTEGERHANDLE:
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2372 {
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2373 std::string tmp = ov.string_value ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2374 graphics_handle gh = fp.get___myhandle__ ();
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2375 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
2376 figure_manager::set_name (tmp);
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2377 }
7ee18dc46bbb new and improved non-integer figure handles
John W. Eaton <jwe@octave.org>
parents: 13815
diff changeset
2378 break;
18961
52e01aa1fe8b Overhaul FLTK pan, rotate, zoom
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18958
diff changeset
2379
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2380 case figure::properties::ID_POSITION:
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2381 figure_manager::update_boundingbox (ov.string_value (), true);
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2382 break;
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2383
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2384 case figure::properties::ID_OUTERPOSITION:
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2385 figure_manager::update_boundingbox (ov.string_value (), false);
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2386 break;
10154
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2387 }
40dfc0c99116 DLD-FUNCTIONS/*.cc: untabify
John W. Eaton <jwe@octave.org>
parents: 10076
diff changeset
2388 }
8059
75c99d3f97d7 Octave to backend notification scheme
John W. Eaton <jwe@octave.org>
parents: 7965
diff changeset
2389 }
11155
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2390 else if (go.isa ("uimenu"))
f0e9befd6a1c add uimenu graphic object to fltk backend
Kai Habel <kai.habel@gmx.de>
parents: 11045
diff changeset
2391 {
11239
5fa7667f90e5 Add prefix ID_ to property ids to avoid name clash on windows
Kai Habel <kai.habel@gmx.de>
parents: 11224
diff changeset
2392 if (id == uimenu::properties::ID_LABEL)
22622
4191f8b5070c Add '__' to start/end of hidden Octave-only graphics properties (bug #49205).
Rik <rik@octave.org>
parents: 22407
diff changeset
2393 uimenu_set___fltk_label__ (go);
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2394
14854
5ae9f0f77635 maint: Use Octave coding conventions for coddling parenthis is DLD-FUNCTIONS directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
2395 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
2396 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
2397 }
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2398 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2399
8077
a4e03f9b4b8a Fix FLTK backend update
Michael Goffioul
parents: 8060
diff changeset
2400 void redraw_figure (const graphics_object& go) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2401 {
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2402 // We scan all figures and add those which use FLTK.
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2403
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2404 gh_manager& gh_mgr = m_interpreter.get_gh_manager ();
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2405
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2406 graphics_object obj = gh_mgr.get_object (0);
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2407
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2408 if (obj && obj.isa ("root"))
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2409 {
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2410 base_properties& props = obj.get_properties ();
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2411 Matrix children = props.get_all_children ();
9652
ecdb275bd41b make drawnow work for fltk backend
John W. Eaton <jwe@octave.org>
parents: 9640
diff changeset
2412
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2413 for (octave_idx_type n = 0; n < children.numel (); n++)
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2414 {
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2415 graphics_object fobj = gh_mgr.get_object (children (n));
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2416
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2417 if (fobj && fobj.isa ("figure"))
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2418 {
27277
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2419 figure::properties& fp
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2420 = dynamic_cast<figure::properties&> (fobj.get_properties ());
db687716fed6 style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents: 27266
diff changeset
2421
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2422 if (fp.get___graphics_toolkit__ ()
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2423 == FLTK_GRAPHICS_TOOLKIT_NAME)
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2424 figure_manager::new_window (fp);
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2425 }
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2426 }
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2427 }
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2428
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
2429 figure_manager::mark_modified (go.get_handle ());
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2430 Fl::check ();
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2431 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2432
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2433 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
2434 const std::string& term,
21699
21fdab18f857 Remove reference to drawnow 'mono' throughout scripts and code, update args test
Daniel J Sebald <daniel.sebald@ieee.org>
parents: 21644
diff changeset
2435 const std::string& file_cmd,
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2436 const std::string& /*debug_file*/) const
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2437 {
12449
2f0d1e12806d invoke/terminate printing process synchronously with rendering (#32319)
Konstantinos Poulios <logari81@gmail.com>
parents: 12324
diff changeset
2438 figure_manager::print (go.get_handle (), file_cmd, term);
9798
2d6a5af744b6 printing for fltk backend using gl2ps
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9758
diff changeset
2439 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2440
23535
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2441 uint8NDArray get_pixels (const graphics_object& go) const
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2442 {
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2443 return figure_manager::get_pixels (go.get_handle ());
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2444 }
2aab625b502c Add getframe function for opengl based toolkits (bug #48195)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 23457
diff changeset
2445
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2446 Matrix get_canvas_size (const graphics_handle& fh) const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2447 {
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
2448 return figure_manager::get_size (fh);
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2449 }
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2450
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2451 /*
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2452 double get_screen_resolution () const
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2453 {
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2454 // FLTK doesn't give this info.
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2455 return 72.0;
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2456
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2457 // FIXME: FLTK >= 1.3.0 could do this with Fl::screen_dpi (h, v, n)
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2458 // but do we need it?
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2459 }
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
2460 */
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2461
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2462 Matrix get_screen_size () const
7869
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2463 {
e6d5532f760e style fixes
John W. Eaton <jwe@octave.org>
parents: 7861
diff changeset
2464 Matrix sz (1, 2, 0.0);
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2465 sz(0) = Fl::w ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2466 sz(1) = Fl::h ();
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2467 return sz;
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2468 }
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
2469
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31730
diff changeset
2470 void close ()
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
2471 {
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2472 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
2473 {
23703
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2474 m_interpreter.munlock ("__init_fltk__");
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
2475
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2476 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
2477 args.append (false);
25407
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
2478 Fremove_input_event_hook (m_interpreter, args, 0);
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2479 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
2480
18958
c9f960441513 Overhaul FLTK plotting and printing
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18678
diff changeset
2481 figure_manager::close_all ();
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
2482 }
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
2483 }
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2484
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2485 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
2486 {
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2487 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
2488 }
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2489
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2490 private:
23703
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2491
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2492 octave::interpreter& m_interpreter;
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2493
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2494 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
2495 };
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2496
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2497 #endif
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2498
29750
3a84bd37c6eb Backed out changeset 52b2680e091c (bug #60771)
John W. Eaton <jwe@octave.org>
parents: 29654
diff changeset
2499 DEFMETHOD_DLD (__fltk_check__, interp, , ,
3a84bd37c6eb Backed out changeset 52b2680e091c (bug #60771)
John W. Eaton <jwe@octave.org>
parents: 29654
diff changeset
2500 doc: /* -*- texinfo -*-
3a84bd37c6eb Backed out changeset 52b2680e091c (bug #60771)
John W. Eaton <jwe@octave.org>
parents: 29654
diff changeset
2501 @deftypefn {} {} __fltk_check__ ()
3a84bd37c6eb Backed out changeset 52b2680e091c (bug #60771)
John W. Eaton <jwe@octave.org>
parents: 29654
diff changeset
2502 Undocumented internal function. Calls Fl::check ()
3a84bd37c6eb Backed out changeset 52b2680e091c (bug #60771)
John W. Eaton <jwe@octave.org>
parents: 29654
diff changeset
2503 @end deftypefn */)
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2504 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
2505 #if defined (HAVE_FLTK)
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2506 Fl::check ();
20060
76b1168342c0 Redraw FLTK figure after zoom operations on linked axes (bug #44719).
Rik <rik@octave.org>
parents: 20053
diff changeset
2507
76b1168342c0 Redraw FLTK figure after zoom operations on linked axes (bug #44719).
Rik <rik@octave.org>
parents: 20053
diff changeset
2508 if (Vdrawnow_requested)
27335
50216d7a2f6b eliminate static wrapper functions in gh_manager class
John W. Eaton <jwe@octave.org>
parents: 27277
diff changeset
2509 Fdrawnow (interp);
20957
9db35d2042be maint: eliminate special cases of statements after error.
Rik <rik@octave.org>
parents: 20955
diff changeset
2510
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
2511 return octave_value_list ();
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2512 #else
27350
27f3d36c45a4 build: silence unused parameter warning introduced in cset 50216d7a2f6b
Mike Miller <mtmiller@octave.org>
parents: 27335
diff changeset
2513 octave_unused_parameter (interp);
27f3d36c45a4 build: silence unused parameter warning introduced in cset 50216d7a2f6b
Mike Miller <mtmiller@octave.org>
parents: 27335
diff changeset
2514
21109
bd1752782e56 Use err_disabled_feature, warn_disabled_feature throughout code base.
Rik <rik@octave.org>
parents: 21021
diff changeset
2515 err_disabled_feature ("__fltk_check__", "OpenGL and FLTK");
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2516 #endif
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2517 }
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2518
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2519 // Initialize the fltk graphics toolkit.
9951
d64d15e12e6b print immediately in fltk backend
Shai Ayal <shaiay@users.sourceforge.net>
parents: 9802
diff changeset
2520
23703
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2521 DEFMETHOD_DLD (__init_fltk__, interp, , ,
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2522 doc: /* -*- texinfo -*-
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
2523 @deftypefn {} {} __init_fltk__ ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
2524 Undocumented internal function.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
2525 @end deftypefn */)
7834
caab78e7e377 added checks for fltk & freetype in configure script
Shai Ayal <shaiay@sourceforge.net>
parents:
diff changeset
2526 {
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21723
diff changeset
2527 #if defined (HAVE_FLTK)
27266
596312d4f25d don't use singleton pattern for display_info class
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
2528 octave::display_info& dpy_info = interp.get_display_info ();
596312d4f25d don't use singleton pattern for display_info class
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
2529
596312d4f25d don't use singleton pattern for display_info class
John W. Eaton <jwe@octave.org>
parents: 27263
diff changeset
2530 if (! dpy_info.display_available ())
17881
7aadb87f599a Display warning and don't init FLTK toolkit if no DISPLAY available (bug #40423).
Rik <rik@octave.org>
parents: 17861
diff changeset
2531 error ("__init_fltk__: no graphics DISPLAY available");
7aadb87f599a Display warning and don't init FLTK toolkit if no DISPLAY available (bug #40423).
Rik <rik@octave.org>
parents: 17861
diff changeset
2532 else if (! toolkit_loaded)
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2533 {
30766
db0335e1b6e0 Backed out changeset fc530ec01070 (bug #61994)
John W. Eaton <jwe@octave.org>
parents: 30760
diff changeset
2534 interp.mlock ();
db0335e1b6e0 Backed out changeset fc530ec01070 (bug #61994)
John W. Eaton <jwe@octave.org>
parents: 30760
diff changeset
2535
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23746
diff changeset
2536 octave::gtk_manager& gtk_mgr = interp.get_gtk_manager ();
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23746
diff changeset
2537
23703
6eb5f6199a5a move mlock, munlock, and mislocked to interpreter class
John W. Eaton <jwe@octave.org>
parents: 23695
diff changeset
2538 fltk_graphics_toolkit *fltk = new fltk_graphics_toolkit (interp);
27734
a9780be9ecbc move graphics_toolkit class inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 27350
diff changeset
2539 octave::graphics_toolkit tk (fltk);
23774
41795b504a8b don't use singleton for gtk_manager
John W. Eaton <jwe@octave.org>
parents: 23746
diff changeset
2540 gtk_mgr.load_toolkit (tk);
14021
e3bed294b117 refactor graphics_toolkit class (bug #31583)
John W. Eaton <jwe@octave.org>
parents: 14020
diff changeset
2541 toolkit_loaded = true;
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11585
diff changeset
2542
19010
c3af040956df fix FLTK position/outerposition properties, respect units
Andreas Weber <andy.weber.aw@gmail.com>
parents: 18985
diff changeset
2543 octave_value fcn (new octave_builtin (F__fltk_check__));
28439
e760fef2829c refactor octave_fcn_handle class
John W. Eaton <jwe@octave.org>
parents: 28198
diff changeset
2544 octave_value fcn_handle (new octave_fcn_handle (fcn));
e760fef2829c refactor octave_fcn_handle class
John W. Eaton <jwe@octave.org>
parents: 28198
diff changeset
2545
25407
ab10403a0b50 new input_system class to manage user input for the interpreter
John W. Eaton <jwe@octave.org>
parents: 25103
diff changeset
2546 octave_value_list id = Fadd_input_event_hook (interp, fcn_handle, 1);
16348
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2547
072b3e6504c4 use function handle for fltk input event hook function
John W. Eaton <jwe@octave.org>
parents: 15507
diff changeset
2548 fltk->set_input_event_hook_id (id);
8060
09f32aac8fbc Interface for backend switch/initialization
John W. Eaton <jwe@octave.org>
parents: 8059
diff changeset
2549 }
20957
9db35d2042be maint: eliminate special cases of statements after error.
Rik <rik@octave.org>
parents: 20955
diff changeset
2550
23024
a6a7b054e4ba Rationalize #includes in libinterp/dldfcn directory.
Rik <rik@octave.org>
parents: 22869
diff changeset
2551 return octave_value_list ();
21109
bd1752782e56 Use err_disabled_feature, warn_disabled_feature throughout code base.
Rik <rik@octave.org>
parents: 21021
diff changeset
2552
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2553 #else
23785
99cdc1547054 Stop unused parameter warning when building without FLTK.
Rik <rik@octave.org>
parents: 23774
diff changeset
2554 octave_unused_parameter (interp);
99cdc1547054 Stop unused parameter warning when building without FLTK.
Rik <rik@octave.org>
parents: 23774
diff changeset
2555
21109
bd1752782e56 Use err_disabled_feature, warn_disabled_feature throughout code base.
Rik <rik@octave.org>
parents: 21021
diff changeset
2556 err_disabled_feature ("__init_fltk__", "OpenGL and FLTK");
15507
b9b9795a7cd9 build: Build FLTK-associated DOCSTRINGS even when HAVE_FLTK is 0 (bug #37541).
Rik <rik@octave.org>
parents: 15506
diff changeset
2557 #endif
11576
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2558 }
8ac9687dbe9f rename backend to graphics_toolkit
John W. Eaton <jwe@octave.org>
parents: 11553
diff changeset
2559
21575
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21568
diff changeset
2560 /*
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21568
diff changeset
2561 ## No test needed for internal helper function.
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21568
diff changeset
2562 %!assert (1)
bc9aa534bc29 maint: Clean up BIST tests so they don't produce warnings.
Rik <rik@octave.org>
parents: 21568
diff changeset
2563 */
29993
b5fae48ad807 move classes for graphics objects and properties inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29966
diff changeset
2564
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 31105
diff changeset
2565 OCTAVE_END_NAMESPACE(octave)