Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10575
Modified Files: Tag: devel_0_39 desire.c desire.h Log Message: rtext is dead.
Index: desire.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v retrieving revision 1.1.2.17 retrieving revision 1.1.2.18 diff -C2 -d -r1.1.2.17 -r1.1.2.18 *** desire.h 3 Sep 2006 04:52:39 -0000 1.1.2.17 --- desire.h 3 Sep 2006 04:57:34 -0000 1.1.2.18 *************** *** 258,267 **** EXTERN int text_shouldvis(t_text *x, t_glist *glist);
- EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who); - EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who); - EXTERN void rtext_free(t_rtext *x); - EXTERN void rtext_retext(t_rtext *x); - EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize); - EXTERN t_class *canvas_class; EXTERN t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv); --- 258,261 ----
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.142 retrieving revision 1.1.2.143 diff -C2 -d -r1.1.2.142 -r1.1.2.143 *** desire.c 3 Sep 2006 04:52:38 -0000 1.1.2.142 --- desire.c 3 Sep 2006 04:57:33 -0000 1.1.2.143 *************** *** 716,739 **** void canvas_create_editor(t_glist *x, int createit) { t_gobj *y; - t_object *ob; if (createit) { if (x->gl_editor) bug("canvas_create_editor"); ! else { ! x->gl_editor = editor_new(x); ! glist_each(y,x) { ! ob = pd_checkobject(&y->g_pd); ! if (ob) rtext_new(x, ob); ! } ! } } else { if (!x->gl_editor) bug("canvas_create_editor"); else { - glist_each(y,x) { - ob = pd_checkobject(&y->g_pd); - if (ob) { - t_rtext *r = glist_findrtext(x, ob); - if (r) rtext_free(r); - } - } editor_free(x->gl_editor, x); x->gl_editor = 0; --- 716,725 ---- void canvas_create_editor(t_glist *x, int createit) { t_gobj *y; if (createit) { if (x->gl_editor) bug("canvas_create_editor"); ! else x->gl_editor = editor_new(x); } else { if (!x->gl_editor) bug("canvas_create_editor"); else { editor_free(x->gl_editor, x); x->gl_editor = 0; *************** *** 2654,2658 **** void glist_delete(t_glist *x, t_gobj *y) { t_gobj *g; - t_object *ob; t_gotfn chkdsp = zgetfn(&y->g_pd, gensym("dsp")); int drawcommand = class_isdrawcommand(y->g_pd); --- 2640,2643 ---- *************** *** 2667,2671 **** sys_mgui(y,"delete","");
- if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); if (x->gl_list == y) { x->gl_list = y->g_next; --- 2652,2655 ---- *************** *** 2698,2706 ****
void glist_retext(t_glist *glist, t_text *y) { ! if (glist->gl_editor && glist->gl_editor->e_rtext) { ! t_rtext *rt = glist_findrtext(glist, y); ! if (rt) rtext_retext(rt); ! gobj_changed(y,0); ! } }
--- 2682,2686 ----
void glist_retext(t_glist *glist, t_text *y) { ! if (glist->gl_editor && glist->gl_editor->e_rtext) gobj_changed(y,0); }
*************** *** 9053,9138 **** } } - - /* ---------------------------------------------------------------- */ - /* formerly g_rtext.c */ - - struct _rtext { - char *x_buf; - int x_bufsize; - t_text *x_text; - t_glist *x_glist; - struct _rtext *x_next; - }; - - t_rtext *rtext_new(t_glist *glist, t_text *who) { - t_rtext *x = (t_rtext *)getbytes(sizeof *x); - x->x_text = who; - x->x_glist = glist; - x->x_next = glist->gl_editor->e_rtext; - binbuf_gettext(who->te_binbuf, &x->x_buf, &x->x_bufsize); - glist->gl_editor->e_rtext = x; - return x; - } - - void rtext_free(t_rtext *x) { - t_editor *e = x->x_glist->gl_editor; - if (e->e_textedfor == x) e->e_textedfor = 0; - if (e->e_rtext == x) e->e_rtext = x->x_next; - else { - t_rtext *e2; - for (e2 = e->e_rtext; e2; e2 = e2->x_next) if (e2->x_next == x) { - e2->x_next = x->x_next; - break; - } - } - freebytes(x->x_buf, x->x_bufsize); - freebytes(x, sizeof *x); - } - - /* LATER deal with tcl-significant characters */ - void rtext_retext(t_rtext *x) { - t_text *text = x->x_text; - t_freebytes(x->x_buf, x->x_bufsize); - binbuf_gettext(text->te_binbuf, &x->x_buf, &x->x_bufsize); - /* special case: for number boxes, try to pare the number down - to the specified width of the box. */ - if (text->te_width > 0 && text->te_type == T_ATOM && x->x_bufsize > text->te_width) { - t_atom *atomp = binbuf_getvec(text->te_binbuf); - int natom = binbuf_getnatom(text->te_binbuf); - int bufsize = x->x_bufsize; - if (natom == 1 && atomp->a_type == A_FLOAT) { - /* try to reduce size by dropping decimal digits */ - int wantreduce = bufsize - text->te_width; - char *decimal = 0, *nextchar, *ebuf = x->x_buf + bufsize, *s1, *s2; - for (decimal = x->x_buf; decimal < ebuf; decimal++) if (*decimal == '.') break; - if (decimal >= ebuf) goto giveup; - for (nextchar = decimal + 1; nextchar < ebuf; nextchar++) - if (*nextchar < '0' || *nextchar > '9') break; - if (nextchar - decimal - 1 < wantreduce) goto giveup; - for (s1 = nextchar - wantreduce, s2 = s1 + wantreduce; s2 < ebuf; s1++, s2++) *s1 = *s2; - x->x_buf = t_resizebytes(x->x_buf, bufsize, text->te_width); - bufsize = text->te_width; - goto done; - giveup: - /* give up and bash it to "+" or "-" */ - x->x_buf[0] = (atomp->a_w.w_float < 0 ? '-' : '+'); - x->x_buf = t_resizebytes(x->x_buf, bufsize, 1); - bufsize = 1; - } else if (bufsize > text->te_width) { - x->x_buf[text->te_width - 1] = '>'; - x->x_buf = t_resizebytes(x->x_buf, bufsize, text->te_width); - bufsize = text->te_width; - } - done: - x->x_bufsize = bufsize; - } - } - - /* find the rtext that goes with a text item */ - t_rtext *glist_findrtext(t_glist *gl, t_text *who) { - t_rtext *x = gl->gl_editor->e_rtext; - while (x && x->x_text != who) x = x->x_next; - if (!x) bug("glist_findrtext"); - return x; - } - --- 9033,9034 ----