From owner-bug-gnuplot@Dartmouth.EDU Wed Nov 3 23:16:44 1999 Return-Path: Received: from nmrc.ucc.ie (bastion.nmrc.ucc.ie [143.239.64.1]) by mailhost.nmrc.ucc.ie (Postfix) with SMTP id D19FD6B for ; Wed, 3 Nov 1999 23:16:43 +0000 (GMT) Received: from mailhub.dartmouth.edu (mailhub.dartmouth.edu [129.170.16.6]) by nmrc.ucc.ie (Postfix) with SMTP id 504B11668 for ; Wed, 3 Nov 1999 23:19:13 +0000 (GMT) Received: (from mj@localhost) by mailhub.dartmouth.edu (8.9.3+DND/8.9.3) id SAA00143 for bug-gnuplot-outgoing; Wed, 3 Nov 1999 18:09:52 -0500 (EST) Received: from utrhcs.cs.utwente.nl (utrhcs.cs.utwente.nl [130.89.10.247]) by mailhub.dartmouth.edu (8.9.3+DND/8.9.3) with ESMTP id SAA09017 for ; Wed, 3 Nov 1999 18:09:50 -0500 (EST) Received: from myrtilos.cs.utwente.nl (myrtilos.cs.utwente.nl [130.89.16.9]) by utrhcs.cs.utwente.nl (8.9.1/8.9.1) with SMTP id AAA10411 for ; Thu, 4 Nov 1999 00:09:47 +0100 (MET) Received: from erlang.cs.utwente.nl by myrtilos.cs.utwente.nl (SMI-8.6/csrelay-Sol1.4/RB) id AAA20029; Thu, 4 Nov 1999 00:09:46 +0100 Received: by erlang.cs.utwente.nl (8.8.8+Sun/SMI-SVR4) id AAA11860; Thu, 4 Nov 1999 00:09:45 +0100 (MET) From: ptdeboer@cs.utwente.nl (Pieter-Tjerk de Boer) Message-Id: <199911032309.AAA11860@erlang.cs.utwente.nl> Subject: patch: rotate splots by mouse (X11) To: bug-gnuplot@Dartmouth.EDU Date: Thu, 4 Nov 1999 00:09:45 +0100 (MET) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-bug-gnuplot@Dartmouth.EDU Precedence: bulk Status: RO X-Status: A Content-Length: 2757 Lines: 54 Hello, A few weeks ago, I made some modifications to gnuplot which allow changing the view of a 3D plot (splot) with the mouse under X11. By moving the mouse while keeping one of its buttons depressed, the picture can be dragged to the desired orientation; depending on which button is pressed, either only the axes are dragged, or the entire plot is dragged (the latter being useful for simple plots and/or on fast machines). As an extra, clicking a mouse button in a 2D plot prints the coordinates. As the coming of version 3.7.1 was announced, I held back the patch until 3.7.1 would be out. I have now made the patch available (updated to fit gnuplot 3.7.1 of course) at the following place: http://www.cs.utwente.nl/~ptdeboer/gp371_x11mouse.patch I have tested it under Solaris and Linux, but it probably works for almost all X11 systems. Of course, I would like to see this patch (or an improved version of it; suggestions are welcome) included in a future version of gnuplot. Since this patch changes quite a few files, here's a list of the most important changes: * change gplt_x11.c / gnuplot_x11 such that it reports mouse events on its standard output. Also, the completion of a drawing is reported this way, to keep the main program and the X11 driver synchronized. * change readline.c such that if the terminal driver provides the (new) function waitforinput(), this is called when waiting for input from the user. * change term/x11.trm such that: - it sets up full-duplex communication with gnuplot_x11 - it provides the new waitforinput() terminal driver function; this uses select() to wait for input both from stdin (to allow readline to continue its work) and input from gnuplot_x11. Upon receiving the latter, appropriate functions from (new) mouse.c are called. * add mouse.c (and mouse.h): this file contains functions to be called upon mouse events by the terminal driver. These functions determine what happens upon the event; e.g., for dragging, the view settings are changed and do_3dplot() is called. * in plot3d.c: changes such that the data stored in memory pointed to by first_3dplot is preserved between plots. Thus, the data need not be re-read or re-calculated for every redraw while dragging. The remaining changes are small ones, usually immediate consequences of the changes outlined above. Unfortunately, until earlier today (through a pointer in the updated gnuplot FAQ) I did not know that Petr Mikulik has also been working on mouse support for OS/2 (and apparently also X11 now); so perhaps some of our work is duplicate, or incompatible... Best regards, Pieter-Tjerk de Boer (ptdeboer@cs.utwente.nl) [[[[ unsubscribe from bug-gnuplot via majordomo@dartmouth.edu ]]]]