Commit e4fc94e8 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

jwilkes/purr-data#41

bind/unbind scalar symbol in scalar_vis instead of scalar_new
This way scalar events continue to work if the user happens to
change the [struct] arguments on us.
parent 659cbfb2
......@@ -326,9 +326,6 @@ t_scalar *scalar_new(t_glist *owner, t_symbol *templatesym)
x->sc_template = templatesym;
gpointer_setglist(&gp, owner, &x->sc_gobj);
word_init(x->sc_vec, template, &gp);
char buf[50];
sprintf(buf, "x%lx", (long unsigned int)x);
pd_bind(&x->sc_gobj.g_pd, gensym(buf));
return (x);
}
......@@ -912,6 +909,8 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
{
//fprintf(stderr,"scalar_vis %d %lx\n", vis, (t_int)z);
t_scalar *x = (t_scalar *)z;
char buf[50];
sprintf(buf, "x%lx", (long unsigned int)x);
x->sc_bboxcache = 0;
......@@ -980,6 +979,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
(long unsigned int)x->sc_vec);
gui_vmess("gui_scalar_draw_group", "xss",
glist_getcanvas(owner), groupbuf, tagbuf);
pd_bind(&x->sc_gobj.g_pd, gensym(buf));
}
/* warning: don't need--- have recursive func. */
......@@ -1007,6 +1007,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
sprintf(tagbuf, "scalar%lx", (long unsigned int)x->sc_vec);
gui_vmess("gui_scalar_erase", "xs",
glist_getcanvas(owner), tagbuf);
pd_unbind(&x->sc_gobj.g_pd, gensym(buf));
}
sys_unqueuegui(x);
......
......@@ -416,7 +416,8 @@ static void template_conformarray(t_template *tfrom, t_template *tto,
/* this routine searches for every scalar in the glist that belongs
to the "from" template and makes it belong to the "to" template. Descend
glists recursively.
We don't handle redrawing here; this is to be filled in LATER... */
We don't do a redraw here, instead it happens when we change the
template (in glist_add). */
t_array *garray_getarray(t_garray *x);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment