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

add t_array pointer and index to the scalar event interface for the GUI

parent 8a2d70b4
...@@ -450,7 +450,8 @@ var canvas_events = (function() { ...@@ -450,7 +450,8 @@ var canvas_events = (function() {
ty = minv.b * dx + minv.d * dy; ty = minv.b * dx + minv.d * dy;
var obj = scalar_draggables[draggable_elem.id]; var obj = scalar_draggables[draggable_elem.id];
pdgui.pdsend(obj.cid, "scalar_event", obj.scalar_sym, pdgui.pdsend(obj.cid, "scalar_event", obj.scalar_sym,
obj.drawcommand_sym, obj.event_name, dx, dy, tx, ty); obj.drawcommand_sym, obj.event_name, dx, dy, tx, ty,
obj.array_sym, obj.index);
last_draggable_x = new_x; last_draggable_x = new_x;
last_draggable_y = new_y; last_draggable_y = new_y;
}, },
...@@ -963,12 +964,14 @@ var canvas_events = (function() { ...@@ -963,12 +964,14 @@ var canvas_events = (function() {
last_search_term = ""; last_search_term = "";
}, },
add_scalar_draggable: function(cid, tag, scalar_sym, drawcommand_sym, add_scalar_draggable: function(cid, tag, scalar_sym, drawcommand_sym,
event_name) { event_name, array_sym, index) {
scalar_draggables[tag] = { scalar_draggables[tag] = {
cid: cid, cid: cid,
scalar_sym: scalar_sym, scalar_sym: scalar_sym,
drawcommand_sym: drawcommand_sym, drawcommand_sym: drawcommand_sym,
event_name: event_name event_name: event_name,
array_sym: array_sym,
index: index
}; };
}, },
remove_scalar_draggable: function(id) { remove_scalar_draggable: function(id) {
......
...@@ -3345,7 +3345,7 @@ function gui_draw_coords(cid, tag, shape, points) { ...@@ -3345,7 +3345,7 @@ function gui_draw_coords(cid, tag, shape, points) {
// of the bbox of the shape will still register as part of the event. // of the bbox of the shape will still register as part of the event.
// (Attempting to set the event more than once is ignored.) // (Attempting to set the event more than once is ignored.)
function gui_draw_drag_event(cid, tag, scalar_sym, drawcommand_sym, function gui_draw_drag_event(cid, tag, scalar_sym, drawcommand_sym,
event_name, state) { event_name, array_sym, index, state) {
var win = patchwin[cid].window; var win = patchwin[cid].window;
if (state === 0) { if (state === 0) {
win.canvas_events.remove_scalar_draggable(tag); win.canvas_events.remove_scalar_draggable(tag);
...@@ -3357,13 +3357,13 @@ function gui_draw_drag_event(cid, tag, scalar_sym, drawcommand_sym, ...@@ -3357,13 +3357,13 @@ function gui_draw_drag_event(cid, tag, scalar_sym, drawcommand_sym,
// Events for scalars-- mouseover, mouseout, etc. // Events for scalars-- mouseover, mouseout, etc.
function gui_draw_event(cid, tag, scalar_sym, drawcommand_sym, event_name, function gui_draw_event(cid, tag, scalar_sym, drawcommand_sym, event_name,
state) { array_sym, index, state) {
var item = get_item(cid, tag), var item = get_item(cid, tag),
event_type = "on" + event_name; event_type = "on" + event_name;
if (state === 1) { if (state === 1) {
item[event_type] = function(e) { item[event_type] = function(e) {
pdsend(cid, "scalar_event", scalar_sym, drawcommand_sym, event_name, pdsend(cid, "scalar_event", scalar_sym, drawcommand_sym, event_name,
e.pageX, e.pageY); e.pageX, e.pageY, array_sym, index);
}; };
} else { } else {
item[event_type] = null; item[event_type] = null;
......
...@@ -344,7 +344,7 @@ struct _widgetbehavior ...@@ -344,7 +344,7 @@ struct _widgetbehavior
t_deletefn w_deletefn; t_deletefn w_deletefn;
t_visfn w_visfn; t_visfn w_visfn;
t_clickfn w_clickfn; t_clickfn w_clickfn;
t_displacefnwtag w_displacefnwtag; t_displacefnwtag w_displacefnwtag;
}; };
/* -------- behaviors for scalars defined by objects in template --------- */ /* -------- behaviors for scalars defined by objects in template --------- */
...@@ -376,7 +376,7 @@ typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist, ...@@ -376,7 +376,7 @@ typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist,
typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist, typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist,
struct _glist *parentglist, t_scalar *sc, struct _glist *parentglist, t_scalar *sc,
t_word *data, t_template *tmpl, t_float basex, t_float basey, t_word *data, t_template *tmpl, t_float basex, t_float basey,
int flag); struct _array *parentarray, int flag);
/* field a mouse click */ /* field a mouse click */
typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist, typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist,
t_word *data, t_template *tmpl, t_scalar *sc, t_array *ap, t_word *data, t_template *tmpl, t_scalar *sc, t_array *ap,
......
...@@ -777,10 +777,11 @@ extern void svg_parentwidgettogui(t_gobj *z, t_scalar *sc, t_glist *owner, ...@@ -777,10 +777,11 @@ extern void svg_parentwidgettogui(t_gobj *z, t_scalar *sc, t_glist *owner,
t_word *data, t_template *template); t_word *data, t_template *template);
extern void svg_register_events(t_gobj *z, t_canvas *c, t_scalar *sc, extern void svg_register_events(t_gobj *z, t_canvas *c, t_scalar *sc,
t_template *template, t_word *data); t_template *template, t_word *data, t_array *parentarray);
static void scalar_group_configure(t_scalar *x, t_glist *owner, static void scalar_group_configure(t_scalar *x, t_glist *owner,
t_template *template, t_word *data, t_glist *gl, t_glist *parent) t_template *template, t_word *data, t_glist *gl, t_glist *parent,
t_array *parentarray)
{ {
t_gobj *y; t_gobj *y;
char tagbuf[MAXPDSTRING]; char tagbuf[MAXPDSTRING];
...@@ -796,20 +797,21 @@ static void scalar_group_configure(t_scalar *x, t_glist *owner, ...@@ -796,20 +797,21 @@ static void scalar_group_configure(t_scalar *x, t_glist *owner,
glist_getcanvas(owner), tagbuf); glist_getcanvas(owner), tagbuf);
svg_grouptogui(gl, template, data); svg_grouptogui(gl, template, data);
gui_end_vmess(); gui_end_vmess();
svg_register_events((t_gobj *)gl, owner, x, template, data); svg_register_events((t_gobj *)gl, owner, x, template, data, parentarray);
for (y = gl->gl_list; y; y = y->g_next) for (y = gl->gl_list; y; y = y->g_next)
{ {
if (pd_class(&y->g_pd) == canvas_class && if (pd_class(&y->g_pd) == canvas_class &&
((t_glist *)y)->gl_svg) ((t_glist *)y)->gl_svg)
{ {
scalar_group_configure(x, owner, template, data, (t_glist *)y, gl); scalar_group_configure(x, owner, template, data, (t_glist *)y, gl,
0);
} }
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue; if (!wb) continue;
//(*wb->w_parentvisfn)(y, owner, gl, x, data, template, //(*wb->w_parentvisfn)(y, owner, gl, x, data, template,
// 0, 0, vis); // 0, 0, 0, vis);
svg_parentwidgettogui(y, x, owner, data, template); svg_parentwidgettogui(y, x, owner, data, template);
svg_register_events(y, owner, x, template, data); svg_register_events(y, owner, x, template, data, parentarray);
} }
} }
...@@ -853,14 +855,14 @@ void scalar_doconfigure(t_gobj *xgobj, t_glist *owner) ...@@ -853,14 +855,14 @@ void scalar_doconfigure(t_gobj *xgobj, t_glist *owner)
((t_glist *)y)->gl_svg) ((t_glist *)y)->gl_svg)
{ {
scalar_group_configure(x, owner, template, x->sc_vec, scalar_group_configure(x, owner, template, x->sc_vec,
(t_glist *)y, templatecanvas); (t_glist *)y, templatecanvas, 0);
} }
continue; continue;
} }
//(*wb->w_parentvisfn)(y, owner, 0, x, x->sc_vec, template, //(*wb->w_parentvisfn)(y, owner, 0, x, x->sc_vec, template,
// basex, basey, vis); // basex, basey, 0, vis);
svg_parentwidgettogui(y, x, owner, x->sc_vec, template); svg_parentwidgettogui(y, x, owner, x->sc_vec, template);
svg_register_events(y, owner, x, template, x->sc_vec); svg_register_events(y, owner, x, template, x->sc_vec, 0);
} }
if (glist_isselected(owner, &x->sc_gobj)) if (glist_isselected(owner, &x->sc_gobj))
{ {
...@@ -909,12 +911,12 @@ void array_configure(t_scalar *x, t_glist *owner, t_array *a, t_word *data) ...@@ -909,12 +911,12 @@ void array_configure(t_scalar *x, t_glist *owner, t_array *a, t_word *data)
((t_glist *)y)->gl_svg) ((t_glist *)y)->gl_svg)
{ {
scalar_group_configure(x, owner, template, data, scalar_group_configure(x, owner, template, data,
(t_glist *)y, elemtemplatecanvas); (t_glist *)y, elemtemplatecanvas, a);
} }
continue; continue;
} }
svg_parentwidgettogui(y, x, owner, data, elemtemplate); svg_parentwidgettogui(y, x, owner, data, elemtemplate);
svg_register_events(y, owner, x, elemtemplate, data); svg_register_events(y, owner, x, elemtemplate, data, a);
} }
} }
...@@ -938,7 +940,7 @@ static void scalar_groupvis(t_scalar *x, t_glist *owner, t_template *template, ...@@ -938,7 +940,7 @@ static void scalar_groupvis(t_scalar *x, t_glist *owner, t_template *template,
gui_end_vmess(); gui_end_vmess();
/* register events */ /* register events */
svg_register_events((t_gobj *)gl, owner, x, template, x->sc_vec); svg_register_events((t_gobj *)gl, owner, x, template, x->sc_vec, 0);
} }
for (y = gl->gl_list; y; y = y->g_next) for (y = gl->gl_list; y; y = y->g_next)
{ {
...@@ -950,7 +952,7 @@ static void scalar_groupvis(t_scalar *x, t_glist *owner, t_template *template, ...@@ -950,7 +952,7 @@ static void scalar_groupvis(t_scalar *x, t_glist *owner, t_template *template,
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue; if (!wb) continue;
(*wb->w_parentvisfn)(y, owner, gl, x, x->sc_vec, template, (*wb->w_parentvisfn)(y, owner, gl, x, x->sc_vec, template,
0, 0, vis); 0, 0, 0, vis);
} }
} }
...@@ -1076,7 +1078,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) ...@@ -1076,7 +1078,7 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
continue; continue;
} }
(*wb->w_parentvisfn)(y, owner, 0, x, x->sc_vec, template, (*wb->w_parentvisfn)(y, owner, 0, x, x->sc_vec, template,
basex, basey, vis); basex, basey, 0, vis);
} }
if (!vis) if (!vis)
{ {
......
...@@ -1736,14 +1736,14 @@ extern void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state); ...@@ -1736,14 +1736,14 @@ extern void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state);
void svg_sendupdate(t_svg *x, t_canvas *c, t_symbol *s, void svg_sendupdate(t_svg *x, t_canvas *c, t_symbol *s,
t_template *template, t_word *data, int *predraw_bbox, void *parent, t_template *template, t_word *data, int *predraw_bbox, void *parent,
t_scalar *sc) t_scalar *sc, t_array *array)
{ {
/* todo-- I'm mixing "c" with glist_getcanvas(c) too freely... /* todo-- I'm mixing "c" with glist_getcanvas(c) too freely...
need to experiment with gop scalars to make sure I'm not breaking need to experiment with gop scalars to make sure I'm not breaking
anything */ anything */
int in_array = (sc->sc_vec != data);
//post("in_array is %d", in_array);
char tag[MAXPDSTRING]; char tag[MAXPDSTRING];
int index = (array ?
((((char *)data) - array->a_vec) / array->a_elemsize) : -1);
if (x->x_type == gensym("g") || x->x_type == gensym("svg")) if (x->x_type == gensym("g") || x->x_type == gensym("svg"))
{ {
sprintf(tag, "dgroup%lx.%lx", sprintf(tag, "dgroup%lx.%lx",
...@@ -1846,57 +1846,57 @@ void svg_sendupdate(t_svg *x, t_canvas *c, t_symbol *s, ...@@ -1846,57 +1846,57 @@ void svg_sendupdate(t_svg *x, t_canvas *c, t_symbol *s,
} }
else if (s == gensym("mouseover")) else if (s == gensym("mouseover"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mouseover", glist_getcanvas(c), tag, sc, x, "mouseover", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mouseover.a_attr, template, data, 0)); &x->x_events.e_mouseover.a_attr, template, data, 0));
} }
else if (s == gensym("mouseout")) else if (s == gensym("mouseout"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mouseout", glist_getcanvas(c), tag, sc, x, "mouseout", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mouseout.a_attr, template, data, 0)); &x->x_events.e_mouseout.a_attr, template, data, 0));
} }
else if (s == gensym("mousemove")) else if (s == gensym("mousemove"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mousemove", glist_getcanvas(c), tag, sc, x, "mousemove", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mousemove.a_attr, template, data, 0)); &x->x_events.e_mousemove.a_attr, template, data, 0));
} }
else if (s == gensym("mouseup")) else if (s == gensym("mouseup"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mouseup", glist_getcanvas(c), tag, sc, x, "mouseup", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mouseup.a_attr, template, data, 0)); &x->x_events.e_mouseup.a_attr, template, data, 0));
} }
else if (s == gensym("mousedown")) else if (s == gensym("mousedown"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mousedown", glist_getcanvas(c), tag, sc, x, "mousedown", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mousedown.a_attr, template, data, 0)); &x->x_events.e_mousedown.a_attr, template, data, 0));
} }
else if (s == gensym("mouseenter")) else if (s == gensym("mouseenter"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mouseenter", glist_getcanvas(c), tag, sc, x, "mouseenter", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mouseenter.a_attr, template, data, 0)); &x->x_events.e_mouseenter.a_attr, template, data, 0));
} }
else if (s == gensym("mouseleave")) else if (s == gensym("mouseleave"))
{ {
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "mouseleave", glist_getcanvas(c), tag, sc, x, "mouseleave", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_mouseleave.a_attr, template, data, 0)); &x->x_events.e_mouseleave.a_attr, template, data, 0));
} }
else if (s == gensym("drag")) else if (s == gensym("drag"))
{ {
gui_vmess("gui_draw_drag_event", "xsxxsi", gui_vmess("gui_draw_drag_event", "xsxxsxii",
glist_getcanvas(c), tag, sc, x, "drag", glist_getcanvas(c), tag, sc, x, "drag", array, index,
(int)fielddesc_getcoord( (int)fielddesc_getcoord(
&x->x_events.e_drag.a_attr, template, data, 0)); &x->x_events.e_drag.a_attr, template, data, 0));
} }
...@@ -2058,7 +2058,7 @@ void svg_updatevec(t_canvas *c, t_word *data, t_template *template, ...@@ -2058,7 +2058,7 @@ void svg_updatevec(t_canvas *c, t_word *data, t_template *template,
{ {
svg_sendupdate(x, glist_getcanvas(c), s, svg_sendupdate(x, glist_getcanvas(c), s,
elemtemplate, (t_word *)(elem + elemsize * j), elemtemplate, (t_word *)(elem + elemsize * j),
predraw_bbox, parent, sc); predraw_bbox, parent, sc, array);
} }
} }
svg_updatevec(c, (t_word *)elem, elemtemplate, target, parent, svg_updatevec(c, (t_word *)elem, elemtemplate, target, parent,
...@@ -2096,7 +2096,7 @@ void svg_doupdate(t_svg *x, t_canvas *c, t_symbol *s) ...@@ -2096,7 +2096,7 @@ void svg_doupdate(t_svg *x, t_canvas *c, t_symbol *s)
if (parenttemplate == template) if (parenttemplate == template)
{ {
svg_sendupdate(x, visible, s, template, svg_sendupdate(x, visible, s, template,
data, &redraw_bbox, parent, (t_scalar *)g); data, &redraw_bbox, parent, (t_scalar *)g, 0);
} }
else else
{ {
...@@ -2136,9 +2136,10 @@ void svg_update(t_svg *x, t_symbol *s) ...@@ -2136,9 +2136,10 @@ void svg_update(t_svg *x, t_symbol *s)
/* not sure if this will work with array elements */ /* not sure if this will work with array elements */
void svg_register_events(t_gobj *z, t_canvas *c, t_scalar *sc, void svg_register_events(t_gobj *z, t_canvas *c, t_scalar *sc,
t_template *template, t_word *data) t_template *template, t_word *data, t_array *a)
{ {
t_svg *svg; t_svg *svg;
int index = (a ? ((((char *)data) - a->a_vec) / a->a_elemsize) : -1);
char tagbuf[MAXPDSTRING]; char tagbuf[MAXPDSTRING];
if (pd_class(&z->g_pd) == canvas_class) if (pd_class(&z->g_pd) == canvas_class)
{ {
...@@ -2164,45 +2165,43 @@ void svg_register_events(t_gobj *z, t_canvas *c, t_scalar *sc, ...@@ -2164,45 +2165,43 @@ void svg_register_events(t_gobj *z, t_canvas *c, t_scalar *sc,
return; return;
} }
if (svg->x_events.e_mouseover.a_flag) if (svg->x_events.e_mouseover.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mouseover", glist_getcanvas(c), tagbuf, sc, svg, "mouseover", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mouseover.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mouseover.a_attr, template,
data, 1)); data, 1));
if (svg->x_events.e_mouseout.a_flag) if (svg->x_events.e_mouseout.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mouseout", glist_getcanvas(c), tagbuf, sc, svg, "mouseout", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mouseout.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mouseout.a_attr, template,
data, 1)); data, 1));
if (svg->x_events.e_mousemove.a_flag) if (svg->x_events.e_mousemove.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mousemove", glist_getcanvas(c), tagbuf, sc, svg, "mousemove", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mousemove.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mousemove.a_attr, template,
data, 1)); data, 1));
if (svg->x_events.e_mousedown.a_flag) if (svg->x_events.e_mousedown.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mousedown", glist_getcanvas(c), tagbuf, sc, svg, "mousedown", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mousedown.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mousedown.a_attr, template,
data, 1)); data, 1));
if (svg->x_events.e_mouseup.a_flag) if (svg->x_events.e_mouseup.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mouseup", glist_getcanvas(c), tagbuf, sc, svg, "mouseup", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mouseup.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mouseup.a_attr, template,
data, 1)); data, 1));
if (svg->x_events.e_mouseenter.a_flag) if (svg->x_events.e_mouseenter.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mouseenter", glist_getcanvas(c), tagbuf, sc, svg, "mouseenter", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mouseenter.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mouseenter.a_attr,
data, 1)); template, data, 1));
if (svg->x_events.e_mouseleave.a_flag) if (svg->x_events.e_mouseleave.a_flag)
gui_vmess("gui_draw_event", "xsxxsi", gui_vmess("gui_draw_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "mouseleave", glist_getcanvas(c), tagbuf, sc, svg, "mouseleave", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_mouseleave.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_mouseleave.a_attr,
data, 1)); template, data, 1));
if (svg->x_events.e_drag.a_flag) if (svg->x_events.e_drag.a_flag)
gui_vmess("gui_draw_drag_event", "xsxxsi", gui_vmess("gui_draw_drag_event", "xsxxsxii",
glist_getcanvas(c), tagbuf, sc, svg, "drag", glist_getcanvas(c), tagbuf, sc, svg, "drag", a, index,
(int)fielddesc_getcoord(&svg->x_events.e_drag.a_attr, template, (int)fielddesc_getcoord(&svg->x_events.e_drag.a_attr, template,
data, 1)); data, 1));
} }
...@@ -4145,7 +4144,7 @@ void svg_grouptogui(t_glist *g, t_template *template, t_word *data) ...@@ -4145,7 +4144,7 @@ void svg_grouptogui(t_glist *g, t_template *template, t_word *data)
static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
t_scalar *sc, t_word *data, t_template *template, t_scalar *sc, t_word *data, t_template *template,
t_float basex, t_float basey, int vis) t_float basex, t_float basey, t_array *parentarray, int vis)
{ {
t_draw *x = (t_draw *)z; t_draw *x = (t_draw *)z;
t_svg *sa = (t_svg *)x->x_attr; t_svg *sa = (t_svg *)x->x_attr;
...@@ -4228,7 +4227,7 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, ...@@ -4228,7 +4227,7 @@ static void draw_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
} }
/* register events */ /* register events */
svg_register_events(z, glist, sc, template, data); svg_register_events(z, glist, sc, template, data, parentarray);
} }
else else
{ {
...@@ -5094,7 +5093,7 @@ static void numbertocolor(int n, char *s) ...@@ -5094,7 +5093,7 @@ static void numbertocolor(int n, char *s)
static void curve_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, static void curve_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
t_scalar *sc, t_word *data, t_template *template, t_scalar *sc, t_word *data, t_template *template,
t_float basex, t_float basey, int vis) t_float basex, t_float basey, t_array *parentarray, int vis)
{ {
t_curve *x = (t_curve *)z; t_curve *x = (t_curve *)z;
int i, n = x->x_npoints; int i, n = x->x_npoints;
...@@ -5870,7 +5869,8 @@ static void plot_activate(t_gobj *z, t_glist *glist, ...@@ -5870,7 +5869,8 @@ static void plot_activate(t_gobj *z, t_glist *glist,
static void plot_groupvis(t_scalar *x, t_glist *owner, t_word *data, static void plot_groupvis(t_scalar *x, t_glist *owner, t_word *data,
t_template *template, t_template *template,
t_glist *groupcanvas, t_glist *parent, t_float basex, t_float basey) t_glist *groupcanvas, t_glist *parent, t_float basex, t_float basey,
t_array *parentarray)
{ {
t_gobj *y; t_gobj *y;
char tagbuf[MAXPDSTRING], parent_tagbuf[MAXPDSTRING]; char tagbuf[MAXPDSTRING], parent_tagbuf[MAXPDSTRING];
...@@ -5891,12 +5891,12 @@ static void plot_groupvis(t_scalar *x, t_glist *owner, t_word *data, ...@@ -5891,12 +5891,12 @@ static void plot_groupvis(t_scalar *x, t_glist *owner, t_word *data,
((t_glist *)y)->gl_svg) ((t_glist *)y)->gl_svg)
{ {
plot_groupvis(x, owner, data, template, (t_glist *)y, groupcanvas, plot_groupvis(x, owner, data, template, (t_glist *)y, groupcanvas,
basex, basey); basex, basey, parentarray);
} }
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue; if (!wb) continue;
(*wb->w_parentvisfn)(y, owner, groupcanvas, x, data, template, (*wb->w_parentvisfn)(y, owner, groupcanvas, x, data, template,
basex, basey, 1); basex, basey, parentarray, 1);
} }
} }
...@@ -5916,7 +5916,7 @@ int plot_has_drawcommand(t_canvas *elemtemplatecanvas) ...@@ -5916,7 +5916,7 @@ int plot_has_drawcommand(t_canvas *elemtemplatecanvas)
static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
t_scalar *sc, t_word *data, t_template *template, t_scalar *sc, t_word *data, t_template *template,
t_float basex, t_float basey, int tovis) t_float basex, t_float basey, t_array *parentarray, int tovis)
{ {
t_plot *x = (t_plot *)z; t_plot *x = (t_plot *)z;
int elemsize, yonset, wonset, xonset, i; int elemsize, yonset, wonset, xonset, i;
...@@ -5970,7 +5970,6 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, ...@@ -5970,7 +5970,6 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
if (symoutline == &s_) symoutline = gensym("#000000"); if (symoutline == &s_) symoutline = gensym("#000000");
if (symfill == &s_) symfill = gensym("#000000"); if (symfill == &s_) symfill = gensym("#000000");
t_float xscale = glist_xtopixels(glist, 1) - glist_xtopixels(glist, 0); t_float xscale = glist_xtopixels(glist, 1) - glist_xtopixels(glist, 0);
t_float yscale = glist_ytopixels(glist, 1) - glist_ytopixels(glist, 0); t_float yscale = glist_ytopixels(glist, 1) - glist_ytopixels(glist, 0);
t_float x_inverse = 1 / xscale; t_float x_inverse = 1 / xscale;
...@@ -6371,13 +6370,13 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, ...@@ -6371,13 +6370,13 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,
plot_groupvis(sc, glist, plot_groupvis(sc, glist,
(t_word *)(elem + elemsize * i), (t_word *)(elem + elemsize * i),
template, (t_glist *)y, template, (t_glist *)y,
elemtemplatecanvas, usexloc, useyloc); elemtemplatecanvas, usexloc, useyloc, array);
} }
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue; if (!wb) continue;
(*wb->w_parentvisfn)(y, glist, elemtemplatecanvas, sc, (*wb->w_parentvisfn)(y, glist, elemtemplatecanvas, sc,
(t_word *)(elem + elemsize * i), (t_word *)(elem + elemsize * i),
elemtemplate, usexloc, useyloc, tovis); elemtemplate, usexloc, useyloc, array, tovis);
} }
} }
} }
...@@ -6417,7 +6416,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist, ...@@ -6417,7 +6416,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, t_glist *parentglist,