|
From: Harald H. <h.h...@tu...> - 2004-10-21 21:58:32
|
Today, I have noticed that sometimes terminal settings are saved where I
normally would not expect it. See this example:
set terminal postscript eps color
set output "1.eps"
plot sin(x)
set output
set terminal png
set output "2.png"
replot
set output
set terminal postscript eps
set output "3.eps"
plot sin(x)
set output
It produces two identical, coloured, eps figures. I would prefer that a
terminal starts with its default settings when it is chosen after another
terminal type. If I want to restore the old settings I can use
'set term push' and 'set term pop' (BTW: gnuplot does not find these
command in the help).
Another case is this:
set terminal postscript eps
set terminal postscript color
This adds the setting 'color' to the already chosen terminal type. If this
should be the case has been discussed here some years ago.
But, if a different terminal has been used in the meanwhile I think the
old settings should not be preserved.
This behaviour can be realised by adding a new terminal function to the
term_api that is called whenever changing the terminal type from one to
another, for example term->set_defaults().
This routine should then be called in change_term() in term.c, for example
like this:
/* Success: set terminal type now */
+ if (strcmp(term->name, t->name) != 0) {
+ /* maybe also if (term == t) { works here */
term = t;
+ if (term->set_defaults())
+ term->set_defaults()
+ }
term_initialised = FALSE;
name = term->name;
For me, this is a difference to the variable term_initialised since this
is also set when something is changed within the same terminal.
The mentioned approach
- avoids to use global default variables, as it is done at the moment,
- can help to solve the problem mentioned at the beginning of this mail,
- eases shared code for different terminals, for example different default
font sizes for postscript, epslatex, ps(la)tex. I have been run in large
difficulties when trying to merge these terminals since they often need
different default values.
Of course, this needs to change the terminal api, but I think it is worth
it because it provides a much clearer interface for the terminal's default
values. When appending the new terminal routine to the TERMENTRY, it is
not necessary to add this functionality to all terminals immediately.
What do you think about it? I offer to do the work if you also think this
is useful.
Harald
--
Harald Harders
h.h...@tu...
http://www.harald-harders.de
|