Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25273
Modified Files: Tag: devel_0_39 desire.c m_pd.h Log Message: more of PD_PLUSPLUS_FACE
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.30 retrieving revision 1.4.4.11.2.31 diff -C2 -d -r1.4.4.11.2.30 -r1.4.4.11.2.31 *** m_pd.h 28 Nov 2006 00:44:54 -0000 1.4.4.11.2.30 --- m_pd.h 28 Nov 2006 01:17:57 -0000 1.4.4.11.2.31 *************** *** 226,232 **** --- 226,236 ---- } t_gobj;
+ #ifdef PD_PLUSPLUS_FACE + typedef struct _scalar : t_gobj { + #else typedef struct _scalar /* a graphical object holding data */ { t_gobj sc_gobj; /* header for graphical object */ + #endif t_symbol *sc_template; /* template name (LATER replace with pointer) */ t_word sc_vec[1]; /* indeterminate-length array of words */
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.206 retrieving revision 1.1.2.207 diff -C2 -d -r1.1.2.206 -r1.1.2.207 *** desire.c 28 Nov 2006 00:55:24 -0000 1.1.2.206 --- desire.c 28 Nov 2006 01:17:55 -0000 1.1.2.207 *************** *** 87,90 **** --- 87,92 ---- #define pd_unbind(a,b) pd_unbind((t_pd *)(a),b) #define pd_checkobject(a) pd_checkobject((t_pd *)(a)) + #define pd_pushsym(a) pd_pushsym((t_pd *)(a)) + #define pd_popsym(a) pd_popsym((t_pd *)(a))
//-------------------------------------------------------------------------- *************** *** 396,402 **** if (*name == '$' && isdigit(name[1])) { t_canvasenvironment *env = canvas_getenv(x); ! pd_pushsym((t_pd *)x); ret = binbuf_realizedollsym(gensym(name+1), env->argc, env->argv, 1); ! pd_popsym((t_pd *)x); } else ret = s; return ret; --- 398,404 ---- if (*name == '$' && isdigit(name[1])) { t_canvasenvironment *env = canvas_getenv(x); ! pd_pushsym(x); ret = binbuf_realizedollsym(gensym(name+1), env->argc, env->argv, 1); ! pd_popsym(x); } else ret = s; return ret; *************** *** 546,550 **** x->willvis = vis; x->font = sys_nearestfontsize(font); ! pd_pushsym((t_pd *)x); x->next_add = -1; x->connectbuf = binbuf_new(); --- 548,552 ---- x->willvis = vis; x->font = sys_nearestfontsize(font); ! pd_pushsym(x); x->next_add = -1; x->connectbuf = binbuf_new(); *************** *** 610,614 **** x->gl_obj.te_binbuf = binbuf_new(); binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph")); ! if (!menu) pd_pushsym((t_pd *)x); canvas_add(g, (t_gobj *)x); return x; --- 612,616 ---- x->gl_obj.te_binbuf = binbuf_new(); binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph")); ! if (!menu) pd_pushsym(x); canvas_add(g, (t_gobj *)x); return x; *************** *** 761,769 **** static void canvas_resortoutlets(t_canvas *x);
! static void canvas_push(t_canvas *x) {pd_pushsym((t_pd *)x);}
static void canvas_pop(t_canvas *x, t_floatarg fvis) { if (fvis!=0) canvas_vis(x, 1); ! pd_popsym((t_pd *)x); canvas_resortinlets(x); canvas_resortoutlets(x); --- 763,771 ---- static void canvas_resortoutlets(t_canvas *x);
! static void canvas_push(t_canvas *x) {pd_pushsym(x);}
static void canvas_pop(t_canvas *x, t_floatarg fvis) { if (fvis!=0) canvas_vis(x, 1); ! pd_popsym(x); canvas_resortinlets(x); canvas_resortoutlets(x); *************** *** 857,861 **** extern "C" void canvas_popabstraction(t_canvas *x) { newest = (t_pd *)x; ! pd_popsym((t_pd *)x); x->loading = 0; canvas_resortinlets(x); --- 859,863 ---- extern "C" void canvas_popabstraction(t_canvas *x) { newest = (t_pd *)x; ! pd_popsym(x); x->loading = 0; canvas_resortinlets(x); *************** *** 883,889 **** else if (ac && av->a_type == A_DOLLSYM) { t_canvasenvironment *e = canvas_getenv(x); ! pd_pushsym((t_pd *)x); canvas_rename(x, binbuf_realizedollsym(av->a_w.w_symbol, e->argc, e->argv, 1), 0); ! pd_popsym((t_pd *)x); } else canvas_rename(x, gensym("Pd"), 0); --- 885,891 ---- else if (ac && av->a_type == A_DOLLSYM) { t_canvasenvironment *e = canvas_getenv(x); ! pd_pushsym(x); canvas_rename(x, binbuf_realizedollsym(av->a_w.w_symbol, e->argc, e->argv, 1), 0); ! pd_popsym(x); } else canvas_rename(x, gensym("Pd"), 0); *************** *** 915,919 **** x->owner = z; /* create a graph for the table */ ! t_canvas *gl = canvas_addcanvas((t_canvas*)x, &s_, 0, -1, (f > 1 ? f-1 : 1), 1, 50, 350, 550, 50); graph_array(gl, s, &s_float, f, 0); canvas_pop(x, 0); --- 917,921 ---- x->owner = z; /* create a graph for the table */ ! t_canvas *gl = canvas_addcanvas(x, &s_, 0, -1, (f > 1 ? f-1 : 1), 1, 50, 350, 550, 50); graph_array(gl, s, &s_float, f, 0); canvas_pop(x, 0); *************** *** 1144,1149 **** void canvas_disconnect(t_canvas *x, float from_, float outlet, float to_, float inlet) { canvas_wires_each(oc,t,x) { ! int from = canvas_getindex(x, (t_gobj *)t.from); ! int to = canvas_getindex(x, (t_gobj *)t.to); if (from == from_ && t.outlet == outlet && to == to_ && t.inlet == inlet) { --- 1146,1151 ---- void canvas_disconnect(t_canvas *x, float from_, float outlet, float to_, float inlet) { canvas_wires_each(oc,t,x) { ! int from = canvas_getindex(x, t.from); ! int to = canvas_getindex(x, t.to); if (from == from_ && t.outlet == outlet && to == to_ && t.inlet == inlet) { *************** *** 1162,1169 **** int i=0, nobj = canvas_getindex(gl, 0); /* number of objects */ for (t_gobj *g = gl->list; g && i < nobj; i++) { ! if (g != except && g->_class == canvas_class && ! canvas_isabstraction((t_canvas *)g) && ! ((t_canvas *)g)->name == name && ! canvas_getdir((t_canvas *)g) == dir) { /* we're going to remake the object, so "g" will go stale. Get its index here, --- 1164,1169 ---- int i=0, nobj = canvas_getindex(gl, 0); /* number of objects */ for (t_gobj *g = gl->list; g && i < nobj; i++) { ! if (g != except && g->_class == canvas_class && canvas_isabstraction((t_canvas *)g) && ! ((t_canvas *)g)->name == name && canvas_getdir((t_canvas *)g) == dir) { /* we're going to remake the object, so "g" will go stale. Get its index here, *************** *** 1367,1374 **** binbuf_clear(x->connectbuf); canvas_wires_each(oc,t,x) { ! if ((o == (t_gobj *)t.from) != (o == (t_gobj *)t.to)) binbuf_addv(x->connectbuf, "ssiiii;", gensym("#X"), gensym("connect"), ! canvas_getindex(x, (t_gobj *)t.from), t.outlet, ! canvas_getindex(x, (t_gobj *)t.to), t.inlet); } } --- 1367,1374 ---- binbuf_clear(x->connectbuf); canvas_wires_each(oc,t,x) { ! if ((o==t.from) != (o==t.to)) binbuf_addv(x->connectbuf, "ssiiii;", gensym("#X"), gensym("connect"), ! canvas_getindex(x, t.from), t.outlet, ! canvas_getindex(x, t.to), t.inlet); } } *************** *** 2705,2710 **** */
! struct _guiconnect { ! t_object o; t_pd *who; t_symbol *sym; --- 2705,2709 ---- */
! struct _guiconnect : t_object { t_pd *who; t_symbol *sym; *************** *** 2861,2865 **** } if (wasvis) canvas_getcanvas(x)->mapped = 0; ! canvas_add(x, &sc->sc_gobj); int message; int nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg); --- 2860,2864 ---- } if (wasvis) canvas_getcanvas(x)->mapped = 0; ! canvas_add(x,sc); int message; int nline = canvas_scanbinbuf(natoms, vec, &message, p_nextmsg); *************** *** 2954,2958 **** t_gobj *y, *y2 = 0, *newone, *oldone = 0; canvas_each(y,x) { ! if (y == &sc->sc_gobj) {scindex = ntotal; oldone = y;} ntotal++; } --- 2953,2957 ---- t_gobj *y, *y2 = 0, *newone, *oldone = 0; canvas_each(y,x) { ! if (y==sc) {scindex = ntotal; oldone = y;} ntotal++; } *************** *** 3804,3808 **** TEMPLATE_CHECK(owner,templatesym,0) t_scalar *x = (t_scalar *)getbytes(sizeof(t_scalar) + (t->n - 1) * sizeof(*x->sc_vec)); ! x->sc_gobj._class = scalar_class; x->sc_template = templatesym; gpointer_setcanvas(&gp, owner, x); --- 3803,3807 ---- TEMPLATE_CHECK(owner,templatesym,0) t_scalar *x = (t_scalar *)getbytes(sizeof(t_scalar) + (t->n - 1) * sizeof(*x->sc_vec)); ! x->_class = scalar_class; x->sc_template = templatesym; gpointer_setcanvas(&gp, owner, x); *************** *** 4132,4136 **** gpointer_init(&gp); x = (t_scalar *)getbytes(sizeof(t_scalar) + (tto->n - 1) * sizeof(*x->sc_vec)); ! x->sc_gobj._class = scalar_class; x->sc_template = tfrom->sym; gpointer_setcanvas(&gp, canvas, x); --- 4131,4135 ---- gpointer_init(&gp); x = (t_scalar *)getbytes(sizeof(t_scalar) + (tto->n - 1) * sizeof(*x->sc_vec)); ! x->_class = scalar_class; x->sc_template = tfrom->sym; gpointer_setcanvas(&gp, canvas, x); *************** *** 4142,4149 **** if (canvas->list == (t_gobj *)scfrom) { canvas->list = (t_gobj *)x; ! x->sc_gobj.g_next = scfrom->sc_gobj.g_next; } else { for (t_gobj *y2, *y = canvas->list; (y2 = y->g_next); y = y2) if (y2 == (t_gobj *)scfrom) { ! x->sc_gobj.g_next = y2->g_next; y->g_next = (t_gobj *)x; goto nobug; --- 4141,4148 ---- if (canvas->list == (t_gobj *)scfrom) { canvas->list = (t_gobj *)x; ! x->g_next = scfrom->g_next; } else { for (t_gobj *y2, *y = canvas->list; (y2 = y->g_next); y = y2) if (y2 == (t_gobj *)scfrom) { ! x->g_next = y2->g_next; y->g_next = (t_gobj *)x; goto nobug; *************** *** 5426,5430 **** 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; else gobj = gobj->g_next; --- 5425,5429 ---- 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; if (!gobj) gobj = canvas->list; else gobj = gobj->g_next; *************** *** 5860,5877 **** t_gstub *gs = gp->gp_stub; t_word *vec; - t_scalar *sc, *oldsc; - t_canvas *canvas; TEMPLATE_CHECK(x,x->templatesym,) if (!gs) {pd_error(x, "no current pointer"); return;} if (gs->gs_which != GP_GLIST) {pd_error(x, "lists only, not arrays"); return;} ! canvas = gs->gs_un.gs_glist; if (canvas->valid != gp->gp_valid) {pd_error(x, "stale pointer"); return;} if (!nitems) return; x->variables[0].f = f; ! sc = scalar_new(canvas,x->templatesym); if (!sc) {pd_error(x, "%s: couldn't create scalar", x->templatesym->s_name); return;} ! oldsc = gp->gp_un.gp_scalar; ! 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; --- 5859,5874 ---- t_gstub *gs = gp->gp_stub; t_word *vec; TEMPLATE_CHECK(x,x->templatesym,) if (!gs) {pd_error(x, "no current pointer"); return;} if (gs->gs_which != GP_GLIST) {pd_error(x, "lists only, not arrays"); return;} ! t_canvas *canvas = gs->gs_un.gs_glist; if (canvas->valid != gp->gp_valid) {pd_error(x, "stale pointer"); return;} if (!nitems) return; x->variables[0].f = f; ! t_scalar *sc = scalar_new(canvas,x->templatesym); if (!sc) {pd_error(x, "%s: couldn't create scalar", x->templatesym->s_name); return;} ! t_scalar *oldsc = gp->gp_un.gp_scalar; ! if (oldsc) {sc->g_next = oldsc->g_next; oldsc->g_next = sc;} ! else {sc->g_next = canvas->list; canvas->list = sc;} gobj_changed(sc,0); gp->gp_un.gp_scalar = sc; *************** *** 6090,6094 **** newest = 0; binbuf_gettext(b,&s,&n); ! pd_pushsym((t_pd *)gl); canvas_getargs(&argc, &argv); binbuf_eval(b, &pd_objectmaker, argc, argv); --- 6087,6091 ---- newest = 0; binbuf_gettext(b,&s,&n); ! pd_pushsym(gl); canvas_getargs(&argc, &argv); binbuf_eval(b, &pd_objectmaker, argc, argv); *************** *** 6111,6115 **** if (pd_class(&x->ob_pd) == vinlet_class) canvas_resortinlets(canvas_getcanvas(gl)); if (pd_class(&x->ob_pd) == voutlet_class) canvas_resortoutlets(canvas_getcanvas(gl)); ! pd_popsym((t_pd *)gl); }
--- 6108,6112 ---- if (pd_class(&x->ob_pd) == vinlet_class) canvas_resortinlets(canvas_getcanvas(gl)); if (pd_class(&x->ob_pd) == voutlet_class) canvas_resortoutlets(canvas_getcanvas(gl)); ! pd_popsym(gl); }
*************** *** 6444,6448 **** /* canvas_reorder_last(x,i); */ gobj_changed(x,0); ! /*err: pd_popsym((t_pd *)x);*/ }
--- 6441,6445 ---- /* canvas_reorder_last(x,i); */ gobj_changed(x,0); ! /*err: pd_popsym(x);*/ }