Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9968
Modified Files: Tag: devel_0_39 g_scalar.c Log Message: upgrading to 0.39-test2
Index: g_scalar.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_scalar.c,v retrieving revision 1.4 retrieving revision 1.4.8.1 diff -C2 -d -r1.4 -r1.4.8.1 *** g_scalar.c 6 Sep 2004 20:20:34 -0000 1.4 --- g_scalar.c 22 May 2005 12:48:10 -0000 1.4.8.1 *************** *** 7,13 **** 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. */
--- 7,10 ---- *************** *** 18,22 **** * changes marked with IOhannes * added Krzysztof Czajas fix to avoid crashing... ! */
#include <stdlib.h> --- 15,19 ---- * changes marked with IOhannes * added Krzysztof Czajas fix to avoid crashing... ! */
#include <stdlib.h> *************** *** 168,172 **** { t_scalar *x = (t_scalar *)z; - int hit = 0; t_template *template = template_findbyname(x->sc_template); t_canvas *templatecanvas = template_findcanvas(template); --- 165,168 ---- *************** *** 183,187 **** else { - int hit = 0; x1 = y1 = 0x7fffffff; x2 = y2 = -0x7fffffff; --- 179,182 ---- *************** *** 194,207 **** x->sc_vec, template, basex, basey, &nx1, &ny1, &nx2, &ny2); ! if (hit) ! { ! if (nx1 < x1) x1 = nx1; ! if (ny1 < y1) y1 = ny1; ! if (nx2 > x2) x2 = nx2; ! if (ny2 > y2) y2 = ny2; ! } ! else x1 = nx1, y1 = ny1, x2 = nx2, y2 = ny2, hit = 1; } ! if (!hit) x1 = y1 = x2 = y2 = 0; } /* post("scalar x1 %d y1 %d x2 %d y2 %d", x1, y1, x2, y2); */ --- 189,199 ---- x->sc_vec, template, basex, basey, &nx1, &ny1, &nx2, &ny2); ! if (nx1 < x1) x1 = nx1; ! if (ny1 < y1) y1 = ny1; ! if (nx2 > x2) x2 = nx2; ! if (ny2 > y2) y2 = ny2; } ! if (x2 < x1 || y2 < y1) ! x1 = y1 = x2 = y2 = 0; } /* post("scalar x1 %d y1 %d x2 %d y2 %d", x1, y1, x2, y2); */ *************** *** 220,223 **** --- 212,226 ---- { int x1, y1, x2, y2; + t_symbol *templatesym = x->sc_template; + t_template *tmpl; + t_atom at; + t_gpointer gp; + gpointer_init(&gp); + gpointer_setglist(&gp, owner, x); + SETPOINTER(&at, &gp); + if (tmpl = template_findbyname(templatesym)) + template_notify(tmpl, gensym("select"), 1, &at); + gpointer_unset(&gp); + scalar_getrect(z, owner, &x1, &y1, &x2, &y2); x1--; x2++; y1--; y2++; *************** *** 305,318 **** }
! 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; 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); for (y = templatecanvas->gl_list; y; y = y->g_next) { --- 308,321 ---- }
! 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) { int hit = 0; t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; ! 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) { *************** *** 320,324 **** if (!wb) continue; if (hit = (*wb->w_parentclickfn)(y, owner, ! x, template, basex, basey, xpix, ypix, shift, alt, dbl, doit)) return (hit); --- 323,327 ---- if (!wb) continue; if (hit = (*wb->w_parentclickfn)(y, owner, ! data, template, sc, ap, basex + xloc, basey + yloc, xpix, ypix, shift, alt, dbl, doit)) return (hit); *************** *** 327,330 **** --- 330,342 ---- }
+ 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);