[cells-gtk-devel] gtk first app
Peter Hildebrandt
peter.hildebrandt at gmail.com
Sat Jan 17 12:01:59 UTC 2009
Hello Johan,
welcome aboard! As to your questions:
(1) yeah, I know about Martin's fix, and you are right; this appears
to be permanent now. When I did a lot of cells-gtk work about 8
months ago, SBCL still needed this specific utf patch due to some
issue with cffi. Apparently this is fixed in cffi now and the patch
can go away.
I have been quite busy with my day job for the past couple months,
which is why there hasn't been any progress with cells-gtk. My
apologies to all you guys.
Things are looking a little better at the moment, so I hope I can get
around to submitting a few patches and working on the docs in the near
future.
(2) The cairo drawing area is distinct from the cairo-x11 thingy. The
cairo-x11 canvas uses x11 directly to display its own window which is
solely for drawing. The cairo-drawing-area is a gtk widget which
allows the use of cairo for drawing.
Just like the threading, the latter is disabled by default (for folks
who do not have cairo). Therefore you need to push the
cairo-drawing-area feature (or something like this, I forget. It is
commented out in one of the asds, I believe. Chekc the sources), then
kill the fasls, and recompile.
Then check the sources in test-gtk (test-drawing I believe it is) to
see how it is used. I hope I will get around to writing this up in
the near future now that I see that there's people out there who would
actually care :-)
If you have any further questions, please lemme know.
Best,
Peter
On Fri, Jan 16, 2009 at 11:40 PM, Johan Ur Riise <johan at riise-data.no> wrote:
>> I even managed to get the cairo-canvas working.
>> Here is a small sample programm:
>>
>>
>> (require 'asdf)
>> (require 'cl-cairo2)
>> (require 'cl-cairo2-x11)
>> (require 'cells-gtk)
>>
>> (defpackage :cell-gtk-cairo (:use :cl :cells-gtk :cells))
>> (in-package :cell-gtk-cairo)
>>
>> (defparameter *gtk-debug* nil)
>>
>> (defmodel my-app (gtk-app)
>> ()
>> (:default-initargs :title "cells"
>> :md-name :martin-top
>> :position :center
>> :width (c-in 200) :height (c-in 200)
>> :kids (c-in nil)))
>>
>> (init-gtk)
>> (start-win 'my-app)
>
> I got this far. I had to push :cells-gtk-threads to *features*, then
> kill the fasls, then load cells-gtk again (to get the start-win function
> compiled). A window appears,
>
>>
>> ; to destroy the window contents
>> (progn
>> (not-to-be (find-widget :cairo-draw))
>> (setf (kids (find-widget :martin-top)) nil))
>>
>> (setf
>> (kids (find-widget :martin-top))
>> (list
>> (mk-vbox
>> :fm-parent (find-widget :martin-top)
>> :kids
>> (kids-list?
>> (make-kid 'cairo-drawing-area
>> :expand t :fill t
>> :width (c-in 40)
>> :height (c-in 40)
>> :md-name :cairo-draw)
>> (mk-button
>> :label "create rectangle"
>> :on-clicked
>> (callback (w e d)
>> (mk-primitive (find-widget :cairo-draw)
>> :rectangle
>> :p1 (c-in (2d:v 10 10))
>> :p2 (c-in (2d:v 49 94))
>> :filled t
>> :selectable t
>> :draggable t
>> :rgb '(1 0 0))))
>> (mk-button
>> :label "create text-label"
>> :on-clicked
>> (callback (w e d)
>> (mk-primitive (find-widget :cairo-draw)
>> :text-label
>> :text "Hallo Welt!"
>> :p1 (c-in (2d:v 20 20))
>> :filled t
>> :selectable t
>> :draggable t
>> :rgb '(1 0 0))))
>> (mk-button
>> :label "create line"
>> :on-clicked
>> (callback (w e d)
>> (mk-primitive (find-widget :cairo-draw)
>> :line
>> :p1 (c-in (2d:v 0 0))
>> :p2 (c-in (2d:v 49 94))
>> :filled t
>> :selectable t
>> :draggable t
>> :rgb '(1 0 0))))))))
>>
>>
>
> On compiling this I get a condition "There is no class named
> CAIRO-DRAWING-AREA."
>
>
>> I just run this in slime. I found out, that you can destroy the
>> contents of
>> the window with not-to-be. That is very convenient if you want to
>> change
>> the program on the fly.
>>
>> I would really like to build a small raytracing program for lens
>> systems.
>> But unfortunately I'm somewhat stuck. I still don't understand how to
>> create new widgets in the cairo panel in cell-style
>> e.g. a lens which can be moved around or a ray that is refracted at a
>> surface
>> and whose angle can be changed by moving the intersection point with
>> the
>> mouse.
>>
>> I guess it looks really cool once I have this working.
>>
>> Martin
>>
>
>
>
> _______________________________________________
> cells-gtk-devel site list
> cells-gtk-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cells-gtk-devel
>
More information about the cells-gtk-devel
mailing list