Commit 57ee7778 authored by Albert Gräf's avatar Albert Gräf
Browse files

pddplink: handle symbol input on the 1st inlet.

As discussed on the mailing list, it's useful to allow symbol
inputs (other than bang) on pddplink's inlet, to make it easier to
invoke pddplink on a variable symbol (filename, patch, URL) value.

Note that for backward compatibility, a dummy filename argument is still
needed. Please check the updated help patch for details and an example.
parent d9ac7f33
......@@ -221,13 +221,22 @@ static t_pd *pddplink_pdtarget(t_pddplink *x)
return ((t_pd *)x); /* internal error */
}
static void pddplink_anything(t_pddplink *x, t_symbol *s, int ac, t_atom *av)
static void pddplink_symbol(t_pddplink *x, t_symbol *s)
{
if (x->x_ishit)
{
startpost("pddplink: internal error (%s", (s ? s->s_name : ""));
postatom(ac, av);
post(")");
post("pddplink: internal error (%s)", (s ? s->s_name : ""));
}
else
{
if (s == &s_) return; // nothing to see here, move along...
x->x_ishit = 1;
char final_name[FILENAME_MAX];
sys_expandpathelems(s->s_name, final_name);
gui_vmess("gui_pddplink_open", "ss",
final_name,
x->x_dirsym->s_name);
x->x_ishit = 0;
}
}
......@@ -426,14 +435,14 @@ void pddplink_setup(void)
sizeof(t_pddplink),
CLASS_NOINLET | CLASS_PATCHABLE,
A_GIMME, 0);
class_addanything(pddplink_class, pddplink_anything);
class_addsymbol(pddplink_class, pddplink_symbol);
class_setwidget(pddplink_class, &pddplink_widgetbehavior);
pddplinkbox_class = class_new(gensym("pddplink"), 0,
(t_method)pddplink_free,
sizeof(t_pddplink), 0, A_GIMME, 0);
class_addbang(pddplinkbox_class, pddplink_bang);
class_addanything(pddplinkbox_class, pddplink_anything);
class_addsymbol(pddplinkbox_class, pddplink_symbol);
class_addmethod(pddplinkbox_class, (t_method)pddplink_click,
gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
......
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