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