writing 'mouse interactive' routines to extend draw, plot2d, etc.



Mario Rodriguez wrote:
> S. Newhouse escribi?:
>   
>>   I am interested in writing some maxima or lisp routines which give
>> plot windows with mouse interaction.  For instance, the gnuplot
>> interface to draw.lisp allows one to show the coordinates of points in a
>> 2d graphic display.  Pressing the middle button at a point will print
>> the coordinates on the screen.  I would like to be able to print the
>> coordinates to a file, and to have various keyboard combinations do
>> other things--e.g. open new graphic windows, etc.
>>     
> Hello,
>
> Sorry, but I didn't pay much attention to these interactive actions.
> Probably, we could extend some of the features you are suggesting, the
> same way as we did with saving coordinates.
>
> But these actions are between the user and Gnuplot. Another (and very
> interesting) question is how to let Maxima know the actions I'm making
> on the Gnuplot window, so that Maxima could recalculate, replot or make
> anything else the user wants. I confess I don't know if this is even
> possible with the pipes routines we have at hand.
>
> Now that draw has reached (or is approaching to reach) a reasonable
> stable status, maybe it's time to look into these things.
>
>   
>>   Since gnuplot is so
>> well developed, I would like to use that as the main engine for these
>> purposes.  So, I have been reading
>> Mario's 'draw.lisp'.  I noticed that there are variables
>>    datastorage
>>    cmdstorage
>>    datapath
>>
>>     
> variable datastorage is used to create file data.gnuplot and variable
> cmdstorage is used to create file maxout.gnuplot. On the other hand,
> datapath is the path where these two files are allocated.
>
> Why two files? There are three reasons:
>
> 1.- Some plots requiere a lot of data to be piped to Gnuplot, so that I
> have reached the limits of piping. My solution to these problem was to
> pipe only the commands and let data saved appart.
>
> 2.- In Gnuplot 4.2 data can be saved in binary files, which would make
> plotting faster. At this moment, Maxima writes data.gnuplot in plain
> text, but I plan to see how to handle the binary formats for Gnuplot.
>
> 3.- With two distinct files, I can zoom the plotting window dragging
> with the right button, something I couldn't make before. (I'm not a
> windows user, but I think plot2d has, or had in the past, the same problem)
>
>   
>> But, I don't know where there files are kept and how gnuplot accesses them.
>>
>>
>>     
> maxima_tempdir;
>
>   
>> Would it be easier with openmath?
>>
>>     
> openmath has some interactive potentials Gnuplot doesn't have. The menus
> and sliders of Jaime's plotdf are good examples.
>
> But I don't know if Maxima could be informed about my mouse and keyboard
> actions on the plotting window.
>
>
>   
>>  I would greatly appreciate it any hints for this process.
>>
>>     
> I hope these comments will be of interest to you.
>
> Mario
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> .
>
>   
Hello,

 I work in Linux, so I don't know much about operating in Win-XP in a 
similar way. 

 Thanks, Mario, for the answers to my questions.  Now that I can see the 
'maxout.gnuplot' and 'data.gnuplot' files, I see what 'draw' is doing.
 It transfers the user into gnuplot in batch mode with the appropriate 
commands.

  Since there is no direct menu available, at least in the graphic 
window, one might use the 'shell escape' command in gnuplot to spawn 
other processes.

 There could be a command switch in draw which would escape to a shell, 
open a window for keyboard interaction, etc.  Perhaps a certain key 
combination (e.g. 'tw' for 'terminal window)  would open a terminal 
window which would feed other commands to maxima and or gnuplot.
 
  Here is another question:  Why is it that 'draw2d' allows (apparently) 
a full gnuplot session to be opened, but 'plot2d' does not.  For 
instance, the third mouse zoom does not seem to work in plot2d?

Thanks for any thoughts.
 -sen