Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15394
Modified Files: Tag: devel_0_39 desire.c Log Message: lobotomy
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -C2 -d -r1.1.2.12 -r1.1.2.13 *** desire.c 16 Sep 2005 01:39:54 -0000 1.1.2.12 --- desire.c 16 Sep 2005 18:30:45 -0000 1.1.2.13 *************** *** 25,28 **** --- 25,37 ---- #include <string.h>
+ //-------------------------------------------------------------------------- + // from g_canvas.c + + //-------------------------------------------------------------------------- + // from g_editor.c + + //-------------------------------------------------------------------------- + // from g_text.c + #define CLAMP(_var,_min,_max) { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; } #define MIN(a,b) ((a)<(b)?(a):(b)) *************** *** 118,122 **** t_iemgui *iemgui_new(t_class *qlass); void iemgui_propertiesfn(t_gobj *x, t_glist *owner); - const char *iemgui_get_font(t_iemgui *self); void iemgui_constrain(t_iemgui *x); t_symbol *s_empty; --- 127,130 ---- *************** *** 156,162 **** void pd_upload(t_gobj *self);
! ! /* LATER this will instead maintain a hashtable of objects that should redrawn, ! and the scheduler will flush it (or part of it) once in a while... */ static void pd_changed (/*t_gobj*/ void *x) { t_gobj *self = (t_gobj *)x; --- 164,169 ---- void pd_upload(t_gobj *self);
! /* Todo: this will instead maintain a hashtable of objects that should redrawn, ! and the scheduler will flush it (or part of it) once in a while... */ static void pd_changed (/*t_gobj*/ void *x) { t_gobj *self = (t_gobj *)x; *************** *** 166,197 **** }
! /* ----------------- the "text" object. ------------------ */ ! ! /* add a "text" object (comment) to a glist. While this one goes for any glist, ! the other 3 below are for canvases only. (why?) This is called ! without args if invoked from the GUI; otherwise at least x and y ! are provided. */ ! void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv) ! { t_text *x = (t_text *)pd_new(text_class); t_atom at; sys_vgui("global _; set _(%x:canvas) %lx\n",(long)x,(long)gl); ! x->te_width = 0; /* don't know it yet. */ x->te_type = T_TEXT; x->te_binbuf = binbuf_new(); ! if (argc > 1) ! { x->te_xpix = atom_getfloatarg(0, argc, argv); x->te_ypix = atom_getfloatarg(1, argc, argv); if (argc > 2) binbuf_restore(x->te_binbuf, argc-2, argv+2); ! else ! { SETSYMBOL(&at, gensym("comment")); binbuf_restore(x->te_binbuf, 1, &at); } glist_add(gl, &x->te_g); ! } ! else ! { int xpix, ypix; pd_vmess((t_pd *)glist_getcanvas(gl), gensym("editmode"), "i", 1); --- 173,193 ---- }
! void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { t_text *x = (t_text *)pd_new(text_class); t_atom at; sys_vgui("global _; set _(%x:canvas) %lx\n",(long)x,(long)gl); ! x->te_width = 0; x->te_type = T_TEXT; x->te_binbuf = binbuf_new(); ! if (argc > 1) { x->te_xpix = atom_getfloatarg(0, argc, argv); x->te_ypix = atom_getfloatarg(1, argc, argv); if (argc > 2) binbuf_restore(x->te_binbuf, argc-2, argv+2); ! else { SETSYMBOL(&at, gensym("comment")); binbuf_restore(x->te_binbuf, 1, &at); } glist_add(gl, &x->te_g); ! } else { int xpix, ypix; pd_vmess((t_pd *)glist_getcanvas(gl), gensym("editmode"), "i", 1); *************** *** 205,220 **** glist_noselect(gl); glist_select(gl, &x->te_g); - /* it would be nice to "activate" here, but then the second, - "put-me-down" click changes the text selection, which is quite - irritating, so I took this back out. It's OK in messages - and objects though since there's no text in them at menu - creation. */ - /* gobj_activate(&x->te_g, gl, 1); */ canvas_startmotion(glist_getcanvas(gl)); } }
- /* ----------------- the "object" object. ------------------ */ - extern t_pd *newest; void canvas_getargs(int *argcp, t_atom **argvp); --- 201,208 ---- *************** *** 254,259 **** }
- /* object creation routine. These are called without any arguments if - they're invoked from the gui; when pasting or restoring from a file, we get at least x and y. */ void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { t_binbuf *b = binbuf_new(); --- 242,245 ---- *************** *** 272,284 **** }
! /* make an object box for an object that's already there. */ ! ! /* iemlib */ ! void canvas_iemguis(t_glist *gl, t_symbol *guiobjname) ! { t_atom at; t_binbuf *b = binbuf_new(); int xpix, ypix; - pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); glist_noselect(gl); --- 258,265 ---- }
! void canvas_iemguis(t_glist *gl, t_symbol *guiobjname) { t_atom at; t_binbuf *b = binbuf_new(); int xpix, ypix; pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); glist_noselect(gl); *************** *** 293,312 **** void canvas_##a(t_glist *gl, t_symbol *s, int argc, t_atom *argv) \ {canvas_iemguis(gl, gensym(#b));} ! Z(bng,bng) ! Z(toggle,tgl) ! Z(vslider,vsl) ! Z(hslider,hsl) ! Z(hdial,hdl) ! Z(vdial,vdl) ! Z(hradio,hradio) ! Z(vradio,vradio) ! Z(vumeter,vu) ! Z(mycnv,cnv) ! Z(numbox,nbx) #undef Z
! void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv) ! { ! x->te_width = 0; /* don't know it yet. */ x->te_type = T_OBJECT; x->te_binbuf = binbuf_new(); --- 274,285 ---- void canvas_##a(t_glist *gl, t_symbol *s, int argc, t_atom *argv) \ {canvas_iemguis(gl, gensym(#b));} ! Z(bng,bng) Z(toggle,tgl) ! Z(vslider,vsl) Z(hslider,hsl) ! Z(hdial,hdl) Z(vdial,vdl) Z(hradio,hradio) Z(vradio,vradio) ! Z(vumeter,vu) Z(mycnv,cnv) Z(numbox,nbx) #undef Z
! void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv) { ! x->te_width = 0; x->te_type = T_OBJECT; x->te_binbuf = binbuf_new(); *************** *** 317,322 **** }
- /* ---------------------- the "message" text item ------------------------ */ - typedef struct { t_pd mr_pd; --- 290,293 ---- *************** *** 382,388 **** if (argc > 2) binbuf_restore(x->m_text.te_binbuf, argc-2, argv+2); glist_add(gl, &x->m_text.te_g); ! } ! else ! { int xpix, ypix; pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); --- 353,357 ---- if (argc > 2) binbuf_restore(x->m_text.te_binbuf, argc-2, argv+2); glist_add(gl, &x->m_text.te_g); ! } else { int xpix, ypix; pd_vmess(&gl->gl_pd, gensym("editmode"), "i", 1); *************** *** 399,405 **** }
- /* ---------------------- the "atom" text item ------------------------ */ - - #define ATOMBUFSIZE 40 #define ATOM_LABELLEFT 0 #define ATOM_LABELRIGHT 1 --- 368,371 ---- *************** *** 407,412 **** #define ATOM_LABELDOWN 3
! typedef struct _gatom ! { t_text a_text; t_atom a_atom; /* this holds the value and the type */ --- 373,377 ---- #define ATOM_LABELDOWN 3
! typedef struct _gatom { t_text a_text; t_atom a_atom; /* this holds the value and the type */ *************** *** 418,422 **** t_symbol *a_symfrom; /* "receive" name -- bind ourselvs to this */ t_symbol *a_symto; /* "send" name -- send to this on output */ - char a_buf[ATOMBUFSIZE];/* string buffer for typing */ char a_shift; /* was shift key down when dragging started? */ char a_wherelabel; /* 0-3 for left, right, above, below */ --- 383,386 ---- *************** *** 428,442 **** to introduce some quoting mechanism; but then we'd be much more complicated. */ ! static t_symbol *gatom_escapit(t_symbol *s) ! { ! if (!*s->s_name) ! return (gensym("-")); ! else if (*s->s_name == '-') ! { ! char shmo[100]; ! shmo[0] = '-'; ! strncpy(shmo+1, s->s_name, 99); ! shmo[99] = 0; ! return (gensym(shmo)); } /* else return (iemgui_dollar2raute(s));*/ --- 392,402 ---- to introduce some quoting mechanism; but then we'd be much more complicated. */ ! static t_symbol *gatom_escapit(t_symbol *s) { ! if (!*s->s_name) return (gensym("-")); ! if (*s->s_name == '-') { ! char shmo[1000]; ! snprintf(shmo,1000,"-%s",s->s_name); ! shmo[999] = 0; ! return gensym(shmo); } /* else return (iemgui_dollar2raute(s));*/ *************** *** 444,470 **** }
! /* undo previous operation: strip leading "-" if found. */ ! static t_symbol *gatom_unescapit(t_symbol *s) ! { ! if (*s->s_name == '-') ! return (gensym(s->s_name+1)); ! /* else return (iemgui_raute2dollar(s));*/ ! else return s; ! } ! ! #if 0 /* ??? */ ! /* expand leading $0, $1, etc. in the symbol */ ! static t_symbol *gatom_realizedollar(t_gatom *x, t_symbol *s) ! { ! return (canvas_realizedollar(x->a_glist, s)); } - #endif
! static void gatom_retext(t_gatom *x, int senditup) ! { binbuf_clear(x->a_text.te_binbuf); binbuf_add(x->a_text.te_binbuf, 1, &x->a_atom); ! if (senditup) ! glist_retext(x->a_glist, &x->a_text); }
--- 404,418 ---- }
! /* undo previous operation: strip leading "-" if found. */ ! static t_symbol *gatom_unescapit(t_symbol *s) { ! if (*s->s_name == '-') return (gensym(s->s_name+1)); ! /* return (iemgui_raute2dollar(s));*/ ! return s; }
! static void gatom_retext(t_gatom *x, int senditup) { binbuf_clear(x->a_text.te_binbuf); binbuf_add(x->a_text.te_binbuf, 1, &x->a_atom); ! if (senditup) glist_retext(x->a_glist, &x->a_text); }
*************** *** 481,515 **** senditup = (x->a_atom.a_w.w_symbol != oldatom.a_w.w_symbol); gatom_retext(x, senditup); ! x->a_buf[0] = 0; }
! static void gatom_bang(t_gatom *x) ! { if (x->a_atom.a_type == A_FLOAT) { if (x->a_text.te_outlet) outlet_float(x->a_text.te_outlet, x->a_atom.a_w.w_float); ! if (*x->a_expanded_to->s_name && x->a_expanded_to->s_thing) ! { ! if (x->a_symto == x->a_symfrom) ! pd_error(x, ! "%s: atom with same send/receive name (infinite loop)", ! x->a_symto->s_name); ! else pd_float(x->a_expanded_to->s_thing, x->a_atom.a_w.w_float); } ! } ! else if (x->a_atom.a_type == A_SYMBOL) ! { if (x->a_text.te_outlet) outlet_symbol(x->a_text.te_outlet, x->a_atom.a_w.w_symbol); ! if (*x->a_symto->s_name && x->a_expanded_to->s_thing) ! { ! if (x->a_symto == x->a_symfrom) ! pd_error(x, ! "%s: atom with same send/receive name (infinite loop)", ! x->a_symto->s_name); ! else pd_symbol(x->a_expanded_to->s_thing, x->a_atom.a_w.w_symbol); } } }
--- 429,456 ---- senditup = (x->a_atom.a_w.w_symbol != oldatom.a_w.w_symbol); gatom_retext(x, senditup); ! // x->a_buf[0] = 0; }
! static void gatom_bang(t_gatom *x) { if (x->a_atom.a_type == A_FLOAT) { if (x->a_text.te_outlet) outlet_float(x->a_text.te_outlet, x->a_atom.a_w.w_float); ! if (*x->a_expanded_to->s_name && x->a_expanded_to->s_thing) { ! if (x->a_symto == x->a_symfrom) goto err; ! pd_float(x->a_expanded_to->s_thing, x->a_atom.a_w.w_float); } ! } else if (x->a_atom.a_type == A_SYMBOL) { if (x->a_text.te_outlet) outlet_symbol(x->a_text.te_outlet, x->a_atom.a_w.w_symbol); ! if (*x->a_symto->s_name && x->a_expanded_to->s_thing) { ! if (x->a_symto == x->a_symfrom) goto err; ! pd_symbol(x->a_expanded_to->s_thing, x->a_atom.a_w.w_symbol); } } + return; + err: + pd_error(x, "%s: atom with same send/receive name (infinite loop)", + x->a_symto->s_name); }
*************** *** 611,642 **** outlet_free(x->a_text.te_outlet); } ! if (draglo >= draghi) ! draglo = draghi = 0; x->a_draglo = draglo; x->a_draghi = draghi; ! if (width < 0) ! width = 4; ! else if (width > 80) ! width = 80; x->a_text.te_width = width; x->a_wherelabel = ((int)wherelabel & 3); x->a_label = label; if (*x->a_symfrom->s_name) ! pd_unbind(&x->a_text.te_pd, ! canvas_realizedollar(x->a_glist, x->a_symfrom)); x->a_symfrom = symfrom; if (*x->a_symfrom->s_name) ! pd_bind(&x->a_text.te_pd, ! canvas_realizedollar(x->a_glist, x->a_symfrom)); x->a_symto = symto; x->a_expanded_to = canvas_realizedollar(x->a_glist, x->a_symto); gobj_vis(&x->a_text.te_g, x->a_glist, 1); - /* glist_retext(x->a_glist, &x->a_text); */ }
! void canvas_atom(t_glist *gl, t_atomtype type, ! t_symbol *s, int argc, t_atom *argv) ! { t_gatom *x = (t_gatom *)pd_new(gatom_class); t_atom at; --- 552,574 ---- outlet_free(x->a_text.te_outlet); } ! if (draglo >= draghi) draglo = draghi = 0; x->a_draglo = draglo; x->a_draghi = draghi; ! if (width < 0) width = 4; else if (width > 80) width = 80; x->a_text.te_width = width; x->a_wherelabel = ((int)wherelabel & 3); x->a_label = label; if (*x->a_symfrom->s_name) ! pd_unbind((t_pd *)x, canvas_realizedollar(x->a_glist, x->a_symfrom)); x->a_symfrom = symfrom; if (*x->a_symfrom->s_name) ! pd_bind((t_pd *)x, canvas_realizedollar(x->a_glist, x->a_symfrom)); x->a_symto = symto; x->a_expanded_to = canvas_realizedollar(x->a_glist, x->a_symto); gobj_vis(&x->a_text.te_g, x->a_glist, 1); /* glist_retext(x->a_glist, &x->a_text); */ }
! void canvas_atom(t_glist *gl, t_atomtype type, t_symbol *s, int argc, t_atom *argv) { t_gatom *x = (t_gatom *)pd_new(gatom_class); t_atom at; *************** *** 653,664 **** x->a_symfrom = &s_; x->a_symto = x->a_expanded_to = &s_; ! if (type == A_FLOAT) ! { x->a_atom.a_w.w_float = 0; x->a_text.te_width = 5; SETFLOAT(&at, 0); ! } ! else ! { x->a_atom.a_w.w_symbol = &s_symbol; x->a_text.te_width = 10; --- 585,593 ---- x->a_symfrom = &s_; x->a_symto = x->a_expanded_to = &s_; ! if (type == A_FLOAT) { x->a_atom.a_w.w_float = 0; x->a_text.te_width = 5; SETFLOAT(&at, 0); ! } else { x->a_atom.a_w.w_symbol = &s_symbol; x->a_text.te_width = 10; *************** *** 666,673 **** } binbuf_add(x->a_text.te_binbuf, 1, &at); ! if (argc > 1) ! /* create from file. x, y, width, low-range, high-range, flags, label, receive-name, send-name */ - { x->a_text.te_xpix = atom_getfloatarg(0, argc, argv); x->a_text.te_ypix = atom_getfloatarg(1, argc, argv); --- 595,601 ---- } binbuf_add(x->a_text.te_binbuf, 1, &at); ! if (argc > 1) { ! /* create from file. x, y, width, low-range, high-range, flags, label, receive-name, send-name */ x->a_text.te_xpix = atom_getfloatarg(0, argc, argv); x->a_text.te_ypix = atom_getfloatarg(1, argc, argv); *************** *** 694,700 **** inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); glist_add(gl, &x->a_text.te_g); ! } ! else ! { int xpix, ypix; outlet_new(&x->a_text, --- 622,626 ---- inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); glist_add(gl, &x->a_text.te_g); ! } else { int xpix, ypix; outlet_new(&x->a_text, *************** *** 718,743 **** {canvas_atom(gl, A_SYMBOL, s, argc, argv);}
! static void gatom_free(t_gatom *x) ! { if (*x->a_symfrom->s_name) ! pd_unbind(&x->a_text.te_pd, ! canvas_realizedollar(x->a_glist, x->a_symfrom)); gfxstub_deleteforkey(x); }
! static void gatom_properties(t_gobj *z, t_glist *owner) ! { ! t_gatom *x = (t_gatom *)z; ! char buf[200]; ! sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n", ! x->a_text.te_width, x->a_draglo, x->a_draghi, ! x->a_wherelabel, gatom_escapit(x->a_label)->s_name, ! gatom_escapit(x->a_symfrom)->s_name, ! gatom_escapit(x->a_symto)->s_name); ! gfxstub_new(&x->a_text.te_pd, x, buf); ! } ! ! /* -------------------- widget behavior for text objects ------------ */ ! static void text_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { *xp1 = *yp1 = *xp2 = *yp2 = 42; /* desire */ --- 644,654 ---- {canvas_atom(gl, A_SYMBOL, s, argc, argv);}
! static void gatom_free(t_gatom *x) { if (*x->a_symfrom->s_name) ! pd_unbind((t_pd *)x, canvas_realizedollar(x->a_glist, x->a_symfrom)); gfxstub_deleteforkey(x); }
! static void gatom_properties(t_gobj *z,t_glist *o) {sys_mgui(z,"properties","");} static void text_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { *xp1 = *yp1 = *xp2 = *yp2 = 42; /* desire */ *************** *** 747,768 **** x->te_xpix += dx; x->te_ypix += dy; } static void text_select(t_gobj *z, t_glist *glist, int state) { ! t_text *x = (t_text *)z; ! t_rtext *y = glist_findrtext(glist, x); ! rtext_select(y, state); ! if (glist_isvisible(glist) && text_shouldvis(x, glist)) ! sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist, ! rtext_gettag(y), (state? "blue" : "black")); } static void text_activate(t_gobj *z, t_glist *glist, int state) { ! t_text *x = (t_text *)z; ! t_rtext *y = glist_findrtext(glist, x); ! if (z->g_pd != gatom_class) rtext_activate(y, state); ! } ! static void text_delete(t_gobj *z, t_glist *glist) { ! t_text *x = (t_text *)z; ! canvas_deletelinesfor(glist, x); }
/* return true if the text box should be drawn. We don't show object boxes inside graphs. */ --- 658,673 ---- x->te_xpix += dx; x->te_ypix += dy; + /* assuming we got that command from desire.tk; then we don't have to actually + move anything because the GUI does that for us. */ } static void text_select(t_gobj *z, t_glist *glist, int state) { ! sys_mgui(z,"wb_select","i",state); ! // rtext_select(y, state); //??? } static void text_activate(t_gobj *z, t_glist *glist, int state) { ! sys_mgui(z,"wb_activate","i",state); ! // what is this function supposed to be for anyway? } + static void text_delete(t_gobj *z, t_glist *glist) {sys_mgui(z,"wb_delete","");}
/* return true if the text box should be drawn. We don't show object boxes inside graphs. */ *************** *** 776,780 **** t_text *x = (t_text *)z; if (vis) { ! if (text_shouldvis(x, glist)) {if (vis) pd_changed(x); else sys_mgui(z,"erase","");} } else { sys_mgui(z,"erase",""); --- 681,685 ---- t_text *x = (t_text *)z; if (vis) { ! if (text_shouldvis(x, glist)) pd_changed(x); } else { sys_mgui(z,"erase",""); *************** *** 782,792 **** }
! void text_save(t_gobj *z, t_binbuf *b) ! { t_text *x = (t_text *)z; ! if (x->te_type == T_OBJECT) ! { ! /* if we have a "saveto" method, and if we don't happen to be ! a canvas that's an abstraction, the saveto method does the work */ if (zgetfn(&x->te_pd, gensym("saveto")) && !((pd_class(&x->te_pd) == canvas_class) && --- 687,693 ---- }
! void text_save(t_gobj *z, t_binbuf *b) { t_text *x = (t_text *)z; ! if (x->te_type == T_OBJECT) { if (zgetfn(&x->te_pd, gensym("saveto")) && !((pd_class(&x->te_pd) == canvas_class) && *************** *** 797,803 **** binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->te_xpix, (t_int)x->te_ypix); ! } ! else /* otherwise just save the text */ ! { binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (t_int)x->te_xpix, (t_int)x->te_ypix); --- 698,702 ---- binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), (t_int)x->te_xpix, (t_int)x->te_ypix); ! } else { binbuf_addv(b, "ssii", gensym("#X"), gensym("obj"), (t_int)x->te_xpix, (t_int)x->te_ypix); *************** *** 805,818 **** binbuf_addbinbuf(b, x->te_binbuf); binbuf_addv(b, ";"); ! } ! else if (x->te_type == T_MESSAGE) ! { binbuf_addv(b, "ssii", gensym("#X"), gensym("msg"), (t_int)x->te_xpix, (t_int)x->te_ypix); binbuf_addbinbuf(b, x->te_binbuf); binbuf_addv(b, ";"); ! } ! else if (x->te_type == T_ATOM) ! { t_atomtype t = ((t_gatom *)x)->a_atom.a_type; t_symbol *sel = (t == A_SYMBOL ? gensym("symbolatom") : --- 704,713 ---- binbuf_addbinbuf(b, x->te_binbuf); binbuf_addv(b, ";"); ! } else if (x->te_type == T_MESSAGE) { binbuf_addv(b, "ssii", gensym("#X"), gensym("msg"), (t_int)x->te_xpix, (t_int)x->te_ypix); binbuf_addbinbuf(b, x->te_binbuf); binbuf_addv(b, ";"); ! } else if (x->te_type == T_ATOM) { t_atomtype t = ((t_gatom *)x)->a_atom.a_type; t_symbol *sel = (t == A_SYMBOL ? gensym("symbolatom") : *************** *** 828,834 **** label, symfrom, symto); binbuf_addv(b, ";"); ! } ! else ! { binbuf_addv(b, "ssii", gensym("#X"), gensym("text"), (t_int)x->te_xpix, (t_int)x->te_ypix); --- 723,727 ---- label, symfrom, symto); binbuf_addv(b, ";"); ! } else { binbuf_addv(b, "ssii", gensym("#X"), gensym("text"), (t_int)x->te_xpix, (t_int)x->te_ypix); *************** *** 838,875 **** }
! /* this one is for everyone but "gatoms"; it's imposed in m_class.c */ ! t_widgetbehavior text_widgetbehavior = ! { ! text_getrect, ! text_displace, ! text_select, ! text_activate, ! text_delete, ! text_vis, ! 0, };
! /* -------------------- the "text" class ------------ */ ! ! #ifdef MACOSX ! #define EXTRAPIX 2 ! #else ! #define EXTRAPIX 1 ! #endif ! ! void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, ! char *tag, int x1, int y1, int x2, int y2) {} ! void text_drawborder(t_text *x, t_glist *glist, ! char *tag, int width2, int height2, int firsttime) {} void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag) {} void text_eraseborder(t_text *x, t_glist *glist, char *tag) {}
! /* change text; if T_OBJECT, remake it. LATER we'll have an undo buffer ! which should be filled in here before making the change. */ ! ! void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) ! { ! if (x->te_type == T_OBJECT) ! { t_binbuf *b = binbuf_new(); int natom1, natom2; --- 731,747 ---- }
! /* this one is for everyone but "gatoms"; it's imposed in m_class.c */ ! t_widgetbehavior text_widgetbehavior = { ! text_getrect, text_displace, text_select, ! text_activate, text_delete, text_vis, 0, };
! void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, char *tag, int x1, int y1, int x2, int y2) {} ! void text_drawborder(t_text *x, t_glist *glist, char *tag, int width2, int height2, int firsttime) {} void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag) {} void text_eraseborder(t_text *x, t_glist *glist, char *tag) {}
! void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) { ! if (x->te_type == T_OBJECT) { t_binbuf *b = binbuf_new(); int natom1, natom2; *************** *** 889,895 **** binbuf_free(x->te_binbuf); x->te_binbuf = b; ! } ! else /* normally, just destroy the old one and make a new one. */ ! { int xwas = x->te_xpix, ywas = x->te_ypix; glist_delete(glist, &x->te_g); --- 761,765 ---- binbuf_free(x->te_binbuf); x->te_binbuf = b; ! } else { int xwas = x->te_xpix, ywas = x->te_ypix; glist_delete(glist, &x->te_g); *************** *** 900,905 **** canvas_restoreconnections(glist_getcanvas(glist)); } - /* if we made a new "pd" or changed a window name, - update window list */ if (natom2 >= 1 && vec2[0].a_type == A_SYMBOL && !strcmp(vec2[0].a_w.w_symbol->s_name, "pd")) --- 770,773 ---- *************** *** 909,914 **** }
! void g_text_setup(void) ! { text_class = class_new(gensym("text"), 0, 0, sizeof(t_text), CLASS_NOINLET | CLASS_PATCHABLE, 0); --- 777,781 ---- }
! void g_text_setup(void) { text_class = class_new(gensym("text"), 0, 0, sizeof(t_text), CLASS_NOINLET | CLASS_PATCHABLE, 0); *************** *** 943,954 **** 0x782814, 0x285014, 0x004450, 0x001488, 0x580050 }; - - const char *iemgui_get_font(t_iemgui *self) { - int i = self->font_style; - if (i==0) return "helvetica"; - if (i==1) return "times"; - if (i==2) return "courier"; - return 0; - } int iemgui_clip_size(int size) {return MAX(8,size);} --- 810,813 ----