Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30158
Modified Files: Tag: desiredata desire.c Log Message: replaced canvas_init by canvas_new2
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.122 retrieving revision 1.1.2.217.2.123 diff -C2 -d -r1.1.2.217.2.122 -r1.1.2.217.2.123 *** desire.c 11 Jan 2007 17:36:04 -0000 1.1.2.217.2.122 --- desire.c 11 Jan 2007 18:40:14 -0000 1.1.2.217.2.123 *************** *** 524,529 **** static int hack = 1;
! void canvas_init(t_canvas *x) { ! /* zero out everyone except "pd" and "dix" fields */ memset(((char *)x) + sizeof(t_gobj), 0, sizeof(*x) - sizeof(t_gobj)); x->xlabel = (t_symbol **)getbytes(0); --- 524,530 ---- static int hack = 1;
! static t_canvas *canvas_new2() { ! t_canvas *x = (t_canvas *)pd_new(canvas_class); ! /* zero out every field except "pd" and "dix" */ memset(((char *)x) + sizeof(t_gobj), 0, sizeof(*x) - sizeof(t_gobj)); x->xlabel = (t_symbol **)getbytes(0); *************** *** 533,536 **** --- 534,538 ---- gobj_changed(x,0); // could be made implicit } + return x; }
*************** *** 538,542 **** a "text" object in another window (canvas_getcurrent() tells us which.) */ static t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) { ! t_canvas *x = (t_canvas *)pd_new(canvas_class); t_canvas *owner = canvas_getcurrent(); t_symbol *s = &s_; --- 540,544 ---- a "text" object in another window (canvas_getcurrent() tells us which.) */ static t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) { ! t_canvas *x = canvas_new2(); t_canvas *owner = canvas_getcurrent(); t_symbol *s = &s_; *************** *** 544,548 **** int height = CANVAS_DEFCANVASHEIGHT, yloc = CANVAS_DEFCANVASYLOC; int vis=0, font = owner?owner->font:42 /*sys_defaultfont*/; - canvas_init(x); if (!owner) canvas_addtolist(x); /* toplevel vs subwindow */ --- 546,549 ---- *************** *** 616,621 **** int menu = 0; char *str; ! t_canvas *x = (t_canvas *)pd_new(canvas_class); ! canvas_init(x); if (!*sym->name) { char buf[40]; --- 617,621 ---- int menu = 0; char *str; ! t_canvas *x = canvas_new2(); if (!*sym->name) { char buf[40]; *************** *** 671,676 **** extern "C" void glob_redraw(void) {canvases_each(x) canvas_redraw(x);}
! /* This is sent from the GUI to inform a toplevel that its window has been ! moved or resized. */ static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2) { int heightwas = y2 - y1; --- 671,675 ---- extern "C" void glob_redraw(void) {canvases_each(x) canvas_redraw(x);}
! /* This is sent from the GUI to inform a toplevel that its window has been moved or resized. */ static void canvas_setbounds(t_canvas *x, int x1, int y1, int x2, int y2) { int heightwas = y2 - y1; *************** *** 1275,1280 **** canvas_vis(canvas_getcanvas(gl), 1); return 1; ! } ! else if (g->_class == canvas_class) { if (canvas_dofinderror((t_canvas *)g, error_object)) return 1; } --- 1274,1278 ---- canvas_vis(canvas_getcanvas(gl), 1); return 1; ! } else if (g->_class == canvas_class) { if (canvas_dofinderror((t_canvas *)g, error_object)) return 1; } *************** *** 7155,7159 ****
struct t_declare : t_object { - t_canvas *canvas; /* obsolete field */ int useme; }; --- 7153,7156 ---- *************** *** 7162,7166 **** t_declare *x = (t_declare *)pd_new(declare_class); x->useme = 1; - x->canvas = canvas_getcurrent(); /* LATER update environment and/or load libraries */ return x; --- 7159,7162 ---- *************** *** 7183,7187 ****
static void canvas_declare(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { - int i; t_canvasenvironment *e = canvas_getenv(x); #if 0 --- 7179,7182 ---- *************** *** 7190,7194 **** endpost(); #endif ! for (i = 0; i < argc; i++) { char strbuf[MAXPDSTRING]; char *flag = atom_getsymbolarg(i, argc, argv)->name; --- 7185,7189 ---- endpost(); #endif ! for (int i=0; i<argc; i++) { char strbuf[MAXPDSTRING]; char *flag = atom_getsymbolarg(i, argc, argv)->name; *************** *** 7344,7352 **** //printf("visualloader_anything start newest=%p\n",newest); while (j<argc) { - t_arglist *al; i=j; while (j<argc && atom_getsymbolarg(j,argc,argv)!=gensym(",")) j++; if (i==j) {j++; continue;} ! al = (t_arglist *) malloc(sizeof(t_arglist) + (j-i)*sizeof(t_atom)); al->c=j-i; copy_atoms(al->c,al->v,&argv[i]); --- 7339,7346 ---- //printf("visualloader_anything start newest=%p\n",newest); while (j<argc) { i=j; while (j<argc && atom_getsymbolarg(j,argc,argv)!=gensym(",")) j++; if (i==j) {j++; continue;} ! t_arglist *al = (t_arglist *) malloc(sizeof(t_arglist) + (j-i)*sizeof(t_atom)); al->c=j-i; copy_atoms(al->c,al->v,&argv[i]);