aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-06 21:22:15 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-06 21:22:15 +0000
commit9194a1eb9422b9f859a968243c02659eb50d07a2 (patch)
treef136b209a7d2fc425451ffca827a84c5e65a4e94
parent33c65ada15b488b70aef4c9b0e43cb1a50ca1bfd (diff)
added bang methods for simulating clicks on links
svn path=/trunk/externals/pddp/; revision=15534
-rw-r--r--helplink-help.pd11
-rw-r--r--helplink.c3
-rw-r--r--pddplink-help.pd20
-rw-r--r--pddplink.c6
4 files changed, 34 insertions, 6 deletions
diff --git a/helplink-help.pd b/helplink-help.pd
index 3ec1d63..ea0de47 100644
--- a/helplink-help.pd
+++ b/helplink-help.pd
@@ -1,4 +1,5 @@
-#N canvas 275 101 468 415 12;
+#N canvas 280 108 468 497 12;
+#X declare -stdpath extra/Gem;
#X text 20 10 [helplink] makes a clickable link to a help patch based
on the object name. It is useful for providing links to help patches
in other patches.;
@@ -9,3 +10,11 @@ in other patches.;
#X text 29 234 If the help patch or object does not exist \, [helplink]
will not output an error until someone clicks on the link.;
#X obj 55 339 helplink Gem/scale;
+#X obj 250 308 helplink gemwin;
+#X obj 239 153 declare -stdpath extra/Gem;
+#X text 33 384 helplink also has a hidden inlet. You can send a bang
+to simulate clicking a helplink:;
+#X obj 54 447 helplink select;
+#X obj 54 425 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X connect 11 0 10 0;
diff --git a/helplink.c b/helplink.c
index 052ac51..76353c0 100644
--- a/helplink.c
+++ b/helplink.c
@@ -205,8 +205,9 @@ void helplink_setup(void)
(t_newmethod)helplink_new,
(t_method)helplink_free,
sizeof(t_helplink),
- CLASS_NOINLET | CLASS_PATCHABLE,
+ CLASS_PATCHABLE,
A_DEFSYMBOL, 0);
+ class_addbang(helplink_class, helplink_doclick);
class_setwidget(helplink_class, &helplink_widgetbehavior);
}
diff --git a/pddplink-help.pd b/pddplink-help.pd
index c03f429..dd7ecad 100644
--- a/pddplink-help.pd
+++ b/pddplink-help.pd
@@ -1,14 +1,26 @@
-#N canvas 314 87 424 397 12;
+#N canvas 319 94 424 397 12;
#X text 20 10 first entry;
#X text 50 50 three ways of linking to a;
#X text 50 170 three ways of linking to a;
#X obj 50 195 pddplink http://puredata.info;
-#X obj 50 230 pddplink http://puredata.info -box;
+#X obj 50 239 pddplink http://puredata.info -box;
#X text 50 290 three ways of linking to;
#X obj 260 290 pddplink dsp-help.pd -text another local patch;
#X obj 50 315 pddplink dsp-help.pd;
-#X obj 50 350 pddplink dsp-help.pd -box;
+#X obj 52 359 pddplink dsp-help.pd -box;
#X obj 270 170 pddplink http://puredata.info -text remote URL;
#X obj 270 50 pddplink README.txt -text local file;
#X obj 50 75 pddplink README.txt;
-#X obj 50 110 pddplink README.txt -box;
+#X obj 50 120 pddplink README.txt -box;
+#X obj 52 339 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 73 336 <-- bang to open the link;
+#X obj 50 219 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 71 216 <-- bang to open the link;
+#X obj 50 99 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
+-1;
+#X text 71 96 <-- bang to open the link;
+#X connect 13 0 8 0;
+#X connect 15 0 4 0;
+#X connect 17 0 12 0;
diff --git a/pddplink.c b/pddplink.c
index 962a407..68192f0 100644
--- a/pddplink.c
+++ b/pddplink.c
@@ -170,6 +170,11 @@ static void pddplink_click(t_pddplink *x, t_floatarg xpos, t_floatarg ypos,
x->x_ishit = 0;
}
+static void pddplink_bang(t_pddplink *x)
+{
+ pddplink_click(x, 0, 0, 0, 0, 0);
+}
+
static int pddplink_wbclick(t_gobj *z, t_glist *glist, int xpix, int ypix,
int shift, int alt, int dbl, int doit)
{
@@ -354,6 +359,7 @@ void pddplink_setup(void)
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_addmethod(pddplinkbox_class, (t_method)pddplink_click,
gensym("click"),