[PD-cvs] pd/src desire.c,1.1.2.217.2.200,1.1.2.217.2.201
Mathieu Bouchard
matju at users.sourceforge.net
Sun Aug 12 02:47:46 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21860
Modified Files:
Tag: desiredata
desire.c
Log Message:
fix [inlet] ordering bug
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.200
retrieving revision 1.1.2.217.2.201
diff -C2 -d -r1.1.2.217.2.200 -r1.1.2.217.2.201
*** desire.c 11 Aug 2007 21:16:45 -0000 1.1.2.217.2.200
--- desire.c 12 Aug 2007 00:47:42 -0000 1.1.2.217.2.201
***************
*** 539,545 ****
x->loading = 1;
x->goprect = 0; /* no GOP rectangle unless it's turned on later */
! /* cancel "vis" flag if we're a subpatch of an
! abstraction inside another patch. A separate mechanism prevents
! the toplevel abstraction from showing up. */
if (vis && gensym("#X")->thing && gensym("#X")->thing->_class == canvas_class) {
t_canvas *z = (t_canvas *)(gensym("#X")->thing);
--- 539,544 ----
x->loading = 1;
x->goprect = 0; /* no GOP rectangle unless it's turned on later */
! /* cancel "vis" flag if we're a subpatch of an abstraction inside another patch.
! A separate mechanism prevents the toplevel abstraction from showing up. */
if (vis && gensym("#X")->thing && gensym("#X")->thing->_class == canvas_class) {
t_canvas *z = (t_canvas *)(gensym("#X")->thing);
***************
*** 866,871 ****
}
! /* return true if the "canvas" object is an abstraction (so we don't
! save its contents, fogr example.) */
int canvas_isabstraction(t_canvas *x) {return x->env!=0;}
--- 865,869 ----
}
! /* return true if the "canvas" object is an abstraction (so we don't save its contents, fogr example.) */
int canvas_isabstraction(t_canvas *x) {return x->env!=0;}
***************
*** 2190,2212 ****
extern "C" t_outlet *voutlet_getit(t_pd *x);
static void canvas_resortinlets(t_canvas *x) {
! int n=0, j, xmax = -0x7fffffff;
! t_gobj *y, **maxp;
! canvas_each(y,x) if (y->_class==vinlet_class) n++;
! //post("canvas_resortinlets %d",n);
! if (n<2) return;
! t_gobj **vec = (t_gobj **)getbytes(n*sizeof(*vec)), **vp = vec;
! canvas_each(y,x) if (y->_class==vinlet_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_moveinletfirst(x,vinlet_getit(y));
! }
! free(vec);
}
static void canvas_resortoutlets(t_canvas *x) {
--- 2188,2204 ----
extern "C" t_outlet *voutlet_getit(t_pd *x);
+ typedef int (*t_order)(const void *, const void *);
+ 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) {
More information about the Pd-cvs
mailing list