Commit 9316925f authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

Merge branch 'aggraef/purr-data-pddplink-symbol-input'

parents dbef0fe7 8c21dc9a
#N canvas 319 94 424 397 12; #N canvas 319 94 424 539 12;
#X text 20 10 first entry; #X text 20 10 first entry;
#X text 50 50 three ways of linking to a; #X text 50 50 three ways of linking to a;
#X text 50 170 three ways of linking to a; #X text 50 170 three ways of linking to a;
...@@ -21,6 +21,16 @@ ...@@ -21,6 +21,16 @@
#X obj 50 99 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 #X obj 50 99 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1; -1;
#X text 71 96 <-- bang to open the link; #X text 71 96 <-- bang to open the link;
#X text 50 410 purr-data only: pass the file name or URL as a symbol
to inlet #1 (a dummy filename argument is still needed), f 47;
#X msg 50 470 symbol http://puredata.info;
#X obj 250 450 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 250 470 symbol README.txt;
#X obj 50 499 pddplink dummy -box;
#X connect 13 0 8 0; #X connect 13 0 8 0;
#X connect 15 0 4 0; #X connect 15 0 4 0;
#X connect 17 0 12 0; #X connect 17 0 12 0;
#X connect 20 0 23 0;
#X connect 21 0 22 0;
#X connect 22 0 23 0;
...@@ -221,13 +221,22 @@ static t_pd *pddplink_pdtarget(t_pddplink *x) ...@@ -221,13 +221,22 @@ static t_pd *pddplink_pdtarget(t_pddplink *x)
return ((t_pd *)x); /* internal error */ 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) if (x->x_ishit)
{ {
startpost("pddplink: internal error (%s", (s ? s->s_name : "")); post("pddplink: internal error (%s)", (s ? s->s_name : ""));
postatom(ac, av); }
post(")"); 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;
} }
} }
...@@ -400,9 +409,7 @@ static void *pddplink_new(t_symbol *s, int ac, t_atom *av) ...@@ -400,9 +409,7 @@ static void *pddplink_new(t_symbol *s, int ac, t_atom *av)
SETSYMBOL(&x->x_openargs[0], x->x_ulink); SETSYMBOL(&x->x_openargs[0], x->x_ulink);
SETSYMBOL(&x->x_openargs[1], x->x_dirsym); SETSYMBOL(&x->x_openargs[1], x->x_dirsym);
x->x_ishit = 0; x->x_ishit = 0;
if (x->x_isboxed) if (!x->x_isboxed)
outlet_new((t_object *)x, &s_anything);
else
{ {
/* do we need to set ((t_text *)x)->te_type = T_TEXT; ? */ /* do we need to set ((t_text *)x)->te_type = T_TEXT; ? */
if (!x->x_vistext) if (!x->x_vistext)
...@@ -426,14 +433,14 @@ void pddplink_setup(void) ...@@ -426,14 +433,14 @@ void pddplink_setup(void)
sizeof(t_pddplink), sizeof(t_pddplink),
CLASS_NOINLET | CLASS_PATCHABLE, CLASS_NOINLET | CLASS_PATCHABLE,
A_GIMME, 0); A_GIMME, 0);
class_addanything(pddplink_class, pddplink_anything); class_addsymbol(pddplink_class, pddplink_symbol);
class_setwidget(pddplink_class, &pddplink_widgetbehavior); class_setwidget(pddplink_class, &pddplink_widgetbehavior);
pddplinkbox_class = class_new(gensym("pddplink"), 0, pddplinkbox_class = class_new(gensym("pddplink"), 0,
(t_method)pddplink_free, (t_method)pddplink_free,
sizeof(t_pddplink), 0, A_GIMME, 0); sizeof(t_pddplink), 0, A_GIMME, 0);
class_addbang(pddplinkbox_class, pddplink_bang); 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, class_addmethod(pddplinkbox_class, (t_method)pddplink_click,
gensym("click"), gensym("click"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); 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