|
From: Daniel J S. <dan...@ie...> - 2004-09-13 17:56:52
|
Ethan Merritt wrote:
>On Monday 13 September 2004 10:21 am, Daniel J Sebald wrote:
>
>
>>For developers' sake, the change isn't too drastic. The one conceptual
>>change is that I moved the code that keeps track of the "most recent
>>plot number" to inside gnuplot_x11.c instead of x11.trm. (You see, if
>>x11.trm keeps setting the number every time it does a plot, then the
>>non-numbered plots lose the "current_plot" status.
>>
>>
>
>What is a "non-numbered plot"?
>
A non-numbered plot is one for which the command
> set term x11 window <XID>
is given. When the feature come to the list, I raised the question of
whether the XID should be associated with a numbered plot. Dave
suggested it didn't have to be. I agreed and programmed it that way.
There are two things in a plot array in gplt_x11.c, the plot number and
the window ID. The list of plots can be searched for either element.
So conceptually, one should think of two "banks of plots"--those with
numbers, those with window IDs.
>Surely if x11 is processing a "replot" command, this needs to go to
>the last window that x11.trm itself knew about. What else could it mean?
>I don't see how gnuplot_x11 can know this better than x11.trm itself.
>
It is the same difference, so long as the link between the two isn't broken.
>>I see no reason for
>>x11 to change "current_plot" except during a "set term x11" command...
>>
"current_plot" is a variable inside gplt_x11.c. The equivalent inside
x11.trm is "X11_plot_number".
But the current CVS does just what you say it shouldn't. Inside
X11_graphics(), which I believe is called for all plots, is
PRINT2("G%d %lu\n", X11_plot_number, windowid);
which changes the plot in the case where I had just issued, say,
> set term x11 window '200002e'
First, I altered the PRINT2() above so that the plot number isn't part
of the G command. And one's response would be, so that should be
enough. Yes, but when I did this I thought "why shouldn't gnuplot_x11
be keeping track of the most recent plot number in the case where it
can't find the current plot number in the linked-list (because it was
deleted) and it must create a new plot?" Before gnuplot_x11 would just
create a plot with number zero.
In other words, the addition of a "most_recent_plot_number" is a small
addition to gplt_x11.c, and I think it takes care of the problem. Look
at it another way. If what you are saying above is true, that x11
should change the plot number only when there is a "set term x11 #"
command, why should x11.trm keep track of the plot number?
If the case arises that some more sophisticated organization is needed.
Say, gnuplot keeps track of the plot commands for every open window and
can switch back and forth between them, then x11 can certainly override
gnuplot_x11.c.
Dan
|