[PD] objecttools [WAS: reusable snippets with key commands WAS: left mouse click abuse]

Patrice Colet pat at mamalala.org
Wed Jan 7 00:05:17 CET 2009


  In the archive I've provided there was a wrong filename, it's 
corrected and attached again with the pd example.

Mathieu Bouchard a écrit :
 > On Tue, 6 Jan 2009, Patrice Colet wrote:
 >
 >> how do you get a specific selected object with using [objectcount]?
 >
 > You don't, you have to make a new class very similar to [objectcount],
 > that's all.
 >
 > #include <m_pd.h>
 > #include "g_canvas.h"
 > typedef struct {t_object o; t_canvas *c;} t_objectselect;
 > static t_class *objectselect_class;
 > t_pd *objectselect_new (void) {
 >   t_objectselect *self = (t_objectselect *)pd_new(objectselect_class);
 >   self->c=canvas_getcurrent();
 >   return (t_pd *)self;
 > }
 > void objectselect_float(t_objectselect *self, t_float f) {
 >   glist_noselect(self->c);
 >   int i=0; t_gobj *o = self->c->gl_list;
 >   for (; o; i++, o=o->g_next) if (i==(int)f) break;
 >   if (o) glist_select(self->c,o);
 > }
 > void objectselect_setup (void) {
 >   objectselect_class=class_new(gensym("objectselect"),
 >     (t_newmethod)objectselect_new,0,sizeof(t_objectselect),0,0);
 >   class_addfloat(objectselect_class,objectselect_float);
 > }
 >
-------------- next part --------------
A non-text attachment was scrubbed...
Name: objecttools.zip
Type: application/octet-stream
Size: 6584 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20090107/2f6f4db2/attachment.obj>


More information about the Pd-list mailing list