expose built-in hotkey functions to the command line

View: New views
6 Messages — Rating Filter:   Alert me  

expose built-in hotkey functions to the command line

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

After the addition of new automatic GPVAL_ variables, I wish to be able to
rebound some hotkeys, for example:

bind Right "if (GPVAL_SPLOT) builtin_rotate_right; \
        else set xrange [GPVAL_X_MIN+100:GPVAL_X_MAX+100]; reread"

I propose to move the "builtin_" functions from the default "bind" command
among other functions callable from the command line. I guess there is a
very small probability that users would call functions by these names and
thus it would break some scripts.

---
PM

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: expose built-in hotkey functions to the command line

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 09 July 2008, Petr Mikulik wrote:
> After the addition of new automatic GPVAL_ variables, I wish to be able to
> rebound some hotkeys, for example:
>
> bind Right "if (GPVAL_SPLOT) builtin_rotate_right; \
> else set xrange [GPVAL_X_MIN+100:GPVAL_X_MAX+100]; reread"
>
> I propose to move the "builtin_" functions from the default "bind" command
> among other functions callable from the command line.

What happens if mousing is not active when you call such a function?
Suppose, for instance, that I am viewing using
        "set term png; set output '|display png:-'
which I frequently do.

Does calling the function print an error?

Does it silently change the view angle internally without changing the displayed image?

Does it force a replot even though this terminal wouldn't normally
respond to hotkeys?


--
Ethan A Merritt

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: expose built-in hotkey functions to the command line

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > After the addition of new automatic GPVAL_ variables, I wish to be able to
> > rebound some hotkeys, for example:
> >
> > bind Right "if (GPVAL_SPLOT) builtin_rotate_right; \
> > else set xrange [GPVAL_X_MIN+100:GPVAL_X_MAX+100]; reread"
> >
> > I propose to move the "builtin_" functions from the default "bind" command
> > among other functions callable from the command line.
>
> What happens if mousing is not active when you call such a function?
> Suppose, for instance, that I am viewing using
> "set term png; set output '|display png:-'
> which I frequently do.
>
> Does calling the function print an error?

no

> Does it force a replot even though this terminal wouldn't normally
> respond to hotkeys?

no

> Does it silently change the view angle internally without changing the
> displayed image?

In principle, it does not matter. The function is expected to be called for
interactive terminals only. For other terminals, the behaviour does not make
good sense. Then it can change the parameters but not call replot. I think
the interactive terminals can be distinguished by presence of set_cursor()
function.

I think it could be useful to add flag GPVAL_TERM_INTERACTIVE = {0|1} in
order to distinguish these terminals.

---
PM

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: expose built-in hotkey functions to the command line

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 11 July 2008, you wrote:

> > > After the addition of new automatic GPVAL_ variables, I wish to be able to
> > > rebound some hotkeys, for example:
> > >
> > > bind Right "if (GPVAL_SPLOT) builtin_rotate_right; \
> > > else set xrange [GPVAL_X_MIN+100:GPVAL_X_MAX+100]; reread"
> > >
> > > I propose to move the "builtin_" functions from the default "bind" command
> > > among other functions callable from the command line.
> >
> > What happens if mousing is not active when you call such a function?
> > Suppose, for instance, that I am viewing using
> > "set term png; set output '|display png:-'
> > which I frequently do.
> >
> > Does calling the function print an error?
>
> no
>
> > Does it force a replot even though this terminal wouldn't normally
> > respond to hotkeys?
>
> no

Why not?  That seems to me to be the main use of the function.
You could make minor adjustments to the view angle even for non-mousing
terminals.


> > Does it silently change the view angle internally without changing the
> > displayed image?
>
> In principle, it does not matter. The function is expected to be called for
> interactive terminals only.

Then I am not sure I see what is the argument for making it a generally
available function.  I suppose it allows you to change the key bindings to
something else....

> For other terminals, the behaviour does not make  
> good sense. Then it can change the parameters but not call replot. I think
> the interactive terminals can be distinguished by presence of set_cursor()
> function.
>
> I think it could be useful to add flag GPVAL_TERM_INTERACTIVE = {0|1} in
> order to distinguish these terminals.

I think that is the wrong mechanism.
If it is a terminal property it should be a terminal flag:

   if (term->flags | TERM_INTERACTIVE) ...

except that there already is a global TBOOLEAN that would probably serve:

   if (mouse_setting.on) ...



--
Ethan A Merritt

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: expose built-in hotkey functions to the command line

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > > > bind Right "if (GPVAL_SPLOT) builtin_rotate_right; \
> > > > else set xrange [GPVAL_X_MIN+100:GPVAL_X_MAX+100]; reread"
> > > >
> > > > I propose to move the "builtin_" functions from the default "bind" command
> > > > among other functions callable from the command line.
> > >
> > > What happens if mousing is not active when you call such a function?
> > > Suppose, for instance, that I am viewing using
> > > "set term png; set output '|display png:-'
> > > which I frequently do.
> > >
> > > Does calling the function print an error?
> >
> > no
> >
> > > Does it force a replot even though this terminal wouldn't normally
> > > respond to hotkeys?
> >
> > no
>
> Why not?  That seems to me to be the main use of the function.
> You could make minor adjustments to the view angle even for non-mousing
> terminals.

Fine, it can do replot.

> > > Does it silently change the view angle internally without changing the
> > > displayed image?
> >
> > In principle, it does not matter. The function is expected to be called for
> > interactive terminals only.
>
> Then I am not sure I see what is the argument for making it a generally
> available function.  I suppose it allows you to change the key bindings to
> something else....

Yes, it allows me to change it something else as well as back to the default
value -- or even to do something else and then call the default function,
which is not currently possible.

> > For other terminals, the behaviour does not make  
> > good sense. Then it can change the parameters but not call replot. I think
> > the interactive terminals can be distinguished by presence of set_cursor()
> > function.
> >
> > I think it could be useful to add flag GPVAL_TERM_INTERACTIVE = {0|1} in
> > order to distinguish these terminals.
>
> I think that is the wrong mechanism.
> If it is a terminal property it should be a terminal flag:
>
>    if (term->flags | TERM_INTERACTIVE) ...
>
> except that there already is a global TBOOLEAN that would probably serve:
>
>    if (mouse_setting.on) ...

Then this needs a change to terminals -- I would agree on this.

---
PM

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: expose built-in hotkey functions to the command line

by Ethan Merritt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Saturday 12 July 2008, Petr Mikulik wrote:
> > > > > bind Right "if (GPVAL_SPLOT) builtin_rotate_right; \
> > > > > else set xrange [GPVAL_X_MIN+100:GPVAL_X_MAX+100]; reread"
> > > > >
> > > > > I propose to move the "builtin_" functions from the default "bind" command
> > > > > among other functions callable from the command line.


> > > For other terminals, the behaviour does not make  
> > > good sense. Then it can change the parameters but not call replot. I think
> > > the interactive terminals can be distinguished by presence of set_cursor()
> > > function.
> > >
> > > I think it could be useful to add flag GPVAL_TERM_INTERACTIVE = {0|1} in
> > > order to distinguish these terminals.
> >
> > I think that is the wrong mechanism.
> > If it is a terminal property it should be a terminal flag:
> >
> >    if (term->flags | TERM_INTERACTIVE) ...
> >
> > except that there already is a global TBOOLEAN that would probably serve:
> >
> >    if (mouse_setting.on) ...
>
> Then this needs a change to terminals -- I would agree on this.

I was thinking that you could simply have the new functions test whether mousing
is active:
     arrow_right( ...)
     {
         if (!mouse_setting.on) return;
         ...
     }

That would not need any change to the terminal drivers.

--
Ethan A Merritt

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
LightInTheBox - Buy quality products at wholesale price