[cl-graph-devel] printing readably and presentation question (SBCL + MCCLIM + CL-GRAPH)

Gary King gwking at metabang.com
Mon Feb 20 15:54:10 UTC 2006


hi John,

Congratulations on getting this to work and sorry I couldn't be more  
help. FWIW, I have access to some old EKSL code that contains some  
different graph layout algorithms (simple force field, radial layout  
and some sort of hierarchical one). It will require dusting off and  
it currently only knows how to display in MCL (using either the Mac  
toolbox widgets or OpenGL). I'm not sure how quickly I'd be able to  
get to it but I'd be happy to add it to my list and give you a sense  
of how long it might take to get it stumbling.

Gary

On Feb 18, 2006, at 9:12 AM, John Morrison wrote:

> On Sunday 12 February 2006 09:35 pm, Gary King wrote:
>> I'm hardly CLIM savvy at all (it's on the great list of things to do
>> sometime soon...) so I can't help much. I'll try to do some reading
>> tonight and see if that brings me any insight.
>
> Thanks -- I think I figured it out (mostly), and it is, in fact, a
> Stupid Newbie question.  I needed to provide a non-default "accept"
> method on the presentation type corresponding to the "actual" type.
> The default one seems to depend upon being able to read the printed
> representation...
>
> The stuff below seems to work -- it's fugly and crufty and not
> entirely finished, but it's clearly possible...
>
> I think if you didn't need to do what I do (add slots for
> force-directed layout), then you could have a cleaner and simpler
> version...
>
> -jm
>
> --- cut here ---
>
> ;; The class is derived from graph-container-vertex
>
> (defclass vtx (cl-graph:graph-container-vertex)
>   (
>      [ snip snip snip]
>   ))
>
>
> ;; I needed to provide an "accept" method...
> ;; Please excuse all the debugging cruft I left in here
> ;; and the stylistically repulsive c-style parens which
> ;; are useful for commenting out individual lines as I
> ;; clearly do when doing my low-tech print-style debugging...
>
>
> (define-presentation-method accept ((type vtx) stream view &key)
>   (values
>    (with-application-frame (frame)
>      (let ((g (slot-value frame 'current-force-directed-digraph)))
>        (describe (cl-graph:vertexes g) *terminal-io*)
>        (multiple-value-bind (object success string)
>     (handler-case (complete-input stream
>       (lambda (so-far mode)
>         (format *terminal-io* "lambda ~S ~S~%" so-far mode)
>         (complete-from-possibilities
>          so-far
>          (cl-graph:vertexes g)
>          nil
>          :action mode
>          :predicate (lambda (obj)
> ;        (format *terminal-io* "pred ~S, type-of ~S~%" obj (type-of  
> obj))
>         t)
>          :name-key (lambda (obj)
> ;       (format *terminal-io* "name-key ~S, type-of ~S~%" obj (type- 
> of obj))
> ;       (describe (format nil "~S" obj) *terminal-io*)
> ;       (describe (format nil "~A" obj) *terminal-io*)
>        (format nil "~S" obj)
>        )
>          :value-key (lambda (obj)
> ;        (format *terminal-io* "value-key ~S, type-of ~S~%" obj  
> (type-of obj))
>         obj)
>          )))
>       )
>   (format *terminal-io* "mvp object ~S success ~S string ~S~%"  
> object success
> string)
>   object
>   )
>        )
>      )
>    )
>   )
>
> --- cut here ---
>
>
> -- 
> ==== John Morrison
> ==== MAK Technologies Inc.
> ==== 68 Moulton Street, Cambridge, MA 02138
> ==== http://www.mak.com/
> ==== vox:617-876-8085 x115
> ==== fax:617-876-9208
> ==== jm at mak.com
>
>


-- 
Gary Warren King
metabang.com
http://www.metabang.com/





More information about the cl-graph-devel mailing list