Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32711
Modified Files: Tag: desiredata desire.c Log Message: fix [outlet] ordering bug
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.201 retrieving revision 1.1.2.217.2.202 diff -C2 -d -r1.1.2.217.2.201 -r1.1.2.217.2.202 *** desire.c 12 Aug 2007 00:47:42 -0000 1.1.2.217.2.201 --- desire.c 12 Aug 2007 01:16:06 -0000 1.1.2.217.2.202 *************** *** 2191,2223 **** int gobj_order_x (t_object **a, t_object **b) {return (*a)->x - (*b)->x;}
static void canvas_resortinlets(t_canvas *x) { int n=0; canvas_each(y,x) if (y->_class==vinlet_class) n++; t_object **vec = new t_object *[n], **vp = vec; canvas_each(y,x) if (y->_class==vinlet_class) *vp++ = (t_object *)y; - //{std::ostringstream s; s<<"disorder:"; for (int i=0; i<n; i++) s<<" "<<vec[i]->x; post("%s",s.str().data());} qsort(vec,n,sizeof(t_object *),(t_order)gobj_order_x); - //{std::ostringstream s; s<<" order:"; for (int i=0; i<n; i++) s<<" "<<vec[i]->x; post("%s",s.str().data());} - //t_inlet *p=0; for (int i=n; i--;) {t_inlet *let = vinlet_getit(vec[i]); let->next = p;} for (int i=n; i--;) obj_moveinletfirst(x,vinlet_getit(vec[i])); delete[] vec; } static void canvas_resortoutlets(t_canvas *x) { ! int n=0, j, xmax = -0x7fffffff; ! t_gobj *y, **maxp; ! canvas_each(y,x) if (y->_class==voutlet_class) n++; ! if (n<2) return; ! t_gobj **vec = (t_gobj **)getbytes(n*sizeof(*vec)), **vp = vec; ! canvas_each(y,x) if (y->_class==voutlet_class) *vp++ = y; ! for (int i=n; i--;) { ! for (vp = vec, maxp = 0, j=n; j--; vp++) { ! if (!*vp) continue; ! int x1 = ((t_text *)*vp)->x; ! if (x1 > xmax) {xmax = x1; maxp = vp;} ! } ! if (!maxp) break; ! y = *maxp; *maxp = 0; ! obj_moveoutletfirst(x,voutlet_getit(y)); ! } ! free(vec); }
--- 2191,2211 ---- int gobj_order_x (t_object **a, t_object **b) {return (*a)->x - (*b)->x;}
+ //{std::ostringstream s; s<<"disorder:"; for (int i=0; i<n; i++) s<<" "<<vec[i]->x; post("%s",s.str().data());} + static void canvas_resortinlets(t_canvas *x) { int n=0; canvas_each(y,x) if (y->_class==vinlet_class) n++; t_object **vec = new t_object *[n], **vp = vec; canvas_each(y,x) if (y->_class==vinlet_class) *vp++ = (t_object *)y; qsort(vec,n,sizeof(t_object *),(t_order)gobj_order_x); for (int i=n; i--;) obj_moveinletfirst(x,vinlet_getit(vec[i])); delete[] vec; } static void canvas_resortoutlets(t_canvas *x) { ! int n=0; canvas_each(y,x) if (y->_class==voutlet_class) n++; ! t_object **vec = new t_object *[n], **vp = vec; ! canvas_each(y,x) if (y->_class==voutlet_class) *vp++ = (t_object *)y; ! qsort(vec,n,sizeof(t_object *),(t_order)gobj_order_x); ! for (int i=n; i--;) obj_moveoutletfirst(x,voutlet_getit(vec[i])); ! delete[] vec; }