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