diff options
Diffstat (limited to 'pd')
-rw-r--r-- | pd/portaudio/pa_win_wdmks/pa_win_wdmks.c | 2 | ||||
-rw-r--r-- | pd/portaudio/pablio/ringbuffer.c | 2 | ||||
-rw-r--r-- | pd/portaudio/pablio/ringbuffer.h | 2 | ||||
-rw-r--r-- | pd/portmidi/pm_mac/pmmacosxcm.c | 2 | ||||
-rw-r--r-- | pd/src/g_template.c | 124 | ||||
-rw-r--r-- | pd/src/m_binbuf.c | 12 | ||||
-rw-r--r-- | pd/src/s_audio_pablio.h | 2 | ||||
-rw-r--r-- | pd/src/s_audio_paring.c | 2 | ||||
-rw-r--r-- | pd/src/s_audio_paring.h | 2 |
9 files changed, 131 insertions, 19 deletions
diff --git a/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c b/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c index f8be09aa..ba3d3a30 100644 --- a/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c +++ b/pd/portaudio/pa_win_wdmks/pa_win_wdmks.c @@ -1,5 +1,5 @@ /* - * $Id: pa_win_wdmks.c,v 1.7 2006-08-15 16:09:57 millerpuckette Exp $ + * $Id: pa_win_wdmks.c,v 1.8 2006-08-15 21:57:29 millerpuckette Exp $ * PortAudio Windows WDM-KS interface * * Author: Andrew Baldwin diff --git a/pd/portaudio/pablio/ringbuffer.c b/pd/portaudio/pablio/ringbuffer.c index 3a68e243..dd4067ec 100644 --- a/pd/portaudio/pablio/ringbuffer.c +++ b/pd/portaudio/pablio/ringbuffer.c @@ -1,5 +1,5 @@ /* - * $Id: ringbuffer.c,v 1.6 2006-08-15 16:09:57 millerpuckette Exp $ + * $Id: ringbuffer.c,v 1.7 2006-08-15 21:57:29 millerpuckette Exp $ * ringbuffer.c * Ring Buffer utility.. * diff --git a/pd/portaudio/pablio/ringbuffer.h b/pd/portaudio/pablio/ringbuffer.h index 9395416e..d46d2fc8 100644 --- a/pd/portaudio/pablio/ringbuffer.h +++ b/pd/portaudio/pablio/ringbuffer.h @@ -6,7 +6,7 @@ extern "C" #endif /* __cplusplus */ /* - * $Id: ringbuffer.h,v 1.7 2006-08-15 16:09:57 millerpuckette Exp $ + * $Id: ringbuffer.h,v 1.8 2006-08-15 21:57:29 millerpuckette Exp $ * ringbuffer.h * Ring Buffer utility.. * diff --git a/pd/portmidi/pm_mac/pmmacosxcm.c b/pd/portmidi/pm_mac/pmmacosxcm.c index 19ee5d89..c1d5e9aa 100644 --- a/pd/portmidi/pm_mac/pmmacosxcm.c +++ b/pd/portmidi/pm_mac/pmmacosxcm.c @@ -5,7 +5,7 @@ * and subsequent work by Andrew Zeldis and Zico Kolter
* and Roger B. Dannenberg
*
- * $Id: pmmacosxcm.c,v 1.7 2006-08-15 16:09:57 millerpuckette Exp $
+ * $Id: pmmacosxcm.c,v 1.8 2006-08-15 21:57:29 millerpuckette Exp $
*/
/* Notes:
diff --git a/pd/src/g_template.c b/pd/src/g_template.c index a1e8882f..1624e0ed 100644 --- a/pd/src/g_template.c +++ b/pd/src/g_template.c @@ -482,7 +482,6 @@ void template_notify(t_template *template, t_symbol *s, int argc, t_atom *argv) outlet_anything(template->t_list->x_obj.ob_outlet, s, argc, argv); } -#if 0 /* bash the first of (argv) with a pointer to a scalar, and send on to template as a notification message */ static void template_notifyforscalar(t_template *template, t_glist *owner, @@ -490,12 +489,11 @@ static void template_notifyforscalar(t_template *template, t_glist *owner, { t_gpointer gp; gpointer_init(&gp); - gpointer_setglist(&gp, owner, x); + gpointer_setglist(&gp, owner, sc); 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 we'll need. If there's already a template, check if it matches. @@ -791,6 +789,7 @@ static void fielddesc_setfloat_var(t_fielddesc *fd, t_symbol *s) #define CLOSED 1 #define BEZ 2 +#define NOMOUSE 4 #define A_ARRAY 55 /* LATER decide whether to enshrine this in m_pd.h */ static void fielddesc_setfloatarg(t_fielddesc *fd, int argc, t_atom *argv) @@ -956,7 +955,7 @@ t_class *curve_class; typedef struct _curve { t_object x_obj; - int x_flags; /* CLOSED and/or BEZ */ + int x_flags; /* CLOSED and/or BEZ and/or NOMOUSE */ t_fielddesc x_fillcolor; t_fielddesc x_outlinecolor; t_fielddesc x_width; @@ -981,7 +980,6 @@ static void *curve_new(t_symbol *classsym, t_int argc, t_atom *argv) } else classname += 4; if (classname[0] == 'c') flags |= BEZ; - x->x_flags = flags; fielddesc_setfloat_const(&x->x_vis, 1); while (1) { @@ -991,8 +989,14 @@ static void *curve_new(t_symbol *classsym, t_int argc, t_atom *argv) fielddesc_setfloatarg(&x->x_vis, 1, argv+1); 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++); else fielddesc_setfloat_const(&x->x_fillcolor, 0); @@ -1038,7 +1042,8 @@ static void curve_getrect(t_gobj *z, t_glist *glist, int i, n = x->x_npoints; t_fielddesc *f = x->x_vec; int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; - if (!fielddesc_getfloat(&x->x_vis, template, data, 0)) + if (!fielddesc_getfloat(&x->x_vis, template, data, 0) || + (x->x_flags & NOMOUSE)) { *xp1 = *yp1 = 0x7fffffff; *xp2 = *yp2 = -0x7fffffff; @@ -1185,6 +1190,7 @@ static t_scalar *curve_motion_scalar; static t_array *curve_motion_array; 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 probably by attaching a gpointer here ... */ @@ -1193,6 +1199,12 @@ static void curve_motion(void *z, t_floatarg dx, t_floatarg dy) { 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; if (f->fd_var && (dx != 0)) @@ -1207,6 +1219,10 @@ static void curve_motion(void *z, t_floatarg dx, t_floatarg dy) curve_motion_ybase + curve_motion_ycumulative * curve_motion_yper, 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); if (curve_motion_array) @@ -1264,6 +1280,8 @@ static int curve_click(t_gobj *z, t_glist *glist, curve_motion_wp = data; 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); } return (1); @@ -2113,6 +2131,9 @@ static t_scalar *drawnumber_motion_scalar; static t_array *drawnumber_motion_array; 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 probably by attaching a gpointer here ... */ @@ -2121,6 +2142,17 @@ static void drawnumber_motion(void *z, t_floatarg dx, t_floatarg dy) { 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, f->fd_un.fd_varsym, @@ -2128,11 +2160,84 @@ static void drawnumber_motion(void *z, t_floatarg dx, t_floatarg dy) drawnumber_motion_ycumulative, 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 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, float basex, float basey, @@ -2154,9 +2259,14 @@ static int drawnumber_click(t_gobj *z, t_glist *glist, drawnumber_motion_template = template; drawnumber_motion_scalar = sc; drawnumber_motion_array = ap; + drawnumber_motion_firstkey = 1; drawnumber_motion_ycumulative = fielddesc_getfloat(&x->x_value, template, data, 0); - glist_grab(glist, z, drawnumber_motion, 0, xpix, ypix); + 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); } diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index fbae4be5..06c3c6a2 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -490,11 +490,12 @@ t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew) * whenever this happened, enable this code */ substr=strchr(str, '$'); - if(substr) - { - strncat(buf2, str, (substr-str)); - str=substr+1; - } + if (!substr || substr-str >= MAXPDSTRING) + return (s); + + strncat(buf2, str, (substr-str)); + str=substr+1; + #endif while((next=binbuf_expanddollsym(str, buf, dollarnull, ac, av, tonew))>=0) @@ -527,6 +528,7 @@ t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew) } } done: + post("realize %s->%s", s->s_name, buf2); return (gensym(buf2)); } diff --git a/pd/src/s_audio_pablio.h b/pd/src/s_audio_pablio.h index e47934f0..4cfb35f7 100644 --- a/pd/src/s_audio_pablio.h +++ b/pd/src/s_audio_pablio.h @@ -7,7 +7,7 @@ extern "C" #endif /* __cplusplus */ /* - * $Id: s_audio_pablio.h,v 1.5 2006-08-15 16:09:57 millerpuckette Exp $ + * $Id: s_audio_pablio.h,v 1.6 2006-08-15 21:57:29 millerpuckette Exp $ * PABLIO.h * Portable Audio Blocking read/write utility. * diff --git a/pd/src/s_audio_paring.c b/pd/src/s_audio_paring.c index c824700d..89ed1960 100644 --- a/pd/src/s_audio_paring.c +++ b/pd/src/s_audio_paring.c @@ -1,5 +1,5 @@ /* - * $Id: s_audio_paring.c,v 1.5 2006-08-15 16:09:57 millerpuckette Exp $ + * $Id: s_audio_paring.c,v 1.6 2006-08-15 21:57:29 millerpuckette Exp $ * ringbuffer.c * Ring Buffer utility.. * diff --git a/pd/src/s_audio_paring.h b/pd/src/s_audio_paring.h index dcd218b5..9d8613d5 100644 --- a/pd/src/s_audio_paring.h +++ b/pd/src/s_audio_paring.h @@ -6,7 +6,7 @@ extern "C" #endif /* __cplusplus */ /* - * $Id: s_audio_paring.h,v 1.5 2006-08-15 16:09:57 millerpuckette Exp $ + * $Id: s_audio_paring.h,v 1.6 2006-08-15 21:57:29 millerpuckette Exp $ * ringbuffer.h * Ring Buffer utility.. * |