octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more graphics changes.


From: John W. Eaton
Subject: Re: more graphics changes.
Date: Wed, 21 Mar 2007 12:31:40 -0400

On 20-Mar-2007, Daniel J Sebald wrote:

| John W. Eaton wrote:
| 
| > I removed the call to drawnow in clf.  That change should also improve
| > compatibility with you know what.
| 
| I wonder if the follow hunk of code is necessary inside figure:
| 
|    ## 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 (isnan (f) || cf != f)
|        drawnow ();
|      endif
|    endif

The Matlab docs for drawnow say that it is called by figure.  However,
it seems that it only calls it to update figures that are already
displayed rather than calling drawnow unconditionally.  So I think
that the above is OK.

| If any changes where made to the current figure they are automatically 
updated 
| unless "visible" is "off".  Seems redundant.  I'd think that the following 
would 
| be the only reason to update:
| 
|    ## 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 and current figure is not in automatic redraw mode.
|    cf = get (0, "currentfigure");
|    if (! isempty (cf) && cf != 0 && strcmp (get (cf, "visible"), "off"))
|      if (isnan (f) || cf != f)
|        set (cf, "visible", "on");
|        drawnow ();
|        set (cf, "visible", "off");
|      endif
|    endif
| 
| and even then it is questionable because if the user turned off visibility 
for 
| the figure, perhaps they don't want it updated automatically.

I've just modified drawnow so that it updates all figures, not just
the current one, and so it also checks the visible property.

| Also, there may be a bug in the following:
| 
| figure(1)
| image
| set(1,"visible","off")
| figure(2)
| plot([0:30])
| set(1,"visible","on")
| 
| Note that it is figure 2 that is redrawn when figure 1's visibility is turned 
| back on.

I think this works in a compatible way now, even closing figure 1 when
its visible property is set to "off".

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]