[cells-gtk-devel] cells-gtk drawing-area widget

Peter Denno peter.denno at nist.gov
Tue Jun 12 14:16:21 UTC 2007


On Sunday 10 June 2007 00:56, Martin Flack wrote:
> Hi guys,

Hi, Martin.
>
> I've managed to get cells-gtk drawing-area to basically work. I'm
> attaching the diff. A few notes follow.
>
> In drawing.lisp I shuffled some stuff around and used the double
> colon package selector to get it find all the symbols on first
> load. There may be a slightly cleaner way to do this.

Probably just exporting them from wherever they are would be fine. 
>
> I fixed a bug where *window* was not bound on first run and caused
> an error, but would be ok on later runs in the same Lisp image.
>
> I made button1-down, button2-down, and button3-down all cells so
> that you can use them as inputs in the cells-gtk framework.
>
> For the future, I suspect that drawing-expose-event-handler could
> probably be simpler and not call init-graphics-context each time?
> Also drawing-pointer-motion-handler produces an effect but probably
> not quite what was intended (the image is moved while you hold down
> the button, but excess areas are not cleaned so it looks slurred
> along, and subsequent tries move it from 0,0 again).

I don't recall any problems like that.

>
> I'm on SBCL on Ubuntu 7.04.

I'll check it out soon, and if things work OK, merge it in. I haven't 
worked on this code in at least a year, but I seem to recall having a 
plan to use closures to draw things.  We are intending to switch to 
Cairo???  Also, ideally, we'd add example code to the test-gtk demo, 
as yet another tab in the notebook.

I found a call to the code that I was experimenting with. It looks 
like this:
(defmodel instance-diagram (window)
  ()
  (:default-initargs
   :md-name :instance-diagram :width 700 :height 
500 :position :center ))
   :kids
   (list 
    (mk-drawing-area 
     :md-name :drawing-area :fill t :expand t 
     :draw-fn 
     #'(lambda (self) )))
	 (with-pixmap (p "demo" :widget self :width 100 :height 100)
            (with-gc (p :fg "red") (draw-line p 0 0 100 100))
	    (draw-text p "this is text" 10 70)
	    (draw-rectangle p 10 10 30 30)
	    (draw-rectangle p 1 1 97 97)
	    (insert-pixmap p 0 0)
	    p))))))
      


>
> Martin Flack

-- 
Best regards,
  - Peter



More information about the cells-gtk-devel mailing list