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

open canvas field when popup menu is selected on a scalar

parent 710d3e63
......@@ -2307,7 +2307,7 @@ t_gobj *canvas_findhitbox(t_canvas *x, int xpos, int ypos,
return (rval);
}
extern int scalar_hascanvasfield(t_scalar *x);
extern int scalar_getcanvasfield(t_scalar *x);
/* right-clicking on a canvas object pops up a menu. */
static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y_sel)
......@@ -2350,7 +2350,7 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y_sel)
if they happen to have a canvas field inside them. */
if (pd_class(&y->g_pd) == scalar_class)
{
if (scalar_hascanvasfield((t_scalar *)y))
if (scalar_getcanvasfield((t_scalar *)y))
scalar_has_canvas = 1;
canopen = scalar_has_canvas;
}
......
......@@ -255,7 +255,8 @@ int template_cancreate(t_template *template)
return (template_check_array_fields(0, template) == 1);
}
int scalar_hascanvasfield(t_scalar *x)
/* get the first canvas field for a scalar */
t_canvas *scalar_getcanvasfield(t_scalar *x)
{
t_template *template = template_findbyname(x->sc_template);
if (template)
......@@ -265,7 +266,7 @@ int scalar_hascanvasfield(t_scalar *x)
for (i = 0; i < nitems; i++, datatypes++)
{
if (datatypes->ds_type == DT_LIST)
return 1;
return x->sc_vec[i].w_list;
}
}
return 0;
......@@ -1227,7 +1228,8 @@ static void scalar_save(t_gobj *z, t_binbuf *b)
static void scalar_menuopen(t_scalar *x)
{
post("tried to open a thing");
t_canvas *c = scalar_getcanvasfield(x);
canvas_vis(c, 1);
}
static void scalar_properties(t_gobj *z, struct _glist *owner)
......
......@@ -1336,7 +1336,6 @@ static void field_set(t_field *x, t_symbol *s)
static void field_bang(t_field *x)
{
post("sanity is %d", x->x_canvas->sanity);
t_word *vec = x->x_canvas->gl_vec;
t_template *template = x->x_template;
t_symbol *fieldsym = x->x_s;
......
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