Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31551
Modified Files: Tag: devel_0_39 desire.c desire.tk Log Message: fixed restore for real: line #X restore appears during upload and is correctly handled by update_object. Also, client Canvas class is reparented from {Menuable View} to {Menuable TextBox}.
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.290 retrieving revision 1.1.2.291 diff -C2 -d -r1.1.2.290 -r1.1.2.291 *** desire.tk 7 Aug 2006 07:42:40 -0000 1.1.2.290 --- desire.tk 7 Aug 2006 16:41:49 -0000 1.1.2.291 *************** *** 132,136 **** if {$i>=0} {set @subscribers [lreplace $@subscribers $i $i]} } ! def* Observable changed {args} { foreach x $@subscribers {eval [concat [list $x notice $self] $args]} } --- 132,136 ---- if {$i>=0} {set @subscribers [lreplace $@subscribers $i $i]} } ! def Observable changed {args} { foreach x $@subscribers {eval [concat [list $x notice $self] $args]} } *************** *** 961,965 **** #-----------------------------------------------------------------------------------#
! class_new Canvas {Menuable View}
#def Canvas close {} {pd $self menuclose 0} --- 961,965 ---- #-----------------------------------------------------------------------------------#
! class_new Canvas {Menuable ObjectBox}
#def Canvas close {} {pd $self menuclose 0} *************** *** 1524,1528 **** }
! def* TextBox update_size {} { global font set @textwidth [expr $font(padx)+$font(width)*([string length $@text]+$@edit)] --- 1524,1528 ---- }
! def TextBox update_size {} { global font set @textwidth [expr $font(padx)+$font(width)*([string length $@text]+$@edit)] *************** *** 2553,2557 **** }
! def* Canvas key {x y key iso shift} {
set c .$self.c --- 2553,2557 ---- }
! def Canvas key {x y key iso shift} {
set c .$self.c *************** *** 2894,2897 **** --- 2894,2898 ---- } set canvas(current) $self + set isnew 0 } "#X" { *************** *** 2905,2908 **** --- 2906,2911 ---- set class obj set _class ObjectBox + # this is not the same @isnew as $isnew ! + # in the future, both @isnew and @valid should go elsewhere or disappear set _($self:isnew) [expr [llength $mess] == 4] set _($self:valid) 0 *************** *** 2918,2922 **** symbolatom {$self text= [lindex $d 4]} text {$self text= [join [lrange $mess 4 end]]} ! default {$self text= [join [lrange $mess 4 end]]; set i 0; foreach f $fields($class) {set _($self:$f) [lindex $d $i]; incr i}} } --- 2921,2926 ---- symbolatom {$self text= [lindex $d 4]} text {$self text= [join [lrange $mess 4 end]]} ! restore {$self text= [join [lrange $mess 4 end]]} ! default {$self text= [join [lrange $mess 4 end]] set i 0; foreach f $fields($class) {set _($self:$f) [lindex $d $i]; incr i}} }
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.96 retrieving revision 1.1.2.97 diff -C2 -d -r1.1.2.96 -r1.1.2.97 *** desire.c 7 Aug 2006 05:54:12 -0000 1.1.2.96 --- desire.c 7 Aug 2006 16:41:49 -0000 1.1.2.97 *************** *** 76,80 **** void appendix_save (t_gobj *master, t_binbuf *b) { t_hash *h = master->g_adix->visual; ! fprintf(stderr,"appendix_save %p size=%d\n",master,hash_size(h)); if (hash_size(h)) { hashkey k; --- 76,80 ---- void appendix_save (t_gobj *master, t_binbuf *b) { t_hash *h = master->g_adix->visual; ! /* fprintf(stderr,"appendix_save %p size=%d\n",master,hash_size(h)); */ if (hash_size(h)) { hashkey k; *************** *** 184,188 **** //post("queue_get: items in queue: %d",self->len); b = ((t_text *)stuff)->te_binbuf; ! if (b) {char *buf; int bufn; binbuf_gettext(b,&buf,&bufn); printf("queue_get [%.*s]\n",bufn,buf);} else {printf("queue_get (%s)\n",(*(t_pd*)stuff)->c_name->s_name);} return stuff; --- 184,191 ---- //post("queue_get: items in queue: %d",self->len); b = ((t_text *)stuff)->te_binbuf; ! if (b) { ! char *buf; int bufn; ! binbuf_gettext(b,&buf,&bufn); ! printf("queue_get [%.*s] %p\n",bufn,buf,stuff);} else {printf("queue_get (%s)\n",(*(t_pd*)stuff)->c_name->s_name);} return stuff; *************** *** 10765,10769 **** t_text *x = (t_text *)pd_new(text_class); t_atom at; ! sys_vgui("global _; set _(x%x:canvas) %lx\n",(long)x,(long)gl); x->te_width = 0; x->te_type = T_TEXT; --- 10768,10772 ---- t_text *x = (t_text *)pd_new(text_class); t_atom at; ! sys_vgui("global _; set _(x%x:canvas) x%lx\n",(long)x,(long)gl); x->te_width = 0; x->te_type = T_TEXT; *************** *** 10817,10821 **** } if (!x) x = (t_text *)pd_new(text_class); ! sys_vgui("global _; set _(x%x:canvas) %lx\n",(long)x,(long)gl); x->te_binbuf = b; x->te_xpix = xpix; --- 10820,10824 ---- } if (!x) x = (t_text *)pd_new(text_class); ! sys_vgui("global _; set _(x%x:canvas) x%lx\n",(long)x,(long)gl); x->te_binbuf = b; x->te_xpix = xpix; *************** *** 11641,11656 ****
void pd_upload(t_gobj *self) { ! t_binbuf *buf = binbuf_new(); t_class *c = self->g_pd; int n; char *s; if (c==canvas_class) { /* just the "#N canvas" line, not the contents */ ! canvas_savecontainerto((t_canvas *)self,buf); ! /* note: this does NOT handle the restore. */ } else { /* this was outside of the "else" for a while. why? I don't remember */ ! c->c_savefn(self,buf); } ! binbuf_gettext(buf,&s,&n); if (s[n-1]=='\n') n--; sys_vgui("update_object x%lx {%.*s} %d %d\n", --- 11644,11689 ----
void pd_upload(t_gobj *self) { ! t_binbuf *b = binbuf_new(); t_class *c = self->g_pd; int n; char *s; + t_text *x = (t_text *)self; + #if 1 if (c==canvas_class) { /* just the "#N canvas" line, not the contents */ ! canvas_savecontainerto((t_canvas *)self,b); ! binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), ! (t_int)x->te_xpix, (t_int)x->te_ypix); ! if (x->te_binbuf) { ! binbuf_addbinbuf(b, x->te_binbuf); ! } else { ! bug("binbuf missing at #X restore !!!"); ! } ! binbuf_addv(b, ";"); } else { /* this was outside of the "else" for a while. why? I don't remember */ ! c->c_savefn(self,b); } ! #endif ! #if 0 ! /* adapted from text_save. sorry */ ! if (x->te_type == T_OBJECT && zgetfn(&x->te_pd, gensym("saveto")) && ! !((pd_class(&x->te_pd) == canvas_class) && ! (canvas_isabstraction((t_canvas *)x) ! || canvas_istable((t_canvas *)x)))) { ! mess1(&x->te_pd, gensym("saveto"), b); ! binbuf_addv(b, "ssii", gensym("#X"), gensym("restore"), ! (t_int)x->te_xpix, (t_int)x->te_ypix); ! if (x->te_binbuf) { ! binbuf_addbinbuf(b, x->te_binbuf); ! } else { ! bug("binbuf missing at #X restore !!!"); ! } ! binbuf_addv(b, ";"); ! } else { ! c->c_savefn(self,b); ! } ! #endif ! ! binbuf_gettext(b,&s,&n); if (s[n-1]=='\n') n--; sys_vgui("update_object x%lx {%.*s} %d %d\n", *************** *** 11658,11662 **** obj_ninlets((t_text *)self), obj_noutlets((t_text *)self)); ! binbuf_free(buf); free(s); if (c==canvas_class) { --- 11691,11695 ---- obj_ninlets((t_text *)self), obj_noutlets((t_text *)self)); ! binbuf_free(b); free(s); if (c==canvas_class) {