Bug Summary

File:libinterp/dldfcn/__init_fltk__.cc
Location:line 1477, column 36
Description:The right operand of '<' is a garbage value

Annotated Source Code

1/*
2
3Copyright (C) 2007-2013 Shai Ayal
4
5This file is part of Octave.
6
7Octave is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by the
9Free Software Foundation; either version 3 of the License, or (at your
10option) any later version.
11
12Octave is distributed in the hope that it will be useful, but WITHOUT
13ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with Octave; see the file COPYING. If not, see
19<http://www.gnu.org/licenses/>.
20
21*/
22
23/*
24
25To initialize:
26
27 graphics_toolkit ("fltk");
28 plot (randn (1e3, 1));
29
30*/
31
32// PKG_ADD: if (__have_fltk__ () && have_window_system ()) register_graphics_toolkit ("fltk"); endif
33
34#ifdef HAVE_CONFIG_H1
35#include <config.h>
36#endif
37
38#include "builtin-defun-decls.h"
39#include "defun-dld.h"
40#include "error.h"
41#include "ov-fcn-handle.h"
42
43#ifdef HAVE_FLTK1
44
45#include <map>
46#include <set>
47#include <sstream>
48#include <iostream>
49
50#ifdef WIN32
51#define WIN32_LEAN_AND_MEAN
52#endif
53
54#include <FL/Fl.H>
55#include <FL/Fl_Box.H>
56#include <FL/Fl_Button.H>
57#include <FL/Fl_Choice.H>
58#include <FL/Fl_File_Chooser.H>
59#include <FL/Fl_Gl_Window.H>
60#include <FL/Fl_Menu_Bar.H>
61#include <FL/Fl_Menu_Button.H>
62#include <FL/Fl_Output.H>
63#include <FL/Fl_Window.H>
64#include <FL/fl_ask.H>
65#include <FL/fl_draw.H>
66#include <FL/gl.h>
67
68// FLTK headers may include X11/X.h which defines Complex, and that
69// conflicts with Octave's Complex typedef. We don't need the X11
70// Complex definition in this file, so remove it before including Octave
71// headers which may require Octave's Complex typedef.
72#undef Complex
73
74#include "cmd-edit.h"
75#include "lo-ieee.h"
76
77#include "display.h"
78#include "file-ops.h"
79#include "gl-render.h"
80#include "gl2ps-renderer.h"
81#include "graphics.h"
82#include "parse.h"
83#include "sysdep.h"
84#include "toplev.h"
85#include "variables.h"
86
87#define FLTK_GRAPHICS_TOOLKIT_NAME"fltk" "fltk"
88
89// Give FLTK no more than 0.01 sec to do its stuff.
90static double fltk_maxtime = 1e-2;
91
92const char* help_text = "\
93Keyboard Shortcuts\n\
94a - autoscale\n\
95p - pan/zoom\n\
96r - rotate\n\
97g - toggle grid\n\
98\n\
99Mouse\n\
100left drag - pan\n\
101mouse wheel - zoom\n\
102right drag - rectangle zoom\n\
103left double click - autoscale\n\
104";
105
106class OpenGL_fltk : public Fl_Gl_Window
107{
108public:
109 OpenGL_fltk (int xx, int yy, int ww, int hh, double num)
110 : Fl_Gl_Window (xx, yy, ww, hh, 0), number (num), renderer (),
111 in_zoom (false), zoom_box (), print_mode (false)
112 {
113 // Ask for double buffering and a depth buffer.
114 mode (FL_DEPTH | FL_DOUBLE);
115 }
116
117 ~OpenGL_fltk (void) { }
118
119 void zoom (bool z)
120 {
121 in_zoom = z;
122 if (! in_zoom)
123 hide_overlay ();
124 }
125
126 bool zoom (void) { return in_zoom; }
127 void set_zoom_box (const Matrix& zb) { zoom_box = zb; }
128
129 void print (const std::string& cmd, const std::string& term)
130 {
131 print_mode = true;
132 print_cmd = cmd;
133 print_term = term;
134 }
135
136 void resize (int xx, int yy, int ww, int hh)
137 {
138 Fl_Gl_Window::resize (xx, yy, ww, hh);
139 setup_viewport (ww, hh);
140 redraw ();
141 }
142
143 bool renumber (double new_number)
144 {
145 bool retval = false;
146
147 if (number != new_number)
148 {
149 number = new_number;
150 retval = true;
151 }
152
153 return retval;
154 }
155
156private:
157 double number;
158 opengl_renderer renderer;
159 bool in_zoom;
160 // (x1,y1,x2,y2)
161 Matrix zoom_box;
162
163 bool print_mode;
164 std::string print_cmd;
165 std::string print_term;
166
167 void setup_viewport (int ww, int hh)
168 {
169 glMatrixMode (GL_PROJECTION0x1701);
170 glLoadIdentity ();
171 glViewport (0, 0, ww, hh);
172 }
173
174 void draw (void)
175 {
176 if (! valid ())
177 {
178 valid (1);
179 setup_viewport (w (), h ());
180 }
181
182 if (print_mode)
183 {
184#ifdef HAVE_GL2PS_H
185 FILE *fp = octave_popen (print_cmd.c_str (), "w");
186 glps_renderer rend (fp, print_term);
187
188 rend.draw (gh_manager::get_object (number), print_cmd);
189
190 octave_pclose (fp);
191 print_mode = false;
192#else
193 print_mode = false;
194 error ("fltk: printing not available without gl2ps library");
195 return;
196#endif
197 }
198 else
199 {
200 renderer.draw (gh_manager::get_object (number));
201
202 if (zoom ())
203 overlay ();
204 }
205 }
206
207 void zoom_box_vertex (void)
208 {
209 glVertex2d (zoom_box(0), h () - zoom_box(1));
210 glVertex2d (zoom_box(0), h () - zoom_box(3));
211 glVertex2d (zoom_box(2), h () - zoom_box(3));
212 glVertex2d (zoom_box(2), h () - zoom_box(1));
213 glVertex2d (zoom_box(0), h () - zoom_box(1));
214 }
215
216 void overlay (void)
217 {
218 glPushMatrix ();
219
220 glMatrixMode (GL_MODELVIEW0x1700);
221 glLoadIdentity ();
222
223 glMatrixMode (GL_PROJECTION0x1701);
224 glLoadIdentity ();
225 gluOrtho2D (0.0, w (), 0.0, h ());
226
227 glPushAttrib (GL_DEPTH_BUFFER_BIT0x00000100 | GL_CURRENT_BIT0x00000001);
228 glDisable (GL_DEPTH_TEST0x0B71);
229
230 glBegin (GL_POLYGON0x0009);
231 glColor4f (0.45, 0.62, 0.81, 0.1);
232 zoom_box_vertex ();
233 glEnd ();
234
235 glBegin (GL_LINE_STRIP0x0003);
236 glLineWidth (1.5);
237 glColor4f (0.45, 0.62, 0.81, 0.9);
238 zoom_box_vertex ();
239 glEnd ();
240
241 glPopAttrib ();
242 glPopMatrix ();
243 }
244
245 int handle (int event)
246 {
247 int retval = Fl_Gl_Window::handle (event);
248
249 switch (event)
250 {
251 case FL_ENTER:
252 window ()->cursor (FL_CURSOR_CROSS);
253 return 1;
254
255 case FL_LEAVE:
256 window ()->cursor (FL_CURSOR_DEFAULT);
257 return 1;
258 }
259
260 return retval;
261 }
262};
263
264// Parameter controlling how fast we zoom when using the scrool wheel.
265static double Vwheel_zoom_speed = 0.05;
266// Parameter controlling the GUI mode.
267static enum { pan_zoom, rotate_zoom, none } gui_mode;
268
269void script_cb (Fl_Widget*, void* data)
270{
271 static_cast<uimenu::properties*> (data)->execute_callback ();
272}
273
274
275class fltk_uimenu
276{
277public:
278 fltk_uimenu (int xx, int yy, int ww, int hh)
279 {
280 menubar = new
281 Fl_Menu_Bar (xx, yy, ww, hh);
282 }
283
284 int items_to_show (void)
285 {
286 //returns the number of visible menu items
287 int len = menubar->size ();
288 int n = 0;
289 for (int t = 0; t < len; t++ )
290 {
291 const Fl_Menu_Item *m = static_cast<const Fl_Menu_Item*> (&
292 (menubar->menu ()[t]));
293 if ((m->label () != NULL__null) && m->visible ())
294 n++;
295 }
296
297 return n;
298 }
299
300 void show (void)
301 {
302 menubar->show ();
303 }
304
305 void hide (void)
306 {
307 menubar->hide ();
308 }
309
310 bool is_visible (void)
311 {
312 return menubar->visible ();
313 }
314
315 int find_index_by_name (const std::string& findname)
316 {
317 // This function is derived from Greg Ercolano's function
318 // int GetIndexByName(...), see:
319 // http://seriss.com/people/erco/fltk/#Menu_ChangeLabel
320 // He agreed via PM that it can be included in octave using GPLv3
321 // Kai Habel (14.10.2010)
322
323 std::string menupath;
324 for (int t = 0; t < menubar->size (); t++ )
325 {
326 Fl_Menu_Item *m = const_cast<Fl_Menu_Item*> (&(menubar->menu ()[t]));
327 if (m->submenu ())
328 {
329 // item has submenu
330 if (!menupath.empty ())
331 menupath += "/";
332 menupath += m->label ();
333
334 if (menupath.compare (findname) == 0 )
335 return (t);
336 }
337 else
338 {
339 // End of submenu? Pop back one level.
340 if (m->label () == NULL__null)
341 {
342 std::size_t idx = menupath.find_last_of ("/");
343 if (idx != std::string::npos)
344 menupath.erase (idx);
345 else
346 menupath.clear ();
347 continue;
348 }
349 // Menu item?
350 std::string itempath = menupath;
351 if (!itempath.empty ())
352 itempath += "/";
353 itempath += m->label ();
354
355 if (itempath.compare (findname) == 0)
356 return (t);
357 }
358 }
359 return (-1);
360 }
361
362 Matrix find_uimenu_children (uimenu::properties& uimenup) const
363 {
364 Matrix uimenu_childs = uimenup.get_all_children ();
365 Matrix retval = do_find_uimenu_children (uimenu_childs);
366 return retval;
367 }
368
369 Matrix find_uimenu_children (figure::properties& figp) const
370 {
371 Matrix uimenu_childs = figp.get_all_children ();
372 Matrix retval = do_find_uimenu_children (uimenu_childs);
373 return retval;
374 }
375
376 Matrix do_find_uimenu_children (Matrix uimenu_childs) const
377 {
378 octave_idx_type k = 0;
379
380
381 Matrix pos = Matrix (uimenu_childs.numel (), 1);
382
383 for (octave_idx_type ii = 0; ii < uimenu_childs.numel (); ii++)
384 {
385 graphics_object kidgo = gh_manager::get_object (uimenu_childs (ii));
386
387 if (kidgo.valid_object () && kidgo.isa ("uimenu"))
388 {
389 uimenu_childs(k) = uimenu_childs(ii);
390 pos(k++) =
391 dynamic_cast<uimenu::properties&>
392 (kidgo.get_properties ()).get_position ();
393 }
394 }
395
396 uimenu_childs.resize (k, 1);
397 pos.resize (k, 1);
398 Matrix retval = Matrix (k, 1);
399 // Don't know if this is the best method to sort.
400 // Can we avoid the for loop?
401 Array<octave_idx_type> sidx = pos.sort_rows_idx (DESCENDING);
402 for (octave_idx_type ii = 0; ii < k; ii++)
403 retval(ii) = uimenu_childs (sidx(ii));
404
405 return retval;
406 }
407
408 void delete_entry (uimenu::properties& uimenup)
409 {
410 std::string fltk_label = uimenup.get_fltk_label ();
411 int idx = find_index_by_name (fltk_label.c_str ());
412
413 if (idx >= 0)
414 menubar->remove (idx);
415 }
416
417 void update_accelerator (uimenu::properties& uimenup)
418 {
419 std::string fltk_label = uimenup.get_fltk_label ();
420 if (!fltk_label.empty ())
421 {
422 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
423 fltk_label.c_str ()));
424 if (item != NULL__null)
425 {
426 std::string acc = uimenup.get_accelerator ();
427 if (acc.length () > 0)
428 {
429 int key = FL_CTRL0x00040000 + acc[0];
430 item->shortcut (key);
431 }
432 }
433 }
434 }
435
436 void update_callback (uimenu::properties& uimenup)
437 {
438 std::string fltk_label = uimenup.get_fltk_label ();
439 if (!fltk_label.empty ())
440 {
441 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
442 fltk_label.c_str ()));
443 if (item != NULL__null)
444 {
445 if (!uimenup.get_callback ().is_empty ())
446 item->callback (static_cast<Fl_Callback*> (script_cb),
447 static_cast<void*> (&uimenup));
448 else
449 item->callback (NULL__null, static_cast<void*> (0));
450 }
451 }
452 }
453
454 void update_enable (uimenu::properties& uimenup)
455 {
456 std::string fltk_label = uimenup.get_fltk_label ();
457 if (!fltk_label.empty ())
458 {
459 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
460 fltk_label.c_str ()));
461 if (item != NULL__null)
462 {
463 if (uimenup.is_enable ())
464 item->activate ();
465 else
466 item->deactivate ();
467 }
468 }
469 }
470
471 void update_foregroundcolor (uimenu::properties& uimenup)
472 {
473 std::string fltk_label = uimenup.get_fltk_label ();
474 if (!fltk_label.empty ())
475 {
476 Fl_Menu_Item* item = const_cast<Fl_Menu_Item*> (menubar->find_item (
477 fltk_label.c_str ()));
478 if (item != NULL__null)
479 {
480 Matrix rgb = uimenup.get_foregroundcolor_rgb ();
481
482 uchar r = static_cast<uchar> (gnulib::floor (rgb (0) * 255));
483 uchar g = static_cast<uchar> (gnulib::floor (rgb (1) * 255));
484 uchar b = static_cast<uchar> (gnulib::floor (rgb (2) * 255));
485
486 item->labelcolor (fl_rgb_color (r, g, b));
487 }
488 }
489 }
490
491 void update_seperator (const uimenu::properties& uimenup)
492 {
493 // Matlab places the separator before the current
494 // menu entry, while fltk places it after. So we need to find
495 // the previous item in this menu/submenu. (Kai)
496 std::string fltk_label = uimenup.get_fltk_label ();
497 if (!fltk_label.empty ())
498 {
499 int itemflags = 0, idx;
500 int curr_idx = find_index_by_name (fltk_label.c_str ());
501
502 for (idx = curr_idx - 1; idx >= 0; idx--)
503 {
504 Fl_Menu_Item* item
505 = const_cast<Fl_Menu_Item*> (&menubar->menu () [idx]);
506 itemflags = item->flags;
507 if (item->label () != NULL__null)
508 break;
509 }
510
511 if (idx >= 0 && idx < menubar->size ())
512 {
513 if (uimenup.is_separator ())
514 {
515 if (idx >= 0 && !(itemflags & FL_SUBMENU))
516 menubar->mode (idx, itemflags | FL_MENU_DIVIDER);
517 }
518 else
519 menubar->mode (idx, itemflags & (~FL_MENU_DIVIDER));
520 }
521 }
522 }
523
524 void update_visible (uimenu::properties& uimenup)
525 {
526 std::string fltk_label = uimenup.get_fltk_label ();
527 if (!fltk_label.empty ())
528 {
529 Fl_Menu_Item* item
530 = const_cast<Fl_Menu_Item*> (menubar->find_item (fltk_label.c_str ()));
531 if (item != NULL__null)
532 {
533 if (uimenup.is_visible ())
534 item->show ();
535 else
536 item->hide ();
537 }
538 }
539 }
540
541 void add_entry (uimenu::properties& uimenup)
542 {
543
544 std::string fltk_label = uimenup.get_fltk_label ();
545
546 if (!fltk_label.empty ())
547 {
548 bool item_added = false;
549 do
550 {
551 const Fl_Menu_Item* item
552 = menubar->find_item (fltk_label.c_str ());
553
554 if (item == NULL__null)
555 {
556 Matrix uimenu_ch = find_uimenu_children (uimenup);
557 int len = uimenu_ch.numel ();
558 int flags = 0;
559 if (len > 0)
560 flags = FL_SUBMENU;
561 if (len == 0 && uimenup.is_checked ())
562 flags += FL_MENU_TOGGLE + FL_MENU_VALUE;
563 menubar->add (fltk_label.c_str (), 0, 0, 0, flags);
564 item_added = true;
565 }
566 else
567 {
568 //avoid duplicate menulabels
569 std::size_t idx1 = fltk_label.find_last_of ("(");
570 std::size_t idx2 = fltk_label.find_last_of (")");
571 int len = idx2 - idx1;
572 int val = 1;
573 if (len > 0)
574 {
575 std::string valstr = fltk_label.substr (idx1 + 1, len - 1);
576 fltk_label.erase (idx1, len + 1);
577 val = atoi (valstr.c_str ());
578 if (val > 0 && val < 99)
579 val++;
580 }
581 std::ostringstream valstream;
582 valstream << val;
583 fltk_label += "(" + valstream.str () + ")";
584 }
585 }
586 while (!item_added);
587 uimenup.set_fltk_label (fltk_label);
588 }
589 }
590
591 void add_to_menu (uimenu::properties& uimenup)
592 {
593 Matrix kids = find_uimenu_children (uimenup);
594 int len = kids.length ();
595 std::string fltk_label = uimenup.get_fltk_label ();
596
597 add_entry (uimenup);
598 update_foregroundcolor (uimenup);
599 update_callback (uimenup);
600 update_accelerator (uimenup);
601 update_enable (uimenup);
602 update_visible (uimenup);
603 update_seperator (uimenup);
604
605 for (octave_idx_type ii = 0; ii < len; ii++)
606 {
607 graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
608 if (kgo.valid_object ())
609 {
610 uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
611 (kgo.get_properties ());
612 add_to_menu (kprop);
613 }
614 }
615 }
616
617 void add_to_menu (figure::properties& figp)
618 {
619 Matrix kids = find_uimenu_children (figp);
620 int len = kids.length ();
621 menubar->clear ();
622 for (octave_idx_type ii = 0; ii < len; ii++)
623 {
624 graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
625
626 if (kgo.valid_object ())
627 {
628 uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
629 (kgo.get_properties ());
630 add_to_menu (kprop);
631 }
632 }
633 }
634
635 template <class T_prop>
636 void remove_from_menu (T_prop& prop)
637 {
638 Matrix kids;
639 std::string type = prop.get_type ();
640 kids = find_uimenu_children (prop);
641 int len = kids.length ();
642
643 for (octave_idx_type ii = 0; ii < len; ii++)
644 {
645 graphics_object kgo = gh_manager::get_object (kids (len - (ii + 1)));
646
647 if (kgo.valid_object ())
648 {
649 uimenu::properties kprop = dynamic_cast<uimenu::properties&>
650 (kgo.get_properties ());
651 remove_from_menu (kprop);
652 }
653 }
654
655 if (type.compare ("uimenu") == 0)
656 delete_entry (dynamic_cast<uimenu::properties&> (prop));
657 else if (type.compare ("figure") == 0)
658 menubar->clear ();
659 }
660
661 ~fltk_uimenu (void)
662 {
663 delete menubar;
664 }
665
666private:
667
668 // No copying!
669
670 fltk_uimenu (const fltk_uimenu&);
671
672 fltk_uimenu operator = (const fltk_uimenu&);
673
674 Fl_Menu_Bar* menubar;
675};
676
677class plot_window : public Fl_Window
678{
679 friend class fltk_uimenu;
680public:
681 plot_window (int xx, int yy, int ww, int hh, figure::properties& xfp)
682 : Fl_Window (xx, yy - menu_h, ww, hh + menu_h + status_h, "octave"),
683 window_label (), shift (0), ndim (2), fp (xfp), canvas (0),
684 autoscale (0), togglegrid (0), panzoom (0), rotate (0), help (0),
685 status (0), ax_obj (), pos_x (0), pos_y (0)
686 {
687 callback (window_close, static_cast<void*> (this));
688 size_range (4*status_h, 2*status_h);
689
690 // FIXME: The function below is only available in FLTK >= 1.3
691 // At some point support for FLTK 1.1 will be dropped in Octave.
692 // At that point this function should be uncommented.
693 // The current solution is to call xclass() before show() for each window.
694 // Set WM_CLASS which allows window managers to properly group related
695 // windows. Otherwise, the class is just "FLTK"
696 //default_xclass ("Octave");
697
698 begin ();
699 {
700 // bbox of plot canvas = [xx, yy, ww, hh];
701 // (xx, yy) = UL coordinate relative to UL window.
702
703 canvas = new OpenGL_fltk (0, menu_h, ww, hh, number ());
704
705 uimenu = new fltk_uimenu (0, 0, ww, menu_h);
706 uimenu->hide ();
707
708 // Toolbar is a composite of "bottom", "autoscale", "togglegrid",
709 // "panzoom", "rotate", "help", and "status".
710
711 yy = hh + menu_h;
712 bottom = new Fl_Box (0, yy, ww, status_h);
713 bottom->box (FL_FLAT_BOX);
714
715 ndim = calc_dimensions (gh_manager::get_object (fp.get___myhandle__ ()));
716
717 autoscale = new Fl_Button (0, yy, status_h, status_h, "A");
718 autoscale->callback (button_callback, static_cast<void*> (this));
719 autoscale->tooltip ("Autoscale");
720
721 togglegrid = new Fl_Button (status_h, yy, status_h,
722 status_h, "G");
723 togglegrid->callback (button_callback, static_cast<void*> (this));
724 togglegrid->tooltip ("Toggle Grid");
725
726 panzoom = new Fl_Button (2 * status_h, yy, status_h,
727 status_h, "P");
728 panzoom->callback (button_callback, static_cast<void*> (this));
729 panzoom->tooltip ("Mouse Pan/Zoom");
730
731 rotate = new Fl_Button (3 * status_h, yy, status_h,
732 status_h, "R");
733 rotate->callback (button_callback, static_cast<void*> (this));
734 rotate->tooltip ("Mouse Rotate");
735
736 if (ndim == 2)
737 rotate->deactivate ();
738
739 help = new Fl_Button (4 * status_h, yy, status_h,
740 status_h, "?");
741 help->callback (button_callback, static_cast<void*> (this));
742 help->tooltip ("Help");
743
744 status = new Fl_Output (5 * status_h, yy,
745 ww > 2*status_h ? ww - status_h : 0,
746 status_h, "");
747
748 status->textcolor (FL_BLACK);
749 status->color (FL_GRAYFL_BACKGROUND_COLOR);
750 status->textfont (FL_COURIER);
751 status->textsize (10);
752 status->box (FL_ENGRAVED_BOX);
753
754 // This allows us to have a valid OpenGL context right away.
755 canvas->mode (FL_DEPTH | FL_DOUBLE );
756 if (fp.is_visible ())
757 {
758 // FIXME: This code should be removed when Octave drops support
759 // for FLTK 1.1. Search for default_xclass in this file to find
760 // code that should be uncommented to take its place.
761 //
762 // Set WM_CLASS which allows window managers to properly group
763 // related windows. Otherwise, the class is just "FLTK"
764 xclass ("Octave");
765 show ();
766 if (fp.get_currentaxes ().ok ())
767 show_canvas ();
768 else
769 hide_canvas ();
770 }
771 }
772 end ();
773
774 status->show ();
775 autoscale->show ();
776 togglegrid->show ();
777 panzoom->show ();
778 rotate->show ();
779
780 set_name ();
781 resizable (canvas);
782 gui_mode = (ndim == 3 ? rotate_zoom : pan_zoom);
783 uimenu->add_to_menu (fp);
784 if (uimenu->items_to_show ())
785 show_menubar ();
786 else
787 hide_menubar ();
788 }
789
790 ~plot_window (void)
791 {
792 canvas->hide ();
793 status->hide ();
794 uimenu->hide ();
795 this->hide ();
796 }
797
798 double number (void) { return fp.get___myhandle__ ().value (); }
799
800 void renumber (double new_number)
801 {
802 if (canvas)
803 {
804 if (canvas->renumber (new_number))
805 mark_modified ();
806 }
807 else
808 error ("unable to renumber figure");
809 }
810
811 void print (const std::string& cmd, const std::string& term)
812 {
813 canvas->print (cmd, term);
814
815 // Print immediately so the output file will exist when the drawnow
816 // command is done.
817 mark_modified ();
818 Fl::wait (fltk_maxtime);
819 }
820
821 void show_menubar (void)
822 {
823 if (!uimenu->is_visible ())
824 {
825 // FIXME: Toolbar and menubar do not update
826 uimenu->show ();
827 mark_modified ();
828 }
829 }
830
831 void hide_menubar (void)
832 {
833 if (uimenu->is_visible ())
834 {
835 // FIXME: Toolbar and menubar do not update
836 uimenu->hide ();
837 mark_modified ();
838 }
839 }
840
841 void uimenu_update (const graphics_handle& gh, int id)
842 {
843 graphics_object uimenu_obj = gh_manager::get_object (gh);
844
845 if (uimenu_obj.valid_object () && uimenu_obj.isa ("uimenu"))
846 {
847 uimenu::properties& uimenup =
848 dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ());
849 std::string fltk_label = uimenup.get_fltk_label ();
850 graphics_object fig = uimenu_obj.get_ancestor ("figure");
851 figure::properties& figp =
852 dynamic_cast<figure::properties&> (fig.get_properties ());
853
854 switch (id)
855 {
856 case base_properties::ID_BEINGDELETED:
857 uimenu->remove_from_menu (uimenup);
858 break;
859
860 case base_properties::ID_VISIBLE:
861 uimenu->update_visible (uimenup);
862 break;
863
864 case uimenu::properties::ID_ACCELERATOR:
865 uimenu->update_accelerator (uimenup);
866 break;
867
868 case uimenu::properties::ID_CALLBACK:
869 uimenu->update_callback (uimenup);
870 break;
871
872 case uimenu::properties::ID_CHECKED:
873 uimenu->add_to_menu (figp);//rebuilding entire menu
874 break;
875
876 case uimenu::properties::ID_ENABLE:
877 uimenu->update_enable (uimenup);
878 break;
879
880 case uimenu::properties::ID_FOREGROUNDCOLOR:
881 uimenu->update_foregroundcolor (uimenup);
882 break;
883
884 case uimenu::properties::ID_LABEL:
885 uimenu->add_to_menu (figp);//rebuilding entire menu
886 break;
887
888 case uimenu::properties::ID_POSITION:
889 uimenu->add_to_menu (figp);//rebuilding entire menu
890 break;
891
892 case uimenu::properties::ID_SEPARATOR:
893 uimenu->update_seperator (uimenup);
894 break;
895 }
896
897 if (uimenu->items_to_show ())
898 show_menubar ();
899 else
900 hide_menubar ();
901
902 mark_modified ();
903 }
904 }
905
906 void show_canvas (void)
907 {
908 if (fp.is_visible ())
909 {
910 canvas->show ();
911 canvas->make_current ();
912 }
913 }
914
915 void hide_canvas (void)
916 {
917 canvas->hide ();
918 }
919
920 void mark_modified (void)
921 {
922 damage (FL_DAMAGE_ALL);
923 canvas->damage (FL_DAMAGE_ALL);
924 ndim = calc_dimensions (gh_manager::get_object (fp.get___myhandle__ ()));
925
926 if (ndim == 3)
927 rotate->activate ();
928 else if (ndim == 2 && gui_mode == rotate_zoom)
929 {
930 rotate->deactivate ();
931 gui_mode = pan_zoom;
932 }
933 }
934
935 void set_name (void)
936 {
937 window_label = fp.get_title ();
938 label (window_label.c_str ());
939 }
940
941private:
942
943 // No copying!
944
945 plot_window (const plot_window&);
946
947 plot_window& operator = (const plot_window&);
948
949 // window name -- this must exists for the duration of the window's
950 // life
951 std::string window_label;
952
953 // Mod keys status
954 int shift;
955
956 // Number of dimensions, 2 or 3.
957 int ndim;
958
959 // Figure properties.
960 figure::properties& fp;
961
962 // Status area height.
963 static const int status_h = 20;
964
965 // Menu height
966 static const int menu_h = 20;
967
968 // Window callback.
969 static void window_close (Fl_Widget*, void* data)
970 {
971 octave_value_list args;
972 args(0) = static_cast<plot_window*> (data)->number ();
973 feval ("close", args);
974 }
975
976 // Button callbacks.
977 static void button_callback (Fl_Widget* ww, void* data)
978 {
979 static_cast<plot_window*> (data)->button_press (ww, data);
980 }
981
982 void button_press (Fl_Widget* widg, void*)
983 {
984 if (widg == autoscale)
985 axis_auto ();
986
987 if (widg == togglegrid)
988 toggle_grid ();
989
990 if (widg == panzoom)
991 gui_mode = pan_zoom;
992
993 if (widg == rotate && ndim == 3)
994 gui_mode = rotate_zoom;
995
996 if (widg == help)
997 fl_message ("%s", help_text);
998 }
999
1000 fltk_uimenu* uimenu;
1001 OpenGL_fltk* canvas;
1002 Fl_Box* bottom;
1003 Fl_Button* autoscale;
1004 Fl_Button* togglegrid;
1005 Fl_Button* panzoom;
1006 Fl_Button* rotate;
1007 Fl_Button* help;
1008 Fl_Output* status;
1009 graphics_object ax_obj;
1010 int pos_x;
1011 int pos_y;
1012
1013 void axis_auto (void)
1014 {
1015 octave_value_list args;
1016 args(0) = fp.get_currentaxes ().as_octave_value ();
1017 args(1) = "auto";
1018 feval ("axis", args);
1019 mark_modified ();
1020 }
1021
1022 void toggle_grid (void)
1023 {
1024 octave_value_list args;
1025 if (fp.get_currentaxes ().ok ())
1026 args(0) = fp.get_currentaxes ().as_octave_value ();
1027
1028 feval ("grid", args);
1029 mark_modified ();
1030 }
1031
1032 void pixel2pos (const graphics_handle& ax, int px, int py, double& xx,
1033 double& yy) const
1034 {
1035 pixel2pos ( gh_manager::get_object (ax), px, py, xx, yy);
1036 }
1037
1038 void pixel2pos (graphics_object ax, int px, int py, double& xx,
1039 double& yy) const
1040 {
1041 if (ax && ax.isa ("axes"))
11
Calling 'graphics_object::operator _Bool'
12
Returning from 'graphics_object::operator _Bool'
13
Taking false branch
1042 {
1043 axes::properties& ap =
1044 dynamic_cast<axes::properties&> (ax.get_properties ());
1045 ColumnVector pp = ap.pixel2coord (px, py);
1046 xx = pp(0);
1047 yy = pp(1);
1048 }
1049 }
1050
1051 graphics_handle pixel2axes_or_ca (int px, int py )
1052 {
1053 Matrix kids = fp.get_children ();
1054 int len = kids.length ();
1055
1056 for (int k = 0; k < len; k++)
1057 {
1058 graphics_handle hnd = gh_manager::lookup (kids(k));
1059
1060 if (hnd.ok ())
1061 {
1062 graphics_object kid = gh_manager::get_object (hnd);
1063
1064 if (kid.valid_object () && kid.isa ("axes"))
1065 {
1066 Matrix bb = kid.get_properties ().get_boundingbox (true);
1067
1068 if (bb(0) <= px && px < (bb(0)+bb(2))
1069 && bb(1) <= py && py < (bb(1)+bb(3)))
1070 {
1071 return hnd;
1072 }
1073 }
1074 }
1075 }
1076 return fp.get_currentaxes ();
1077 }
1078
1079 void pixel2status (const graphics_handle& ax, int px0, int py0,
1080 int px1 = -1, int py1 = -1)
1081 {
1082 pixel2status (gh_manager::get_object (ax), px0, py0, px1, py1);
1083 }
1084
1085 void pixel2status (graphics_object ax, int px0, int py0,
1086 int px1 = -1, int py1 = -1)
1087 {
1088 double x0, y0, x1, y1;
1089 std::stringstream cbuf;
1090 cbuf.precision (4);
1091 cbuf.width (6);
1092 pixel2pos (ax, px0, py0, x0, y0);
1093 cbuf << "[" << x0 << ", " << y0 << "]";
1094 if (px1 >= 0)
1095 {
1096 pixel2pos (ax, px1, py1, x1, y1);
1097 cbuf << " -> ["<< x1 << ", " << y1 << "]";
1098 }
1099
1100 status->value (cbuf.str ().c_str ());
1101 status->redraw ();
1102 }
1103
1104 void view2status (graphics_object ax)
1105 {
1106 if (ax && ax.isa ("axes"))
1107 {
1108 axes::properties& ap =
1109 dynamic_cast<axes::properties&> (ax.get_properties ());
1110 std::stringstream cbuf;
1111 cbuf.precision (4);
1112 cbuf.width (6);
1113 Matrix v (1,2,0);
1114 v = ap.get ("view").matrix_value ();
1115 cbuf << "[azimuth: " << v(0) << ", elevation: " << v(1) << "]";
1116
1117 status->value (cbuf.str ().c_str ());
1118 status->redraw ();
1119 }
1120 }
1121
1122 void set_currentpoint (int px, int py)
1123 {
1124 if (!fp.is_beingdeleted ())
1125 {
1126 Matrix pos (1,2,0);
1127 pos(0) = px;
1128 pos(1) = h () - (py + status_h + menu_dy ());
1129 fp.set_currentpoint (pos);
1130 graphics_object robj = gh_manager::get_object (fp.get_parent ());
1131 root_figure::properties& rp =
1132 dynamic_cast<root_figure::properties&> (robj.get_properties ());
1133 rp.set_currentfigure (fp.get___myhandle__ ().value ());
1134 }
1135 }
1136
1137 void set_axes_currentpoint (graphics_object ax, int px, int py)
1138 {
1139 if (ax.valid_object ())
1140 {
1141 axes::properties& ap =
1142 dynamic_cast<axes::properties&> (ax.get_properties ());
1143
1144 double xx, yy;
1145 pixel2pos (ax, px, py, xx, yy);
1146
1147 Matrix pos (2,3,0);
1148 pos(0,0) = xx;
1149 pos(1,0) = yy;
1150 pos(0,1) = xx;
1151 pos(1,1) = yy;
1152
1153 ap.set_currentpoint (pos);
1154 fp.set_currentaxes (ap.get___myhandle__ ().value ());
1155 }
1156 }
1157
1158 int menu_dy ()
1159 {
1160 if (uimenu->is_visible ())
1161 return menu_h;
1162 else
1163 return 0;
1164 }
1165
1166 int key2shift (int key)
1167 {
1168 if (key == FL_Shift_L0xffe1 || key == FL_Shift_R0xffe2)
1169 return FL_SHIFT0x00010000;
1170
1171 if (key == FL_Control_L0xffe3 || key == FL_Control_R0xffe4)
1172 return FL_CTRL0x00040000;
1173
1174 if (key == FL_Alt_L0xffe9 || key == FL_Alt_R0xffea)
1175 return FL_ALT0x00080000;
1176
1177 if (key == FL_Meta_L0xffe7 || key == FL_Meta_R0xffe8)
1178 return FL_META0x00400000;
1179
1180 return 0;
1181 }
1182
1183 int key2ascii (int key)
1184 {
1185 if (key < 256) return key;
1186 if (key == FL_Tab0xff09) return '\t';
1187 if (key == FL_Enter0xff0d) return 0x0a;
1188 if (key == FL_BackSpace0xff08) return 0x08;
1189 if (key == FL_Escape0xff1b) return 0x1b;
1190
1191 return 0;
1192 }
1193
1194 Cell modifier2cell ()
1195 {
1196 string_vector mod;
1197
1198 if (shift & FL_SHIFT0x00010000)
1199 mod.append (std::string ("shift"));
1200 if (shift & FL_CTRL0x00040000)
1201 mod.append (std::string ("control"));
1202 if (shift & FL_ALT0x00080000 || shift & FL_META0x00400000)
1203 mod.append (std::string ("alt"));
1204
1205 return Cell (mod);
1206 }
1207
1208 void resize (int xx,int yy,int ww,int hh)
1209 {
1210 Fl_Window::resize (xx, yy, ww, hh);
1211
1212 Matrix pos (1,4,0);
1213 pos(0) = xx;
1214 pos(1) = yy + menu_dy ();
1215 pos(2) = ww;
1216 pos(3) = hh - menu_dy () - status_h;
1217
1218 fp.set_boundingbox (pos, true);
1219 }
1220
1221 void draw (void)
1222 {
1223 // FIXME: Toolbar and menubar do not update properly
1224 Matrix pos = fp.get_boundingbox (true);
1225 int canvas_h = pos(3);
1226 int canvas_w = pos(2);
1227 int canvas_y = menu_dy ();
1228 int toolbar_y = menu_dy () + canvas_h;
1229 pos(1) = pos(1) - menu_dy ();
1230 pos(3) = pos(3) + menu_dy () + status_h;
1231
1232 Fl_Window::resize (pos(0), pos(1), pos(2), pos(3));
1233
1234 bottom->resize (0, toolbar_y, status_h, status_h);
1235 autoscale->resize (0, toolbar_y, status_h, status_h);
1236 togglegrid->resize (status_h, toolbar_y, status_h, status_h);
1237 panzoom->resize (2 * status_h, toolbar_y, status_h, status_h);
1238 rotate->resize (3 * status_h, toolbar_y, status_h, status_h);
1239 help->resize (4 * status_h, toolbar_y, status_h, status_h);
1240 status->resize (5 * status_h, toolbar_y, pos(2) - 4 * status_h, status_h);
1241 if (canvas->valid ())
1242 canvas->resize (0, canvas_y, canvas_w, canvas_h);
1243
1244 return Fl_Window::draw ();
1245 }
1246
1247 int handle (int event)
1248 {
1249 graphics_handle gh;
1250
1251 graphics_object fig = gh_manager::get_object (fp.get___myhandle__ ());
1252 int retval = Fl_Window::handle (event);
1253
1254 // We only handle events which are in the canvas area.
1255 if (!Fl::event_inside (canvas))
1
Taking false branch
1256 return retval;
1257
1258 if (!fp.is_beingdeleted ())
2
Taking true branch
1259 {
1260 switch (event)
3
Control jumps to 'case FL_RELEASE:' at line 1433
1261 {
1262 case FL_KEYDOWN:
1263 {
1264 int key = Fl::event_key ();
1265
1266 shift |= key2shift (key);
1267 int key_a = key2ascii (key);
1268 if (key_a && fp.get_keypressfcn ().is_defined ())
1269 {
1270 octave_scalar_map evt;
1271 evt.assign ("Character", octave_value (key_a));
1272 evt.assign ("Key", octave_value (std::tolower (key_a)));
1273 evt.assign ("Modifier", octave_value (modifier2cell ()));
1274 fp.execute_keypressfcn (evt);
1275 }
1276 switch (key)
1277 {
1278 case 'a':
1279 case 'A':
1280 axis_auto ();
1281 break;
1282
1283 case 'g':
1284 case 'G':
1285 toggle_grid ();
1286 break;
1287
1288 case 'p':
1289 case 'P':
1290 gui_mode = pan_zoom;
1291 break;
1292
1293 case 'r':
1294 case 'R':
1295 gui_mode = rotate_zoom;
1296 break;
1297 }
1298 }
1299 break;
1300
1301 case FL_KEYUP:
1302 {
1303 int key = Fl::event_key ();
1304
1305 shift &= (~key2shift (key));
1306 int key_a = key2ascii (key);
1307 if (key_a && fp.get_keyreleasefcn ().is_defined ())
1308 {
1309 octave_scalar_map evt;
1310 evt.assign ("Character", octave_value (key_a));
1311 evt.assign ("Key", octave_value (std::tolower (key_a)));
1312 evt.assign ("Modifier", octave_value (modifier2cell ()));
1313 fp.execute_keyreleasefcn (evt);
1314 }
1315 }
1316 break;
1317
1318 case FL_MOVE:
1319 pixel2status (pixel2axes_or_ca (Fl::event_x (),
1320 Fl::event_y () - menu_dy ()),
1321 Fl::event_x (), Fl::event_y () - menu_dy ());
1322 break;
1323
1324 case FL_PUSH:
1325 pos_x = Fl::event_x ();
1326 pos_y = Fl::event_y () - menu_dy ();
1327
1328 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
1329
1330 gh = pixel2axes_or_ca (pos_x, pos_y);
1331
1332 if (gh.ok ())
1333 {
1334 ax_obj = gh_manager::get_object (gh);
1335 set_axes_currentpoint (ax_obj, pos_x, pos_y);
1336 }
1337
1338 fp.execute_windowbuttondownfcn (Fl::event_button());
1339
1340 if (Fl::event_button () == 1 || Fl::event_button () == 3)
1341 return 1;
1342
1343 break;
1344
1345 case FL_DRAG:
1346 if (fp.get_windowbuttonmotionfcn ().is_defined ())
1347 {
1348 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
1349 fp.execute_windowbuttonmotionfcn ();
1350 }
1351
1352 if (Fl::event_button () == 1)
1353 {
1354 if (ax_obj && ax_obj.isa ("axes"))
1355 {
1356 if (gui_mode == pan_zoom)
1357 pixel2status (ax_obj, pos_x, pos_y,
1358 Fl::event_x (),
1359 Fl::event_y () - menu_dy ());
1360 else
1361 view2status (ax_obj);
1362 axes::properties& ap =
1363 dynamic_cast<axes::properties&>
1364 (ax_obj.get_properties ());
1365
1366 double x0, y0, x1, y1;
1367 Matrix pos = fp.get_boundingbox (true);
1368 pixel2pos (ax_obj, pos_x, pos_y, x0, y0);
1369 pixel2pos (ax_obj, Fl::event_x (),
1370 Fl::event_y () - menu_dy (),
1371 x1, y1);
1372
1373 if (gui_mode == pan_zoom)
1374 ap.translate_view (x0, x1, y0, y1);
1375 else if (gui_mode == rotate_zoom)
1376 {
1377 double daz, del;
1378 daz = (Fl::event_x () - pos_x) / pos(2) * 360;
1379 del = (Fl::event_y () - menu_dy () - pos_y)
1380 / pos(3) * 360;
1381 ap.rotate_view (del, daz);
1382 }
1383
1384 pos_x = Fl::event_x ();
1385 pos_y = Fl::event_y () - menu_dy ();
1386 mark_modified ();
1387 }
1388 return 1;
1389 }
1390 else if (Fl::event_button () == 3)
1391 {
1392 pixel2status (ax_obj, pos_x, pos_y,
1393 Fl::event_x (), Fl::event_y () - menu_dy ());
1394 Matrix zoom_box (1,4,0);
1395 zoom_box (0) = pos_x;
1396 zoom_box (1) = pos_y;
1397 zoom_box (2) = Fl::event_x ();
1398 zoom_box (3) = Fl::event_y () - menu_dy ();
1399 canvas->set_zoom_box (zoom_box);
1400 canvas->zoom (true);
1401 canvas->redraw ();
1402 }
1403
1404 break;
1405
1406 case FL_MOUSEWHEEL:
1407 {
1408 graphics_object ax =
1409 gh_manager::get_object (pixel2axes_or_ca (Fl::event_x (),
1410 Fl::event_y ()
1411 - menu_dy ()));
1412 if (ax && ax.isa ("axes"))
1413 {
1414 axes::properties& ap =
1415 dynamic_cast<axes::properties&> (ax.get_properties ());
1416
1417 // Determine if we're zooming in or out.
1418 const double factor =
1419 (Fl::event_dy () > 0) ? 1 / (1.0 - Vwheel_zoom_speed)
1420 : 1.0 - Vwheel_zoom_speed;
1421
1422 // Get the point we're zooming about.
1423 double x1, y1;
1424 pixel2pos (ax, Fl::event_x (), Fl::event_y () - menu_dy (),
1425 x1, y1);
1426
1427 ap.zoom_about_point (x1, y1, factor, false);
1428 mark_modified ();
1429 }
1430 }
1431 return 1;
1432
1433 case FL_RELEASE:
1434 if (fp.get_windowbuttonupfcn ().is_defined ())
4
Taking false branch
1435 {
1436 set_currentpoint (Fl::event_x (), Fl::event_y () - menu_dy ());
1437 fp.execute_windowbuttonupfcn ();
1438 }
1439
1440 if (Fl::event_button () == 1)
5
Taking false branch
1441 {
1442 if ( Fl::event_clicks () == 1)
1443 {
1444 if (ax_obj && ax_obj.isa ("axes"))
1445 {
1446 axes::properties& ap = dynamic_cast<axes::properties&>
1447 (ax_obj.get_properties ());
1448 ap.set_xlimmode ("auto");
1449 ap.set_ylimmode ("auto");
1450 ap.set_zlimmode ("auto");
1451 mark_modified ();
1452 }
1453 }
1454 }
1455 if (Fl::event_button () == 3)
6
Taking true branch
1456 {
1457 // End of drag -- zoom.
1458 if (canvas->zoom ())
7
Taking true branch
1459 {
1460 canvas->zoom (false);
1461 double x0,y0,x1,y1;
8
'x1' declared without an initial value
1462 if (ax_obj && ax_obj.isa ("axes"))
9
Taking true branch
1463 {
1464 axes::properties& ap = dynamic_cast<axes::properties&>
1465 (ax_obj.get_properties ());
1466 pixel2pos (ax_obj, pos_x, pos_y, x0, y0);
1467 int pos_x1 = Fl::event_x ();
1468 int pos_y1 = Fl::event_y () - menu_dy ();
1469 pixel2pos (ax_obj, pos_x1, pos_y1, x1, y1);
10
Calling 'plot_window::pixel2pos'
14
Returning from 'plot_window::pixel2pos'
1470 Matrix xl (1,2,0);
1471 Matrix yl (1,2,0);
1472 int dx = abs (pos_x - pos_x1);
1473 int dy = abs (pos_y - pos_y1);
1474 // Smallest zoom box must be 4 pixels square
1475 if ((dx > 4) && (dy > 4))
15
Assuming 'dx' is > 4
16
Assuming 'dy' is > 4
17
Taking true branch
1476 {
1477 if (x0 < x1)
18
The right operand of '<' is a garbage value
1478 {
1479 xl(0) = x0;
1480 xl(1) = x1;
1481 }
1482 else
1483 {
1484 xl(0) = x1;
1485 xl(1) = x0;
1486 }
1487 if (y0 < y1)
1488 {
1489 yl(0) = y0;
1490 yl(1) = y1;
1491 }
1492 else
1493 {
1494 yl(0) = y1;
1495 yl(1) = y0;
1496 }
1497 ap.zoom (xl, yl);
1498 }
1499 mark_modified ();
1500 }
1501 }
1502 }
1503 break;
1504 }
1505 }
1506
1507 return retval;
1508 }
1509};
1510
1511class figure_manager
1512{
1513public:
1514
1515 static bool instance_ok (void)
1516 {
1517 bool retval = true;
1518
1519 if (! instance)
1520 instance = new figure_manager ();
1521
1522 if (! instance)
1523 {
1524 ::error ("unable to create figure_manager object!");
1525
1526 retval = false;
1527 }
1528
1529 return retval;
1530 }
1531
1532 ~figure_manager (void)
1533 {
1534 close_all ();
1535 }
1536
1537 static void close_all (void)
1538 {
1539 if (instance_ok ())
1540 instance->do_close_all ();
1541 }
1542
1543 static void new_window (figure::properties& fp)
1544 {
1545 if (instance_ok ())
1546 instance->do_new_window (fp);
1547 }
1548
1549 static void delete_window (int idx)
1550 {
1551 if (instance_ok ())
1552 instance->do_delete_window (idx);
1553 }
1554
1555 static void delete_window (const std::string& idx_str)
1556 {
1557 delete_window (str2idx (idx_str));
1558 }
1559
1560 static void renumber_figure (const std::string& idx_str, double new_number)
1561 {
1562 if (instance_ok ())
1563 instance->do_renumber_figure (str2idx (idx_str), new_number);
1564 }
1565
1566 static void toggle_window_visibility (int idx, bool is_visible)
1567 {
1568 if (instance_ok ())
1569 instance->do_toggle_window_visibility (idx, is_visible);
1570 }
1571
1572 static void toggle_window_visibility (const std::string& idx_str,
1573 bool is_visible)
1574 {
1575 toggle_window_visibility (str2idx (idx_str), is_visible);
1576 }
1577
1578 static void mark_modified (int idx)
1579 {
1580 if (instance_ok ())
1581 instance->do_mark_modified (idx);
1582 }
1583
1584 static void mark_modified (const graphics_handle& gh)
1585 {
1586 mark_modified (hnd2idx (gh));
1587 }
1588
1589 static void set_name (int idx)
1590 {
1591 if (instance_ok ())
1592 instance->do_set_name (idx);
1593 }
1594
1595 static void set_name (const std::string& idx_str)
1596 {
1597 set_name (str2idx (idx_str));
1598 }
1599
1600 static Matrix get_size (int idx)
1601 {
1602 return instance_ok () ? instance->do_get_size (idx) : Matrix ();
1603 }
1604
1605 static Matrix get_size (const graphics_handle& gh)
1606 {
1607 return get_size (hnd2idx (gh));
1608 }
1609
1610 static void print (const graphics_handle& gh, const std::string& cmd,
1611 const std::string& term)
1612 {
1613 if (instance_ok ())
1614 instance->do_print (hnd2idx (gh), cmd, term);
1615 }
1616
1617 static void uimenu_update (const graphics_handle& figh,
1618 const graphics_handle& uimenuh, int id)
1619 {
1620 if (instance_ok ())
1621 instance->do_uimenu_update (hnd2idx (figh), uimenuh, id);
1622 }
1623
1624 static void update_canvas (const graphics_handle& gh,
1625 const graphics_handle& ca)
1626 {
1627 if (instance_ok ())
1628 instance->do_update_canvas (hnd2idx (gh), ca);
1629 }
1630
1631 static void toggle_menubar_visibility (int fig_idx, bool menubar_is_figure)
1632 {
1633 if (instance_ok ())
1634 instance->do_toggle_menubar_visibility (fig_idx, menubar_is_figure);
1635 }
1636
1637 static void toggle_menubar_visibility (const std::string& fig_idx_str,
1638 bool menubar_is_figure)
1639 {
1640 toggle_menubar_visibility (str2idx (fig_idx_str), menubar_is_figure);
1641 }
1642
1643private:
1644
1645 static figure_manager *instance;
1646
1647 figure_manager (void) { }
1648
1649 // No copying!
1650 figure_manager (const figure_manager&);
1651 figure_manager& operator = (const figure_manager&);
1652
1653 // Singelton -- hide all of the above.
1654
1655 static int curr_index;
1656 typedef std::map<int, plot_window*> window_map;
1657 typedef window_map::iterator wm_iterator;;
1658 window_map windows;
1659
1660 static std::string fltk_idx_header;
1661
1662 void do_close_all (void)
1663 {
1664 wm_iterator win;
1665 for (win = windows.begin (); win != windows.end (); win++)
1666 delete win->second;
1667 windows.clear ();
1668 }
1669
1670 void do_new_window (figure::properties& fp)
1671 {
1672 int idx = figprops2idx (fp);
1673
1674 if (idx >= 0 && windows.find (idx) == windows.end ())
1675 {
1676 Matrix pos = fp.get_boundingbox (true);
1677
1678 int x = pos(0);
1679 int y = pos(1);
1680 int w = pos(2);
1681 int h = pos(3);
1682
1683 idx2figprops (curr_index, fp);
1684
1685 windows[curr_index++] = new plot_window (x, y, w, h, fp);
1686 }
1687 }
1688
1689 void do_delete_window (int idx)
1690 {
1691 wm_iterator win = windows.find (idx);
1692
1693 if (win != windows.end ())
1694 {
1695 delete win->second;
1696 windows.erase (win);
1697 }
1698 }
1699
1700 void do_renumber_figure (int idx, double new_number)
1701 {
1702 wm_iterator win = windows.find (idx);
1703
1704 if (win != windows.end ())
1705 win->second->renumber (new_number);
1706 }
1707
1708 void do_toggle_window_visibility (int idx, bool is_visible)
1709 {
1710 wm_iterator win = windows.find (idx);
1711
1712 if (win != windows.end ())
1713 {
1714 if (is_visible)
1715 win->second->show ();
1716 else
1717 win->second->hide ();
1718
1719 win->second->redraw ();
1720 }
1721 }
1722
1723 void do_toggle_menubar_visibility (int fig_idx, bool menubar_is_figure)
1724 {
1725 wm_iterator win = windows.find (fig_idx);
1726
1727 if (win != windows.end ())
1728 {
1729 if (menubar_is_figure)
1730 win->second->show_menubar ();
1731 else
1732 win->second->hide_menubar ();
1733
1734 win->second->redraw ();
1735 }
1736 }
1737
1738 void do_mark_modified (int idx)
1739 {
1740 wm_iterator win = windows.find (idx);
1741
1742 if (win != windows.end ())
1743 win->second->mark_modified ();
1744 }
1745
1746 void do_set_name (int idx)
1747 {
1748 wm_iterator win = windows.find (idx);
1749
1750 if (win != windows.end ())
1751 win->second->set_name ();
1752 }
1753
1754 Matrix do_get_size (int idx)
1755 {
1756 Matrix sz (1, 2, 0.0);
1757
1758 wm_iterator win = windows.find (idx);
1759
1760 if (win != windows.end ())
1761 {
1762 sz(0) = win->second->w ();
1763 sz(1) = win->second->h ();
1764 }
1765
1766 return sz;
1767 }
1768
1769 void do_print (int idx, const std::string& cmd, const std::string& term)
1770 {
1771 wm_iterator win = windows.find (idx);
1772
1773 if (win != windows.end ())
1774 win->second->print (cmd, term);
1775 }
1776
1777 void do_uimenu_update (int idx, const graphics_handle& gh, int id)
1778 {
1779 wm_iterator win = windows.find (idx);
1780
1781 if (win != windows.end ())
1782 win->second->uimenu_update (gh, id);
1783 }
1784
1785 void do_update_canvas (int idx, const graphics_handle& ca)
1786 {
1787 wm_iterator win = windows.find (idx);
1788
1789 if (win != windows.end ())
1790 {
1791 if (ca.ok ())
1792 win->second->show_canvas ();
1793 else
1794 win->second->hide_canvas ();
1795 }
1796 }
1797
1798 static int str2idx (const caseless_str& clstr)
1799 {
1800 int ind;
1801 if (clstr.find (fltk_idx_header,0) == 0)
1802 {
1803 std::istringstream istr (clstr.substr (fltk_idx_header.size ()));
1804 if (istr >> ind)
1805 return ind;
1806 }
1807 error ("figure_manager: could not recognize fltk index");
1808 return -1;
1809 }
1810
1811 void idx2figprops (int idx, figure::properties& fp)
1812 {
1813 std::ostringstream ind_str;
1814 ind_str << fltk_idx_header << idx;
1815 fp.set___plot_stream__ (ind_str.str ());
1816 }
1817
1818 static int figprops2idx (const figure::properties& fp)
1819 {
1820 if (fp.get___graphics_toolkit__ () == FLTK_GRAPHICS_TOOLKIT_NAME"fltk")
1821 {
1822 octave_value ps = fp.get___plot_stream__ ();
1823 if (ps.is_string ())
1824 return str2idx (ps.string_value ());
1825 else
1826 return 0;
1827 }
1828 error ("figure_manager: figure is not fltk");
1829 return -1;
1830 }
1831
1832 static int hnd2idx (double h)
1833 {
1834 graphics_object fobj = gh_manager::get_object (h);
1835 if (fobj && fobj.isa ("figure"))
1836 {
1837 figure::properties& fp =
1838 dynamic_cast<figure::properties&> (fobj.get_properties ());
1839 return figprops2idx (fp);
1840 }
1841 error ("figure_manager: H (= %g) is not a figure", h);
1842 return -1;
1843 }
1844
1845 static int hnd2idx (const graphics_handle& fh)
1846 {
1847 return hnd2idx (fh.value ());
1848 }
1849};
1850
1851figure_manager *figure_manager::instance = 0;
1852
1853std::string figure_manager::fltk_idx_header="fltk index=";
1854int figure_manager::curr_index = 1;
1855
1856static bool toolkit_loaded = false;
1857
1858static int
1859__fltk_redraw__ (void)
1860{
1861 if (toolkit_loaded)
1862 {
1863 // We scan all figures and add those which use FLTK.
1864 graphics_object obj = gh_manager::get_object (0);
1865 if (obj && obj.isa ("root"))
1866 {
1867 base_properties& props = obj.get_properties ();
1868 Matrix children = props.get_all_children ();
1869
1870 for (octave_idx_type n = 0; n < children.numel (); n++)
1871 {
1872 graphics_object fobj = gh_manager::get_object (children (n));
1873 if (fobj && fobj.isa ("figure"))
1874 {
1875 figure::properties& fp =
1876 dynamic_cast<figure::properties&> (fobj.get_properties ());
1877 if (fp.get___graphics_toolkit__ ()
1878 == FLTK_GRAPHICS_TOOLKIT_NAME"fltk")
1879 figure_manager::new_window (fp);
1880 }
1881 }
1882 }
1883
1884 // it seems that we have to call Fl::check twice to get everything drawn
1885 Fl::check ();
1886 Fl::check ();
1887 }
1888
1889 return 0;
1890}
1891
1892class fltk_graphics_toolkit : public base_graphics_toolkit
1893{
1894public:
1895 fltk_graphics_toolkit (void)
1896 : base_graphics_toolkit (FLTK_GRAPHICS_TOOLKIT_NAME"fltk"),
1897 input_event_hook_fcn_id ()
1898 { }
1899
1900 ~fltk_graphics_toolkit (void) { }
1901
1902 bool is_valid (void) const { return true; }
1903
1904 bool initialize (const graphics_object& go)
1905 {
1906 if (go.isa ("figure")
1907 || go.isa ("uimenu"))
1908 {
1909 if (go.isa ("uimenu"))
1910 update (go, uimenu::properties::ID_LABEL);
1911
1912 return true;
1913 }
1914
1915 return false;
1916 }
1917
1918 void finalize (const graphics_object& go)
1919 {
1920 if (go.isa ("figure"))
1921 {
1922 octave_value ov = go.get (caseless_str ("__plot_stream__"));
1923
1924 if (! ov.is_empty ())
1925 figure_manager::delete_window (ov.string_value ());
1926 }
1927 }
1928
1929 void uimenu_set_fltk_label (graphics_object uimenu_obj)
1930 {
1931 if (uimenu_obj.valid_object ())
1932 {
1933 uimenu::properties& uimenup =
1934 dynamic_cast<uimenu::properties&> (uimenu_obj.get_properties ());
1935 std::string fltk_label = uimenup.get_label ();
1936 graphics_object go = gh_manager::get_object (uimenu_obj.get_parent ());
1937 if (go.isa ("uimenu"))
1938 fltk_label = dynamic_cast<const uimenu::properties&>
1939 (go.get_properties ()).get_fltk_label ()
1940 + "/"
1941 + fltk_label;
1942 else if (go.isa ("figure"))
1943 ;
1944 else
1945 error ("unexpected parent object\n");
1946
1947 uimenup.set_fltk_label (fltk_label);
1948 }
1949 }
1950
1951 void update (const graphics_object& go, int id)
1952 {
1953 if (go.isa ("figure"))
1954 {
1955 octave_value ov = go.get (caseless_str ("__plot_stream__"));
1956
1957 if (! ov.is_empty ())
1958 {
1959 const figure::properties& fp =
1960 dynamic_cast<const figure::properties&> (go.get_properties ());
1961
1962 switch (id)
1963 {
1964 case base_properties::ID_VISIBLE:
1965 figure_manager::toggle_window_visibility (ov.string_value (),
1966 fp.is_visible ());
1967 break;
1968
1969 case figure::properties::ID_MENUBAR:
1970 figure_manager::toggle_menubar_visibility
1971 (ov.string_value (), fp.menubar_is ("figure"));
1972 break;
1973
1974 case figure::properties::ID_CURRENTAXES:
1975 figure_manager::update_canvas (go.get_handle (),
1976 fp.get_currentaxes ());
1977 break;
1978
1979 case figure::properties::ID_NAME:
1980 case figure::properties::ID_NUMBERTITLE:
1981 figure_manager::set_name (ov.string_value ());
1982 break;
1983
1984 case figure::properties::ID_INTEGERHANDLE:
1985 {
1986 std::string tmp = ov.string_value ();
1987 graphics_handle gh = fp.get___myhandle__ ();
1988 figure_manager::renumber_figure (tmp, gh.value ());
1989 figure_manager::set_name (tmp);
1990 }
1991 break;
1992 }
1993 }
1994 }
1995 else if (go.isa ("uimenu"))
1996 {
1997 if (id == uimenu::properties::ID_LABEL)
1998 uimenu_set_fltk_label (go);
1999
2000 graphics_object fig = go.get_ancestor ("figure");
2001 figure_manager::uimenu_update (fig.get_handle (), go.get_handle (), id);
2002 }
2003 }
2004
2005 void redraw_figure (const graphics_object& go) const
2006 {
2007 figure_manager::mark_modified (go.get_handle ());
2008
2009 __fltk_redraw__ ();
2010 }
2011
2012 void print_figure (const graphics_object& go,
2013 const std::string& term,
2014 const std::string& file_cmd, bool /*mono*/,
2015 const std::string& /*debug_file*/) const
2016 {
2017 figure_manager::print (go.get_handle (), file_cmd, term);
2018 redraw_figure (go);
2019 }
2020
2021 Matrix get_canvas_size (const graphics_handle& fh) const
2022 {
2023 return figure_manager::get_size (fh);
2024 }
2025
2026 double get_screen_resolution (void) const
2027 {
2028 // FLTK doesn't give this info.
2029 return 72.0;
2030 }
2031
2032 Matrix get_screen_size (void) const
2033 {
2034 Matrix sz (1, 2, 0.0);
2035 sz(0) = Fl::w ();
2036 sz(1) = Fl::h ();
2037 return sz;
2038 }
2039
2040 void close (void)
2041 {
2042 if (toolkit_loaded)
2043 {
2044 munlock ("__init_fltk__");
2045
2046 figure_manager::close_all ();
2047
2048 octave_value_list args = input_event_hook_fcn_id;
2049 args.append (false);
2050 Fremove_input_event_hook (args, 0);
2051
2052 input_event_hook_fcn_id = octave_value_list ();
2053
2054 // FIXME: ???
2055 Fl::wait (fltk_maxtime);
2056 }
2057 }
2058
2059 void set_input_event_hook_id (const octave_value_list& id)
2060 {
2061 input_event_hook_fcn_id = id;
2062 }
2063
2064private:
2065 octave_value_list input_event_hook_fcn_id;
2066};
2067
2068#endif
2069
2070DEFUN_DLD (__fltk_redraw__, , ,octave_value_list F__fltk_redraw__ (const octave_value_list&
, int ); extern "C" octave_function * G__fltk_redraw__ (const
octave_shlib& shl, bool relative) { octave_function *retval
= 0; check_version ("api-v48+", "__fltk_redraw__"); if (! error_state
) { octave_dld_function *fcn = octave_dld_function::create (F__fltk_redraw__
, shl, "__fltk_redraw__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __fltk_redraw__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_redraw__ (const octave_value_list
& , int )
2071 "-*- texinfo -*-\n\octave_value_list F__fltk_redraw__ (const octave_value_list&
, int ); extern "C" octave_function * G__fltk_redraw__ (const
octave_shlib& shl, bool relative) { octave_function *retval
= 0; check_version ("api-v48+", "__fltk_redraw__"); if (! error_state
) { octave_dld_function *fcn = octave_dld_function::create (F__fltk_redraw__
, shl, "__fltk_redraw__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __fltk_redraw__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_redraw__ (const octave_value_list
& , int )
2072@deftypefn {Loadable Function} {} __fltk_redraw__ ()\n\octave_value_list F__fltk_redraw__ (const octave_value_list&
, int ); extern "C" octave_function * G__fltk_redraw__ (const
octave_shlib& shl, bool relative) { octave_function *retval
= 0; check_version ("api-v48+", "__fltk_redraw__"); if (! error_state
) { octave_dld_function *fcn = octave_dld_function::create (F__fltk_redraw__
, shl, "__fltk_redraw__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __fltk_redraw__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_redraw__ (const octave_value_list
& , int )
2073Undocumented internal function.\n\octave_value_list F__fltk_redraw__ (const octave_value_list&
, int ); extern "C" octave_function * G__fltk_redraw__ (const
octave_shlib& shl, bool relative) { octave_function *retval
= 0; check_version ("api-v48+", "__fltk_redraw__"); if (! error_state
) { octave_dld_function *fcn = octave_dld_function::create (F__fltk_redraw__
, shl, "__fltk_redraw__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __fltk_redraw__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_redraw__ (const octave_value_list
& , int )
2074@end deftypefn")octave_value_list F__fltk_redraw__ (const octave_value_list&
, int ); extern "C" octave_function * G__fltk_redraw__ (const
octave_shlib& shl, bool relative) { octave_function *retval
= 0; check_version ("api-v48+", "__fltk_redraw__"); if (! error_state
) { octave_dld_function *fcn = octave_dld_function::create (F__fltk_redraw__
, shl, "__fltk_redraw__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __fltk_redraw__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_redraw__ (const octave_value_list
& , int )
2075{
2076#ifdef HAVE_FLTK1
2077 __fltk_redraw__ ();
2078#else
2079 error ("__fltk_redraw__: not available without OpenGL and FLTK libraries");
2080#endif
2081
2082 return octave_value ();
2083}
2084
2085// Initialize the fltk graphics toolkit.
2086
2087DEFUN_DLD (__init_fltk__, , ,octave_value_list F__init_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__init_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__init_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__init_fltk__, shl, "__init_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __init_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__init_fltk__ (const octave_value_list
& , int )
2088 "-*- texinfo -*-\n\octave_value_list F__init_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__init_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__init_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__init_fltk__, shl, "__init_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __init_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__init_fltk__ (const octave_value_list
& , int )
2089@deftypefn {Loadable Function} {} __init_fltk__ ()\n\octave_value_list F__init_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__init_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__init_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__init_fltk__, shl, "__init_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __init_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__init_fltk__ (const octave_value_list
& , int )
2090Undocumented internal function.\n\octave_value_list F__init_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__init_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__init_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__init_fltk__, shl, "__init_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __init_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__init_fltk__ (const octave_value_list
& , int )
2091@end deftypefn")octave_value_list F__init_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__init_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__init_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__init_fltk__, shl, "__init_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {} __init_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__init_fltk__ (const octave_value_list
& , int )
2092{
2093#ifdef HAVE_FLTK1
2094 if (! display_info::display_available ())
2095 error ("__init_fltk__: no graphics DISPLAY available");
2096 else if (! toolkit_loaded)
2097 {
2098 mlock ();
2099
2100 fltk_graphics_toolkit *fltk = new fltk_graphics_toolkit ();
2101 graphics_toolkit tk (fltk);
2102 gtk_manager::load_toolkit (tk);
2103 toolkit_loaded = true;
2104
2105 octave_value fcn (new octave_builtin (F__fltk_redraw__));
2106 octave_value fcn_handle (new octave_fcn_handle (fcn, "@__fltk_redraw__"));
2107 octave_value_list id = Fadd_input_event_hook (fcn_handle, 1);
2108
2109 fltk->set_input_event_hook_id (id);
2110 }
2111#else
2112 error ("__init_fltk__: not available without OpenGL and FLTK libraries");
2113#endif
2114
2115 return octave_value ();
2116}
2117
2118DEFUN_DLD (__fltk_maxtime__, args, ,octave_value_list F__fltk_maxtime__ (const octave_value_list&
args, int ); extern "C" octave_function * G__fltk_maxtime__ (
const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "__fltk_maxtime__");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (F__fltk_maxtime__, shl, "__fltk_maxtime__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_maxtime__ (const octave_value_list
& args, int )
2119 "-*- texinfo -*-\n\octave_value_list F__fltk_maxtime__ (const octave_value_list&
args, int ); extern "C" octave_function * G__fltk_maxtime__ (
const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "__fltk_maxtime__");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (F__fltk_maxtime__, shl, "__fltk_maxtime__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_maxtime__ (const octave_value_list
& args, int )
2120@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n\octave_value_list F__fltk_maxtime__ (const octave_value_list&
args, int ); extern "C" octave_function * G__fltk_maxtime__ (
const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "__fltk_maxtime__");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (F__fltk_maxtime__, shl, "__fltk_maxtime__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_maxtime__ (const octave_value_list
& args, int )
2121@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\n\octave_value_list F__fltk_maxtime__ (const octave_value_list&
args, int ); extern "C" octave_function * G__fltk_maxtime__ (
const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "__fltk_maxtime__");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (F__fltk_maxtime__, shl, "__fltk_maxtime__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_maxtime__ (const octave_value_list
& args, int )
2122Undocumented internal function.\n\octave_value_list F__fltk_maxtime__ (const octave_value_list&
args, int ); extern "C" octave_function * G__fltk_maxtime__ (
const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "__fltk_maxtime__");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (F__fltk_maxtime__, shl, "__fltk_maxtime__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_maxtime__ (const octave_value_list
& args, int )
2123@end deftypefn")octave_value_list F__fltk_maxtime__ (const octave_value_list&
args, int ); extern "C" octave_function * G__fltk_maxtime__ (
const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "__fltk_maxtime__");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (F__fltk_maxtime__, shl, "__fltk_maxtime__", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{maxtime} =} __fltk_maxtime__ ()\n@deftypefnx {Loadable Function} {} __fltk_maxtime__ (@var{maxtime})\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__fltk_maxtime__ (const octave_value_list
& args, int )
2124{
2125#ifdef HAVE_FLTK1
2126 octave_value retval = fltk_maxtime;
2127
2128 if (args.length () == 1)
2129 {
2130 if (args(0).is_real_scalar ())
2131 fltk_maxtime = args(0).double_value ();
2132 else
2133 error ("argument must be a real scalar");
2134 }
2135
2136 return retval;
2137#else
2138 error ("__fltk_maxtime__: not available without OpenGL and FLTK libraries");
2139 return octave_value ();
2140#endif
2141}
2142
2143DEFUN_DLD (__have_fltk__, , ,octave_value_list F__have_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__have_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__have_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__have_fltk__, shl, "__have_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__have_fltk__ (const octave_value_list
& , int )
2144 "-*- texinfo -*-\n\octave_value_list F__have_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__have_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__have_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__have_fltk__, shl, "__have_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__have_fltk__ (const octave_value_list
& , int )
2145@deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\n\octave_value_list F__have_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__have_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__have_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__have_fltk__, shl, "__have_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__have_fltk__ (const octave_value_list
& , int )
2146Undocumented internal function.\n\octave_value_list F__have_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__have_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__have_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__have_fltk__, shl, "__have_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__have_fltk__ (const octave_value_list
& , int )
2147@end deftypefn")octave_value_list F__have_fltk__ (const octave_value_list&
, int ); extern "C" octave_function * G__have_fltk__ (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "__have_fltk__"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (F__have_fltk__, shl, "__have_fltk__"
, "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{FLTK_available} =} __have_fltk__ ()\nUndocumented internal function.\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list F__have_fltk__ (const octave_value_list
& , int )
2148{
2149 octave_value retval;
2150
2151#ifdef HAVE_FLTK1
2152 retval = true;
2153#else
2154 retval = false;
2155#endif
2156
2157 return retval;
2158}
2159
2160// FIXME: This function should be abstracted and made potentially
2161// available to all graphics toolkits. This suggests putting it in
2162// graphics.cc as is done for drawnow() and having the master
2163// mouse_wheel_zoom function call fltk_mouse_wheel_zoom. The same
2164// should be done for gui_mode and fltk_gui_mode. For now (2011.01.30),
2165// just changing function names and docstrings.
2166
2167DEFUN_DLD (mouse_wheel_zoom, args, nargout,octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2168 "-*- texinfo -*-\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2169@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2170@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2171@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2172Query or set the mouse wheel zoom factor.\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2173\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2174The zoom factor is a number in the range (0,1) which is the percentage of the\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2175current axis limits that will be used when zooming. For example, if the\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2176current x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2177then a zoom operation will change the limits by 20.\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2178\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2179When called from inside a function with the @qcode{\"local\"} option, the\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2180variable is changed locally for the function and any subroutines it calls. \n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2181The original variable value is restored when exiting the function.\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2182\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2183This function is currently implemented only for the FLTK graphics toolkit.\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2184@seealso{gui_mode}\n\octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2185@end deftypefn")octave_value_list Fmouse_wheel_zoom (const octave_value_list&
args, int nargout); extern "C" octave_function * Gmouse_wheel_zoom
(const octave_shlib& shl, bool relative) { octave_function
*retval = 0; check_version ("api-v48+", "mouse_wheel_zoom");
if (! error_state) { octave_dld_function *fcn = octave_dld_function
::create (Fmouse_wheel_zoom, shl, "mouse_wheel_zoom", "-*- texinfo -*-\n@deftypefn {Loadable Function} {@var{val} =} mouse_wheel_zoom ()\n@deftypefnx {Loadable Function} {@var{old_val} =} mouse_wheel_zoom (@var{new_val})\n@deftypefnx {Loadable Function} {} mouse_wheel_zoom (@var{new_val}, \"local\")\nQuery or set the mouse wheel zoom factor.\n\nThe zoom factor is a number in the range (0,1) which is the percentage of the\ncurrent axis limits that will be used when zooming. For example, if the\ncurrent x-axis limits are [0, 50] and @code{mouse_wheel_zoom} is 0.4 (40%),\nthen a zoom operation will change the limits by 20.\n\nWhen called from inside a function with the @qcode{\"local\"} option, the\nvariable is changed locally for the function and any subroutines it calls. \nThe original variable value is restored when exiting the function.\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{gui_mode}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fmouse_wheel_zoom (const octave_value_list
& args, int nargout)
2186{
2187#ifdef HAVE_FLTK1
2188 return SET_INTERNAL_VARIABLE_WITH_LIMITS(wheel_zoom_speed, 0.0001, 0.9999)set_internal_variable (Vwheel_zoom_speed, args, nargout, "wheel_zoom_speed"
, 0.0001, 0.9999)
;
2189#else
2190 error ("mouse_wheel_zoom: not available without OpenGL and FLTK libraries");
2191 return octave_value ();
2192#endif
2193}
2194
2195DEFUN_DLD (gui_mode, args, ,octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2196 "-*- texinfo -*-\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2197@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2198@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2199Query or set the GUI mode for the current graphics toolkit.\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2200The @var{mode} argument can be one of the following strings:\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2201\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2202@table @asis\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2203@item @qcode{\"2d\"}\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2204Allows panning and zooming of current axes.\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2205\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2206@item @qcode{\"3d\"}\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2207Allows rotating and zooming of current axes.\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2208\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2209@item @qcode{\"none\"}\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2210Mouse inputs have no effect.\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2211@end table\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2212\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2213This function is currently implemented only for the FLTK graphics toolkit.\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2214@seealso{mouse_wheel_zoom}\n\octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2215@end deftypefn")octave_value_list Fgui_mode (const octave_value_list& args
, int ); extern "C" octave_function * Ggui_mode (const octave_shlib
& shl, bool relative) { octave_function *retval = 0; check_version
("api-v48+", "gui_mode"); if (! error_state) { octave_dld_function
*fcn = octave_dld_function::create (Fgui_mode, shl, "gui_mode"
, "-*- texinfo -*-\n@deftypefn {Built-in Function} {@var{mode} =} gui_mode ()\n@deftypefnx {Built-in Function} {} gui_mode (@var{mode})\nQuery or set the GUI mode for the current graphics toolkit.\nThe @var{mode} argument can be one of the following strings:\n\n@table @asis\n@item @qcode{\"2d\"}\nAllows panning and zooming of current axes.\n\n@item @qcode{\"3d\"}\nAllows rotating and zooming of current axes.\n\n@item @qcode{\"none\"}\nMouse inputs have no effect.\n@end table\n\nThis function is currently implemented only for the FLTK graphics toolkit.\n@seealso{mouse_wheel_zoom}\n@end deftypefn"
); if (relative) fcn->mark_relative (); retval = fcn; } return
retval; } octave_value_list Fgui_mode (const octave_value_list
& args, int )
2216{
2217#ifdef HAVE_FLTK1
2218 caseless_str mode_str;
2219
2220 if (gui_mode == pan_zoom)
2221 mode_str = "2d";
2222 else if (gui_mode == rotate_zoom)
2223 mode_str = "3d";
2224 else
2225 mode_str = "none";
2226
2227 bool failed = false;
2228
2229 if (args.length () == 1)
2230 {
2231 if (args(0).is_string ())
2232 {
2233 mode_str = args(0).string_value ();
2234
2235 if (mode_str.compare ("2d"))
2236 gui_mode = pan_zoom;
2237 else if (mode_str.compare ("3d"))
2238 gui_mode = rotate_zoom;
2239 else if (mode_str.compare ("none"))
2240 gui_mode = none;
2241 else
2242 failed = true;
2243 }
2244 else
2245 failed = true;
2246 }
2247
2248 if (failed)
2249 error ("MODE must be one of the strings: \"2D\", \"3D\", or \"none\"");
2250
2251 return octave_value (mode_str);
2252#else
2253 error ("gui_mode: not available without OpenGL and FLTK libraries");
2254 return octave_value ();
2255#endif
2256}