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