On Tue, 26 Sep 2006, Chuckk Hubbard wrote:
I was about to say the coolest thing would be to be able to delete them. But as I think about it, it wouldn't be hard to make a patch that would set a certain flag to -1 in place of deleting a scalar, and then before appending new scalars, always search for any extant scalars with -1 in that value and alter their values instead of creating new scalars.
I have no idea what you're talking about because I've never used DS, but I can tell you that scalars are part of a canvas in exactly the same way that all patchable objects are: they're all a big brochette - a kind of linked list in which each element points to the next one. In theory, scalars and patchables can be mixed in that list (though I don't know how much it can happen).
The common "class" of scalars (t_scalar) and patchables (t_text) is gobjects (t_gobj), which is obviously a lot generic than what we usually mean by GUI objects (which means t_text that use a custom t_widgetbehavior). The "brochette feature" is part of t_gobj.
There is already code for deleting any t_gobj you want from the brochette: that's what is used when you delete a patchable. There's just something at some point that prevents it.
To me, the "-1" flag is really not needed, but then I might be missing something... something like: a t_gpointer is not a weakref to a t_scalar, it's a weakref to a t_canvas with an extra unsafe pointer to the t_scalar, so the only way you can delete the t_scalar safely is by first deleting all t_gpointers that refer to it, but that's not possible... anyone correct me if I'm wrong. (I'll touch that code again eventually, but maybe not this year)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada