[mcclim-devel] Clouseau-based inspector for Listener

Paolo Amoroso amoroso at mclink.it
Fri Feb 4 16:06:01 UTC 2005


This 5 minutes hack adds to the CLIM Listener a new "Inspect" command
based on the Clouseau inspector:

(in-package :clim-listener)

(define-command (com-inspect :name "Inspect" :command-table lisp-commands :menu t)
    ((obj 'expression :prompt "expression"))
  (clouseau::inspector obj))

(define-gesture-name :inspect :pointer-button-press (:middle :control))

(define-presentation-to-command-translator com-inspect-translator
    (expression com-inspect lisp-commands
                :menu t
                :gesture :inspect
                :documentation ((object stream)
                                (format stream "Inspect ~S" object))
                :pointer-documentation "Inspect")
    (obj)
  (list obj))

The command works, but the translator sort of.

When I Ctrl-Middle-click on an object with expression presentation
type, or right-click and select the "Inspect" command, the Clouseau
frame does open, but it does not inspect the right object: it always
inspects nil, which is probably what com-inspect actually gets.  What
am I doing wrong?

I'm not sure the gesture I have chosen is the right one. but
Shift-Middle-click is already taken by copy and paste.  Any other
suggestions?

Also, is expression the right presentation type to hook this
functionality into in the first place?  Is the translator appropriate?

This tweak to clouseau::inspector makes it possible for the calling
frame to continue processing events, especially repaint ones:

(defun inspector (obj)
  (let ((*print-length* 10)
        (*print-level* 10))
    (run-frame-top-level
     (make-application-frame 'inspector :calling-frame *application-frame* :obj obj))))

Perhaps it may be worth changing clouseau::inspector so that it can
start a new thread in a way similar to clim-listener:run-listener.
This way it would be possible to open more than one inspector frame at
a time from the Listener.


Paolo
-- 
Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log



More information about the mcclim-devel mailing list