changeset 6293:b649aa46950d

[project @ 2007-02-09 21:50:40 by jwe]
author jwe
date Fri, 09 Feb 2007 21:50:40 +0000
parents 3588fc904484
children fa02b0b467b5
files scripts/ChangeLog scripts/plot/__uiobject_init_figure__.in scripts/plot/figure.m src/ChangeLog src/ov-struct.cc
diffstat 5 files changed, 45 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Feb 09 08:33:42 2007 +0000
+++ b/scripts/ChangeLog	Fri Feb 09 21:50:40 2007 +0000
@@ -1,5 +1,10 @@
 2007-02-09  John W. Eaton  <jwe@octave.org>
 
+	* plot/figure.m: Call drawnow for current figure before creating
+	or switching to a new figure.
+	* plot/__uiobject_init_figure__.in: Handle empty arg the same as
+	nargin == 0 case.
+
 	* testfun/assert.m: Try to avoid problems when comparisons involve
 	strange values like Inf+NaNi.
 
--- a/scripts/plot/__uiobject_init_figure__.in	Fri Feb 09 08:33:42 2007 +0000
+++ b/scripts/plot/__uiobject_init_figure__.in	Fri Feb 09 21:50:40 2007 +0000
@@ -33,7 +33,7 @@
 
   if (nargin == 0 || nargin == 1)
 
-    if (nargin == 0)
+    if (nargin == 0 || isempty (f))
       if (isempty (__uiobject_figure_handles_free_list__))
 	f = max (__uiobject_handles__) + 1;
       else
--- a/scripts/plot/figure.m	Fri Feb 09 08:33:42 2007 +0000
+++ b/scripts/plot/figure.m	Fri Feb 09 21:50:40 2007 +0000
@@ -31,6 +31,7 @@
 
   f = [];
 
+  init_new_figure = false;
   if (mod (nargs, 2) == 1)
     tmp = varargin{1};
     if (ishandle (tmp) && strcmp (get (tmp, "type"), "figure"))
@@ -39,7 +40,7 @@
       nargs--;
     elseif (isnumeric (tmp) && tmp > 0 && round (tmp) == tmp)
       f = tmp;
-      __uiobject_init_figure__ (f);
+      init_new_figure = true;
       varargin(1) = [];
       nargs--;
     else
@@ -47,9 +48,19 @@
     endif
   endif
 
+  ## Check to see if we already have a figure on the screen.  If we do,
+  ## then update it if it is different from the figure we are creating
+  ## or switching to.
+  cf = get (0, "currentfigure");
+  if (! isempty (cf) && cf != 0)
+    if (isempty (f) || cf != f)
+      drawnow ();
+    endif
+  endif
+
   if (rem (nargs, 2) == 0)
-    if (isempty (f))
-      f = __uiobject_init_figure__ ();
+    if (isempty (f) || init_new_figure)
+      f = __uiobject_init_figure__ (f);
     endif
     if (nargs > 0)
       set (f, varargin{:});
--- a/src/ChangeLog	Fri Feb 09 08:33:42 2007 +0000
+++ b/src/ChangeLog	Fri Feb 09 21:50:40 2007 +0000
@@ -1,5 +1,9 @@
 2007-02-09  John W. Eaton  <jwe@octave.org>
 
+	* ov-struct.cc (octave_struct::load_ascii,
+	octave_struct::load_binary, octave_struct::load_hdf5):
+	Delete obsolete attempt at backward compatibility.
+
 	* ls-mat5.cc (read_mat5_binary_element): Don't attempt to read
 	fieldnames if there are no fields.
 	(write_mat5_tag): Don't use small data element format if bytes == 0.
--- a/src/ov-struct.cc	Fri Feb 09 08:33:42 2007 +0000
+++ b/src/ov-struct.cc	Fri Feb 09 21:50:40 2007 +0000
@@ -1061,21 +1061,15 @@
 	      if (!is)
 		break;
 
-	      // Try for some backward compatibility...
-	      if (t2.is_cell () && t2.length() > 1)
-		m.assign (nm, t2);
-	      else
-		{
-		  Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+	      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
 
-		  if (error_state)
-		    {
-		      error ("load: internal error loading struct elements");
-		      return false;
-		    }
+	      if (error_state)
+		{
+		  error ("load: internal error loading struct elements");
+		  return false;
+		}
 
-		  m.assign (nm, tcell);
-		}
+	      m.assign (nm, tcell);
 	    }
 
 	  if (is) 
@@ -1151,21 +1145,15 @@
 	  if (!is)
 	    break;
 
-	  // Try for some backward compatibility...
-	  if (t2.is_cell () && t2.length() > 1)
-	    m.assign (nm, t2);
-	  else
-	    {
-	      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+	  Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
  
-	      if (error_state)
-		{
-		  error ("load: internal error loading struct elements");
-		  return false;
-		}
+	  if (error_state)
+	    {
+	      error ("load: internal error loading struct elements");
+	      return false;
+	    }
 
-	      m.assign (nm, tcell);
-	    }
+	  m.assign (nm, tcell);
 	}
 
       if (is) 
@@ -1242,21 +1230,15 @@
     {
       octave_value t2 = dsub.tc;
 
-      // Try for some backward compatibility...
-      if (t2.is_cell () && t2.length() > 1)
-	m.assign (dsub.name, t2);
-      else
-	{
-	  Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
+      Cell tcell = t2.is_cell () ? t2.cell_value () : Cell (t2);
  
-	  if (error_state)
-	    {
-	      error ("load: internal error loading struct elements");
-	      return false;
-	    }
+      if (error_state)
+	{
+	  error ("load: internal error loading struct elements");
+	  return false;
+	}
 
-	  m.assign (dsub.name, tcell);
-	}
+      m.assign (dsub.name, tcell);
 
       if (have_h5giterate_bug)
 	current_item++;  // H5Giterate returned the last index processed