Mercurial > hg > octave-lyh
changeset 6454:7c9b4a6e090b
[project @ 2007-03-26 14:28:24 by jwe]
author | jwe |
---|---|
date | Mon, 26 Mar 2007 14:28:24 +0000 |
parents | 4067a8caff18 |
children | e68b6921b221 |
files | scripts/ChangeLog scripts/plot/drawnow.m |
diffstat | 2 files changed, 51 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,7 @@ 2007-03-26 John W. Eaton <jwe@octave.org> + * plot/drawnow.m: Exit early if call is recursive. + * plot/__go_draw_axes__.m (get_data_limits): New function. Check for Inf too. (__go_draw_axes__): Use get_data_limits.
--- a/scripts/plot/drawnow.m +++ b/scripts/plot/drawnow.m @@ -26,48 +26,61 @@ function drawnow (term, file) - if (nargin == 2) - h = get (0, "currentfigure"); - if (h) - f = get (h); - plot_stream = []; - unwind_protect - plot_stream = open_gnuplot_stream ([], term, file); - __go_draw_figure__ (f, plot_stream); - unwind_protect_cleanup - if (! isempty (plot_stream)) - pclose (plot_stream); - endif - end_unwind_protect - else - error ("drawnow: nothing to draw"); + persistent drawnow_executing = 0; + + unwind_protect + + ## If this is a recursive call, do nothing. + if (++drawnow_executing > 1) + return; endif - elseif (nargin == 0) - for h = __go_figure_handles__ () - if (! (isnan (h) || h == 0)) + + if (nargin == 2) + h = get (0, "currentfigure"); + if (h) f = get (h); - if (f.__modified__) - plot_stream = f.__plot_stream__; - figure_is_visible = strcmp (f.visible, "on"); - if (figure_is_visible) - if (isempty (plot_stream)) - plot_stream = open_gnuplot_stream (h); - endif - __go_draw_figure__ (f, plot_stream); - elseif (! isempty (plot_stream)) + plot_stream = []; + unwind_protect + plot_stream = open_gnuplot_stream ([], term, file); + __go_draw_figure__ (f, plot_stream); + unwind_protect_cleanup + if (! isempty (plot_stream)) pclose (plot_stream); - set (h, "__plot_stream__", []); endif - set (h, "__modified__", false); - endif - __request_drawnow__ (false); + end_unwind_protect + else + error ("drawnow: nothing to draw"); endif - endfor - else - print_usage (); - endif + elseif (nargin == 0) + for h = __go_figure_handles__ () + if (! (isnan (h) || h == 0)) + f = get (h); + if (f.__modified__) + plot_stream = f.__plot_stream__; + figure_is_visible = strcmp (f.visible, "on"); + if (figure_is_visible) + if (isempty (plot_stream)) + plot_stream = open_gnuplot_stream (h); + endif + __go_draw_figure__ (f, plot_stream); + elseif (! isempty (plot_stream)) + pclose (plot_stream); + set (h, "__plot_stream__", []); + endif + set (h, "__modified__", false); + endif + endif + endfor + else + print_usage (); + endif - __request_drawnow__ (false); + unwind_protect_cleanup + + drawnow_executing--; + __request_drawnow__ (false); + + end_unwind_protect endfunction