[PD-cvs] pd/src desire.c,1.1.2.177,1.1.2.178
Mathieu Bouchard
matju at users.sourceforge.net
Mon Sep 11 10:18:40 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24603
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
.
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.177
retrieving revision 1.1.2.178
diff -C2 -d -r1.1.2.177 -r1.1.2.178
*** desire.c 11 Sep 2006 06:49:42 -0000 1.1.2.177
--- desire.c 11 Sep 2006 08:18:36 -0000 1.1.2.178
***************
*** 471,475 ****
if (hack) { /* only manage this canvas if it's not one of the 3 invisible builtin canvases */
gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
! gobj_changed((t_gobj *)x,0);
}
}
--- 471,475 ----
if (hack) { /* only manage this canvas if it's not one of the 3 invisible builtin canvases */
gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
! gobj_changed(x,0);
}
}
***************
*** 2884,2888 ****
canvas_readatoms(x, natoms, vec, p_nextmsg, templatesym, sc->sc_vec, nline, vec + message);
if (wasvis) canvas_getcanvas(x)->mapped = 1;
! gobj_changed(&sc->sc_gobj,0);
return 1;
}
--- 2884,2888 ----
canvas_readatoms(x, natoms, vec, p_nextmsg, templatesym, sc->sc_vec, nline, vec + message);
if (wasvis) canvas_getcanvas(x)->mapped = 1;
! gobj_changed(sc,0);
return 1;
}
***************
*** 3939,3944 ****
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue;
! hit = wb->w_parentclickfn(y, owner,
! data, template, sc, ap, basex + xloc, basey + yloc,
xpix, ypix, shift, alt, dbl, doit);
if (hit) return hit;
--- 3939,3943 ----
t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
if (!wb) continue;
! hit = wb->w_parentclickfn(y, owner, data, template, sc, ap, basex+xloc, basey+yloc,
xpix, ypix, shift, alt, dbl, doit);
if (hit) return hit;
***************
*** 4095,4100 ****
n = x->n;
for (i = 0; i < n; i++) if (x->vec[i].name == name) {
! *p_onset = i * sizeof(t_word);
! *p_type = x->vec[i].type;
*p_arraytype = x->vec[i].arraytemplate;
return 1;
--- 4094,4099 ----
n = x->n;
for (i = 0; i < n; i++) if (x->vec[i].name == name) {
! *p_onset = i*sizeof(t_word);
! *p_type = x->vec[i].type;
*p_arraytype = x->vec[i].arraytemplate;
return 1;
***************
*** 4381,4390 ****
}
- static void template_setup(void) {
- template_class = class_new(gensym("template"), 0, (t_method)template_free,
- sizeof(t_template), CLASS_PD, 0);
- class_addmethod3(pd_canvasmaker, template_usetemplate, "struct", "*");
- }
-
/* ---------------- gtemplates. One per canvas. ----------- */
--- 4380,4383 ----
***************
*** 4488,4498 ****
}
- static void gtemplate_setup(void) {
- gtemplate_class = class_new(gensym("struct"),
- (t_newmethod)gtemplate_new, (t_method)gtemplate_free,
- sizeof(t_gtemplate), CLASS_NOINLET, A_GIMME, 0);
- class_addcreator((t_newmethod)gtemplate_new_old, gensym("template"), A_GIMME, 0);
- }
-
/* --------------- FIELD DESCRIPTORS (NOW CALLED SLOT) ---------------------- */
/* a field descriptor can hold a constant or a variable's name; in the latter case,
--- 4481,4484 ----
***************
*** 4849,4863 ****
}
- static void curve_setup(void) {
- curve_class = class_new(gensym("drawpolygon"), (t_newmethod)curve_new,
- (t_method)curve_free, sizeof(t_curve), 0, A_GIMME, 0);
- class_setdrawcommand(curve_class);
- class_addcreator((t_newmethod)curve_new, gensym("drawcurve"), A_GIMME, 0);
- class_addcreator((t_newmethod)curve_new, gensym("filledpolygon"), A_GIMME, 0);
- class_addcreator((t_newmethod)curve_new, gensym("filledcurve"), A_GIMME, 0);
- class_setparentwidget(curve_class, &curve_widgetbehavior);
- class_addfloat(curve_class, curve_float);
- }
-
t_class *plot_class;
--- 4835,4838 ----
***************
*** 5017,5024 ****
array_getcoordinate(canvas, &array->vec[i*elemsize], xonset, yonset, wonset,
i, basex + xloc, basey + yloc, xinc, xslot, yslot, wslot, &xpix, &ypix, &wpix);
! if (xpix < x1) x1 = xpix;
! if (xpix > x2) x2 = xpix;
! if (ypix - wpix < y1) y1 = ypix - wpix;
! if (ypix + wpix > y2) y2 = ypix + wpix;
if (scalarvis != 0) {
/* check also the drawing instructions for the scalar */
--- 4992,4997 ----
array_getcoordinate(canvas, &array->vec[i*elemsize], xonset, yonset, wonset,
i, basex + xloc, basey + yloc, xinc, xslot, yslot, wslot, &xpix, &ypix, &wpix);
! x1=MIN(x1,xpix); y1=MIN(y1,ypix-wpix);
! x2=MAX(x2,xpix); y2=MAX(y2,ypix+wpix);
if (scalarvis != 0) {
/* check also the drawing instructions for the scalar */
***************
*** 5042,5049 ****
}
end:
! *xp1 = x1;
! *yp1 = y1;
! *xp2 = x2;
! *yp2 = y2;
}
--- 5015,5020 ----
}
end:
! *xp1 = x1; *yp1 = y1;
! *xp2 = x2; *yp2 = y2;
}
***************
*** 5231,5242 ****
t_parentwidgetbehavior plot_widgetbehavior = {plot_getrect,0,0,0,plot_vis,plot_click};
- static void plot_setup(void) {
- plot_class = class_new(gensym("plot"), (t_newmethod)plot_new, 0,
- sizeof(t_plot), 0, A_GIMME, 0);
- class_setdrawcommand(plot_class);
- class_addfloat(plot_class, plot_float);
- class_setparentwidget(plot_class, &plot_widgetbehavior);
- }
-
/* ---------------- drawnumber: draw a number (or symbol) ---------------- */
/* drawnumbers draw numeric fields at controllable locations, with controllable color and label.
--- 5202,5205 ----
***************
*** 5328,5336 ****
}
- static void drawnumber_displace(t_gobj *z, t_canvas *canvas, t_word *data, t_template *template,
- float basex, float basey, int dx, int dy) {
- /* refuse */
- }
-
static void drawnumber_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *template,
float basex, float basey, int vis) {
--- 5291,5294 ----
***************
*** 5343,5349 ****
char colorstring[20], buf[DRAWNUMBER_BUFSIZE];
numbertocolor(slot_getfloat(&x->color, template, data, 1), colorstring);
! if (x->flags & DRAW_SYMBOL)
! SETSYMBOL(&at, slot_getsymbol(&x->value, template, data, 0));
! else SETFLOAT(&at, slot_getfloat( &x->value, template, data, 0));
drawnumber_sprintf(x, buf, &at);
sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}",
--- 5301,5306 ----
char colorstring[20], buf[DRAWNUMBER_BUFSIZE];
numbertocolor(slot_getfloat(&x->color, template, data, 1), colorstring);
! if (x->flags & DRAW_SYMBOL) SETSYMBOL(&at, slot_getsymbol(&x->value, template, data, 0));
! else SETFLOAT( &at, slot_getfloat( &x->value, template, data, 0));
drawnumber_sprintf(x, buf, &at);
sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}",
***************
*** 5371,5378 ****
t_slot *f = &x->value;
dn.ycumulative -= dy;
! template_setfloat(dn.template,
! f->u.varsym, dn.wp, dn.ycumulative, 1);
if (dn.scalar) scalar_redraw(dn.scalar, dn.canvas);
! if (dn.array) array_redraw(dn.array, dn.canvas);
}
#endif
--- 5328,5334 ----
t_slot *f = &x->value;
dn.ycumulative -= dy;
! template_setfloat(dn.template, f->u.varsym, dn.wp, dn.ycumulative, 1);
if (dn.scalar) scalar_redraw(dn.scalar, dn.canvas);
! if (dn.array) array_redraw(dn.array, dn.canvas);
}
#endif
***************
*** 5398,5409 ****
t_parentwidgetbehavior drawnumber_widgetbehavior = {
! drawnumber_getrect,drawnumber_displace,0,0,drawnumber_vis,drawnumber_click};
static void drawnumber_free(t_drawnumber *x) {}
! static void drawnumber_setup(void) {
drawnumber_class = class_new(gensym("drawnumber"),
! (t_newmethod)drawnumber_new, (t_method)drawnumber_free,
! sizeof(t_drawnumber), 0, A_GIMME, 0);
class_setdrawcommand(drawnumber_class);
class_addfloat(drawnumber_class, drawnumber_float);
--- 5354,5386 ----
t_parentwidgetbehavior drawnumber_widgetbehavior = {
! drawnumber_getrect,0,0,0,drawnumber_vis,drawnumber_click};
static void drawnumber_free(t_drawnumber *x) {}
! static void g_template_setup(void) {
! template_class = class_new(gensym("template"), 0, (t_method)template_free,
! sizeof(t_template), CLASS_PD, 0);
! class_addmethod3(pd_canvasmaker, template_usetemplate, "struct", "*");
! gtemplate_class = class_new(gensym("struct"), (t_newmethod)gtemplate_new, (t_method)gtemplate_free,
! sizeof(t_gtemplate), CLASS_NOINLET, A_GIMME, 0);
! class_addcreator((t_newmethod)gtemplate_new_old, gensym("template"), A_GIMME, 0);
!
! curve_class = class_new(gensym("drawpolygon"), (t_newmethod)curve_new,
! (t_method)curve_free, sizeof(t_curve), 0, A_GIMME, 0);
! class_setdrawcommand(curve_class);
! class_addcreator((t_newmethod)curve_new, gensym("drawcurve"), A_GIMME, 0);
! class_addcreator((t_newmethod)curve_new, gensym("filledpolygon"), A_GIMME, 0);
! class_addcreator((t_newmethod)curve_new, gensym("filledcurve"), A_GIMME, 0);
! class_setparentwidget(curve_class, &curve_widgetbehavior);
! class_addfloat(curve_class, curve_float);
!
! plot_class = class_new(gensym("plot"), (t_newmethod)plot_new, 0,
! sizeof(t_plot), 0, A_GIMME, 0);
! class_setdrawcommand(plot_class);
! class_addfloat(plot_class, plot_float);
! class_setparentwidget(plot_class, &plot_widgetbehavior);
!
drawnumber_class = class_new(gensym("drawnumber"),
! (t_newmethod)drawnumber_new, (t_method)drawnumber_free, sizeof(t_drawnumber), 0, A_GIMME, 0);
class_setdrawcommand(drawnumber_class);
class_addfloat(drawnumber_class, drawnumber_float);
***************
*** 5412,5423 ****
}
- static void g_template_setup(void) {
- template_setup();
- gtemplate_setup();
- curve_setup();
- plot_setup();
- drawnumber_setup();
- }
-
/* ------------- gstubs and gpointers - safe pointing --------------- */
/* create a gstub which is "owned" by a canvas (gl) or an array ("a"). */
--- 5389,5392 ----
***************
*** 5555,5559 ****
canvas = gs->gs_un.gs_glist;
if (canvas->valid != gp->gp_valid) {pd_error(x, "next: stale pointer"); return;}
! if (wantselected && !canvas_isvisible(canvas)) {pd_error(x, "vnext: next-selected only works for a visible window"); return;}
gobj = &gp->gp_un.gp_scalar->sc_gobj;
if (!gobj) gobj = canvas->list;
--- 5524,5528 ----
canvas = gs->gs_un.gs_glist;
if (canvas->valid != gp->gp_valid) {pd_error(x, "next: stale pointer"); return;}
! if (wantselected && !canvas_isvisible(canvas)) {pd_error(x, "next: next-selected only works for a visible window"); return;}
gobj = &gp->gp_un.gp_scalar->sc_gobj;
if (!gobj) gobj = canvas->list;
***************
*** 5599,5609 ****
if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;}
templatesym = gpointer_gettemplatesym(&x->gp);
! for (n = x->ntypedout, to = x->typedout; n--; to++) {
if (to->type == templatesym) {outlet_pointer(to->outlet, &x->gp); return;}
- }
outlet_pointer(x->otherout, &x->gp);
}
-
static void ptrobj_pointer(t_ptrobj *x, t_gpointer *gp) {
gpointer_unset(&x->gp);
--- 5568,5576 ----
if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;}
templatesym = gpointer_gettemplatesym(&x->gp);
! for (n = x->ntypedout, to = x->typedout; n--; to++)
if (to->type == templatesym) {outlet_pointer(to->outlet, &x->gp); return;}
outlet_pointer(x->otherout, &x->gp);
}
static void ptrobj_pointer(t_ptrobj *x, t_gpointer *gp) {
gpointer_unset(&x->gp);
***************
*** 5612,5616 ****
}
-
static void ptrobj_rewind(t_ptrobj *x) {
t_canvas *canvas;
--- 5579,5582 ----
***************
*** 5963,5972 ****
}
if (gs->gs_which == GP_GLIST) {
! if (canvas_isvisible(gs->gs_un.gs_glist)) gobj_changed((t_gobj *)(gp->gp_un.gp_scalar),0);
} else {
t_array *o = gs->gs_un.gs_array;
while (STUB(o)->gs_which == GP_ARRAY) o = STUB(o)->gs_un.gs_array;
! if (canvas_isvisible(STUB(o)->gs_un.gs_glist))
! gobj_changed((t_gobj *)(o->gp.gp_un.gp_scalar),0);
}
}
--- 5929,5937 ----
}
if (gs->gs_which == GP_GLIST) {
! if (canvas_isvisible(gs->gs_un.gs_glist)) gobj_changed(gp->gp_un.gp_scalar,0);
} else {
t_array *o = gs->gs_un.gs_array;
while (STUB(o)->gs_which == GP_ARRAY) o = STUB(o)->gs_un.gs_array;
! if (canvas_isvisible(STUB(o)->gs_un.gs_glist)) gobj_changed(o->gp.gp_un.gp_scalar,0);
}
}
***************
*** 6033,6037 ****
if (oldsc) {sc->sc_gobj.g_next = oldsc->sc_gobj.g_next; oldsc->sc_gobj.g_next = &sc->sc_gobj;}
else {sc->sc_gobj.g_next = canvas->list; canvas->list = &sc->sc_gobj;}
! gobj_changed(&sc->sc_gobj, 0);
gp->gp_un.gp_scalar = sc;
vec = sc->sc_vec;
--- 5998,6002 ----
if (oldsc) {sc->sc_gobj.g_next = oldsc->sc_gobj.g_next; oldsc->sc_gobj.g_next = &sc->sc_gobj;}
else {sc->sc_gobj.g_next = canvas->list; canvas->list = &sc->sc_gobj;}
! gobj_changed(sc,0);
gp->gp_un.gp_scalar = sc;
vec = sc->sc_vec;
***************
*** 6100,6104 ****
get_class = class_new(gensym("get"), (t_newmethod)get_new,
(t_method)get_free, sizeof(t_get), 0, A_GIMME, 0);
! class_addpointer(get_class, get_pointer);
set_class = class_new(gensym("set"), (t_newmethod)set_new,
--- 6065,6069 ----
get_class = class_new(gensym("get"), (t_newmethod)get_new,
(t_method)get_free, sizeof(t_get), 0, A_GIMME, 0);
! class_addpointer(get_class, get_pointer);
set_class = class_new(gensym("set"), (t_newmethod)set_new,
***************
*** 6345,6361 ****
{binbuf_eval(x->m_text.te_binbuf, &x->mresp.mr_pd, argc, argv);}
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->m_text.te_binbuf, argc, argv); gobj_changed(x->canvas,0);}
static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
{binbuf_clear(x->m_text.te_binbuf); message_add2(x,s,argc,argv);}
! static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv) {
! binbuf_add(x->m_text.te_binbuf, argc, argv);
! binbuf_addsemi(x->m_text.te_binbuf); gobj_changed(x->canvas,0);
! }
static void message_addcomma(t_message *x)
! {t_atom a; SETCOMMA(&a); binbuf_add(x->m_text.te_binbuf, 1, &a); gobj_changed(x->canvas,0);}
static void message_adddollar(t_message *x, t_floatarg f)
! {t_atom a; SETDOLLAR(&a, f<0?0:f); binbuf_add(x->m_text.te_binbuf, 1, &a); gobj_changed(x->canvas,0);}
static void message_adddollsym(t_message *x, t_symbol *s)
! {t_atom a; SETDOLLSYM(&a, s); binbuf_add(x->m_text.te_binbuf, 1, &a); gobj_changed(x->canvas,0);}
static void message_addsemi(t_message *x) {message_add(x,0,0,0);}
--- 6310,6324 ----
{binbuf_eval(x->m_text.te_binbuf, &x->mresp.mr_pd, argc, argv);}
static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->m_text.te_binbuf, argc, argv); gobj_changed(x,0);}
static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv)
{binbuf_clear(x->m_text.te_binbuf); message_add2(x,s,argc,argv);}
! static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv)
! {binbuf_add(x->m_text.te_binbuf, argc, argv); binbuf_addsemi(x->m_text.te_binbuf); gobj_changed(x,0);}
static void message_addcomma(t_message *x)
! {t_atom a; SETCOMMA(&a); binbuf_add(x->m_text.te_binbuf, 1, &a); gobj_changed(x,0);}
static void message_adddollar(t_message *x, t_floatarg f)
! {t_atom a; SETDOLLAR(&a, f<0?0:f); binbuf_add(x->m_text.te_binbuf, 1, &a); gobj_changed(x,0);}
static void message_adddollsym(t_message *x, t_symbol *s)
! {t_atom a; SETDOLLSYM(&a, s); binbuf_add(x->m_text.te_binbuf, 1, &a); gobj_changed(x,0);}
static void message_addsemi(t_message *x) {message_add(x,0,0,0);}
More information about the Pd-cvs
mailing list