Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18973
Modified Files: Tag: devel_0_39 desire.c Log Message: added canvas method object_moveto
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.64 retrieving revision 1.1.2.65 diff -C2 -d -r1.1.2.64 -r1.1.2.65 *** desire.c 3 Dec 2005 06:56:26 -0000 1.1.2.64 --- desire.c 11 Apr 2006 20:25:33 -0000 1.1.2.65 *************** *** 11544,11548 **** t_text *o; int i; ! if (sscanf(atom_getsymbol(argv)->s_name,"!x%lx",(long*)&o)<1) {error("gargamel was here"); return;} for (i=0; i<argc-1; i++) str[i] = atom_getfloat(argv+i+1); str[argc-1]=0; --- 11544,11549 ---- t_text *o; int i; ! t_symbol *name = atom_getsymbol(argv); ! if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {error("gargamel was here"); return;} for (i=0; i<argc-1; i++) str[i] = atom_getfloat(argv+i+1); str[argc-1]=0; *************** *** 11550,11553 **** --- 11551,11562 ---- }
+ static void canvas_object_moveto(t_canvas *x, t_symbol *name, t_floatarg px, t_floatarg py) { + t_text *o; + if (sscanf(name->s_name,"!x%lx",(long*)&o)<1) {error("gargamel was here"); return;} + o->te_xpix = (int)px; + o->te_ypix = (int)py; + gobj_changed(o,0); + } + void g_text_setup(void) { t_class *c; *************** *** 12884,12887 **** --- 12893,12898 ---- class_addmethod3(c,canvas_motion,"motion","fff"); class_addmethod3(c,canvas_menuclose,"menuclose","F"); + + /* should die: */ class_addmethod3(c,canvas_cut, "cut",""); class_addmethod3(c,canvas_copy, "copy",""); *************** *** 12893,12897 **** --- 12904,12911 ---- class_addmethod3(c,canvas_tidy, "tidy",""); class_addmethod3(c,canvas_texteditor,"texteditor",""); + /* end die */ + class_addmethod3(c,canvas_editmode, "editmode","F"); + class_addmethod3(c,canvas_print, "print","s"); class_addmethod3(c,canvas_menufont, "menufont",""); *************** *** 12925,12928 **** --- 12939,12945 ---- class_addmethod3(c,glist_arraydialog,"arraydialog","sfff"); class_addmethod3(c,glist_sort,"sort",""); + + // dd-specific + class_addmethod3(c,canvas_object_moveto,"object_moveto","ff"); class_addmethod3(c,canvas_text_setto,"text_setto","*"); class_setnotice(c, canvas_notice); *************** *** 12960,12965 **** int i,j=0; for(i=0; s[i] && j<MAXPDSTRING-16; i++) { ! if (index("\"[]$\n",s[i])) t[j++]='\'; ! if (s[i]=='\n') t[j++]='n'; else t[j++] = s[i]; } t[j] = 0; --- 12977,12982 ---- int i,j=0; for(i=0; s[i] && j<MAXPDSTRING-16; i++) { ! if (index("\"[]$\n",s[i])) t[j++]='\'; ! t[j++] = s[i]=='\n' ? 'n' : s[i]; } t[j] = 0; *************** *** 12968,12988 **** }
! void post(const char *fmt, ...) { ! char buf[MAXPDSTRING]; ! va_list ap; ! va_start(ap, fmt); vsnprintf(buf, MAXPDSTRING-1, fmt, ap); ! va_end(ap); ! strcat(buf, "\n"); ! dopost(buf); } - void startpost(const char *fmt, ...) { ! char buf[MAXPDSTRING]; ! va_list ap; ! va_start(ap, fmt); vsnprintf(buf, MAXPDSTRING-1, fmt, ap); ! va_end(ap); ! dopost(buf); }
--- 12985,12997 ---- }
! void post(const char *fmt, ...) { ! char buf[MAXPDSTRING]; va_list ap; va_start(ap, fmt); vsnprintf(buf, MAXPDSTRING-1, fmt, ap); ! va_end(ap); strcat(buf, "\n"); dopost(buf); } void startpost(const char *fmt, ...) { ! char buf[MAXPDSTRING]; va_list ap; va_start(ap, fmt); vsnprintf(buf, MAXPDSTRING-1, fmt, ap); ! va_end(ap); dopost(buf); }
*************** *** 12990,13001 ****
void postatom(int argc, t_atom *argv) { ! char buf[MAXPDSTRING]; ! int i; ! for (i=0; i<argc; i++) { ! atom_string(argv+i,buf,MAXPDSTRING); ! poststring(buf); ! } }
void postfloat(float f) {t_atom a; SETFLOAT(&a, f); postatom(1, &a);} void endpost(void) {dopost("\n");} --- 12999,13007 ----
void postatom(int argc, t_atom *argv) { ! char buf[MAXPDSTRING]; int i; ! for (i=0; i<argc; i++) {atom_string(argv+i,buf,MAXPDSTRING); poststring(buf);} }
+ /* what's the point? */ void postfloat(float f) {t_atom a; SETFLOAT(&a, f); postatom(1, &a);} void endpost(void) {dopost("\n");} *************** *** 13057,13062 **** if (!error_object) post("no findable error yet."); else { ! post("last trackable error:"); ! post("%s", error_string); canvas_finderror(error_object); } --- 13063,13067 ---- if (!error_object) post("no findable error yet."); else { ! post("last trackable error: %s", error_string); canvas_finderror(error_object); } *************** *** 13074,13078 **** }
! /* this isn't worked out yet. */ static const char *errobject; static const char *errstring; --- 13079,13083 ---- }
! /* this isn't worked out yet. */ static const char *errobject; static const char *errstring;