changeset 9652:ecdb275bd41b

make drawnow work for fltk backend
author John W. Eaton <jwe@octave.org>
date Fri, 18 Sep 2009 06:40:06 -0400
parents 7234534f47ba
children e087d7c77ff9
files src/ChangeLog src/DLD-FUNCTIONS/fltk_backend.cc
diffstat 2 files changed, 44 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Sep 18 05:51:13 2009 -0400
+++ b/src/ChangeLog	Fri Sep 18 06:40:06 2009 -0400
@@ -1,3 +1,8 @@
+2009-09-18  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/fltk_backend.cc (fltk_backend::redraw_figure):
+	Call __fltk_redraw__ after marking figure as modified.
+
 2009-09-18  John W. Eaton  <jwe@octave.org>
 
 	* mexproto.h: Define OCTINTERP_API if it is not already defined.
--- a/src/DLD-FUNCTIONS/fltk_backend.cc	Fri Sep 18 05:51:13 2009 -0400
+++ b/src/DLD-FUNCTIONS/fltk_backend.cc	Fri Sep 18 06:40:06 2009 -0400
@@ -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<figure::properties&> (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<figure::properties&> (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__ ();