[mcclim-devel] New version, based on ideas by Timonthy Moore (Has been: DEFINE-APPLCATION-STARTER and a modified Clim Launcher)
Max-Gerd Retzlaff
m.retzlaff at gmx.net
Wed Jan 25 03:00:26 UTC 2006
Hi,
I have not much time to write right now but there is a new version and
I want to inform you about it so that you do not spend thought on
things that are already changed.
I've had a discussion with Timothy Moore in #lisp. His idea has been:
<moore33> mgr: I mean that launch-application could be a generic
function that does what the code generated by your macro does, with
all the flexibility that implies. Not that I care very much, but
these days I tend to think about protocols before I think about
macros.
(The discussion is logged, here is a direct link:
http://meme.b9.com/cview.html?channel=lisp&utime=3347129927#utime_requested )
Afterwards I have rewritten the stuff in clim-utilities.lisp; please,
have a look at the file in the attached archive or at:
http://matroid.org/flux/clim-launcher/clim-utilities.lisp
(The archive i is also in my public flux directory
http://matroid.org/flux/ as clim-launcher-20060125-01.tar.bzip2
(or newer).)
Now there is the generic function LAUNCH-APPLICATION, the most generic
method of it consists basically of the code the previous version of
the DEFINE-APPLICATION-STARTER macro has generated, only more general.
You can know just execute
(climi::launch-application 'climacs-gui:climacs :new-process t)
to start Climacs, without the need to define a custom starter function.
In this case you have to announce your application manually with
something like:
(clim-launcher:add-application "Climacs" ;; (See [1].)
(lambda () (climacs-gui::climacs :new-process t)))
To create a custum starter function nevertheless,
DEFINE-APPLICATION-STARTER does still exist, although it has been
changed to use LAUNCH-APPLICATION. (It will still announce the
application by default, of course.)
Using a generic method has the huge benefit that the starter can now
be modified for each application frame. Think of Beirc, which wants to
make a separate thread for the IRC connection on its start-up.
Another example is Clouseau that needs an object to inspect as an
argument. We can now modify LAUNCH-APPLICATION and put the argument
:object into the (also new) ARGUMENTS-FOR-APPLICATION-FRAME-CREATION
argument for the generic LAUNCH-APPLICATION method:
-- zipp --
;;; Clouseau example
(in-package :clouseau)
(climi::define-application-starter inspector
:function-name inspector)
(in-package :climi)
(defmethod launch-application :around ((application-frame-name (eql 'clouseau::inspector))
&rest rest
&key arguments-for-application-frame-creation
&allow-other-keys)
"This method will put the :OBJECT argument into :ARGUMENTS-FOR-APPLICATION-FRAME-CREATION"
(let ((object (getf rest :object)))
(when object
(setf (getf arguments-for-application-frame-creation :obj)
object
;; ensure that its in the list:
(getf rest :arguments-for-application-frame-creation)
arguments-for-application-frame-creation)))
;; call the real thing
(apply #'call-next-method application-frame-name rest))
-- zapp --
We can now start Clouseau with
(climi::launch-application 'clouseau:inspector :new-process t :object 'dudel)
or via the custom generated function
(clouseau:inspector :object 'tada :new-process t)
Comments are welcome. Bye,
Max
1) The name ADD-APPLICATION should be renamed as well. I like
ANNOUNCE-APPLICATION, but how will DELETE-APPLICATION then
be called? Perhaps we should take REGISTER-APPLICATION and
DEREGISTER-APPLICATION, although I prefer "announce"..
--
Max-Gerd Retzlaff <m.retzlaff at gmx.net> http://blog.matroid.org
For your amusement:
Once is happenstance,
Twice is coincidence,
Three times is enemy action.
-- Auric Goldfinger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clim-launcher-20060125-01.tar.bzip2
Type: application/octet-stream
Size: 2866 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20060125/bfaeb807/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20060125/bfaeb807/attachment.sig>
More information about the mcclim-devel
mailing list