On Saturday, April 30, 2005, at 02:02 PM, Paul Werkowski wrote:
----- Original Message ----- From: "Duncan Rose" duncan@robotcat.demon.co.uk To: mcclim-devel@common-lisp.net Sent: Saturday, April 30, 2005 4:54 AM Subject: [mcclim-devel] Command translator question
| | I'm trying to define a presentation command translator which will | invoke 'describe presentation' on specific types. Unfortunately it | doesn't work (or at least, works in a way that I'm not expecting so if | it's working it's not doing what I want ;-) | | Looking at the translators defined in the Listener and in | builtin-commands.lisp hasn't helped. Here's the translator: | | (define-presentation-to-command-translator port-select-to-command ; | name | (t ; from-type | com-describe ; command-name - maybe | com-describe-presentation? | global-command-table ; command table containing command | :gesture :select ; activate on :select (left-button click) | ;; :tester ... | :documentation | "Invoke the 'describe presentation' command on the selected | presentation" | :pointer-documentation ((object stream) (format stream "Describe ~A" | object)) | :menu t ; command should appear in popped-up menus | ;; :priority ... | :echo nil) ; don't echo the command when it is invoked | ;; arglist must be a subset (using string-equal) of: | ;; (object presentation context-type frame event window x y) | (object) | ;; body of translator; returns a list of the arguments to the command | ;; named by command-name. | (list object)) | | In case I was providing the wrong 'from-type' I changed it to T (all | types, I hope). I've written this using the Beagle back end but it | doesn't work for me when run under CLX either... | | Any suggestions would be appreciated, I'm obviously missing something...
Well, you have not defined COM-DESCRIBE in the attached glimpse.lisp. I have never tried using the global command table in translators so I can't say for sure that it should work. I have always used the frame command table for translators.
This might be a safer way of doing it but I know there's a com-describe in the global command table and I'd like to use it; however, if that's not portable it might be better if I didn't.
I'm thinking at the moment it might be necessary for the command table for glimpse (defaults to 'glimpse' I believe) to :inherit-from the global command table maybe. There's a note for 'define-presetation-translator' that the translator will only be applicable when the command table provided as an argument in the call is one of the command tables from which the application frame's command table inherits. I don't know if this is a restriction for 'define-presentation-to-command-translator' but I'm going to investigate this some more.
Just a nit, but I don't ever recall seeing the idiom (setf x (push thing x)) used elsewhere, just (push thing x) will do.
When I originally wrote the code I was using LIST I think, and the setf's just got left in.
Another nit, you should avoid using unxported CLIMI features. MAP-OVER-PORTS instead of CLIMI::*ALL-PORTS* MAP-OVER-GRAFTS instead of CLIMI::PORT-GRAFTS would make it possible for me to try this code in a "classic CLIM".
I'll change the code to be more compliant, thanks for pointing that out.
Originally the code was only intended to illustrate that application frames all generated a 'raised pane' that contains a 'menu pane' even if the application itself didn't use the menus. I then realized I could expand it somewhat to show me what was going on in the Beagle back end (with mirror regions and transformations etc.) a bit more easily than poking with the Listener; so it's currently very much a work in progress.
-Duncan
Paul