# HG changeset patch # User John W. Eaton # Date 1253270406 14400 # Node ID ecdb275bd41b9015aa7f067119292beed5adfe17 # Parent 7234534f47ba414833f68eb394e52ccef2f309c4 make drawnow work for fltk backend diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-09-18 John W. Eaton + + * DLD-FUNCTIONS/fltk_backend.cc (fltk_backend::redraw_figure): + Call __fltk_redraw__ after marking figure as modified. + 2009-09-18 John W. Eaton * mexproto.h: Define OCTINTERP_API if it is not already defined. diff --git a/src/DLD-FUNCTIONS/fltk_backend.cc b/src/DLD-FUNCTIONS/fltk_backend.cc --- a/src/DLD-FUNCTIONS/fltk_backend.cc +++ b/src/DLD-FUNCTIONS/fltk_backend.cc @@ -55,6 +55,8 @@ #endif #include "cmd-edit.h" +#include "lo-ieee.h" + #include "defun-dld.h" #include "error.h" #include "gl-render.h" @@ -792,6 +794,41 @@ std::string figure_manager::fltk_idx_header="fltk index="; int figure_manager::curr_index = 1; +static bool backend_registered = false; +// give FLTK no more than 0.01 sec to do it's stuff +static double fltk_maxtime = 1e-2; + +static int +__fltk_redraw__ (void) +{ + if (backend_registered) + { + // we scan all figures and add those which use FLTK as a backend + graphics_object obj = gh_manager::get_object (0); + if (obj && obj.isa ("root")) + { + base_properties& props = obj.get_properties (); + Matrix children = props.get_children (); + + for (octave_idx_type n = 0; n < children.numel (); n++) + { + graphics_object fobj = gh_manager::get_object (children (n)); + if (fobj && fobj.isa ("figure")) + { + figure::properties& fp = + dynamic_cast (fobj.get_properties ()); + if (fp.get___backend__ () == FLTK_BACKEND_NAME) + figure_manager::new_window (fp); + } + } + } + + Fl::wait (fltk_maxtime); + } + + return 0; +} + class fltk_backend : public base_graphics_backend { public: @@ -832,6 +869,8 @@ void redraw_figure (const graphics_object& go) const { figure_manager::mark_modified (go.get_handle ()); + + __fltk_redraw__ (); } void print_figure (const graphics_object& /*go*/, @@ -859,41 +898,6 @@ } }; -static bool backend_registered = false; -// give FLTK no more than 0.01 sec to do it's stuff -static double fltk_maxtime = 1e-2; - -static int -__fltk_redraw__ (void) -{ - if (backend_registered) - { - // we scan all figures and add those which use FLTK as a backend - graphics_object obj = gh_manager::get_object (0); - if (obj && obj.isa ("root")) - { - base_properties& props = obj.get_properties (); - Matrix children = props.get_children (); - - for (octave_idx_type n = 0; n < children.numel (); n++) - { - graphics_object fobj = gh_manager::get_object (children (n)); - if (fobj && fobj.isa ("figure")) - { - figure::properties& fp = - dynamic_cast (fobj.get_properties ()); - if (fp.get___backend__ () == FLTK_BACKEND_NAME) - figure_manager::new_window (fp); - } - } - } - - Fl::wait (fltk_maxtime); - } - - return 0; -} - DEFUN_DLD (__fltk_redraw__, , , "") { __fltk_redraw__ ();