From: Ethan M. <merritt@u.washington.edu> - 2008-01-25 20:36:56
|
On Friday 25 January 2008 11:44, Maximilian Fabricius wrote: > > I followed the mouselabel example. > My actual plot script now calls another script: > > pause mouse key > if (MOUSE_KEY != 27 && MOUSE_CHAR ne " ") reread > > Still, if I do this I loose the interactive functionality of x11 > (toggling logscale with l, unzooming on a etc.). > Of course I could try to re-enable all this in the pause-mouse-key-script. > > pause mouse keypress > bind "ctrl-l" "lx=lx+1;if(lx%2)set logscale x; else unset logscale x" > if (MOUSE_KEY != 27 && MOUSE_CHAR ne " ") reread > > (where lx is defined in the first script) > This did not work, though. That won't work. The bind command does not execute anything by itself. (Also gnuplot doesn't have an "else" command, but that's a different issue). You need instead something like: pause mouse keypress if (MOUSE_KEY != 27 && MOUSE_CHAR ne " " && MOUSE_CHAR ne "l") reread if (MOUSE_CHAR eq "l") load "toggle_logscale.gp" reread Where toggle_logscale.gp re-implements the built-in processing that 'pause mouse' bypassed. if (!lx) set logscale x if (lx) unset logscale x lx = !lx replot Zooming should still work as normal because you said "pause mouse keypress", which leaves the button clicks unaffected. > Wouldn't it be easier to have an option > like "pause mouse keypress("q")" to wait for a specifik key? Easier for the user, I agree. Unfortunately the mousing code is very complicated because the details are different for each terminal type (windows, x11, wxt, aqua, pm). So changes to the mousing code tend to be more difficult than other kinds of changes because they have to be worked out and tested separately for each terminal type. There might be a clever way to implement your suggestion in a terminal-independent manner, but that isn't obvious to me at the moment. So it's a perfectly reasonable suggestion, but not all reasonable suggestions are easy to implement. Nevertheless, to go back to your original question > > Alternatively if I could define a key - "q" for example - > which closes the current plot and continues the gunplot script, > that would be great. I already gave an example of how to do that with a "bind" command. So I'm not clear on what problem you are trying to work around at this point. -- Ethan A Merritt |