Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27099
Modified Files: Tag: desiredata desire.c m_class.c m_pd.h Log Message: t_parentwidgetbehavior is dead
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.33.2.7 retrieving revision 1.4.4.11.2.33.2.8 diff -C2 -d -r1.4.4.11.2.33.2.7 -r1.4.4.11.2.33.2.8 *** m_pd.h 13 Dec 2006 01:17:38 -0000 1.4.4.11.2.33.2.7 --- m_pd.h 13 Dec 2006 02:53:02 -0000 1.4.4.11.2.33.2.8 *************** *** 256,263 **** #define te_type type
! #define T_TEXT 0 /* just a textual comment */ ! #define T_OBJECT 1 /* a MAX style patchable object */ ! #define T_MESSAGE 2 /* a MAX stype message */ ! #define T_ATOM 3 /* a cell to display a number or symbol */
#define ob_outlet te_outlet --- 256,263 ---- #define te_type type
! #define T_TEXT 0 /* Comment */ ! #define T_OBJECT 1 /* ObjectBox or other */ ! #define T_MESSAGE 2 /* MessageBox */ ! #define T_ATOM 3 /* FloatBox or SymbolBox */
#define ob_outlet te_outlet *************** *** 459,470 **** char *dirresult, char **nameresult, unsigned int size, int bin);
- /* ---------------- widget behaviors ---------------------- */ - - #if 1 /* this should go away soon */ - EXTERN_STRUCT _parentwidgetbehavior; - #define t_parentwidgetbehavior struct _parentwidgetbehavior - EXTERN t_parentwidgetbehavior *pd_getparentwidget(t_pd *x); - #endif - /* -------------------- classes -------------- */
--- 459,462 ---- *************** *** 498,503 **** EXTERN void class_addanything(t_class *c, t_method fn); EXTERN void class_sethelpsymbol(t_class *c, t_symbol *s); - EXTERN void class_setparentwidget(t_class *c, t_parentwidgetbehavior *w); - EXTERN t_parentwidgetbehavior *class_parentwidget(t_class *c); EXTERN char *class_getname(t_class *c); EXTERN char *class_gethelpname(t_class *c); --- 490,493 ---- *************** *** 840,844 ****
/* removed features: ! sys_fontwidth, sys_fontheight, t_widgetbehavior, class_setproperties, class_setwidget, ! sys_pretendguibytes, sys_queuegui, sys_unqueuegui */ --- 830,835 ----
/* removed features: ! sys_fontwidth, sys_fontheight, t_widgetbehavior, class_setproperties, ! class_setwidget, class_setparentwidget, sys_pretendguibytes, ! sys_queuegui, sys_unqueuegui, */
Index: m_class.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_class.c,v retrieving revision 1.3.4.7.2.22.2.8 retrieving revision 1.3.4.7.2.22.2.9 diff -C2 -d -r1.3.4.7.2.22.2.8 -r1.3.4.7.2.22.2.9 *** m_class.c 12 Dec 2006 23:21:03 -0000 1.3.4.7.2.22.2.8 --- m_class.c 13 Dec 2006 02:53:02 -0000 1.3.4.7.2.22.2.9 *************** *** 323,333 **** void class_addanything(t_class *c, t_method fn) { c->c_anymethod = (t_anymethod)fn;}
- void class_setparentwidget(t_class *c, t_parentwidgetbehavior *pw) {c->c_pwb = pw;} char *class_getname(t_class *c) {return c->c_name->s_name;} char *class_gethelpname(t_class *c) {return c->c_helpname->s_name;} void class_sethelpsymbol(t_class *c, t_symbol *s) {c->c_helpname = s;} - - t_parentwidgetbehavior *pd_getparentwidget(t_pd *x) {return (*x)->c_pwb;} - void class_setdrawcommand(t_class *c) {c->c_drawcommand = 1;} int class_isdrawcommand( t_class *c) {return c->c_drawcommand;} --- 323,329 ---- *************** *** 788,793 **** t_methodentry *c_methods; int c_nmethod; t_method c_freemethod; - struct _widgetbehavior *c_wb; - struct _parentwidgetbehavior *c_pwb; t_savefn c_savefn; int c_floatsignalin; --- 784,787 ----
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.58 retrieving revision 1.1.2.217.2.59 diff -C2 -d -r1.1.2.217.2.58 -r1.1.2.217.2.59 *** desire.c 13 Dec 2006 02:36:53 -0000 1.1.2.217.2.58 --- desire.c 13 Dec 2006 02:53:00 -0000 1.1.2.217.2.59 *************** *** 1838,1842 **** t_canvas *elemtemplatecanvas; t_template *elemtemplate; ! int elemsize, yonset, wonset, xonset, incr, hit; float xsum=0; if (elemtemplatesym == &s_float) return 0; --- 1838,1842 ---- t_canvas *elemtemplatecanvas; t_template *elemtemplate; ! int elemsize, yonset, wonset, xonset, incr; float xsum=0; if (elemtemplatesym == &s_float) return 0; *************** *** 1845,1850 **** return 0; /* if it has more than 2000 points, just check 300 of them. */ ! if (array->n < 2000) incr = 1; ! else incr = array->n / 300; for (int i=0; i < array->n; i += incr) { float usexloc, useyloc; --- 1845,1849 ---- return 0; /* if it has more than 2000 points, just check 300 of them. */ ! if (array->n < 2000) incr=1; else incr = array->n/300; for (int i=0; i < array->n; i += incr) { float usexloc, useyloc; *************** *** 1852,1857 **** else usexloc = xloc + xsum, xsum += xinc; useyloc = yloc + (yonset>=0 ? slot_cvttocoord(yfield, *(float *)&array->vec[elemsize*i+yonset]):0); ! hit = scalar_doclick((t_word *)&array->vec[elemsize*i], ! elemtemplate, 0, array, canvas, usexloc, useyloc, xpix, ypix, shift, alt, dbl, doit); if (hit) return hit; } --- 1851,1858 ---- else usexloc = xloc + xsum, xsum += xinc; useyloc = yloc + (yonset>=0 ? slot_cvttocoord(yfield, *(float *)&array->vec[elemsize*i+yonset]):0); ! int hit = 0; ! /* hit = scalar_doclick((t_word *)&array->vec[elemsize*i], ! elemtemplate, 0, array, canvas, usexloc, useyloc, xpix, ypix, shift, alt, dbl, doit);*/ ! if (hit) return hit; } *************** *** 3760,3767 **** return; } ! canvas_each(y,templatecanvas) { ! t_parentwidgetbehavior *wb = pd_getparentwidget(y); ! if (wb) wb->w_parentvisfn(y, owner, x->v, t, basex, basey, vis); ! } //sys_unqueuegui(x); } --- 3761,3765 ---- return; } ! //canvas_each(y,templatecanvas) pd_getparentwidget(y)->w_parentvisfn(y,owner,x->v,t,basex,basey,vis); //sys_unqueuegui(x); } *************** *** 3776,3794 **** }
int scalar_doclick(t_word *data, t_template *t, t_scalar *sc, t_array *ap, t_canvas *owner, float xloc, float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit) { - int hit = 0; t_canvas *templatecanvas = template_findcanvas(t); float basex = template_getfloat(t, gensym("x"), data, 0); float basey = template_getfloat(t, gensym("y"), data, 0); canvas_each(y,templatecanvas) { ! t_parentwidgetbehavior *wb = pd_getparentwidget(y); ! if (!wb) continue; ! hit = wb->w_parentclickfn(y, owner, data, t, sc, ap, basex+xloc, basey+yloc, xpix, ypix, shift, alt, dbl, doit); if (hit) return hit; ! } return 0; }
static int scalar_click(t_gobj *z, t_canvas *owner, --- 3774,3791 ---- }
+ #if 0 int scalar_doclick(t_word *data, t_template *t, t_scalar *sc, t_array *ap, t_canvas *owner, float xloc, float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_canvas *templatecanvas = template_findcanvas(t); float basex = template_getfloat(t, gensym("x"), data, 0); float basey = template_getfloat(t, gensym("y"), data, 0); canvas_each(y,templatecanvas) { ! int hit = pd_getparentwidget(y)->w_parentclickfn(y, owner, data, t, sc, ap, basex+xloc, basey+yloc, xpix, ypix, shift, alt, dbl, doit); if (hit) return hit; ! }*/ return 0; } + #endif
static int scalar_click(t_gobj *z, t_canvas *owner, *************** *** 4508,4532 **** }
- static void curve_getrect(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, - float basex, float basey, int *xp1, int *yp1, int *xp2, int *yp2) { - t_curve *x = (t_curve *)z; - int n = x->npoints; - t_slot *f = x->vec; - int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; - if (x->flags&NOMOUSE || !slot_getfloat(&x->vis, t, data, 0)) { - *xp1 = *yp1 = 0x7fffffff; - *xp2 = *yp2 = -0x7fffffff; - return; - } - for (int i=0; i<n; i++, f += 2) { - int xloc = canvas_xtopixels(canvas, basex + slot_getcoord(f , t, data, 0)); - int yloc = canvas_ytopixels(canvas, basey + slot_getcoord(f+1, t, data, 0)); - x1=imin(x1,xloc); y1=imin(y1,yloc); - x2=imax(x2,xloc); y2=imax(y2,yloc); - } - *xp1 = x1; *yp1 = y1; - *xp2 = x2; *yp2 = y2; - } - static int rangecolor(int n) {return n*9/255;}
--- 4505,4508 ---- *************** *** 4646,4651 **** }
- t_parentwidgetbehavior curve_widgetbehavior = {curve_getrect,0,0,0,curve_vis,curve_click}; - static void curve_free(t_curve *x) { t_freebytes(x->vec, 2 * x->npoints * sizeof(*x->vec)); --- 4622,4625 ---- *************** *** 4770,4829 **** }
- static void plot_getrect(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, - float basex, float basey, int *xp1, int *yp1, int *xp2, int *yp2) { - t_plot *x = (t_plot *)z; - int elemsize, yonset, wonset, xonset; - t_canvas *elemtemplatecanvas; - t_template *elemtemplate; - t_symbol *elemtemplatesym; - float linewidth, xloc, xinc, yloc, style, xsum=0, yval, vis, scalarvis; - t_array *array; - int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; - int incr; - float xpix, ypix, wpix; - t_slot *xslot, *yslot, *wslot; - if (plot_readownertemplate(x, data, t, &elemtemplatesym, &array, &linewidth, &xloc, - &xinc, &yloc, &style, &vis, &scalarvis)) goto end; - xslot = &x->xpoints; - yslot = &x->ypoints; - wslot = &x->wpoints; - - if (!vis) goto end; - if (array_getfields(elemtemplatesym, &elemtemplatecanvas, - &elemtemplate, &elemsize, xslot, yslot, wslot, &xonset, &yonset, &wonset)) goto end; - /* if it has more than 2000 points, just check 1000 of them. */ - incr = (array->n <= 2000 ? 1 : array->n / 1000); - for (int i=0; i<array->n; i += incr) { - float usexloc, useyloc; - /* get the coords of the point proper */ - 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,(int)xpix); y1=min(y1,(int)(ypix-wpix)); - x2=max(x2,(int)xpix); y2=max(y2,(int)(ypix+wpix)); - if (scalarvis != 0) { - /* check also the drawing instructions for the scalar */ - if (xonset >= 0) - usexloc = basex + xloc + slot_cvttocoord(xslot, *(float *)&array->vec[elemsize*i+xonset]); - else usexloc = basex + xsum, xsum += xinc; - yval = yonset>=0 ? *(float *)&array->vec[elemsize*i+yonset] : 0; - useyloc = basey + yloc + slot_cvttocoord(yslot, yval); - canvas_each(y,elemtemplatecanvas) { - int xx1, xx2, yy1, yy2; - t_parentwidgetbehavior *wb = pd_getparentwidget(y); - if (!wb) continue; - wb->w_parentgetrectfn(y, canvas, (t_word *)((char *)array->vec + elemsize*i), - elemtemplate, usexloc, useyloc, &xx1, &yy1, &xx2, &yy2); - if (xx1 < x1) x1 = xx1; - if (yy1 < y1) y1 = yy1; - if (xx2 > x2) x2 = xx2; - if (yy2 > y2) y2 = yy2; - } - } - } - end: - *xp1 = x1; *yp1 = y1; - *xp2 = x2; *yp2 = y2; - } - static void plot_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, float basex, float basey, int tovis) { --- 4744,4747 ---- *************** *** 4970,4990 **** yval = yonset>=0 ? *(float *)(elem+elemsize*i+yonset) : 0; useyloc = basey + yloc + slot_cvttocoord(yslot, yval); ! canvas_each(y,elemtemplatecanvas) { ! t_parentwidgetbehavior *wb = pd_getparentwidget(y); ! if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), ! elemtemplate, usexloc, useyloc, tovis); ! } } } } else { /* un-draw the individual points */ ! if (scalarvis != 0) { ! for (int i=0; i<nelem; i++) { ! canvas_each(y,elemtemplatecanvas) { ! t_parentwidgetbehavior *wb = pd_getparentwidget(y); ! if (wb) wb->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), elemtemplate,0,0,0); ! } ! } ! } /* and then the trace */ sys_vgui(".x%lx.c delete plot%lx\n", (long)canvas_getcanvas(canvas), (long)data); --- 4888,4902 ---- yval = yonset>=0 ? *(float *)(elem+elemsize*i+yonset) : 0; useyloc = basey + yloc + slot_cvttocoord(yslot, yval); ! /*canvas_each(y,elemtemplatecanvas) pd_getparentwidget(y)->w_parentvisfn(y, canvas, ! (t_word *)(elem+elemsize*i), elemtemplate, usexloc, useyloc, tovis);*/ } } } else { /* un-draw the individual points */ ! /* ! if (scalarvis != 0) ! for (int i=0; i<nelem; i++) ! canvas_each(y,elemtemplatecanvas) ! pd_getparentwidget(y)->w_parentvisfn(y, canvas, (t_word *)(elem+elemsize*i), elemtemplate,0,0,0);*/ /* and then the trace */ sys_vgui(".x%lx.c delete plot%lx\n", (long)canvas_getcanvas(canvas), (long)data); *************** *** 5005,5010 **** }
- t_parentwidgetbehavior plot_widgetbehavior = {plot_getrect,0,0,0,plot_vis,plot_click}; - /* ---------------- drawnumber: draw a number (or symbol) ---------------- */ /* drawnumbers draw numeric fields at controllable locations, with controllable color and label. --- 4917,4920 ---- *************** *** 5070,5096 **** }
- static void drawnumber_getrect(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, - float basex, float basey, int *xp1, int *yp1, int *xp2, int *yp2) { - t_drawnumber *x = (t_drawnumber *)z; - t_atom at; - int xloc, yloc; - char buf[DRAWNUMBER_BUFSIZE]; - if (!slot_getfloat(&x->vis, t, data, 0)) { - *xp1 = *yp1 = 0x7fffffff; - *xp2 = *yp2 = -0x7fffffff; - return; - } - xloc = canvas_xtopixels(canvas, basex + slot_getcoord(&x->xloc, t, data, 0)); - yloc = canvas_ytopixels(canvas, basey + slot_getcoord(&x->yloc, t, data, 0)); - if (x->flags & DRAW_SYMBOL) - SETSYMBOL(&at, slot_getsymbol(&x->value, t, data, 0)); - else SETFLOAT(&at, slot_getfloat(&x->value, t, data, 0)); - drawnumber_sprintf(x, buf, &at); - *xp1 = xloc; - *yp1 = yloc; - *xp2 = xloc + 42; - *yp2 = yloc + 42; - } - static void drawnumber_vis(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, float basex, float basey, int vis) { --- 4980,4983 ---- *************** *** 5186,5189 **** --- 5073,5077 ---- }
+ #if 0 static int drawnumber_click(t_gobj *z, t_canvas *canvas, t_word *data, t_template *t, t_scalar *sc, t_array *ap, float basex, float basey, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_drawnumber *x = (t_drawnumber *)z; *************** *** 5209,5215 **** } else return 0; } ! ! t_parentwidgetbehavior drawnumber_widgetbehavior = { ! drawnumber_getrect,0,0,0,drawnumber_vis,drawnumber_click};
static void drawnumber_free(t_drawnumber *x) {} --- 5097,5101 ---- } else return 0; } ! #endif
static void drawnumber_free(t_drawnumber *x) {} *************** *** 5229,5241 **** 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); --- 5115,5122 ---- class_addcreator((t_newmethod)curve_new, gensym("filledpolygon"), A_GIMME, 0); class_addcreator((t_newmethod)curve_new, gensym("filledcurve"), A_GIMME, 0); 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); drawnumber_class = class_new(gensym("drawnumber"), (t_newmethod)drawnumber_new, (t_method)drawnumber_free, sizeof(t_drawnumber), 0, A_GIMME, 0); *************** *** 5243,5247 **** class_addfloat(drawnumber_class, drawnumber_float); class_addcreator((t_newmethod)drawnumber_new, gensym("drawsymbol"), A_GIMME, 0); - class_setparentwidget(drawnumber_class, &drawnumber_widgetbehavior); }
--- 5124,5127 ----