Scaled class graphs with McCLIM's listener - Lisp Propulsion Laboratory log

Lisp Propulsion Laboratory log

Paolo Amoroso's weblog. Main interests: Lisp, astronomy (Moon), space exploration (Apollo and early manned programs) Calendar of past entries | Related links xml

Scaled class graphs with McCLIM's listener

Thursday, August 19, 2004

I have always liked those cool, AI-ish looking graphs often seen in screen shots of Lisp Machines software. See for example this NoteCards screen at Rainer Joswig's site, particularly the thumbnail view at the left. So, I have hacked the CLIM Listener that comes with McCLIM to also draw similar scaled class hierarchy graphs.

This patch against the current revision of Apps/Listener/dev-commands.lisp in the source tree implements the functionality. It adds keyword arguments :Scale X and :Scale Y to the listener's Show Class Subclasses and Show Class Superclasses commands. The modified syntax looks like this (user input emphasized):

Show Class Subclasses (class) class-name
(keywords):Scale X (scale x[1]) x-scale-factor :Scale Y (scale y[1]) y-scale-factor

Below are screen shots of scaled graphs. The first shows the subclasses of clim:gadget, first at full size and then reduced. The second is my favorite McCLIM stress test and generates a monster graph at full size: it shows the subclasses of t, i.e. the whole class hierarchy (it may take a while on a slow machine). This shot only shows the reduced version.

Graph of subclasses of clim:gadget created with McCLIM's listener: full size (top) and reduced (bottom left).

Graph of subclasses of t created with the listener in a typical McCLIM image: reduced version.

The patch adds scale parameters to clim-listener::class-grapher, and wraps the call to clim:format-graph-from-roots within a scaling transformation with appropriate arguments. Since McCLIM does not scale text, when the scale is reduced (i.e. x or y scale factor < 1), I pass a dummy function to clim:format-graph-from-roots that doesn't draw the node -- it would look tiny anyway. The patch also adds keyword arguments to the Show Class Superclasses and Show Class Subclasses listener commands, and passes the arguments to clim-listener::class-grapher.

Note that this is just a quick hack with some limitations:


Copyright © 2004 by Paolo Amoroso
amoroso@mclink.it

Created with BlogMax

August 2004
Mon Tue Wed Thu Fri Sat Sun
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Jul  Sep
About Lisp | Practical Common Lisp (learn Lisp) | Planet Lisp (blog agregator) | Common Lisp Directory (software and resources) | Why Lisp?