Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24866
Modified Files: Tag: desiredata desire.c Log Message: cleanup
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.151 retrieving revision 1.1.2.217.2.152 diff -C2 -d -r1.1.2.217.2.151 -r1.1.2.217.2.152 *** desire.c 10 Jul 2007 20:32:36 -0000 1.1.2.217.2.151 --- desire.c 10 Jul 2007 23:35:00 -0000 1.1.2.217.2.152 *************** *** 2370,2379 **** }
! /* get the window location in pixels of a "text" object. The ! object's x and y positions are in pixels when the canvas they're ! in is toplevel. Otherwise, if it's a new-style graph-on-parent ! (so goprect is set) we use the offset into the framing subrectangle ! as an offset into the parent rectangle. Finally, it might be an old, ! proportional-style GOP. In this case we do a coordinate transformation. */ static int text_xpix(t_text *x, t_canvas *canvas) { float width = canvas->x2-canvas->x1; --- 2370,2377 ---- }
! /* get the window location in pixels of a "text" object. The object's x and y positions are in pixels ! when the canvas they're in is toplevel. Otherwise, if it's a new-style graph-on-parent (so goprect ! is set) we use the offset into the framing subrectangle as an offset into the parent rectangle. ! Finally, it might be an old, proportional-style GOP. In this case we do a coordinate transformation. */ static int text_xpix(t_text *x, t_canvas *canvas) { float width = canvas->x2-canvas->x1; *************** *** 2390,2397 ****
/* --------------------------- widget behavior ------------------- */ - - #define FONT "-*-courier-bold--normal--%d-*" - /* don't remove this code yet: has to be rewritten in tcl */ static void graph_vis(t_gobj *gr, int vis) { t_canvas *x = (t_canvas *)gr; --- 2388,2393 ----
/* --------------------------- widget behavior ------------------- */ /* don't remove this code yet: has to be rewritten in tcl */ + #if 0 static void graph_vis(t_gobj *gr, int vis) { t_canvas *x = (t_canvas *)gr; *************** *** 2443,2447 **** } } - /* draw ticks in vertical borders*/ if (x->ytick.lperb) { --- 2439,2442 ---- *************** *** 2466,2469 **** --- 2461,2465 ---- for (int i=0; i < x->nylabels; i++) {char *s = x->ylabel[i]->name; DRAWLABEL(x->ylabelx,atof(s));} } + #endif
/* get the graph's rectangle, not counting extra swelling for controls *************** *** 2538,2543 **** }
! /* fill in the contents of the scalar into the vector w. */ ! static void canvas_readatoms(t_canvas *x, int natoms, t_atom *vec, int *p_nextmsg, t_symbol *templatesym, t_word *w, int argc, t_atom *argv) { --- 2534,2538 ---- }
! /* fill in the contents of the scalar into the vector w. */ static void canvas_readatoms(t_canvas *x, int natoms, t_atom *vec, int *p_nextmsg, t_symbol *templatesym, t_word *w, int argc, t_atom *argv) { *************** *** 2586,2598 **** *p_nextmsg = nextmsg + 1; t_template *t = template_findbyname(ts); ! if (!t) { ! pd_error(x,"canvas_read: %s: no such template", ts->name); ! *p_nextmsg = natoms; return 0; ! } t_scalar *sc = scalar_new(x, ts); ! if (!sc) { ! pd_error(x,"couldn't create scalar "%s"", ts->name); ! *p_nextmsg = natoms; return 0; ! } if (wasvis) canvas_getcanvas(x)->mapped = 0; canvas_add(x,sc); --- 2581,2587 ---- *p_nextmsg = nextmsg + 1; t_template *t = template_findbyname(ts); ! if (!t) {pd_error(x,"canvas_read: %s: no such template", ts->name); *p_nextmsg = natoms; return 0;} t_scalar *sc = scalar_new(x, ts); ! if (!sc) {pd_error(x,"couldn't create scalar "%s"", ts->name); *p_nextmsg = natoms; return 0;} if (wasvis) canvas_getcanvas(x)->mapped = 0; canvas_add(x,sc); *************** *** 2663,2667 **** int cr = strcmp(format->name, "cr")==0; if (!cr && *format->name) pd_error(x,"canvas_read: unknown flag: %s", format->name); - /* flag 2 means eval continuously. this is required to autodetect the syntax */ if (binbuf_read_via_path(b, filename->name, canvas_getdir(canvas)->name, cr|2)) { --- 2652,2655 ---- *************** *** 2707,2732 **** } } ! if (!newone) pd_error(x,"couldn't update properties (perhaps a format problem?)"); ! else if (!oldone) bug("data_properties: couldn't find old element"); ! else { ! canvas_delete(x, oldone); ! if (scindex > 0) { ! int nnew = 1; ! canvas_each(y,x) { ! if (nnew == scindex || !y->g_next) { ! newone->g_next = y->g_next; ! y->g_next = newone; ! goto didit; ! } ! nnew++; ! } ! bug("data_properties: can't reinsert"); ! } else { ! newone->g_next = x->list; ! x->list = newone; } } ! didit: ! ; }
--- 2695,2717 ---- } } ! if (!newone) {pd_error(x,"couldn't update properties (perhaps a format problem?)"); return;} ! if (!oldone) {bug("data_properties: couldn't find old element"); return;} ! canvas_delete(x, oldone); ! if (scindex > 0) { ! int nnew = 1; ! canvas_each(y,x) { ! if (nnew == scindex || !y->g_next) { ! newone->g_next = y->g_next; ! y->g_next = newone; ! goto didit; ! } ! nnew++; } + bug("data_properties: can't reinsert"); + } else { + newone->g_next = x->list; + x->list = newone; } ! didit:; }
*************** *** 4795,4799 **** sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}", (long)canvas_getcanvas(canvas), xloc, yloc, colorstring, buf); ! sys_vgui(" -font "FONT, 42 /*sys_hostfontsize(canvas_getfont(canvas))*/); sys_vgui(" -tags drawnumber%lx\n", (long)data); } else sys_vgui(".x%lx.c delete drawnumber%lx\n", (long)canvas_getcanvas(canvas), (long)data); --- 4780,4784 ---- sys_vgui(".x%lx.c create text %d %d -anchor nw -fill %s -text {%s}", (long)canvas_getcanvas(canvas), xloc, yloc, colorstring, buf); ! sys_vgui(" -font {Courier 42}"/*sys_hostfontsize(canvas_getfont(canvas))*/); sys_vgui(" -tags drawnumber%lx\n", (long)data); } else sys_vgui(".x%lx.c delete drawnumber%lx\n", (long)canvas_getcanvas(canvas), (long)data); *************** *** 4855,4859 **** } else { /* key entry for a numeric field. This is just a stopgap. */ - float newf; if (dn.firstkey) sbuf[0] = 0; else sprintf(sbuf, "%g", template_getfloat(dn.t, f->varsym, dn.wp, 1)); --- 4840,4843 ---- *************** *** 4865,4868 **** --- 4849,4853 ---- sbuf[strlen(sbuf)] = key; } + float newf; if (sscanf(sbuf, "%g", &newf) < 1) newf = 0; template_setfloat(dn.t, f->varsym, dn.wp, newf, 1); *************** *** 5024,5028 ****
static void ptrobj_vnext(t_ptrobj *x, float f) { - t_gobj *gobj; t_gpointer *gp = &x->gp; int wantselected = f!=0; --- 5009,5012 ---- *************** *** 5031,5037 **** t_canvas *canvas = gp->canvas; if (wantselected) {pd_error(x, "next: next-selected unsupported in desiredata"); return;} ! /* if (wantselected && !canvas_isvisible(canvas)) ! {pd_error(x, "next: next-selected only works for a visible window"); return;} */ ! gobj = gp->scalar; if (!gobj) gobj = canvas->list; else gobj = gobj->g_next; --- 5015,5020 ---- t_canvas *canvas = gp->canvas; if (wantselected) {pd_error(x, "next: next-selected unsupported in desiredata"); return;} ! /* if (wantselected && !canvas_isvisible(canvas)) {pd_error(x, "next: next-selected only works for a visible window"); return;} */ ! t_gobj *gobj = gp->scalar; if (!gobj) gobj = canvas->list; else gobj = gobj->g_next;