Re: Subclasses
Carlos Agon <[email protected]> Tue, 7 Feb 2006 10:21:45 +0100
| Newsgroups | gmane.lisp.clg.devel |
|---|---|
| Message-ID | <[email protected]> |
hi Espen thanks for your work it is great and very useful for us we are porting our software OpenMusic on LInux. OpenMusic is a visual interface of CLOS including special classes and methods for music composition. It runs on Mac and windows but many people ask us for a Linux version. OpenMusic sources are available under the GNU Public License (GPL), porting it on Linux will allow us to make a true free version. You can see more details about OpenMusic at: http://recherche.ircam.fr/equipes/repmus/OpenMusic/ To start we need to find a class equivalent to the class view in MCL, it is, a container allowing to include other containers at any position and of any size. We need also to draw into these containers. At the moment I have not found a class equivalent, do you know such a class ? or may be we need to use different classes i.e. layout + drawing-area. Can you give us an advice please ? thanks again CArlos AGon Le 7 févr. 06 à 00:18, Espen S Johnsen a écrit : > Espen S Johnsen <[email protected]> writes: > > >> I found an article¹ about writing custom widgets in Pyton and >> decided to >> write the example in Lisp. It is not very advanced, but it could >> easily >> be extended to do something more useful. The next article is >> promised to >> do that. Anyway here is the example (it requires the latest code >> which >> may not propagate into anonymous CVS until a few hours²): >> > > Sorry, that was the wrong code. Here is a working example: > > (defclass egg-clock-face (drawing-area) > () > (:metaclass gobject-class)) > > (define-signal-handler expose-event ((clock egg-clock-face) event) > (let ((cr (gdk:cairo-create (widget-window clock)))) > (with-slots (gdk:x gdk:y gdk:width gdk:height) event > (cairo:rectangle cr gdk:x gdk:y gdk:width gdk:height)) > (cairo:clip cr) > > (multiple-value-bind (width height) (widget-get-size-allocation > clock) > (let* ((x (/ width 2)) > (y (/ height 2)) > (radius (- (min (/ width 2) (/ height 2)) 5))) > > (cairo:circle cr x y radius) > (cairo:set-source-color cr 1.0 1.0 1.0) > (cairo:fill cr t) > (cairo:set-source-color cr 0 0 0) > (cairo:stroke cr) > > (loop > for tick from 0 below 12 > do (cairo:with-context (cr) > (let ((inset (if (zerop (mod tick 3)) > (* 0.2 radius) > (progn > (setf > (cairo:line-width cr) > (* 0.5 (cairo:line-width cr))) > (* 0.1 radius))))) > > (cairo:move-to cr > (+ x (* (- radius inset) (cos (* tick (/ pi 6))))) > (+ y (* (- radius inset) (sin (* tick (/ pi 6)))))) > (cairo:line-to cr > (+ x (* radius (cos (* tick (/ pi 6))))) > (+ y (* radius (sin (* tick (/ pi 6)))))) > (cairo:stroke cr))))))) > nil) > > > #+sbcl(sb-int:set-floating-point-modes :traps nil) > #+cmu(ext:set-floating-point-modes :traps nil) > > (make-instance 'window > :child (make-instance 'egg-clock-face :visible t) > :visible t) > > -- > Espen > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through > log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD > SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 > _______________________________________________ > Clg-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/clg-devel > >