Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26500
Modified Files: Tag: devel_0_39 desire.c Log Message: renaming of some t_fielddesc fields
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.155 retrieving revision 1.1.2.156 diff -C2 -d -r1.1.2.155 -r1.1.2.156 *** desire.c 7 Sep 2006 00:52:17 -0000 1.1.2.155 --- desire.c 7 Sep 2006 01:01:59 -0000 1.1.2.156 *************** *** 707,716 **** if (glist_isvisible(x)) canvas_map(x, 0); /* if we're a graph on our parent and the parent exists and is visible, show ourselves on parent. */ ! if (x->isgraph && x->owner) { ! canvas_create_editor(x, 1); ! x->havewindow = 0; ! } else { ! x->havewindow = 0; ! } } gobj_changed(x,0); --- 707,712 ---- if (glist_isvisible(x)) canvas_map(x, 0); /* if we're a graph on our parent and the parent exists and is visible, show ourselves on parent. */ ! if (x->isgraph && x->owner) canvas_create_editor(x, 1); ! x->havewindow = 0; } gobj_changed(x,0); *************** *** 750,755 **** canvas_vis(x, 0); sys_mgui(x,"delete",""); ! if (strcmp(x->name->s_name, "Pd")) ! pd_unbind((t_pd *)x, canvas_makebindsym(x->name)); if (x->env) { freebytes(x->env->ce_argv, x->env->ce_argc * sizeof(t_atom)); --- 746,750 ---- canvas_vis(x, 0); sys_mgui(x,"delete",""); ! if (strcmp(x->name->s_name, "Pd")) pd_unbind((t_pd *)x, canvas_makebindsym(x->name)); if (x->env) { freebytes(x->env->ce_argv, x->env->ce_argc * sizeof(t_atom)); *************** *** 4313,4318 **** glist_each(y,templatecanvas) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); ! if (!wb) continue; ! wb->w_parentvisfn(y, owner, x->sc_vec, template, basex, basey, vis); } sys_unqueuegui(x); --- 4308,4312 ---- glist_each(y,templatecanvas) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); ! if (wb) wb->w_parentvisfn(y, owner, x->sc_vec, template, basex, basey, vis); } sys_unqueuegui(x); *************** *** 4948,4970 **** t_symbol *fd_varsym; /* the field is variable and this is the name */ } fd_un; ! float fd_v1; /* min and max values */ ! float fd_v2; ! float fd_screen1; /* min and max screen values */ ! float fd_screen2; ! float fd_quantum; /* quantization in value */ };
static void fielddesc_setfloat_const(t_fielddesc *fd, float f) { ! fd->fd_type = A_FLOAT; ! fd->fd_var = 0; ! fd->fd_un.fd_float = f; ! fd->fd_v1 = fd->fd_v2 = fd->fd_screen1 = fd->fd_screen2 = fd->fd_quantum = 0; } - static void fielddesc_setsymbol_const(t_fielddesc *fd, t_symbol *s) { ! fd->fd_type = A_SYMBOL; ! fd->fd_var = 0; ! fd->fd_un.fd_symbol = s; ! fd->fd_v1 = fd->fd_v2 = fd->fd_screen1 = fd->fd_screen2 = fd->fd_quantum = 0; }
--- 4942,4957 ---- t_symbol *fd_varsym; /* the field is variable and this is the name */ } fd_un; ! float min,max; ! float scrmin,scrmax; /* min and max screen values */ ! float quantum; /* quantization in value */ };
static void fielddesc_setfloat_const(t_fielddesc *fd, float f) { ! fd->fd_type = A_FLOAT; fd->fd_var = 0; fd->fd_un.fd_float = f; ! fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } static void fielddesc_setsymbol_const(t_fielddesc *fd, t_symbol *s) { ! fd->fd_type = A_SYMBOL; fd->fd_var = 0; fd->fd_un.fd_symbol = s; ! fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; }
*************** *** 4975,4979 **** if (!(s1 = strchr(s->s_name, '(')) || !(s2 = strchr(s->s_name, ')')) || s1>s2) { fd->fd_un.fd_varsym = s; ! fd->fd_v1 = fd->fd_v2 = fd->fd_screen1 = fd->fd_screen2 = fd->fd_quantum = 0; } else { int cpy = s1 - s->s_name, got; --- 4962,4966 ---- if (!(s1 = strchr(s->s_name, '(')) || !(s2 = strchr(s->s_name, ')')) || s1>s2) { fd->fd_un.fd_varsym = s; ! fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } else { int cpy = s1 - s->s_name, got; *************** *** 4983,5003 **** strbuf[cpy] = 0; fd->fd_un.fd_varsym = gensym(strbuf); ! got = sscanf(s1, "(%f:%f)(%f:%f)(%f)", ! &fd->fd_v1, &fd->fd_v2, &fd->fd_screen1, &fd->fd_screen2, ! &fd->fd_quantum); if (got < 2) goto fail; if (got == 3 || (got < 4 && strchr(s2, '('))) goto fail; if (got < 5 && (s3 = strchr(s2, '(')) && strchr(s3+1, '(')) goto fail; ! if (got == 4) fd->fd_quantum = 0; else if (got == 2) { ! fd->fd_quantum = 0; ! fd->fd_screen1 = fd->fd_v1; ! fd->fd_screen2 = fd->fd_v2; } return; fail: post("parse error: %s", s->s_name); ! fd->fd_v1 = fd->fd_screen1 = fd->fd_v2 = fd->fd_screen2 = ! fd->fd_quantum = 0; } } --- 4970,4988 ---- strbuf[cpy] = 0; fd->fd_un.fd_varsym = gensym(strbuf); ! got = sscanf(s1, "(%f:%f)(%f:%f)(%f)", &fd->min, &fd->max, &fd->scrmin, &fd->scrmax, &fd->quantum); if (got < 2) goto fail; if (got == 3 || (got < 4 && strchr(s2, '('))) goto fail; if (got < 5 && (s3 = strchr(s2, '(')) && strchr(s3+1, '(')) goto fail; ! if (got == 4) fd->quantum = 0; else if (got == 2) { ! fd->quantum = 0; ! fd->scrmin = fd->min; ! fd->scrmax = fd->max; } return; fail: post("parse error: %s", s->s_name); ! fd->min = fd->scrmin = fd->max = fd->scrmax = ! fd->quantum = 0; } } *************** *** 5019,5023 **** fd->fd_var = 1; fd->fd_un.fd_varsym = argv->a_w.w_symbol; ! fd->fd_v1 = fd->fd_v2 = fd->fd_screen1 = fd->fd_screen2 = fd->fd_quantum = 0; } else fielddesc_setsymbol_const(fd, &s_); --- 5004,5008 ---- fd->fd_var = 1; fd->fd_un.fd_varsym = argv->a_w.w_symbol; ! fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } else fielddesc_setsymbol_const(fd, &s_); *************** *** 5044,5052 **** t_float fielddesc_cvttocoord(t_fielddesc *f, float val) { float coord, extreme, div; ! if (f->fd_v2 == f->fd_v1) return val; ! div = (f->fd_screen2 - f->fd_screen1)/(f->fd_v2 - f->fd_v1); ! coord = f->fd_screen1 + (val - f->fd_v1) * div; ! extreme = f->fd_screen1<f->fd_screen2 ? f->fd_screen1 : f->fd_screen2; if (coord<extreme) coord = extreme; ! extreme = f->fd_screen1>f->fd_screen2 ? f->fd_screen1 : f->fd_screen2; if (coord>extreme) coord = extreme; return (coord); } --- 5029,5037 ---- t_float fielddesc_cvttocoord(t_fielddesc *f, float val) { float coord, extreme, div; ! if (f->max == f->min) return val; ! div = (f->scrmax - f->scrmin)/(f->max - f->min); ! coord = f->scrmin + (val - f->min) * div; ! extreme = f->scrmin<f->scrmax ? f->scrmin : f->scrmax; if (coord<extreme) coord = extreme; ! extreme = f->scrmin>f->scrmax ? f->scrmin : f->scrmax; if (coord>extreme) coord = extreme; return (coord); } *************** *** 5068,5079 **** float fielddesc_cvtfromcoord(t_fielddesc *f, float coord) { float val; ! if (f->fd_screen2 == f->fd_screen1) val = coord; else { ! float div = (f->fd_v2 - f->fd_v1)/(f->fd_screen2 - f->fd_screen1); float extreme; ! val = f->fd_v1 + (coord - f->fd_screen1) * div; ! if (f->fd_quantum != 0) val = ((int)((val/f->fd_quantum) + 0.5)) * f->fd_quantum; ! extreme = (f->fd_v1 < f->fd_v2 ? f->fd_v1 : f->fd_v2); if (val<extreme) val=extreme; ! extreme = (f->fd_v1 > f->fd_v2 ? f->fd_v1 : f->fd_v2); if (val>extreme) val=extreme; } return val; --- 5053,5064 ---- float fielddesc_cvtfromcoord(t_fielddesc *f, float coord) { float val; ! if (f->scrmax == f->scrmin) val = coord; else { ! float div = (f->max - f->min)/(f->scrmax - f->scrmin); float extreme; ! val = f->min + (coord - f->scrmin) * div; ! if (f->quantum != 0) val = ((int)((val/f->quantum) + 0.5)) * f->quantum; ! extreme = (f->min < f->max ? f->min : f->max); if (val<extreme) val=extreme; ! extreme = (f->min > f->max ? f->min : f->max); if (val>extreme) val=extreme; } return val; *************** *** 5438,5443 **** return -1; } ! if (!template_find_field(ownertemplate, x->data.fd_un.fd_varsym, ! &arrayonset, &type, &elemtemplatesym)) { error("plot: %s: no such field", x->data.fd_un.fd_varsym->s_name); return -1; --- 5423,5427 ---- return -1; } ! if (!template_find_field(ownertemplate, x->data.fd_un.fd_varsym, &arrayonset, &type, &elemtemplatesym)) { error("plot: %s: no such field", x->data.fd_un.fd_varsym->s_name); return -1; *************** *** 5476,5484 **** /* the "float" template is special in not having to have a canvas; template_findbyname is hardwired to return a predefined template. */ ! if (!(elemtemplate = template_findbyname(elemtemplatesym))) { error("plot: %s: no such template", elemtemplatesym->s_name); return -1; } ! if (!((elemtemplatesym == &s_float) || (elemtemplatecanvas = template_findcanvas(elemtemplate)))) { error("plot: %s: no canvas for this template", elemtemplatesym->s_name); return -1; --- 5460,5468 ---- /* the "float" template is special in not having to have a canvas; template_findbyname is hardwired to return a predefined template. */ ! if (!(elemtemplate = template_findbyname(elemtemplatesym))) { error("plot: %s: no such template", elemtemplatesym->s_name); return -1; } ! if (!(elemtemplatesym==&s_float || (elemtemplatecanvas = template_findcanvas(elemtemplate)))) { error("plot: %s: no canvas for this template", elemtemplatesym->s_name); return -1; *************** *** 5547,5552 **** t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); if (!wb) continue; ! (*wb->w_parentgetrectfn)(y, glist, ! (t_word *)((char *)(array->a_vec) + elemsize * i), elemtemplate, usexloc, useyloc, &xx1, &yy1, &xx2, &yy2); if (xx1 < x1) x1 = xx1; --- 5531,5535 ---- t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); if (!wb) continue; ! wb->w_parentgetrectfn(y, glist, (t_word *)((char *)array->a_vec + elemsize*i), elemtemplate, usexloc, useyloc, &xx1, &yy1, &xx2, &yy2); if (xx1 < x1) x1 = xx1; *************** *** 5713,5718 **** glist_each(y,elemtemplatecanvas) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); ! if (!wb) continue; ! wb->w_parentvisfn(y, glist, (t_word *)(elem + elemsize * i), elemtemplate, usexloc, useyloc, tovis); } } --- 5696,5701 ---- glist_each(y,elemtemplatecanvas) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); ! if (wb) wb->w_parentvisfn(y, glist, (t_word *)(elem + elemsize*i), ! elemtemplate, usexloc, useyloc, tovis); } } *************** *** 5726,5731 **** glist_each(y,elemtemplatecanvas) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); ! if (!wb) continue; ! wb->w_parentvisfn(y, glist, (t_word *)(elem + elemsize * i), elemtemplate, 0, 0, 0); } } --- 5709,5713 ---- glist_each(y,elemtemplatecanvas) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); ! if (wb) wb->w_parentvisfn(y, glist, (t_word *)(elem + elemsize*i), elemtemplate,0,0,0); } }