diff options
author | Miller Puckette <millerpuckette@users.sourceforge.net> | 2004-11-28 21:20:43 +0000 |
---|---|---|
committer | Miller Puckette <millerpuckette@users.sourceforge.net> | 2004-11-28 21:20:43 +0000 |
commit | a346d52dfffc44999d3f10226642f7baa9c5463b (patch) | |
tree | 6fea81e2fcdc9812a3ee984e378900ee4f8e9fe9 /pd/src/g_scalar.c | |
parent | aa82c4290982659a3364eca02573e070418b63e8 (diff) |
unified "array" and "struct array" code. Vast changes to "g_array.c" and
"g_template.c", and many smaller changes to various files. Not yet
well tested.
svn path=/trunk/; revision=2341
Diffstat (limited to 'pd/src/g_scalar.c')
-rw-r--r-- | pd/src/g_scalar.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c index 6c35c2d4..3a61a39d 100644 --- a/pd/src/g_scalar.c +++ b/pd/src/g_scalar.c @@ -6,19 +6,8 @@ "gobj". Scalars have templates which describe their structures, which can contain numbers, sublists, and arrays. -Also, the "tscalar" object, an ordinary text object that owns a single "scalar" -and draws it on the parent. This is intended as a way that abstractions can -control their appearances by adding stuff to draw. */ -/* IOhannes : - * changed the canvas_restore, so that it might accept $args as well (like "pd $0_test") - * so you can make multiple & distinguishable templates - * 1511:forum::für::umläute:2001 - * changes marked with IOhannes - * added Krzysztof Czajas fix to avoid crashing... - */ - #include <stdlib.h> #include <string.h> #include <stdio.h> /* for read/write to files */ @@ -304,28 +293,37 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) sys_unqueuegui(x); } -static int scalar_click(t_gobj *z, struct _glist *owner, - int xpix, int ypix, int shift, int alt, int dbl, int doit) +int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, + t_array *ap, struct _glist *owner, + float xloc, float yloc, int xpix, int ypix, + int shift, int alt, int dbl, int doit) { - t_scalar *x = (t_scalar *)z; int hit = 0; - t_template *template = template_findbyname(x->sc_template); t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex, basey; - scalar_getbasexy(x, &basex, &basey); + float basex = template_getfloat(template, gensym("x"), data, 0); + float basey = template_getfloat(template, gensym("y"), data, 0); for (y = templatecanvas->gl_list; y; y = y->g_next) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); if (!wb) continue; if (hit = (*wb->w_parentclickfn)(y, owner, - x, template, basex, basey, + data, template, sc, ap, basex + xloc, basey + yloc, xpix, ypix, shift, alt, dbl, doit)) return (hit); } return (0); } +static int scalar_click(t_gobj *z, struct _glist *owner, + int xpix, int ypix, int shift, int alt, int dbl, int doit) +{ + t_scalar *x = (t_scalar *)z; + t_template *template = template_findbyname(x->sc_template); + return (scalar_doclick(x->sc_vec, template, x, 0, + owner, 0, 0, xpix, ypix, shift, alt, dbl, doit)); +} + void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b, int amarrayelement); |