From ramarren at gmail.com Wed Jul 1 05:53:52 2009 From: ramarren at gmail.com (Ramarren) Date: Wed, 1 Jul 2009 07:53:52 +0200 Subject: [cells-devel] make-instance, initarg, c-in In-Reply-To: <4A4A8452.3000408@web.de> References: <4A4A8452.3000408@web.de> Message-ID: Hello, Not that I think this is a really good idea, but you can do it using the infamous MOP, using http://www.cliki.net/closer-mop as a compatibility layer: (defmodel auto-cin-model () ()) (defun class-initargs (class) (let ((slots (closer-mop:class-slots class))) (let ((class-initargs (mapcar #'closer-mop:slot-definition-initargs slots))) (remove-if #'(lambda (x) (= (length x) 1)) (mapcar #'list* slots class-initargs))))) (defmethod shared-initialize :after ((instance auto-cin-model) slot-names &rest initargs) (declare (ignore slot-names)) (let ((class-initargs (class-initargs (class-of instance))) (leftmost-initargs (make-hash-table))) (loop for (init-arg init-value) on initargs by #'cddr for init-slot = (car (rassoc init-arg class-initargs :test #'member)) for slot-name = (closer-mop:slot-definition-name init-slot) do (when (and (not (gethash init-slot leftmost-initargs)) (cells::md-slot-cell-type (class-name (class-of instance)) slot-name) (not (typep init-value 'cell))) (setf (slot-value instance slot-name) (c-in init-value))) (setf (gethash init-slot leftmost-initargs) t)))) Now all models inheriting from auto-cin-model will have this behaviour. This is only marginally tested, so probably contains bugs. For one thing, it overrides cells-created shared-initialize, but that is only for checking for error which is impossible in this situation anyway. Regards, Jakub Higersberger On Tue, Jun 30, 2009 at 11:32 PM, Bastian M?ller wrote: > Hi, > > I'm currently using cells and it works very well, > except one thing seems a little unhandy: > > When defining a model it's possible to use (c-in ..) > as an initform to define a slot as a cell, but when > instantiating a class you have to supply (c-in ...) > instead the normal value, eg. > > (defmodel x () > ?((y :accessor y > ? ? ?:initarg :y > ? ? ?:initform (c-in nil)) > ? ...)) > > (let ((test (make-instance 'x :y (c-in 1)))) > ?(setf (y test) 2)) > > works, but instead sth like > > (let ((test (make-instance 'x :y 1))) > ?(setf (y test) 2)) > > would be nice. > > I tried it with > > (defmethod initialize-instance ((self x) &rest rest) > ?(loop for slot in rest by #'cddr > ? ? do (let ((value (getf rest slot)) > ? ? ? ? ? ? ?(name (intern (symbol-name slot)))) > ? ? ? ? ?(setf (slot-value self name) > ? ? ? ? ? ? ? ?(c-in value))))) > > but I just get: > > The slot CELLS::.CELLS is unbound in the object #. > ? [Condition of type UNBOUND-SLOT] > > Is there any way to get this behavior? > > kind regards, > ?Bastian > > _______________________________________________ > cells-devel site list > cells-devel at common-lisp.net > http://common-lisp.net/mailman/listinfo/cells-devel > From ramarren at gmail.com Wed Jul 1 06:21:45 2009 From: ramarren at gmail.com (Ramarren) Date: Wed, 1 Jul 2009 08:21:45 +0200 Subject: [cells-devel] make-instance, initarg, c-in In-Reply-To: References: <4A4A8452.3000408@web.de> Message-ID: I forgot that a single initarg can specify multiple slots! So the code should be more like: (defmodel auto-cin-model () ()) (defun class-initargs (class) (let ((slots (closer-mop:class-slots class))) (let ((class-initargs (mapcar #'closer-mop:slot-definition-initargs slots))) (remove-if #'(lambda (x) (= (length x) 1)) (mapcar #'list* slots class-initargs))))) (defun slots-for-initarg (initarg class-initargs) (loop for (slot . initargs) in class-initargs appending (when (member initarg initargs) (list slot)))) (defmethod shared-initialize :after ((instance auto-cin-model) slot-names &rest initargs) (declare (ignore slot-names)) (let ((class-initargs (class-initargs (class-of instance))) (leftmost-initargs (make-hash-table))) (loop for (init-arg init-value) on initargs by #'cddr do (loop for init-slot in (slots-for-initarg init-arg class-initargs) for slot-name = (closer-mop:slot-definition-name init-slot) do (when (and (not (gethash init-slot leftmost-initargs)) (cells::md-slot-cell-type (class-name (class-of instance)) slot-name) (not (typep init-value 'cell))) (setf (slot-value instance slot-name) (c-in init-value)) (setf (gethash init-slot leftmost-initargs) t)))))) Of course, it would be much easier to just iterate over all slots and set those which are not cells but should be to c-in, but there is "initarg" in the subject after all. Regards, Jakub Higersberger On Wed, Jul 1, 2009 at 7:53 AM, Ramarren wrote: > Hello, > > Not that I think this is a really good idea, but you can do it using > the infamous MOP, using http://www.cliki.net/closer-mop as a > compatibility layer: > > (defmodel auto-cin-model () > ?()) > > (defun class-initargs (class) > ?(let ((slots (closer-mop:class-slots class))) > ? ?(let ((class-initargs > ? ? ? ? ? (mapcar #'closer-mop:slot-definition-initargs slots))) > ? ? ?(remove-if #'(lambda (x) > ? ? ? ? ? ? ? ? ? ? (= (length x) 1)) > ? ? ? ? ? ? ? ? (mapcar #'list* slots class-initargs))))) > > (defmethod shared-initialize :after ((instance auto-cin-model) > slot-names &rest initargs) > ?(declare (ignore slot-names)) > ?(let ((class-initargs (class-initargs (class-of instance))) > ? ? ? ?(leftmost-initargs (make-hash-table))) > ? ?(loop for (init-arg init-value) on initargs by #'cddr > ? ? ? ? ?for init-slot = (car (rassoc init-arg class-initargs :test #'member)) > ? ? ? ? ?for slot-name = (closer-mop:slot-definition-name init-slot) > ? ? ? ? ?do (when (and (not (gethash init-slot leftmost-initargs)) > ? ? ? ? ? ? ? ? ? ? ? ?(cells::md-slot-cell-type (class-name > (class-of instance)) slot-name) > ? ? ? ? ? ? ? ? ? ? ? ?(not (typep init-value 'cell))) > ? ? ? ? ? ? ? (setf (slot-value instance slot-name) (c-in init-value))) > ? ? ? ? ? ? (setf (gethash init-slot leftmost-initargs) t)))) > > Now all models inheriting from auto-cin-model will have this > behaviour. This is only marginally tested, so probably contains bugs. > For one thing, it overrides cells-created shared-initialize, but that > is only for checking for error which is impossible in this situation > anyway. > > Regards, > Jakub Higersberger > > On Tue, Jun 30, 2009 at 11:32 PM, Bastian M?ller wrote: >> Hi, >> >> I'm currently using cells and it works very well, >> except one thing seems a little unhandy: >> >> When defining a model it's possible to use (c-in ..) >> as an initform to define a slot as a cell, but when >> instantiating a class you have to supply (c-in ...) >> instead the normal value, eg. >> >> (defmodel x () >> ?((y :accessor y >> ? ? ?:initarg :y >> ? ? ?:initform (c-in nil)) >> ? ...)) >> >> (let ((test (make-instance 'x :y (c-in 1)))) >> ?(setf (y test) 2)) >> >> works, but instead sth like >> >> (let ((test (make-instance 'x :y 1))) >> ?(setf (y test) 2)) >> >> would be nice. >> >> I tried it with >> >> (defmethod initialize-instance ((self x) &rest rest) >> ?(loop for slot in rest by #'cddr >> ? ? do (let ((value (getf rest slot)) >> ? ? ? ? ? ? ?(name (intern (symbol-name slot)))) >> ? ? ? ? ?(setf (slot-value self name) >> ? ? ? ? ? ? ? ?(c-in value))))) >> >> but I just get: >> >> The slot CELLS::.CELLS is unbound in the object #. >> ? [Condition of type UNBOUND-SLOT] >> >> Is there any way to get this behavior? >> >> kind regards, >> ?Bastian >> >> _______________________________________________ >> cells-devel site list >> cells-devel at common-lisp.net >> http://common-lisp.net/mailman/listinfo/cells-devel >> > From turbo24prg at web.de Sat Jul 4 23:06:19 2009 From: turbo24prg at web.de (=?ISO-8859-1?Q?Bastian_M=FCller?=) Date: Sun, 05 Jul 2009 00:06:19 +0100 Subject: [cells-devel] make-instance, initarg, c-in In-Reply-To: References: <4A4A8452.3000408@web.de> <4A4E9004.3050506@web.de> Message-ID: <4A4FE06B.30108@web.de> Ramarren schrieb: Hi, > It doesn't work because it was a bad idea anyway... I didn't pay > attention to the fact, that by the time an after method on > shared-initialize fires the model is already initiated into the cells > framework, so any changes at that point are too late. Fortunately it > is easy enough to get around with the power of CLOS: > > Again, I did not test this much, but it seems to work, especially > since it doesn't really touch anything inside Cells. I still think it > is not a very good idea, for reasons Kenny specified earlier. I tried it and after adding cells::model-object to the superclasses of the class that is using auto-cin-model everything worked very well. Thanks! I still don't get why it's a bad idea - it seems pretty handy. The user of the library won't have to care to provide c-in wrapped values as initargs, he doesn't need to care for the internals. I put the test in a gist on github: http://gist.github.com/140709 > As an aside, if it is not just amazing username coincidence, judging > by this paste http://paste.lisp.org/display/59172/ You tried to create > bindings for Clutter. If so, You might be interested in my attempt at > http://github.com/Ramarren/cffi-clutter/tree/master , which more or > less works, for some very low values of "works". Shows a moving > rectangle, anyway. Unfortunately, faced with the facts that moving > forward would require understanding enough of GObject to subclass its > objects and that I don't really need it that much, it is unlikely to > progress much further. Yeah, I tried to get a clutter binding, but unfortunately hadn't very much luck with it. I looked around and found your bindings on github and follow it, but didn't try it yet, because of lack of time and I'm not as far with my stuff to use it yet, but I'll sure do so. Thanks for the hint. kind regards, Bastian From kentilton at gmail.com Sat Jul 4 23:18:13 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Sat, 04 Jul 2009 19:18:13 -0400 Subject: [cells-devel] make-instance, initarg, c-in In-Reply-To: <4A4FE06B.30108@web.de> References: <4A4A8452.3000408@web.de> <4A4E9004.3050506@web.de> <4A4FE06B.30108@web.de> Message-ID: <4A4FE335.9070601@gmail.com> Bastian M?ller wrote: > Ramarren schrieb: > Hi, > >> It doesn't work because it was a bad idea anyway... I didn't pay >> attention to the fact, that by the time an after method on >> shared-initialize fires the model is already initiated into the cells >> framework, so any changes at that point are too late. Fortunately it >> is easy enough to get around with the power of CLOS: >> >> Again, I did not test this much, but it seems to work, especially >> since it doesn't really touch anything inside Cells. I still think it >> is not a very good idea, for reasons Kenny specified earlier. > > I tried it and after adding cells::model-object to the superclasses > of the class that is using auto-cin-model everything worked very well. > Thanks! I still don't get why it's a bad idea - Performance: http://smuglispweeny.blogspot.com/2008/02/cells-manifesto.html See "No Cell At All". kt From kentilton at gmail.com Fri Jul 10 19:18:10 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Fri, 10 Jul 2009 15:18:10 -0400 Subject: [cells-devel] [cello-devel] Where can I see the screenshots and obtain a copy of Cello? In-Reply-To: <2473b43f0907100946h6c4d154qf8dcab345ca81796@mail.gmail.com> References: <2473b43f0907100946h6c4d154qf8dcab345ca81796@mail.gmail.com> Message-ID: <4A5793F2.5050207@gmail.com> The only thing I ever do any more is commit my latest source back to CVS. Frank Goenninger had a Cello make-over project going but I am not sure he released anything (or got far enough to do so or something). Web access: http://common-lisp.net/cgi-bin/viewcvs.cgi/?root=cello You can use CVS or just grab the tarball. I have been astonished by reports of people managaing to get the whole thing working unaided, so it is not impossible, just close to it. Not that you would be unaided, just ask and we happy few Cellists will help. I'll look around to see if I can find those screenshots. kt Adam Olsen wrote: > Hi, > > I'd like to use Cello, but unfortunately the FTP url mentioned on the > homepage leads to an empty directory > (ftp://common-lisp.net/pub/project/cello/) > > Can anyone help me out here? > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.8/2227 - Release Date: 07/09/09 05:55:00 > From frgo at me.com Fri Jul 10 19:47:25 2009 From: frgo at me.com (Frank Goenninger) Date: Fri, 10 Jul 2009 21:47:25 +0200 Subject: [cells-devel] [cello-devel] Where can I see the screenshots and obtain a copy of Cello? In-Reply-To: <4A5793F2.5050207@gmail.com> References: <2473b43f0907100946h6c4d154qf8dcab345ca81796@mail.gmail.com> <4A5793F2.5050207@gmail.com> Message-ID: Am 10.07.2009 um 21:18 schrieb Kenneth Tilton: | Frank Goenninger had a Cello make-over project going but I am not | sure he released anything (or got far enough to do so or something). Actually I am currently debugging a nasty OpenGL/FTGL font handling issues with texture fonts and some race condition in the code. So, still a huge amount of work to do, but slowly and steadily getting there. Unfortunately I have won a rather large consulting project that needs 150% of my time. The other 150% are divided between my family and the Cello NX work ;-) Bottom line: It will take at least some months until I get something out that's worth sharing... Best, Frank Adam Olsen wrote: > Hi, > > I'd like to use Cello, but unfortunately the FTP url mentioned on the > homepage leads to an empty directory > (ftp://common-lisp.net/pub/project/cello/) > > Can anyone help me out here? > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.8/2227 - Release Date: > 07/09/09 05:55:00 > _______________________________________________ cello-devel site list cello-devel at common-lisp.net http://common-lisp.net/mailman/listinfo/cello-devel -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo at me.com From achambers.home at googlemail.com Sat Jul 11 15:00:18 2009 From: achambers.home at googlemail.com (Andy Chambers) Date: Sat, 11 Jul 2009 16:00:18 +0100 Subject: [cells-devel] Currently focused window Message-ID: Hi, How would you get the currently focused window in celtk? (I'm trying to write a help bubble that pops up when someone pauses the mouse over a widget for a wee while). Cheers, Andy -- ---- Andy Chambers Formedix Ltd From kentilton at gmail.com Sat Jul 11 20:33:54 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Sat, 11 Jul 2009 16:33:54 -0400 Subject: [cells-devel] Currently focused window In-Reply-To: References: <4A58B129.1000801@gmail.com> Message-ID: <4A58F732.8010707@gmail.com> Andy, Please search on :motionnotify. I see an example in the gears demo. I know that is OpenGL but I am pretty sure all the code you see in there in re event handling is generic to Tk, nothing about OpenGl. The nise thing about Tk via FFI is the control one gets from low-level access to the event stream. There are rare cases where I feel Tk did not expose enough via an API -- I remember vaguely something about key events, forcing me to code up a virtual event handler -- but as a rule the Tcl/Tk world is your oyster with an FFI based interface. Gotta run or I would offer more deets. kt Andy Chambers wrote: > On Sat, Jul 11, 2009 at 4:35 PM, Kenneth Tilton wrote: >> >> Andy Chambers wrote: >>> Hi, >>> >>> How would you get the currently focused window in celtk? (I'm trying >>> to write a help bubble >>> that pops up when someone pauses the mouse over a widget for a wee while). >> I do a lot of that, but... you are using vanilla Celtk, including Tk >> widgets? By currently focused window you mean... what, the Tk idea of the >> current widget? Or the Celtk idea thereof? Or did you mean the toplevel >> window? Or... > > Here's the context... > > (defmd root (window) > :kids (c? (the-kids > (mk-stack (:packing (c?pack-self)) > (mk-ui :aeyn) > (mk-ui :aeterm) > (mk-ui :aestdat)) > (mk-canvas > :height 200 > :background "#ffff99" > :kids (c? (the-kids > (mk-text-item > :coords (list 10 10) > :text "Help Text"))) > :parent-x 10 > :parent-y 20)))) > > mk-ui is a little utility I have that goes off to look for a "field" > definition and > knows how to convert that field into celtk objects. Currently, the canvas > slots are hard-coded but I'd like the position, size, and contents of this > object to change based on where the mouse is. So to answer your question, > I think it's Celtk's idea of the current widget that I need. > > The way I thought of doing it originally was to add a tk <> event > and wait for that in the root window. The tcl attached below does this so > maybe it's just a case of adding this when the window first starts up. I > just wondered if there was a better way of doing it purely in celtk land. > > #!/usr/bin/env wish -f > > global items # For want of a better name > > # I chose Circulate because this is never generated by Tk itself > # and I only want to trigger these events myself because Tk doesn't > # know when to do it. > event add <> > > bind all { > global items > set id [ after 500 { event generate "%W" <> } ] > set items("%W") $id > } > > bind all { > global items > after cancel $items("%W") > unset items("%W") > } > > bind . <> { > puts "A wee pause just happened on %W..." > } > > > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.375 / Virus Database: 270.13.10/2231 - Release Date: 07/11/09 05:57:00 > From achambers.home at googlemail.com Sat Jul 11 22:16:00 2009 From: achambers.home at googlemail.com (Andy Chambers) Date: Sat, 11 Jul 2009 23:16:00 +0100 Subject: [cells-devel] Currently focused window In-Reply-To: <4A58F732.8010707@gmail.com> References: <4A58B129.1000801@gmail.com> <4A58F732.8010707@gmail.com> Message-ID: On Sat, Jul 11, 2009 at 9:33 PM, Kenneth Tilton wrote: > Andy, > > Please search on :motionnotify. I see an example in the gears demo. I know > that is OpenGL but I am pretty sure all the code you see in there in re > event handling is generic to Tk, nothing about OpenGl. > > The nise thing about Tk via FFI is the control one gets from low-level > access to the event stream. There are rare cases where I feel Tk did not > expose enough via an API -- I remember vaguely something about key events, > forcing me to code up a virtual event handler -- but as a rule the Tcl/Tk > world is your oyster with an FFI based interface. Cool I've got something working. Just posting it to the list in-case anyone else wants to use it... The usage would be... (defmd my-window (window) :kids (c? (the-kids (mk-stack (:packing (c?pack-self)) (mk-label :text "hi" :on-hover (lambda () (trc "hovering..."))))))) The on-hover function only gets called after the mouse has been sitting in the widget for 1 1/2 seconds. The attached patch puts an on-hover slot on the widget class so you should be able to apply to any widget in your hierarchy. -- Andy -------------- next part -------------- A non-text attachment was scrubbed... Name: hover.patch Type: text/x-patch Size: 2617 bytes Desc: not available URL: From frgo at me.com Sun Jul 12 11:32:22 2009 From: frgo at me.com (Frank Goenninger) Date: Sun, 12 Jul 2009 13:32:22 +0200 Subject: [cells-devel] Currently focused window In-Reply-To: References: <4A58B129.1000801@gmail.com> <4A58F732.8010707@gmail.com> Message-ID: <1AFC36EC-9619-484C-86C7-D221D821EE1B@me.com> Hi Andy, thanks for this! Cheers Frank Am 12.07.2009 um 00:16 schrieb Andy Chambers: On Sat, Jul 11, 2009 at 9:33 PM, Kenneth Tilton wrote: > Andy, > > Please search on :motionnotify. I see an example in the gears demo. > I know > that is OpenGL but I am pretty sure all the code you see in there in > re > event handling is generic to Tk, nothing about OpenGl. > > The nise thing about Tk via FFI is the control one gets from low-level > access to the event stream. There are rare cases where I feel Tk did > not > expose enough via an API -- I remember vaguely something about key > events, > forcing me to code up a virtual event handler -- but as a rule the > Tcl/Tk > world is your oyster with an FFI based interface. Cool I've got something working. Just posting it to the list in-case anyone else wants to use it... The usage would be... (defmd my-window (window) :kids (c? (the-kids (mk-stack (:packing (c?pack-self)) (mk-label :text "hi" :on-hover (lambda () (trc "hovering..."))))))) The on-hover function only gets called after the mouse has been sitting in the widget for 1 1/2 seconds. The attached patch puts an on-hover slot on the widget class so you should be able to apply to any widget in your hierarchy. -- Andy _______________________________________________ cells-devel site list cells-devel at common-lisp.net http://common-lisp.net/mailman/listinfo/cells-devel -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo at me.com From achambers.home at googlemail.com Mon Jul 13 20:12:22 2009 From: achambers.home at googlemail.com (Andy Chambers) Date: Mon, 13 Jul 2009 21:12:22 +0100 Subject: [cells-devel] tk-client-task-priority Message-ID: Hey Kenny/Frank, How did you work out the correct order of the tk-client-task-priority? I get that tk objects have to be created before they can be configured and that's why :configure appears near the end of the list but why are the :delete, :forget tasks so high up? What if something is scheduled to be deleted and configured in the same cells "timeframe"? Cheers, Andy -- ---- Andy Chambers Formedix Ltd From kentilton at gmail.com Mon Jul 13 20:39:39 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Mon, 13 Jul 2009 16:39:39 -0400 Subject: [cells-devel] tk-client-task-priority In-Reply-To: References: Message-ID: <4A5B9B8B.1040000@gmail.com> Andy Chambers wrote: > Hey Kenny/Frank, > > How did you work out the correct order of the tk-client-task-priority? That all arose from pragmatics, ie, solving things that kicked back during development. > I > get that tk objects have to be created before they can be configured > and that's why :configure appears near the end of the list but why are > the :delete, :forget tasks so high up? What if something is scheduled > to be deleted and configured in the same cells "timeframe"? It sounds impossible for one datapulse to cause a declarative engine to decide something should both exist and not exist. That said... The pragmatic history is forgotten, but normally one wants to clear the stage of things who will not be around for the next datapulse before introducing new information, lest the guys on death row get all busy with some of the new information (and new information cannot possibly want information that should not be there). In your case, something is both coming to life and being purged in one go. Maybe a change makes the thing occur but makes a parent or grandparent thing decide to go away. In that case it probably works best to let the thing come into existence and /then/ clean it up. But let's understand your use case a little better -- how did the birth/death conflation come to pass? kt From achambers.home at googlemail.com Tue Jul 14 22:38:05 2009 From: achambers.home at googlemail.com (Andy Chambers) Date: Tue, 14 Jul 2009 23:38:05 +0100 Subject: [cells-devel] its-alive! Message-ID: What's the concept behind the "its-alive" feature keyword? Is it for when you're making changes to cells internals and you want to only run a small part of the engine so you stop other parts from running? Just wondering. -- Andy From frgo at me.com Wed Jul 15 12:23:55 2009 From: frgo at me.com (Frank Goenninger) Date: Wed, 15 Jul 2009 14:23:55 +0200 Subject: [cells-devel] its-alive! In-Reply-To: References: Message-ID: <95761C9C-5A8B-40D8-8A8D-6D13FA9BF9CE@me.com> Hi Andy, Am 15.07.2009 um 00:38 schrieb Andy Chambers: > What's the concept behind the "its-alive" feature keyword? Is it for > when you're > making changes to cells internals and you want to only run a small > part of the engine > so you stop other parts from running? > > Just wondering. I've always interpreted Kenny's "its-alive" inserts as "When the application is in production (= alive) then do/don't do this and this". I never personally used it. I just made sure that those don't get into my way. ;-) Cheers Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo at me.com From kentilton at gmail.com Wed Jul 15 12:25:04 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Wed, 15 Jul 2009 08:25:04 -0400 Subject: [cells-devel] its-alive! In-Reply-To: References: Message-ID: <4A5DCAA0.7020501@gmail.com> Andy Chambers wrote: > What's the concept behind the "its-alive" feature keyword? Is it for > when you're > making changes to cells internals and you want to only run a small > part of the engine > so you stop other parts from running? No, it is a play on "going live", which means "in production". I'd have to see particular uses to explain why each is the way it is. kt From frgo at me.com Tue Jul 21 17:06:20 2009 From: frgo at me.com (Frank Goenninger) Date: Tue, 21 Jul 2009 19:06:20 +0200 Subject: [cells-devel] adopt-ct ? Meaning ? Message-ID: Hi Kenny, all: I am wondering what the meaning of slot adopt-ct really is ... What does it / what should it do? Thx!!! Best Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo at me.com From kentilton at gmail.com Tue Jul 21 18:31:28 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Tue, 21 Jul 2009 14:31:28 -0400 Subject: [cells-devel] adopt-ct ? Meaning ? In-Reply-To: References: Message-ID: <4A660980.1020007@gmail.com> Frank Goenninger wrote: > Hi Kenny, all: > > I am wondering what the meaning of slot adopt-ct really is ... What > does it / what should it do? That is just a debugging aid to detect when someone already adopted gets adopted again because of some hairy/crazy logic I might be guilty of -- generally a miscoded rule building a tree where a grandparent tries to take a grandkid as a kid. And that code might vary from time to time since I have been known to detach kids and reattach them elsewhere (ie, it is cool to be adopted more than once). Looking at the usages now it could just be a boolean, but I think I was taking a broader view and did not want to lock in any presumptions. Not really sure on that. Likewise for just looking to see if I already have a parent. kt From frgo at me.com Fri Jul 24 08:52:44 2009 From: frgo at me.com (Frank Goenninger) Date: Fri, 24 Jul 2009 10:52:44 +0200 Subject: [cells-devel] Cello: 'find-view-under: Semantics ? Message-ID: <0D31438A-962C-44D5-9E8F-FC745E2CB6C6@me.com> Hi again - thanks again for the fast response on my last request - hoping for another fast one here ;-) So, Cello (the original one) has this function: (defun find-ix-under (self os-pos &key (test #'true)) (when (and (not (typep self 'tool-tip)) ;; (visible self) (not (collapsed self))) (trc nil "find-ix-under" self os-pos (screen-box self)) (let ((inself (point-in-box os-pos (screen-box self)))) (or (when (or inself (not (clipped self))) (trc nil "inside self sbox" self os-pos (screen-box self)) (dolistreversed (k (or (render-order self)(kids self))) ;; overlap goes to last kid displayed (unless (typep k 'window) (trc nil "fixunder kid!!!!!!!!" k) (bwhen (ix (find-ix-under k os-pos :test test)) (return-from find-ix-under ix))))) (when (and inself (funcall test self) (not (ix-click-transparent self))) (trc nil self os-pos (screen-box self)) self))))) which is used as follows: (defmd mouse-view-tracker () (mouse-view :initarg :mouse-view :accessor mouse-view :initform (c? (let ((pos (mouse-pos .og.))) (trc nil "mouseview sees pos" .w. pos) (when pos (eko (nil "ix-togl mouseview >" self) (without-c-dependency (find-ix-under self pos))))))) (:documentation "Mixin to have mouse view tracked in a subtree of the window, mostly so other GUI layout can depend on the sub-tree layout without creating a cyclic dependency, as would happen iof the whole window were watched.")) (defmd ix-togl (mouse-view-tracker #+not focuser ogl-lit-scene control ogl-shared-resource-tender togl ix-view) ... So, the togl widget is a sub-class of mouse-view-tracker. I understand this as "show me the control that is currently being pointed at by the mouse". Only thing is: When looking at the code for 'find-ix-under I can't see how this could possibly work? May I ask for a walk-through of find-ix- under ? Thanks!!! Cheers Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo at me.com From kentilton at gmail.com Fri Jul 24 15:48:12 2009 From: kentilton at gmail.com (Kenneth Tilton) Date: Fri, 24 Jul 2009 11:48:12 -0400 Subject: [cells-devel] Cello: 'find-view-under: Semantics ? In-Reply-To: <0D31438A-962C-44D5-9E8F-FC745E2CB6C6@me.com> References: <0D31438A-962C-44D5-9E8F-FC745E2CB6C6@me.com> Message-ID: <4A69D7BC.7070703@gmail.com> Frank Goenninger wrote: > Hi again - > > thanks again for the fast response on my last request - hoping for > another fast one here ;-) > > So, Cello (the original one) has this function: > > (defun find-ix-under (self os-pos &key (test #'true)) > (when (and (not (typep self 'tool-tip)) ;; > (visible self) > (not (collapsed self))) > (trc nil "find-ix-under" self os-pos (screen-box self)) > (let ((inself (point-in-box os-pos (screen-box self)))) > (or (when (or inself (not (clipped self))) > (trc nil "inside self sbox" self os-pos (screen-box self)) > (dolistreversed (k (or (render-order self)(kids > self))) ;; overlap goes to last kid displayed > (unless (typep k 'window) > (trc nil "fixunder kid!!!!!!!!" k) > (bwhen (ix (find-ix-under k os-pos :test test)) > (return-from find-ix-under ix))))) > > (when (and inself > (funcall test self) > (not (ix-click-transparent self))) > (trc nil self os-pos (screen-box self)) > self))))) > > which is used as follows: > > (defmd mouse-view-tracker () > (mouse-view :initarg :mouse-view :accessor mouse-view > :initform (c? (let ((pos (mouse-pos .og.))) > (trc nil "mouseview sees pos" .w. pos) > (when pos > (eko (nil "ix-togl mouseview >" self) > (without-c-dependency > (find-ix-under self pos))))))) > (:documentation "Mixin to have mouse view tracked in a subtree of > the window, mostly so other GUI layout can depend on > the sub-tree layout without creating a cyclic dependency, as would > happen iof the whole window were watched.")) > > (defmd ix-togl (mouse-view-tracker #+not focuser ogl-lit-scene control > ogl-shared-resource-tender togl ix-view) > ... > > So, the togl widget is a sub-class of mouse-view-tracker. I understand > this as "show me the control that is currently being pointed at by the > mouse". > > Only thing is: When looking at the code for 'find-ix-under I can't see > how this could possibly work? May I ask for a walk-through of find-ix- > under ? haha, no! Please walk me thru what you do not understand. The disabled debug statements give you some hints: first I recursively check kids, if that comes up empty I check myself to see if I am under the mouse and want to be the result. hth, kt ps. Yes, it works. :) k From frgo at me.com Fri Jul 24 16:28:44 2009 From: frgo at me.com (Frank Goenninger) Date: Fri, 24 Jul 2009 18:28:44 +0200 Subject: [cells-devel] Cello: 'find-view-under: Semantics ? In-Reply-To: <4A69D7BC.7070703@gmail.com> References: <0D31438A-962C-44D5-9E8F-FC745E2CB6C6@me.com> <4A69D7BC.7070703@gmail.com> Message-ID: Am 24.07.2009 um 17:48 schrieb Kenneth Tilton: > Frank Goenninger wrote: >> Hi again - >> thanks again for the fast response on my last request - hoping for >> another fast one here ;-) >> So, Cello (the original one) has this function: >> (defun find-ix-under (self os-pos &key (test #'true)) >> (when (and (not (typep self 'tool-tip)) ;; >> (visible self) >> (not (collapsed self))) >> (trc nil "find-ix-under" self os-pos (screen-box self)) >> (let ((inself (point-in-box os-pos (screen-box self)))) >> (or (when (or inself (not (clipped self))) >> (trc nil "inside self sbox" self os-pos (screen-box >> self)) >> (dolistreversed (k (or (render-order self)(kids >> self))) ;; overlap goes to last kid displayed >> (unless (typep k 'window) >> (trc nil "fixunder kid!!!!!!!!" k) >> (bwhen (ix (find-ix-under k os-pos :test test)) >> (return-from find-ix-under ix))))) >> (when (and inself >> (funcall test self) >> (not (ix-click-transparent self))) >> (trc nil self os-pos (screen-box self)) >> self))))) >> which is used as follows: >> (defmd mouse-view-tracker () >> (mouse-view :initarg :mouse-view :accessor mouse-view >> :initform (c? (let ((pos (mouse-pos .og.))) >> (trc nil "mouseview sees pos" .w. pos) >> (when pos >> (eko (nil "ix-togl mouseview >" self) >> (without-c-dependency >> (find-ix-under self pos))))))) >> (:documentation "Mixin to have mouse view tracked in a subtree >> of the window, mostly so other GUI layout can depend on >> the sub-tree layout without creating a cyclic dependency, as would >> happen iof the whole window were watched.")) >> (defmd ix-togl (mouse-view-tracker #+not focuser ogl-lit-scene >> control ogl-shared-resource-tender togl ix-view) >> ... >> So, the togl widget is a sub-class of mouse-view-tracker. I >> understand this as "show me the control that is currently being >> pointed at by the mouse". >> Only thing is: When looking at the code for 'find-ix-under I can't >> see how this could possibly work? May I ask for a walk-through of >> find-ix- under ? > > haha, no! ;-) Hehe - as if I hadn't expected to get a "Joe, you can do this yourself" answer... but: > Please walk me thru what you do not understand. I actually am still struggling with things like g-box, g-offset, and stuff. That's where my problem lies, really, or so it seems... > The disabled debug statements give you some hints: first I > recursively check kids, if that comes up empty I check myself to see > if I am under the mouse and want to be the result. Well, that's just clear - it does work in original Cello. But it doesn't in my Remake... Sh*t. > > hth, kt > > ps. Yes, it works. :) k I know. I can see it when running original Cello here. Hmpf ! I could help to have a real good IDE with stepping support - which I don't have. I miss it rarely, but currently I do !!! AllegroCL sucks in this respect on Mac OS X... Cheers Frank -- Frank Goenninger Cell: +49 175 4321058 E-Mail: frgo at me.com From achambers.home at googlemail.com Mon Jul 27 23:19:07 2009 From: achambers.home at googlemail.com (Andy Chambers) Date: Tue, 28 Jul 2009 00:19:07 +0100 Subject: [cells-devel] [CELTK] A "grid" widget Message-ID: I came across the need for a "grid" widget in celtk. It's really just a macro "mk-grid" that lets you compose a grid as a set of rows with a function to make each row. The function should take two arguments; the first is the row object for the row that is currently being created, the second is the row-number so that you can use it in the :gridding slot. I've not used it in anger yet so it may evolve a bit yet but I'll post any updates as they come. Usage would be as follows: (celtk::run-celtk-window 'window :kids (c? (the-kids (mk-stack (:packing (c?pack-self)) (mk-grid :gridding '(:columns ("-weight {1}" "-weight {0}") :rows ("-weight {1}" "-weight {0}")) :rows '(car cdr) :row-factory (lambda (row row-num) (list (mk-label :text (format nil "~a: " row) :gridding (format nil "-row ~a -column 1 -padx 30 -sticky nw" row-num)) (mk-label :text (format nil "~a" (with-output-to-string (s) (describe row s))) :gridding (format nil "-row ~a -column 2" row-num))))))))) diff --git a/frame.lisp b/frame.lisp index 3f5b2b2..37d6e4e 100644 --- a/frame.lisp +++ b/frame.lisp @@ -42,6 +42,32 @@ See the Lisp Lesser GNU Public License for more details. (defmd stack-mixin (inline-mixin) :packing-side 'top) +;--- g r i d s ---------------------------------------------- + +(defmd grid (grid-manager frame) + (rows) + (row-factory) + (kids (c? (the-kids + (loop for row in (^rows) + for row-num from 0 + collect (funcall (^row-factory) + row + row-num)))))) + +(defobserver .kids ((self grid)) + (when new-value + (loop for k in new-value + when (gridding k) + do (tk-format `(:grid ,k) + (format nil "grid ~a ~a" + (path k) + (gridding k)))))) + +(defmacro mk-grid (&rest initargs) + `(make-instance 'grid + , at initargs + :fm-parent *parent*)) + ;--- f r a m e -------------------------------------------------- diff --git a/packages.lisp b/packages.lisp index 5318b8c..e0b0cc9 100644 --- a/packages.lisp +++ b/packages.lisp @@ -48,6 +48,8 @@ #:entry #:mk-entry #:text + + #:mk-grid #:frame-stack #:frame-row -- ---- Andy Chambers Formedix Ltd