[comp.windows.x] Drawing functions for winterp?

dennis@dennis.colorado.edu (03/16/90)

I am considering using winterp to construct a graph (as in nodes and edges)
editor.  But, in order to draw arrows, I need access
to the X drawing functions (XDrawline...).

As near as I can tell, this is missing from the version
of winterp that came with the X11R4 tape.  Does anyone
have code to access the drawing functions thru winterp?

-Dennis Heimbigner
 (dennis@boulder.colorado.edu)

mayer@hplabsz.HPL.HP.COM (Niels Mayer) (03/22/90)

In article <18424@boulder.Colorado.EDU> dennis@dennis.colorado.edu () writes:
>I am considering using winterp to construct a graph (as in nodes and edges)
>editor.  But, in order to draw arrows, I need access
>to the X drawing functions (XDrawline...).

This is true. Take a look at Doug Young's Motif book, ch 10 "Using the X
graphics Primitives". You'll want to use the xmDrawingAreaWidgetClass
provided by WINTERP, and you'll need to register expose and resize
callbacks on that widget in order to draw your graph. Then you'll need to
call a handful of Xlib functions in those callbacks to draw the graph.

>As near as I can tell, this is missing from the version
>of winterp that came with the X11R4 tape.  Does anyone
>have code to access the drawing functions thru winterp?

Yes, I have provided very little Xlib-level code in WINTERP. I wanted to
concentrate on the widget-level interface because I feel that's about the
right level of code for people to be running in an interpreted system.  It
is also the level of code needed for my own projects... I know I will be
adding the needed Xlib-level extensions as I get further along.

There's alot of Xlib routines, they're very low-level code in my opinion.
Too low-level, in fact, to perform decently in Lisp, be it compiled or
interpreted (IMHO). And of course, they are routines require lots of
diddling with the insides of C datastructures... This task is not easy from
lisp, and once it is accomplished, the results may not be what you'd
expect. I'm very much into hybrid programming with WINTERP -- use Lisp for
the things it's good at, and use C for it's efficiency, speed, small size,
and ability to do grungy low-level interfaces.

What I'd suggest you do is grab some of Doug's Young's example C/Motif code
from expo.lcs.mit.edu:contrib/, and interface the appropriate high-level
routines from that code into winterp's XLISP interpreter.

Adding new lisp primitives to WINTERP is quite easy. The entire source of
WINTERP should be a fair example of how this is done. A good starting point
might be some of the routines in src-server/w_utils.c

I would like to see some high-level point and line plotting routines added
to WINTERP. While you're at it, please throw in a rubber-banding routine,
and other such functionality that cannot be implemented at the widget
level.

One of the reasons that I made WINTERP public is in the hopes that others
will find it to be a suitable platform for their work, and will contribute
any special code that they found missing in the first release.

-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- mayer@hplabs.hp.com
		  Human-Computer Interaction Department
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *