Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3779/pd/src
Modified Files:
g_template.c m_binbuf.c s_audio_pablio.h s_audio_paring.c
s_audio_paring.h
Log Message:
Bug fix - plus, two features I couldn't bear to leave out of 0.40
Index: g_template.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_template.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** g_template.c 11 Aug 2006 20:09:07 -0000 1.15
--- g_template.c 15 Aug 2006 21:57:29 -0000 1.16
***************
*** 483,487 ****
}
- #if 0
/* bash the first of (argv) with a pointer to a scalar, and send on
to template as a notification message */
--- 483,486 ----
***************
*** 491,500 ****
t_gpointer gp;
gpointer_init(&gp);
! gpointer_setglist(&gp, owner, x);
SETPOINTER(argv, &gp);
template_notify(template, s, argc, argv);
gpointer_unset(&gp);
}
- #endif
/* call this when reading a patch from a file to declare what templates
--- 490,498 ----
t_gpointer gp;
gpointer_init(&gp);
! gpointer_setglist(&gp, owner, sc);
SETPOINTER(argv, &gp);
template_notify(template, s, argc, argv);
gpointer_unset(&gp);
}
/* call this when reading a patch from a file to declare what templates
***************
*** 792,795 ****
--- 790,794 ----
#define CLOSED 1
#define BEZ 2
+ #define NOMOUSE 4
#define A_ARRAY 55 /* LATER decide whether to enshrine this in m_pd.h */
***************
*** 957,961 ****
{
t_object x_obj;
! int x_flags; /* CLOSED and/or BEZ */
t_fielddesc x_fillcolor;
t_fielddesc x_outlinecolor;
--- 956,960 ----
{
t_object x_obj;
! int x_flags; /* CLOSED and/or BEZ and/or NOMOUSE */
t_fielddesc x_fillcolor;
t_fielddesc x_outlinecolor;
***************
*** 982,986 ****
else classname += 4;
if (classname[0] == 'c') flags |= BEZ;
- x->x_flags = flags;
fielddesc_setfloat_const(&x->x_vis, 1);
while (1)
--- 981,984 ----
***************
*** 992,997 ****
--- 990,1001 ----
argc -= 2; argv += 2;
}
+ else if (!strcmp(firstarg->s_name, "-x"))
+ {
+ flags |= NOMOUSE;
+ argc -= 1; argv += 1;
+ }
else break;
}
+ x->x_flags = flags;
if ((flags & CLOSED) && argc)
fielddesc_setfloatarg(&x->x_fillcolor, argc--, argv++);
***************
*** 1039,1043 ****
t_fielddesc *f = x->x_vec;
int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff;
! if (!fielddesc_getfloat(&x->x_vis, template, data, 0))
{
*xp1 = *yp1 = 0x7fffffff;
--- 1043,1048 ----
t_fielddesc *f = x->x_vec;
int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff;
! if (!fielddesc_getfloat(&x->x_vis, template, data, 0) ||
! (x->x_flags & NOMOUSE))
{
*xp1 = *yp1 = 0x7fffffff;
***************
*** 1186,1189 ****
--- 1191,1195 ----
static t_word *curve_motion_wp;
static t_template *curve_motion_template;
+ static t_gpointer curve_motion_gpointer;
/* LATER protect against the template changing or the scalar disappearing
***************
*** 1194,1197 ****
--- 1200,1209 ----
t_curve *x = (t_curve *)z;
t_fielddesc *f = x->x_vec + curve_motion_field;
+ t_atom at;
+ if (!gpointer_check(&curve_motion_gpointer, 0))
+ {
+ post("curve_motion: scalar disappeared");
+ return;
+ }
curve_motion_xcumulative += dx;
curve_motion_ycumulative += dy;
***************
*** 1208,1211 ****
--- 1220,1227 ----
1);
}
+ /* LATER figure out what to do to notify for an array? */
+ if (curve_motion_scalar)
+ template_notifyforscalar(curve_motion_template, curve_motion_glist,
+ curve_motion_scalar, gensym("change"), 1, &at);
if (curve_motion_scalar)
scalar_redraw(curve_motion_scalar, curve_motion_glist);
***************
*** 1265,1268 ****
--- 1281,1286 ----
curve_motion_field = 2*bestn;
curve_motion_template = template;
+ gpointer_setglist(&curve_motion_gpointer, curve_motion_glist,
+ curve_motion_scalar);
glist_grab(glist, z, curve_motion, 0, xpix, ypix);
}
***************
*** 2114,2117 ****
--- 2132,2138 ----
static t_word *drawnumber_motion_wp;
static t_template *drawnumber_motion_template;
+ static t_gpointer drawnumber_motion_gpointer;
+ static int drawnumber_motion_symbol;
+ static int drawnumber_motion_firstkey;
/* LATER protect against the template changing or the scalar disappearing
***************
*** 2122,2125 ****
--- 2143,2157 ----
t_drawnumber *x = (t_drawnumber *)z;
t_fielddesc *f = &x->x_value;
+ t_atom at;
+ if (!gpointer_check(&drawnumber_motion_gpointer, 0))
+ {
+ post("drawnumber_motion: scalar disappeared");
+ return;
+ }
+ if (drawnumber_motion_symbol)
+ {
+ post("drawnumber_motion: symbol");
+ return;
+ }
drawnumber_motion_ycumulative -= dy;
template_setfloat(drawnumber_motion_template,
***************
*** 2129,2132 ****
--- 2161,2169 ----
1);
if (drawnumber_motion_scalar)
+ template_notifyforscalar(drawnumber_motion_template,
+ drawnumber_motion_glist, drawnumber_motion_scalar,
+ gensym("change"), 1, &at);
+
+ if (drawnumber_motion_scalar)
scalar_redraw(drawnumber_motion_scalar, drawnumber_motion_glist);
if (drawnumber_motion_array)
***************
*** 2134,2137 ****
--- 2171,2242 ----
}
+ static void drawnumber_key(void *z, t_floatarg fkey)
+ {
+ t_drawnumber *x = (t_drawnumber *)z;
+ t_fielddesc *f = &x->x_value;
+ int key = fkey;
+ char sbuf[MAXPDSTRING];
+ t_atom at;
+ if (!gpointer_check(&drawnumber_motion_gpointer, 0))
+ {
+ post("drawnumber_motion: scalar disappeared");
+ return;
+ }
+ if (key == 0)
+ return;
+ if (drawnumber_motion_symbol)
+ {
+ /* key entry for a symbol field */
+ if (drawnumber_motion_firstkey)
+ sbuf[0] = 0;
+ else strncpy(sbuf, template_getsymbol(drawnumber_motion_template,
+ f->fd_un.fd_varsym, drawnumber_motion_wp, 1)->s_name,
+ MAXPDSTRING);
+ sbuf[MAXPDSTRING-1] = 0;
+ if (key == '\b')
+ {
+ if (*sbuf)
+ sbuf[strlen(sbuf)-1] = 0;
+ }
+ else
+ {
+ sbuf[strlen(sbuf)+1] = 0;
+ sbuf[strlen(sbuf)] = key;
+ }
+ }
+ else
+ {
+ /* key entry for a numeric field. This is just a stopgap. */
+ float newf;
+ if (drawnumber_motion_firstkey)
+ sbuf[0] = 0;
+ else sprintf(sbuf, "%g", template_getfloat(drawnumber_motion_template,
+ f->fd_un.fd_varsym, drawnumber_motion_wp, 1));
+ drawnumber_motion_firstkey = (key == '\n');
+ if (key == '\b')
+ {
+ if (*sbuf)
+ sbuf[strlen(sbuf)-1] = 0;
+ }
+ else
+ {
+ sbuf[strlen(sbuf)+1] = 0;
+ sbuf[strlen(sbuf)] = key;
+ }
+ if (sscanf(sbuf, "%g", &newf) < 1)
+ newf = 0;
+ template_setfloat(drawnumber_motion_template,
+ f->fd_un.fd_varsym, drawnumber_motion_wp, newf, 1);
+ if (drawnumber_motion_scalar)
+ template_notifyforscalar(drawnumber_motion_template,
+ drawnumber_motion_glist, drawnumber_motion_scalar,
+ gensym("change"), 1, &at);
+ if (drawnumber_motion_scalar)
+ scalar_redraw(drawnumber_motion_scalar, drawnumber_motion_glist);
+ if (drawnumber_motion_array)
+ array_redraw(drawnumber_motion_array, drawnumber_motion_glist);
+ }
+ }
+
static int drawnumber_click(t_gobj *z, t_glist *glist,
t_word *data, t_template *template, t_scalar *sc, t_array *ap,
***************
*** 2155,2161 ****
drawnumber_motion_scalar = sc;
drawnumber_motion_array = ap;
drawnumber_motion_ycumulative =
fielddesc_getfloat(&x->x_value, template, data, 0);
! glist_grab(glist, z, drawnumber_motion, 0, xpix, ypix);
}
return (1);
--- 2260,2271 ----
drawnumber_motion_scalar = sc;
drawnumber_motion_array = ap;
+ drawnumber_motion_firstkey = 1;
drawnumber_motion_ycumulative =
fielddesc_getfloat(&x->x_value, template, data, 0);
! drawnumber_motion_symbol = ((x->x_flags & DRAW_SYMBOL) != 0);
! gpointer_setglist(&drawnumber_motion_gpointer,
! drawnumber_motion_glist, drawnumber_motion_scalar);
! glist_grab(glist, z, drawnumber_motion, drawnumber_key,
! xpix, ypix);
}
return (1);
Index: m_binbuf.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_binbuf.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** m_binbuf.c 15 Aug 2006 04:54:15 -0000 1.9
--- m_binbuf.c 15 Aug 2006 21:57:29 -0000 1.10
***************
*** 491,499 ****
*/
substr=strchr(str, '$');
! if(substr)
! {
! strncat(buf2, str, (substr-str));
! str=substr+1;
! }
#endif
--- 491,500 ----
*/
substr=strchr(str, '$');
! if (!substr || substr-str >= MAXPDSTRING)
! return (s);
!
! strncat(buf2, str, (substr-str));
! str=substr+1;
!
#endif
***************
*** 528,531 ****
--- 529,533 ----
}
done:
+ post("realize %s->%s", s->s_name, buf2);
return (gensym(buf2));
}